Add async statements

This commit is contained in:
Jeff 2023-10-16 21:13:39 -04:00
parent 0f58ea5a7a
commit cf22950b7e
5 changed files with 4024 additions and 3841 deletions

View File

@ -10,14 +10,13 @@ async { (output 'Whaddup') }
(item (item
(statement (statement
(async (async
(item
(statement (statement
(expression (expression
(function_call (function_call
(tool) (tool)
(expression (expression
(value (value
(string))))))))))) (string))))))))))
================== ==================
Complex Async Statements Complex Async Statements
@ -39,7 +38,6 @@ async {
(item (item
(statement (statement
(async (async
(item
(statement (statement
(if_else (if_else
(if (if
@ -79,4 +77,93 @@ async {
(tool) (tool)
(expression (expression
(value (value
(string))))))))))) (string))))))))))
==================
Simple Async Await Statements
==================
x = async {
1
}
---
(root
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(async
(statement
(expression
(value
(integer))))))))))
==================
Complex Async Await Statements
==================
x = async {
i = 0
while i < 5 {
(output i)
i += 1
}
(read "examples/assets/faithful.csv")
}
---
(root
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(async
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(while
(expression
(logic
(expression
(identifier))
(logic_operator)
(expression
(value
(integer)))))
(item
(statement
(expression
(function_call
(tool)
(expression
(identifier)))))
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer)))))))))
(statement
(expression
(function_call
(tool)
(expression
(value
(string))))))))))))

View File

@ -236,6 +236,12 @@ module.exports = grammar({
), ),
)), )),
async: $ => seq('async', '{', $.item, '}'), async: $ => seq(
'async',
'{',
repeat($.statement),
'}'
),
} }
}); });

View File

@ -959,8 +959,11 @@
"value": "{" "value": "{"
}, },
{ {
"type": "REPEAT",
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "item" "name": "statement"
}
}, },
{ {
"type": "STRING", "type": "STRING",

View File

@ -32,11 +32,11 @@
"named": true, "named": true,
"fields": {}, "fields": {},
"children": { "children": {
"multiple": false, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "item", "type": "statement",
"named": true "named": true
} }
] ]

File diff suppressed because it is too large Load Diff