#ssh-client #tree-sitter #client-config #ssh-config #config-parser #ssh #parser

tree-sitter-ssh-client-config

SSH client config grammar for the tree-sitter parsing library

69 stable releases

new 2025.1.9 Jan 9, 2025
2024.12.26 Dec 26, 2024
2024.11.21 Nov 21, 2024
2024.7.25 Jul 25, 2024
1.0.3 Mar 30, 2022

#75 in Text editors

Download history 115/week @ 2024-09-22 296/week @ 2024-09-29 188/week @ 2024-10-06 184/week @ 2024-10-13 145/week @ 2024-10-20 151/week @ 2024-10-27 116/week @ 2024-11-03 118/week @ 2024-11-10 175/week @ 2024-11-17 16/week @ 2024-11-24 233/week @ 2024-12-01 299/week @ 2024-12-08 136/week @ 2024-12-15 165/week @ 2024-12-22 158/week @ 2024-12-29 140/week @ 2025-01-05

613 downloads per month

CC0 license

6MB
120K SLoC

C 119K SLoC JavaScript 852 SLoC Scheme 230 SLoC Rust 33 SLoC // 0.4% comments

tree-sitter-ssh-client-config

SSH client config grammar for tree-sitter.

Usage

This grammar is available at crates.io, and you can use it together with the Rust language binding.

use tree_sitter::{Parser, Language};

let mut parser = Parser::new();
parser.set_language(tree_sitter_ssh_client_config::language()).expect("Error loading SSH client config grammar");
let config = "\
Host example.com
  User your-name
  Port 12345";
let tree = parser.parse(config, None).unwrap();
assert_eq!(tree.root_node().to_sexp(), "(client_config (host (host_value)) (user (user_value)) (port (port_value)))");

References


lib.rs:

This crate provides ssh-client-config language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_ssh_client_config::language()).expect("Error loading ssh-client-config grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.8–4MB
~79K SLoC