Add support for 'until' loops

This commit is contained in:
Martin Jambon 2021-10-16 01:44:38 -07:00
parent 30d369ba45
commit 9d9325f8f9
2 changed files with 21 additions and 1 deletions

View File

@ -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
(while_statement
condition: (command

View File

@ -141,7 +141,7 @@ module.exports = grammar({
),
while_statement: $ => seq(
'while',
choice('while', 'until'),
field('condition', $._terminated_statement),
field('body', $.do_group)
),