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

tree-sitter-ssh-client-config

SSH client config grammar for the tree-sitter parsing library

60 stable releases

new 2024.10.31 Oct 31, 2024
2024.9.19 Sep 19, 2024
2024.7.25 Jul 25, 2024
2024.3.28 Mar 28, 2024
1.0.3 Mar 30, 2022

#64 in Text editors

Download history 120/week @ 2024-07-08 110/week @ 2024-07-15 146/week @ 2024-07-22 147/week @ 2024-07-29 101/week @ 2024-08-05 141/week @ 2024-08-12 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

821 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
~76K SLoC