Merge pull request #112 from tree-sitter/mj-until
Add support for 'until' loops
This commit is contained in:
commit
7fb8506cbe
|
@ -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
|
||||
|
|
|
@ -141,7 +141,7 @@ module.exports = grammar({
|
|||
),
|
||||
|
||||
while_statement: $ => seq(
|
||||
'while',
|
||||
choice('while', 'until'),
|
||||
field('condition', $._terminated_statement),
|
||||
field('body', $.do_group)
|
||||
),
|
||||
|
|
|
@ -431,11 +431,20 @@
|
|||
},
|
||||
"while_statement": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "while"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "until"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
"name": "condition",
|
||||
|
|
|
@ -1639,6 +1639,10 @@
|
|||
"type": "unsetenv",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "until",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "variable_name",
|
||||
"named": true
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue