Skip to content

Commit

Permalink
Add support for basename
Browse files Browse the repository at this point in the history
  • Loading branch information
ExcaliburZero committed Nov 5, 2023
1 parent 7e1f6f9 commit 882ca7b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tree-sitter-quickbms/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ module.exports = grammar({
$.binary,
$.unicode,
$.byte,
$.basename,
),
_endian_type: $ => choice(
$.little,
Expand Down Expand Up @@ -319,6 +320,7 @@ module.exports = grammar({
binary: $ => /[Bb][Ii][Nn][Aa][Rr][Yy]/,
unicode: $ => /[Uu][Nn][Ii][Cc][Oo][Dd][Ee]/,
byte: $ => /[Bb][Yy][Tt][Ee]/,
basename: $ => /[Bb][Aa][Ss][Ee][Nn][Aa][Mm][Ee]/,
endian: $ => /[Ee][Nn][Dd][Ii][Aa][Nn]/,
little: $ => /[Ll][Ii][Tt][Tt][Ll][Ee]/,
intel: $ => /[Ii][Nn][Tt][Ee][Ll]/,
Expand Down
16 changes: 15 additions & 1 deletion tree-sitter-quickbms/test/corpus/get.bms
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Get NAME string
get NAME string 0
get SIZE asize

get SIZE asize MEMORY_FILE
get NAME basename

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

(source_file
Expand All @@ -29,4 +32,15 @@ get SIZE asize
(get)
(identifier)
(type
(asize))))
(asize)))
(get_statement
(get)
(identifier)
(type
(asize))
(identifier))
(get_statement
(get)
(identifier)
(type
(basename))))

0 comments on commit 882ca7b

Please sign in to comment.