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 (expression
(value (value
(integer))) (integer)))
(logic_operator)
(expression (expression
(value (value
(integer))))) (integer)))))
@ -104,6 +105,7 @@ else if 4 == 9
(expression (expression
(value (value
(integer))) (integer)))
(logic_operator)
(expression (expression
(value (value
(integer))))) (integer)))))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

12587
src/parser.c

File diff suppressed because it is too large Load Diff