diff --git a/tree-sitter-quickbms/grammar.js b/tree-sitter-quickbms/grammar.js index 551edb2..6d154c1 100644 --- a/tree-sitter-quickbms/grammar.js +++ b/tree-sitter-quickbms/grammar.js @@ -380,6 +380,13 @@ module.exports = grammar({ $.string_literal, $.integer_literal, $.identifier, + $.array_access_expression, + ), + array_access_expression: $ => seq( + field("array", $._expression), + "[", + field("index", $._expression), + "]", ), array_size_expression: $ => seq( field("length", $._expression), diff --git a/tree-sitter-quickbms/test/corpus/get.bms b/tree-sitter-quickbms/test/corpus/get.bms index b1bb567..a822e09 100644 --- a/tree-sitter-quickbms/test/corpus/get.bms +++ b/tree-sitter-quickbms/test/corpus/get.bms @@ -12,6 +12,8 @@ get NAME filename get EXT EXTENSION get WIDTH short +get FILESTART[i] long + -------------------------------------------------------------------------------- (source_file @@ -61,4 +63,11 @@ get WIDTH short (get) (identifier) (type - (short)))) + (short))) + (get_statement + (get) + (array_access_expression + (identifier) + (identifier)) + (type + (long))))