#parser #incremental #gomod

tree-sitter-gomod

gomod grammar for the tree-sitter parsing library

2 stable releases

1.0.1 Dec 18, 2023
1.0.0 Jul 31, 2023

#172 in Text editors

33 downloads per month

MIT license

110KB
4K SLoC

C 3.5K SLoC JavaScript 130 SLoC Scheme 40 SLoC Rust 31 SLoC // 0.5% comments

tree-sitter-gomod

tree-sitter grammar for go.mod files.

Status

The grammar is fairly small, and has been working well for highlighting for me. I expect it to evolve slightly to better fit tree-sitter best practices, but there shouldn't be anything major.


lib.rs:

This crate provides gomod 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_gomod::language()).expect("Error loading gomod grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–4MB
~73K SLoC