Merge pull request #112 from tree-sitter/mj-until

Add support for 'until' loops
This commit is contained in:
Martin Jambon 2021-10-16 14:38:43 -07:00 committed by GitHub
commit 7fb8506cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32631 additions and 32382 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)
),

13
src/grammar.json vendored
View File

@ -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
View File

@ -1639,6 +1639,10 @@
"type": "unsetenv",
"named": false
},
{
"type": "until",
"named": false
},
{
"type": "variable_name",
"named": true

64974
src/parser.c vendored

File diff suppressed because it is too large Load Diff