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)
|
||||
),
|
||||
|
13
src/grammar.json
vendored
13
src/grammar.json
vendored
@ -433,8 +433,17 @@
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "while"
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "while"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "until"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "FIELD",
|
||||
|
4
src/node-types.json
vendored
4
src/node-types.json
vendored
@ -1639,6 +1639,10 @@
|
||||
"type": "unsetenv",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "until",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "variable_name",
|
||||
"named": true
|
||||
|
64974
src/parser.c
vendored
64974
src/parser.c
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user