Add async syntax

This commit is contained in:
Jeff 2023-10-16 16:36:07 -04:00
parent b47907ee26
commit 69778781ee
5 changed files with 5165 additions and 4754 deletions

84
corpus/async.txt Normal file
View File

@ -0,0 +1,84 @@
==================
Simple Async Statements
==================
async (output 'Whaddup')
---
(root
(item
(statement
(async
(item
(statement
(expression
(function_call
(tool)
(expression
(value
(string)))))))))))
==================
Complex Run Statements
==================
async if 1 % 2 == 0 {
(output 'true')
} else {
(output 'false')
}
async (output 'foobar')
---
(root
(item
(statement
(async
(item
(statement
(if_else
(if
(expression
(logic
(expression
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(function_call
(tool)
(expression
(value
(string)))))))
(else
(statement
(expression
(function_call
(tool)
(expression
(value
(string)))))))))))))
(item
(statement
(async
(item
(statement
(expression
(function_call
(tool)
(expression
(value
(string)))))))))))

View File

@ -16,6 +16,7 @@ module.exports = grammar({
$.insert,
$.select,
$.while,
$.async,
),
comment: $ => seq(/[#]+.*/),
@ -234,5 +235,7 @@ module.exports = grammar({
seq('where', $.logic)
),
)),
async: $ => seq('async', $.item),
}
});

View File

@ -50,6 +50,10 @@
{
"type": "SYMBOL",
"name": "while"
},
{
"type": "SYMBOL",
"name": "async"
}
]
},
@ -942,6 +946,19 @@
}
]
}
},
"async": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "async"
},
{
"type": "SYMBOL",
"name": "item"
}
]
}
},
"extras": [

View File

@ -27,6 +27,21 @@
"named": true,
"fields": {}
},
{
"type": "async",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "item",
"named": true
}
]
}
},
{
"type": "boolean",
"named": true,
@ -352,6 +367,10 @@
"type": "assignment",
"named": true
},
{
"type": "async",
"named": true
},
{
"type": "comment",
"named": true
@ -553,6 +572,10 @@
"type": "assert_equal",
"named": false
},
{
"type": "async",
"named": false
},
{
"type": "bash",
"named": false

File diff suppressed because it is too large Load Diff