Skip to content

Commit

Permalink
Add support for short type
Browse files Browse the repository at this point in the history
  • Loading branch information
ExcaliburZero committed Nov 5, 2023
1 parent 5eed5df commit b87807f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/server/keyword_docs/short.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SHORT

16 bit (aka INT), 0 to 0xffff
4 changes: 4 additions & 0 deletions src/server/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ pub fn get_keyword_docs() -> HashMap<String, String> {
"while".to_string(),
include_str!("keyword_docs/do.txt").to_string(),
),
(
"short".to_string(),
include_str!("keyword_docs/short.txt").to_string(),
),
]
.iter()
.cloned()
Expand Down
2 changes: 2 additions & 0 deletions tree-sitter-quickbms/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ module.exports = grammar({
$.seek_end,
),
type: $ => choice(
$.short,
$.long,
$.asize,
$.string,
Expand Down Expand Up @@ -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]/,
Expand Down
8 changes: 7 additions & 1 deletion tree-sitter-quickbms/test/corpus/get.bms
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ get SIZE asize MEMORY_FILE
get NAME basename
get NAME filename
get EXT EXTENSION
get WIDTH short

--------------------------------------------------------------------------------

Expand Down Expand Up @@ -55,4 +56,9 @@ get EXT EXTENSION
(get)
(identifier)
(type
(extension))))
(extension)))
(get_statement
(get)
(identifier)
(type
(short))))

0 comments on commit b87807f

Please sign in to comment.