Begin fixing tests for new grammar

This commit is contained in:
Jeff 2023-10-01 00:01:02 -04:00
parent 57d908af9c
commit 17ba01c0dc
8 changed files with 8192 additions and 6774 deletions

View File

@ -10,9 +10,8 @@ not_a_comment
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(identifier))))) (identifier))))
(item (item
(comment))) (comment)))
@ -27,8 +26,7 @@ not_a_comment # comment
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(identifier))))) (identifier))))
(item (item
(comment))) (comment)))

View File

@ -9,16 +9,15 @@ Simple Equality
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (logic
(expression (expression
(value (value
(integer))) (integer)))
(operator) (logic_operator)
(expression (expression
(value (value
(integer))))))))) (integer))))))))
================== ==================
Complex Equality Complex Equality
@ -31,19 +30,18 @@ Complex Equality
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (logic
(expression (expression
(operation (math
(expression (expression
(value (value
(integer))) (integer)))
(operator) (math_operator)
(expression (expression
(value (value
(integer))))) (integer)))))
(operator) (logic_operator)
(expression (expression
(value (value
(integer))))))))) (integer))))))))

View File

@ -7,24 +7,22 @@ Simple Statements
x x
--- ---
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(value (value
(integer)))))) (integer)))))
(item (item
(statement (statement
(open_statement
(expression (expression
(value (value
(string)))))) (string)))))
(item (item
(statement (statement
(open_statement
(expression (expression
(identifier)))))) (identifier)))))
================== ==================
Simple Assignment Simple Assignment
@ -38,26 +36,20 @@ y = "one"
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (assignment
(expression (identifier)
(identifier))
(operator)
(expression (expression
(value (value
(integer)))))))) (integer)))))))
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (assignment
(expression (identifier)
(identifier))
(operator)
(expression (expression
(value (value
(string))))))))) (string))))))))
================== ==================
Complex Assignment Complex Assignment
@ -70,18 +62,15 @@ x = 1 + 1
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (assignment
(identifier)
(expression (expression
(identifier)) (math
(operator)
(expression
(operation
(expression (expression
(value (value
(integer))) (integer)))
(operator) (math_operator)
(expression (expression
(value (value
(integer))))))))))) (integer))))))))))

View File

@ -11,7 +11,6 @@ table <text, number> {
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(value (value
(table (table
@ -21,7 +20,7 @@ table <text, number> {
(value (value
(string)) (string))
(value (value
(integer)))))))))) (integer)))))))))
================== ==================
Table Assignment Table Assignment
@ -36,12 +35,9 @@ foobar = table <text, number> {
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(operation (assignment
(expression (identifier)
(identifier))
(operator)
(expression (expression
(value (value
(table (table
@ -51,7 +47,7 @@ foobar = table <text, number> {
(value (value
(string)) (string))
(value (value
(integer)))))))))))) (integer)))))))))))
================== ==================
Table Access Table Access
@ -64,19 +60,18 @@ select number from foobar where text == 'answer'
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(select (select
(identifier) (identifier)
(identifier) (identifier)
(expression (expression
(operation (logic
(expression (expression
(identifier)) (identifier))
(operator) (logic_operator)
(expression (expression
(value (value
(string))))))))))) (string))))))))))
================== ==================
@ -90,7 +85,6 @@ insert ['bob was here', 0] into foobar
(root (root
(item (item
(statement (statement
(open_statement
(expression (expression
(insert (insert
(list (list
@ -98,4 +92,4 @@ insert ['bob was here', 0] into foobar
(string)) (string))
(value (value
(integer))) (integer)))
(identifier))))))) (identifier))))))

View File

@ -44,16 +44,15 @@ module.exports = grammar({
$.float, $.float,
$.string, $.string,
$.list, $.list,
$.empty,
$.boolean, $.boolean,
$.function, $.function,
$.table, $.table,
$.map, $.map,
)), )),
float: $ => /\d+\.\d*/, float: $ => /[-]*[0-9]*[.]{1}[0-9]+/,
integer: $ => /\d+/, integer: $ => /[-]*[0-9]+[.]{0}/,
string: $ => /(".*?")|('.*?')|(`.*?`)/, string: $ => /(".*?")|('.*?')|(`.*?`)/,

View File

@ -173,10 +173,6 @@
"type": "SYMBOL", "type": "SYMBOL",
"name": "list" "name": "list"
}, },
{
"type": "SYMBOL",
"name": "empty"
},
{ {
"type": "SYMBOL", "type": "SYMBOL",
"name": "boolean" "name": "boolean"
@ -198,11 +194,11 @@
}, },
"float": { "float": {
"type": "PATTERN", "type": "PATTERN",
"value": "\\d+\\.\\d*" "value": "[-]*[0-9]*[.]{1}[0-9]+"
}, },
"integer": { "integer": {
"type": "PATTERN", "type": "PATTERN",
"value": "\\d+" "value": "[-]*[0-9]+[.]{0}"
}, },
"string": { "string": {
"type": "PATTERN", "type": "PATTERN",

View File

@ -340,10 +340,6 @@
"type": "boolean", "type": "boolean",
"named": true "named": true
}, },
{
"type": "empty",
"named": true
},
{ {
"type": "float", "type": "float",
"named": true "named": true
@ -474,10 +470,6 @@
"type": "else", "type": "else",
"named": false "named": false
}, },
{
"type": "empty",
"named": true
},
{ {
"type": "false", "type": "false",
"named": false "named": false

14712
src/parser.c

File diff suppressed because it is too large Load Diff