#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

65 stable releases

new 2024.12.12 Dec 12, 2024
2024.11.21 Nov 21, 2024
2024.7.25 Jul 25, 2024
2024.3.28 Mar 28, 2024
1.0.3 Mar 30, 2022

#81 in Text editors

Download history 156/week @ 2024-08-19 156/week @ 2024-08-26 160/week @ 2024-09-02 71/week @ 2024-09-09 142/week @ 2024-09-16 107/week @ 2024-09-23 302/week @ 2024-09-30 188/week @ 2024-10-07 185/week @ 2024-10-14 146/week @ 2024-10-21 149/week @ 2024-10-28 116/week @ 2024-11-04 122/week @ 2024-11-11 174/week @ 2024-11-18 7/week @ 2024-11-25 269/week @ 2024-12-02

578 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