Change syntax

This commit is contained in:
Jeff 2023-09-30 22:59:27 -04:00
parent 69fda534a3
commit 57d908af9c
5 changed files with 6527 additions and 7278 deletions

@ -1 +1 @@
Subproject commit f596c6b5811cabc9b1b8ef87b9c6ce627b567c93
Subproject commit 1f829d930a8a5d4683ac41c6a2085c5f482868cd

View File

@ -14,13 +14,11 @@ module.exports = grammar({
comment: $ => seq(token('#'), /.*/),
statement: $ => prec.right(choice(
$.open_statement,
$.yield_statement,
$.expression,
$.yield,
)),
open_statement: $ => prec.right($.expression),
yield_statement: $ => seq($.open_statement, '->', $.open_statement),
yield: $ => prec.left(seq($.statement, '->', $.statement)),
expression: $ => choice(
$._expression_kind,
@ -57,11 +55,7 @@ module.exports = grammar({
integer: $ => /\d+/,
string: $ => choice(
/'([^"]+)'/,
/"([^"]+)"/,
/`([^"]+)`/
),
string: $ => /(".*?")|('.*?')|(`.*?`)/,
empty: $ => '()',

View File

@ -46,40 +46,36 @@
"members": [
{
"type": "SYMBOL",
"name": "open_statement"
"name": "expression"
},
{
"type": "SYMBOL",
"name": "yield_statement"
"name": "yield"
}
]
}
},
"open_statement": {
"type": "PREC_RIGHT",
"yield": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SYMBOL",
"name": "expression"
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "STRING",
"value": "->"
},
{
"type": "SYMBOL",
"name": "statement"
}
]
}
},
"yield_statement": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "open_statement"
},
{
"type": "STRING",
"value": "->"
},
{
"type": "SYMBOL",
"name": "open_statement"
}
]
},
"expression": {
"type": "CHOICE",
"members": [
@ -209,21 +205,8 @@
"value": "\\d+"
},
"string": {
"type": "CHOICE",
"members": [
{
"type": "PATTERN",
"value": "'([^\"]+)'"
},
{
"type": "PATTERN",
"value": "\"([^\"]+)\""
},
{
"type": "PATTERN",
"value": "`([^\"]+)`"
}
]
"type": "PATTERN",
"value": "(\".*?\")|('.*?')|(`.*?`)"
},
"empty": {
"type": "STRING",

View File

@ -256,21 +256,6 @@
"named": true,
"fields": {}
},
{
"type": "open_statement",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "expression",
"named": true
}
]
}
},
{
"type": "root",
"named": true,
@ -314,21 +299,16 @@
"required": true,
"types": [
{
"type": "open_statement",
"type": "expression",
"named": true
},
{
"type": "yield_statement",
"type": "yield",
"named": true
}
]
}
},
{
"type": "string",
"named": true,
"fields": {}
},
{
"type": "table",
"named": true,
@ -396,7 +376,7 @@
}
},
{
"type": "yield_statement",
"type": "yield",
"named": true,
"fields": {},
"children": {
@ -404,7 +384,7 @@
"required": true,
"types": [
{
"type": "open_statement",
"type": "statement",
"named": true
}
]
@ -546,6 +526,10 @@
"type": "select",
"named": false
},
{
"type": "string",
"named": true
},
{
"type": "table",
"named": false

13698
src/parser.c

File diff suppressed because it is too large Load Diff