How to write a tree-sitter grammar in an afternoon
siraben.dev
siraben.dev
[0]: https://softwarefoundations.cis.upenn.edu/lf-current/Imp.htm...
They're often used together. I've written a couple of language servers that use Tree-Sitter to parse documents.
For example when you hover something in VSCode it uses the LSP to communicate with the language server and say "oi, what's on line 5 column 10" and then the language server uses Tree Sitter to parse the document and figure out the answer (or some other parser).
[0] https://tree-sitter.github.io/tree-sitter/syntax-highlightin...
/// This is Markdown-in-Rust.
///
/// ```rust
/// // This is Rust-in-Markdown-in-Rust.
/// /// This is Markdown-in-Rust-in-Markdown-in-Rust.
/// const RUST_IN_MARKDOWN_IN_RUST: &'static str = "
/// In this multi-line string (as the most common example of such token-mixing),
/// those triple slashes are Comment, not String.";
/// // And if Trait and Type get parsed carefully below, the /// must not interrupt that.
/// impl
/// Trait
/// for
/// Type {}
/// ```
struct ThisIsRust;
The remark about injection.include-children in your link suggests it can, but I don’t know enough about it yet to be confident of that preliminary assessment.