Add modules
This commit is contained in:
parent
a78ad8139f
commit
8bd249fc90
5 changed files with 2209 additions and 1317 deletions
27
grammar.js
27
grammar.js
|
|
@ -19,6 +19,7 @@ module.exports = grammar({
|
|||
|
||||
_definition: ($) => choice(
|
||||
$.assignment,
|
||||
$.module,
|
||||
),
|
||||
|
||||
comment: (_) => seq("#", /.*/),
|
||||
|
|
@ -31,6 +32,26 @@ module.exports = grammar({
|
|||
field("right", $._expr),
|
||||
),
|
||||
|
||||
module: ($) => choice(
|
||||
$._old_module,
|
||||
$._new_module,
|
||||
),
|
||||
|
||||
// This syntax is deprecated, but still accepted
|
||||
_old_module: ($) => seq(
|
||||
field("type", $.identifier),
|
||||
"{",
|
||||
optional(commaSeparated($._colon_property)),
|
||||
"}",
|
||||
),
|
||||
|
||||
_new_module: ($) => seq(
|
||||
$.identifier,
|
||||
"(",
|
||||
optional(commaSeparated($._equal_property)),
|
||||
")",
|
||||
),
|
||||
|
||||
// }}}
|
||||
|
||||
// Expressions {{{
|
||||
|
|
@ -168,6 +189,12 @@ module.exports = grammar({
|
|||
field("value", $._expr),
|
||||
),
|
||||
|
||||
_equal_property: ($) => seq(
|
||||
field("field", $.identifier),
|
||||
"=",
|
||||
field("value", $._expr),
|
||||
),
|
||||
|
||||
// }}}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue