Add variable declarations
This commit is contained in:
parent
3cf701dbb1
commit
3eb6b0a0d0
5 changed files with 2280 additions and 1721 deletions
|
|
@ -227,9 +227,18 @@ module.exports = grammar({
|
|||
_declaration_chunks: ($) => repeat1($._declaration_chunk),
|
||||
|
||||
_declaration_chunk: ($) => choice(
|
||||
$.variable_declaration,
|
||||
$.import_declaration,
|
||||
),
|
||||
|
||||
variable_declaration: ($) => seq(
|
||||
"var",
|
||||
field("name", $.identifier),
|
||||
optional(seq(":", field("type", $.identifier))),
|
||||
":=",
|
||||
field("value", $._expr),
|
||||
),
|
||||
|
||||
import_declaration: ($) => seq(
|
||||
"import",
|
||||
field("file", $.string_literal),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue