Add for expressions
This commit is contained in:
parent
26999482a3
commit
bb6875a11d
5 changed files with 1777 additions and 1006 deletions
12
grammar.js
12
grammar.js
|
|
@ -50,6 +50,7 @@ module.exports = grammar({
|
|||
|
||||
$.if_expression,
|
||||
$.while_expression,
|
||||
$.for_expression,
|
||||
),
|
||||
|
||||
nil_literal: (_) => "nil",
|
||||
|
|
@ -192,6 +193,17 @@ module.exports = grammar({
|
|||
"do",
|
||||
field("body", $._expr),
|
||||
),
|
||||
|
||||
for_expression: ($) => seq(
|
||||
"for",
|
||||
field("index", $.identifier),
|
||||
":=",
|
||||
field("start", $._expr),
|
||||
"to",
|
||||
field("end", $._expr),
|
||||
"do",
|
||||
field("body", $._expr),
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue