Revert "Restructure language grammar"

This reverts commit 6ed376335b.
This commit is contained in:
Jeff 2023-10-05 22:34:53 -04:00
parent 6ed376335b
commit 4ddc656455
8 changed files with 6342 additions and 6287 deletions

View File

@ -92,6 +92,7 @@ else if 4 == 9
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))
@ -104,6 +105,7 @@ else if 4 == 9
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer)))))

View File

@ -14,6 +14,7 @@ Simple Equality
(expression
(value
(integer)))
(logic_operator)
(expression
(value
(integer))))))))
@ -38,12 +39,15 @@ Complex Equality
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
(expression
(value
(integer))))))))

View File

@ -66,6 +66,7 @@ select number from foobar where text == 'answer'
(logic
(expression
(identifier))
(logic_operator)
(expression
(value
(string)))))))))

View File

@ -33,6 +33,7 @@ Complex Yield
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))

View File

@ -95,11 +95,11 @@ module.exports = grammar({
math: $ => prec.left(seq(
$.expression,
$._math_operator,
$.math_operator,
$.expression,
)),
_math_operator: $ => choice(
math_operator: $ => choice(
'+',
'-',
'*',
@ -109,11 +109,11 @@ module.exports = grammar({
logic: $ => prec.left(seq(
$.expression,
$._logic_operator,
$.logic_operator,
$.expression,
)),
_logic_operator: $ => choice(
logic_operator: $ => choice(
'==',
'!=',
'&&',

View File

@ -424,7 +424,7 @@
},
{
"type": "SYMBOL",
"name": "_math_operator"
"name": "math_operator"
},
{
"type": "SYMBOL",
@ -433,7 +433,7 @@
]
}
},
"_math_operator": {
"math_operator": {
"type": "CHOICE",
"members": [
{
@ -470,7 +470,7 @@
},
{
"type": "SYMBOL",
"name": "_logic_operator"
"name": "logic_operator"
},
{
"type": "SYMBOL",
@ -479,7 +479,7 @@
]
}
},
"_logic_operator": {
"logic_operator": {
"type": "CHOICE",
"members": [
{

View File

@ -203,10 +203,19 @@
{
"type": "expression",
"named": true
},
{
"type": "logic_operator",
"named": true
}
]
}
},
{
"type": "logic_operator",
"named": true,
"fields": {}
},
{
"type": "loop",
"named": true,
@ -275,10 +284,19 @@
{
"type": "expression",
"named": true
},
{
"type": "math_operator",
"named": true
}
]
}
},
{
"type": "math_operator",
"named": true,
"fields": {}
},
{
"type": "root",
"named": true,

12587
src/parser.c

File diff suppressed because it is too large Load Diff