Add support for 'until' loops
This commit is contained in:
parent
30d369ba45
commit
9d9325f8f9
|
@ -53,6 +53,26 @@ done
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
(program
|
||||||
|
(while_statement
|
||||||
|
condition: (command
|
||||||
|
name: (command_name (word))
|
||||||
|
argument: (word))
|
||||||
|
body: (do_group
|
||||||
|
(command name: (command_name (word)) argument: (word))
|
||||||
|
(command name: (command_name (word)) argument: (word)))))
|
||||||
|
|
||||||
|
====================================
|
||||||
|
Until statements
|
||||||
|
====================================
|
||||||
|
|
||||||
|
until something happens; do
|
||||||
|
echo a
|
||||||
|
echo b
|
||||||
|
done
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
(program
|
(program
|
||||||
(while_statement
|
(while_statement
|
||||||
condition: (command
|
condition: (command
|
||||||
|
|
|
@ -141,7 +141,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
|
|
||||||
while_statement: $ => seq(
|
while_statement: $ => seq(
|
||||||
'while',
|
choice('while', 'until'),
|
||||||
field('condition', $._terminated_statement),
|
field('condition', $._terminated_statement),
|
||||||
field('body', $.do_group)
|
field('body', $.do_group)
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue