feat(generate): add a comment with the tree-sitter version
This commit is contained in:
parent
d3a127a48f
commit
7f0c5f928a
1 changed files with 10 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ const SMALL_STATE_THRESHOLD: usize = 64;
|
|||
const ABI_VERSION_MIN: usize = 13;
|
||||
const ABI_VERSION_MAX: usize = tree_sitter::LANGUAGE_VERSION;
|
||||
const ABI_VERSION_WITH_PRIMARY_STATES: usize = 14;
|
||||
const BUILD_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
macro_rules! add {
|
||||
($this: tt, $($arg: tt)*) => {{
|
||||
|
|
@ -89,6 +90,7 @@ struct LargeCharacterSetInfo {
|
|||
impl Generator {
|
||||
fn generate(mut self) -> String {
|
||||
self.init();
|
||||
self.add_header();
|
||||
self.add_includes();
|
||||
self.add_pragmas();
|
||||
self.add_stats();
|
||||
|
|
@ -280,6 +282,14 @@ impl Generator {
|
|||
.count();
|
||||
}
|
||||
|
||||
fn add_header(&mut self) {
|
||||
add_line!(
|
||||
self,
|
||||
"// Automatically generated by tree-sitter v{BUILD_VERSION}"
|
||||
);
|
||||
add_line!(self, "");
|
||||
}
|
||||
|
||||
fn add_includes(&mut self) {
|
||||
add_line!(self, "#include \"tree_sitter/parser.h\"");
|
||||
add_line!(self, "");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue