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

tree-sitter-ssh-client-config

SSH client config grammar for the tree-sitter parsing library

70 stable releases

new 2025.1.16 Jan 16, 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

#76 in Text editors

Download history 121/week @ 2024-09-25 247/week @ 2024-10-02 188/week @ 2024-10-09 186/week @ 2024-10-16 147/week @ 2024-10-23 144/week @ 2024-10-30 118/week @ 2024-11-06 125/week @ 2024-11-13 171/week @ 2024-11-20 23/week @ 2024-11-27 238/week @ 2024-12-04 298/week @ 2024-12-11 121/week @ 2024-12-18 161/week @ 2024-12-25 170/week @ 2025-01-01 167/week @ 2025-01-08

622 downloads per month

CC0 license

6MB
121K SLoC

C 120K SLoC JavaScript 858 SLoC Scheme 232 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.9–4MB
~80K SLoC