Restructure language grammar

This commit is contained in:
Jeff 2023-10-05 22:26:44 -04:00
parent d0806c2694
commit 6ed376335b
8 changed files with 6098 additions and 6153 deletions

View File

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

View File

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

View File

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

View File

@ -33,7 +33,6 @@ 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,19 +203,10 @@
{
"type": "expression",
"named": true
},
{
"type": "logic_operator",
"named": true
}
]
}
},
{
"type": "logic_operator",
"named": true,
"fields": {}
},
{
"type": "loop",
"named": true,
@ -284,19 +275,10 @@
{
"type": "expression",
"named": true
},
{
"type": "math_operator",
"named": true
}
]
}
},
{
"type": "math_operator",
"named": true,
"fields": {}
},
{
"type": "root",
"named": true,

12209
src/parser.c

File diff suppressed because it is too large Load Diff