Compare commits

..

2 Commits

Author SHA1 Message Date
b4a114108b Add equality operator 2023-09-29 09:17:38 -04:00
20e6af2257 Add list support 2023-09-29 08:59:27 -04:00
5 changed files with 850 additions and 1867 deletions

@ -1 +1 @@
Subproject commit 3182e7c860ac74d1d4e2846152eef45c4111bd63 Subproject commit ad429b35634097c1f81a7ce01f5890fb4594a128

View File

@ -1,6 +1,8 @@
module.exports = grammar({ module.exports = grammar({
name: 'dust', name: 'dust',
word: $ => $.identifier,
rules: { rules: {
root: $ => repeat1($.item), root: $ => repeat1($.item),
@ -21,10 +23,10 @@ module.exports = grammar({
open_statement: $ => prec.left(seq($.expression)), open_statement: $ => prec.left(seq($.expression)),
expression: $ => choice( expression: $ => choice(
prec(0, $.control_flow), $.value,
prec(1, $.value), $.identifier,
prec(2, $.identifier), $.operation,
prec(3, $.operation), $.control_flow,
), ),
close: $ => ";", close: $ => ";",
@ -66,6 +68,7 @@ module.exports = grammar({
'+', '+',
'-', '-',
'=', '=',
'==',
), ),
operation: $ => prec.left(seq( operation: $ => prec.left(seq(

View File

@ -1,5 +1,6 @@
{ {
"name": "dust", "name": "dust",
"word": "identifier",
"rules": { "rules": {
"root": { "root": {
"type": "REPEAT1", "type": "REPEAT1",
@ -84,36 +85,20 @@
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "PREC",
"value": 0,
"content": {
"type": "SYMBOL",
"name": "control_flow"
}
},
{
"type": "PREC",
"value": 1,
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "value" "name": "value"
}
}, },
{ {
"type": "PREC",
"value": 2,
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "identifier" "name": "identifier"
}
}, },
{ {
"type": "PREC",
"value": 3,
"content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "operation" "name": "operation"
} },
{
"type": "SYMBOL",
"name": "control_flow"
} }
] ]
}, },
@ -242,6 +227,10 @@
{ {
"type": "STRING", "type": "STRING",
"value": "=" "value": "="
},
{
"type": "STRING",
"value": "=="
} }
] ]
}, },

View File

@ -248,6 +248,10 @@
"type": "=", "type": "=",
"named": false "named": false
}, },
{
"type": "==",
"named": false
},
{ {
"type": "close", "type": "close",
"named": true "named": true

File diff suppressed because it is too large Load Diff