tree-sitter-java icon indicating copy to clipboard operation
tree-sitter-java copied to clipboard

Add `grammar.json` to the module as constant

Open JonasCir opened this issue 3 years ago • 0 comments

Situation description

Hi there, thank you for creating this great library!

I am in a situation where it would be great to have access to the JSON representation of the grammar ( src/grammar.json) not only grammar.js which is already accessible via tree_sitter_java::GRAMMAR.

It is far easier to look up information in JSON than in the JS code which is currently available.

Proposed changes

Add the following to bindings/rust/lib.rs:

/// The source of the Java tree-sitter grammar description.
pub const GRAMMAR_JSON: &'static str = include_str!("../../src/grammar.json");

JonasCir avatar Jan 29 '22 21:01 JonasCir