Add array expression
This commit is contained in:
parent
02f83784b1
commit
babf666642
5 changed files with 883 additions and 500 deletions
11
grammar.js
11
grammar.js
|
|
@ -30,6 +30,8 @@ module.exports = grammar({
|
|||
$.integer_literal,
|
||||
$.string_literal,
|
||||
|
||||
$.array_expression,
|
||||
|
||||
$.unary_expression,
|
||||
$.binary_expression,
|
||||
$.sequence_expression,
|
||||
|
|
@ -95,6 +97,15 @@ module.exports = grammar({
|
|||
},
|
||||
|
||||
sequence_expression: ($) => seq("(", sepBy(";", $._expr), ")"),
|
||||
|
||||
array_expression: ($) => seq(
|
||||
field("type", $.identifier),
|
||||
"[",
|
||||
field("size", $._expr),
|
||||
"]",
|
||||
"of",
|
||||
field("init", $._expr),
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue