Begin fixing tests for new grammar
This commit is contained in:
parent
57d908af9c
commit
17ba01c0dc
@ -10,9 +10,8 @@ not_a_comment
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(identifier)))))
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
|
||||
@ -27,8 +26,7 @@ not_a_comment # comment
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(identifier)))))
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
|
@ -9,16 +9,15 @@ Simple Equality
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(logic
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))
|
||||
(integer))))))))
|
||||
|
||||
==================
|
||||
Complex Equality
|
||||
@ -31,19 +30,18 @@ Complex Equality
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(logic
|
||||
(expression
|
||||
(operation
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(operator)
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))
|
||||
(integer))))))))
|
||||
|
@ -7,24 +7,22 @@ Simple Statements
|
||||
x
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(integer))))))
|
||||
(integer)))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))
|
||||
(string)))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(identifier))))))
|
||||
(identifier)))))
|
||||
|
||||
==================
|
||||
Simple Assignment
|
||||
@ -38,26 +36,20 @@ y = "one"
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
(integer)))))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))
|
||||
(string))))))))
|
||||
|
||||
==================
|
||||
Complex Assignment
|
||||
@ -70,18 +62,15 @@ x = 1 + 1
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(operation
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))))
|
||||
(integer))))))))))
|
@ -11,7 +11,6 @@ table <text, number> {
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
@ -21,7 +20,7 @@ table <text, number> {
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer))))))))))
|
||||
(integer)))))))))
|
||||
|
||||
==================
|
||||
Table Assignment
|
||||
@ -36,12 +35,9 @@ foobar = table <text, number> {
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
@ -51,7 +47,7 @@ foobar = table <text, number> {
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer))))))))))))
|
||||
(integer)))))))))))
|
||||
|
||||
==================
|
||||
Table Access
|
||||
@ -64,19 +60,18 @@ select number from foobar where text == 'answer'
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(select
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(operation
|
||||
(logic
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))))
|
||||
(string))))))))))
|
||||
|
||||
|
||||
==================
|
||||
@ -90,7 +85,6 @@ insert ['bob was here', 0] into foobar
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(insert
|
||||
(list
|
||||
@ -98,4 +92,4 @@ insert ['bob was here', 0] into foobar
|
||||
(string))
|
||||
(value
|
||||
(integer)))
|
||||
(identifier)))))))
|
||||
(identifier))))))
|
||||
|
@ -44,16 +44,15 @@ module.exports = grammar({
|
||||
$.float,
|
||||
$.string,
|
||||
$.list,
|
||||
$.empty,
|
||||
$.boolean,
|
||||
$.function,
|
||||
$.table,
|
||||
$.map,
|
||||
)),
|
||||
|
||||
float: $ => /\d+\.\d*/,
|
||||
float: $ => /[-]*[0-9]*[.]{1}[0-9]+/,
|
||||
|
||||
integer: $ => /\d+/,
|
||||
integer: $ => /[-]*[0-9]+[.]{0}/,
|
||||
|
||||
string: $ => /(".*?")|('.*?')|(`.*?`)/,
|
||||
|
||||
|
@ -173,10 +173,6 @@
|
||||
"type": "SYMBOL",
|
||||
"name": "list"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "empty"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "boolean"
|
||||
@ -198,11 +194,11 @@
|
||||
},
|
||||
"float": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\d+\\.\\d*"
|
||||
"value": "[-]*[0-9]*[.]{1}[0-9]+"
|
||||
},
|
||||
"integer": {
|
||||
"type": "PATTERN",
|
||||
"value": "\\d+"
|
||||
"value": "[-]*[0-9]+[.]{0}"
|
||||
},
|
||||
"string": {
|
||||
"type": "PATTERN",
|
||||
|
@ -340,10 +340,6 @@
|
||||
"type": "boolean",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "empty",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "float",
|
||||
"named": true
|
||||
@ -474,10 +470,6 @@
|
||||
"type": "else",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "empty",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "false",
|
||||
"named": false
|
||||
|
14712
src/parser.c
14712
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user