1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
1d6b49ba25 Add yield syntax 2023-11-14 22:26:32 -05:00
60013f34da Set edition to 2021 2023-11-14 22:01:17 -05:00
6 changed files with 12907 additions and 11862 deletions

View File

@ -3,7 +3,7 @@ name = "dust-lang"
description = "Data-Oriented Programming Language"
version = "0.3.5"
repository = "https://github.com/tree-sitter/tree-sitter-dust"
edition = "2018"
edition = "2021"
license = "MIT"
[[bin]]

View File

@ -0,0 +1,15 @@
================================================================================
Simple Yield
================================================================================
1 -> (output)
--------------------------------------------------------------------------------
================================================================================
Yield Chain
================================================================================
x -> (foo) -> (bar) -> (abc)
--------------------------------------------------------------------------------

View File

@ -42,6 +42,12 @@ module.exports = grammar({
optional(';'),
)),
yield: $ => prec.left(seq(
$.expression,
'->',
$.function_call,
)),
expression: $ => prec.right(choice(
$._expression_kind,
seq('(', $._expression_kind, ')'),
@ -54,6 +60,7 @@ module.exports = grammar({
$.logic,
$.math,
$.value,
$.yield,
),
_expression_list: $ => repeat1(prec.right(seq(

View File

@ -135,6 +135,27 @@
]
}
},
"yield": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "->"
},
{
"type": "SYMBOL",
"name": "function_call"
}
]
}
},
"expression": {
"type": "PREC_RIGHT",
"value": 0,
@ -191,6 +212,10 @@
{
"type": "SYMBOL",
"name": "value"
},
{
"type": "SYMBOL",
"name": "yield"
}
]
},

View File

@ -127,6 +127,10 @@
{
"type": "value",
"named": true
},
{
"type": "yield",
"named": true
}
]
}
@ -746,6 +750,25 @@
]
}
},
{
"type": "yield",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "expression",
"named": true
},
{
"type": "function_call",
"named": true
}
]
}
},
{
"type": "!=",
"named": false
@ -790,6 +813,10 @@
"type": "-=",
"named": false
},
{
"type": "->",
"named": false
},
{
"type": "..",
"named": false

File diff suppressed because it is too large Load Diff