Begin implementing while loops
This commit is contained in:
parent
a3dbb19ecc
commit
b55420d51b
52
corpus/while.txt
Normal file
52
corpus/while.txt
Normal file
@ -0,0 +1,52 @@
|
||||
==================
|
||||
While Loop
|
||||
==================
|
||||
|
||||
while true {
|
||||
(output "This is a bad idea...")
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(while
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(tool_call
|
||||
(output
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))))
|
||||
|
||||
==================
|
||||
While Assignment
|
||||
==================
|
||||
|
||||
foo = while true {
|
||||
42
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(statement
|
||||
(while
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(tool_call
|
||||
(output
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))))))
|
@ -22,6 +22,7 @@ module.exports = grammar({
|
||||
$.select,
|
||||
$.loop,
|
||||
$.match,
|
||||
$.while,
|
||||
),
|
||||
|
||||
yield: $ => seq(
|
||||
|
@ -69,6 +69,10 @@
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "match"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "while"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -382,6 +382,10 @@
|
||||
"type": "select",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "while",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "yield",
|
||||
"named": true
|
||||
@ -470,6 +474,25 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "while",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "yield",
|
||||
"named": true,
|
||||
|
14873
src/parser.c
14873
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user