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" description = "Data-Oriented Programming Language"
version = "0.3.5" version = "0.3.5"
repository = "https://github.com/tree-sitter/tree-sitter-dust" repository = "https://github.com/tree-sitter/tree-sitter-dust"
edition = "2018" edition = "2021"
license = "MIT" license = "MIT"
[[bin]] [[bin]]

View File

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

View File

@ -41,6 +41,12 @@ module.exports = grammar({
), ),
optional(';'), optional(';'),
)), )),
yield: $ => prec.left(seq(
$.expression,
'->',
$.function_call,
)),
expression: $ => prec.right(choice( expression: $ => prec.right(choice(
$._expression_kind, $._expression_kind,
@ -54,6 +60,7 @@ module.exports = grammar({
$.logic, $.logic,
$.math, $.math,
$.value, $.value,
$.yield,
), ),
_expression_list: $ => repeat1(prec.right(seq( _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": { "expression": {
"type": "PREC_RIGHT", "type": "PREC_RIGHT",
"value": 0, "value": 0,
@ -191,6 +212,10 @@
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "value" "name": "value"
},
{
"type": "SYMBOL",
"name": "yield"
} }
] ]
}, },

View File

@ -127,6 +127,10 @@
{ {
"type": "value", "type": "value",
"named": true "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": "!=", "type": "!=",
"named": false "named": false
@ -790,6 +813,10 @@
"type": "-=", "type": "-=",
"named": false "named": false
}, },
{
"type": "->",
"named": false
},
{ {
"type": "..", "type": "..",
"named": false "named": false

File diff suppressed because it is too large Load Diff