11//! This crate provides Nu language support for the [tree-sitter][] parsing library.
22//!
3- //! Typically, you will use the [language][language func] function to add this language to a
3+ //! Typically, you will use the [LANGUAGE][] constant to add this language to a
44//! tree-sitter [Parser][], and then use the parser to parse some code:
55//!
66//! ```
7+ //! use tree_sitter::Parser;
8+ //!
79//! let code = r#"
10+ //! echo "hello world!"
811//! "#;
9- //! let mut parser = tree_sitter:: Parser::new();
12+ //! let mut parser = Parser::new();
1013//! let language = tree_sitter_nu::LANGUAGE;
1114//! parser
1215//! .set_language(&language.into())
1518//! assert!(!tree.root_node().has_error());
1619//! ```
1720//!
18- //! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
19- //! [language func]: fn.language.html
2021//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
2122//! [tree-sitter]: https://tree-sitter.github.io/
2223
@@ -26,20 +27,18 @@ extern "C" {
2627 fn tree_sitter_nu ( ) -> * const ( ) ;
2728}
2829
29- /// The tree-sitter [`LanguageFn`] for this grammar.
30+ /// The tree-sitter [`LanguageFn`][LanguageFn] for this grammar.
31+ ///
32+ /// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html
3033pub const LANGUAGE : LanguageFn = unsafe { LanguageFn :: from_raw ( tree_sitter_nu) } ;
3134
3235/// The content of the [`node-types.json`][] file for this grammar.
3336///
3437/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
3538pub const NODE_TYPES : & str = include_str ! ( "../../src/node-types.json" ) ;
3639
37- // NOTE: uncomment these to include any queries that this grammar contains:
38-
39- // pub const HIGHLIGHTS_QUERY: &str = include_str!("../../queries/highlights.scm");
40- // pub const INJECTIONS_QUERY: &str = include_str!("../../queries/injections.scm");
41- // pub const LOCALS_QUERY: &str = include_str!("../../queries/locals.scm");
42- // pub const TAGS_QUERY: &str = include_str!("../../queries/tags.scm");
40+ /// The syntax highlighting query for this grammar.
41+ pub const HIGHLIGHT_QUERY : & str = include_str ! ( "../../queries/nu/highlights.scm" ) ;
4342
4443#[ cfg( test) ]
4544mod tests {
0 commit comments