diff --git a/corpus/statements.txt b/corpus/statements.txt index 8ed98aa..d80f49b 100644 --- a/corpus/statements.txt +++ b/corpus/statements.txt @@ -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 diff --git a/grammar.js b/grammar.js index 92036a0..a2e2f87 100644 --- a/grammar.js +++ b/grammar.js @@ -141,7 +141,7 @@ module.exports = grammar({ ), while_statement: $ => seq( - 'while', + choice('while', 'until'), field('condition', $._terminated_statement), field('body', $.do_group) ),