diff --git a/src/server/keyword_docs/short.txt b/src/server/keyword_docs/short.txt new file mode 100644 index 0000000..4b18290 --- /dev/null +++ b/src/server/keyword_docs/short.txt @@ -0,0 +1,3 @@ +SHORT + +16 bit (aka INT), 0 to 0xffff \ No newline at end of file diff --git a/src/server/state.rs b/src/server/state.rs index c98c299..04245f0 100644 --- a/src/server/state.rs +++ b/src/server/state.rs @@ -504,6 +504,10 @@ pub fn get_keyword_docs() -> HashMap { "while".to_string(), include_str!("keyword_docs/do.txt").to_string(), ), + ( + "short".to_string(), + include_str!("keyword_docs/short.txt").to_string(), + ), ] .iter() .cloned() diff --git a/tree-sitter-quickbms/grammar.js b/tree-sitter-quickbms/grammar.js index 2fa1966..2f7b410 100644 --- a/tree-sitter-quickbms/grammar.js +++ b/tree-sitter-quickbms/grammar.js @@ -336,6 +336,7 @@ module.exports = grammar({ $.seek_end, ), type: $ => choice( + $.short, $.long, $.asize, $.string, @@ -377,6 +378,7 @@ module.exports = grammar({ startfunction: $ => /[Ss][Tt][Aa][Rr][Tt][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]/, endfunction: $ => /[Ee][Nn][Dd][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]/, callfunction: $ => /[Cc][Aa][Ll][Ll][Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]/, + short: $ => /[Ss][Hh][Oo][Rr][Tt]/, long: $ => /[Ll][Oo][Nn][Gg]/, asize: $ => /[Aa][Ss][Ii][Zz][Ee]/, string: $ => /[Ss][Tt][Rr][Ii][Nn][Gg]/, diff --git a/tree-sitter-quickbms/test/corpus/get.bms b/tree-sitter-quickbms/test/corpus/get.bms index 44f8f9b..b1bb567 100644 --- a/tree-sitter-quickbms/test/corpus/get.bms +++ b/tree-sitter-quickbms/test/corpus/get.bms @@ -10,6 +10,7 @@ get SIZE asize MEMORY_FILE get NAME basename get NAME filename get EXT EXTENSION +get WIDTH short -------------------------------------------------------------------------------- @@ -55,4 +56,9 @@ get EXT EXTENSION (get) (identifier) (type - (extension)))) + (extension))) + (get_statement + (get) + (identifier) + (type + (short))))