Add list expressions
This commit is contained in:
parent
f548b1d5ad
commit
e13f15e8db
5 changed files with 734 additions and 193 deletions
12
grammar.js
12
grammar.js
|
|
@ -1,3 +1,7 @@
|
|||
function commaSeparated(elem) {
|
||||
return seq(elem, repeat(seq(",", elem)), optional(","))
|
||||
}
|
||||
|
||||
module.exports = grammar({
|
||||
name: "blueprint",
|
||||
|
||||
|
|
@ -32,6 +36,8 @@ module.exports = grammar({
|
|||
$.identifier,
|
||||
$.integer_literal,
|
||||
$._string_literal,
|
||||
// Composites
|
||||
$.list_expression,
|
||||
),
|
||||
|
||||
// The Blueprint scanner makes use of Go's lexer, so copy their rule
|
||||
|
|
@ -72,6 +78,12 @@ module.exports = grammar({
|
|||
),
|
||||
)),
|
||||
|
||||
list_expression: ($) => seq(
|
||||
"[",
|
||||
optional(commaSeparated($._expr)),
|
||||
"]",
|
||||
),
|
||||
|
||||
// }}}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue