Crate tree_sitter_arduino
source ·Expand description
This crate provides arduino 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 = r#"
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
"#;
let mut parser = tree_sitter::Parser::new();
parser.set_language(&tree_sitter_arduino::language()).expect("Error loading arduino grammar");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());
Constants§
- The syntax highlighting queries.
- The content of the
node-types.json
file for this grammar. - The tags queries used for code navigation.
Functions§
- Get the tree-sitter Language for this grammar.