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)))))
|
||||
(expression
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
|
||||
@ -27,8 +26,7 @@ not_a_comment # comment
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(identifier)))))
|
||||
(expression
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
|
@ -9,16 +9,15 @@ Simple Equality
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
|
||||
==================
|
||||
Complex Equality
|
||||
@ -31,19 +30,18 @@ Complex Equality
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
|
@ -7,24 +7,22 @@ Simple Statements
|
||||
x
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(integer))))))
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))
|
||||
(expression
|
||||
(value
|
||||
(string)))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(identifier))))))
|
||||
(expression
|
||||
(identifier)))))
|
||||
|
||||
==================
|
||||
Simple Assignment
|
||||
@ -37,27 +35,21 @@ y = "one"
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
(statement
|
||||
(expression
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))
|
||||
(statement
|
||||
(expression
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(string))))))))
|
||||
|
||||
==================
|
||||
Complex Assignment
|
||||
@ -70,18 +62,15 @@ x = 1 + 1
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))))
|
||||
(expression
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))))
|
@ -11,17 +11,16 @@ table <text, number> {
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer))))))))))
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer)))))))))
|
||||
|
||||
==================
|
||||
Table Assignment
|
||||
@ -36,22 +35,19 @@ foobar = table <text, number> {
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(operation
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer))))))))))))
|
||||
(expression
|
||||
(assignment
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(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
|
||||
(expression
|
||||
(identifier))
|
||||
(operator)
|
||||
(expression
|
||||
(value
|
||||
(string)))))))))))
|
||||
(expression
|
||||
(select
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(identifier))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))
|
||||
|
||||
|
||||
==================
|
||||
@ -90,12 +85,11 @@ insert ['bob was here', 0] into foobar
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(open_statement
|
||||
(expression
|
||||
(insert
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer)))
|
||||
(identifier)))))))
|
||||
(expression
|
||||
(insert
|
||||
(list
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer)))
|
||||
(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