Add for expressions

This commit is contained in:
Bruno BELANYI 2022-06-01 20:23:04 +02:00
parent 26999482a3
commit bb6875a11d
5 changed files with 1777 additions and 1006 deletions

View file

@ -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),
),
}
});