Remove semicolons from language
This commit is contained in:
parent
3c0ac94fdd
commit
9aef6712fe
@ -1 +1 @@
|
|||||||
Subproject commit 8bcf59f216178622a0f2711dbea82e7a280f7ed0
|
Subproject commit 823bb3130591716771190e3123c5772250e00dc7
|
@ -2,14 +2,14 @@
|
|||||||
If/Then
|
If/Then
|
||||||
==================
|
==================
|
||||||
|
|
||||||
if true then "True";
|
if true then "True"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(root
|
(root
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(control_flow
|
(control_flow
|
||||||
(expression
|
(expression
|
||||||
@ -19,22 +19,21 @@ if true then "True";
|
|||||||
(open_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string)))))))
|
(string)))))))))))
|
||||||
(close)))))
|
|
||||||
|
|
||||||
|
|
||||||
==================
|
==================
|
||||||
If/Then Assignment
|
If/Then Assignment
|
||||||
==================
|
==================
|
||||||
|
|
||||||
x = if true then 1;
|
x = if true then 1
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(root
|
(root
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(operation
|
(operation
|
||||||
(expression
|
(expression
|
||||||
@ -49,6 +48,5 @@ x = if true then 1;
|
|||||||
(open_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))))))
|
(integer)))))))))))))
|
||||||
(close)))))
|
|
||||||
|
|
||||||
|
@ -2,47 +2,44 @@
|
|||||||
Simple Statements
|
Simple Statements
|
||||||
==================
|
==================
|
||||||
|
|
||||||
1;
|
1
|
||||||
"one";
|
"one"
|
||||||
x;
|
x
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(root
|
(root
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))
|
(integer))))))
|
||||||
(close))))
|
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string)))
|
(string))))))
|
||||||
(close))))
|
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(identifier))
|
(identifier))))))
|
||||||
(close)))))
|
|
||||||
|
|
||||||
==================
|
==================
|
||||||
Simple Assignment
|
Simple Assignment
|
||||||
==================
|
==================
|
||||||
|
|
||||||
x = 1;
|
x = 1
|
||||||
y = "one";
|
y = "one"
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(root
|
(root
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(operation
|
(operation
|
||||||
(expression
|
(expression
|
||||||
@ -50,11 +47,10 @@ y = "one";
|
|||||||
(operator)
|
(operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer))))))))
|
||||||
(close))))
|
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(operation
|
(operation
|
||||||
(expression
|
(expression
|
||||||
@ -62,21 +58,20 @@ y = "one";
|
|||||||
(operator)
|
(operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string)))))
|
(string)))))))))
|
||||||
(close)))))
|
|
||||||
|
|
||||||
==================
|
==================
|
||||||
Complex Assignment
|
Complex Assignment
|
||||||
==================
|
==================
|
||||||
|
|
||||||
x = 1 + 1;
|
x = 1 + 1
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
(root
|
(root
|
||||||
(item
|
(item
|
||||||
(statement
|
(statement
|
||||||
(closed_statement
|
(open_statement
|
||||||
(expression
|
(expression
|
||||||
(operation
|
(operation
|
||||||
(expression
|
(expression
|
||||||
@ -90,5 +85,4 @@ x = 1 + 1;
|
|||||||
(operator)
|
(operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer)))))))))
|
||||||
(close)))))
|
|
||||||
|
@ -14,12 +14,9 @@ module.exports = grammar({
|
|||||||
comment: $ => prec.left(seq(token('#'), /.*/)),
|
comment: $ => prec.left(seq(token('#'), /.*/)),
|
||||||
|
|
||||||
statement: $ => choice(
|
statement: $ => choice(
|
||||||
$.closed_statement,
|
|
||||||
$.open_statement,
|
$.open_statement,
|
||||||
),
|
),
|
||||||
|
|
||||||
closed_statement: $ => seq($.expression, $.close),
|
|
||||||
|
|
||||||
open_statement: $ => prec.left(seq($.expression)),
|
open_statement: $ => prec.left(seq($.expression)),
|
||||||
|
|
||||||
expression: $ => choice(
|
expression: $ => choice(
|
||||||
@ -29,8 +26,6 @@ module.exports = grammar({
|
|||||||
$.control_flow,
|
$.control_flow,
|
||||||
),
|
),
|
||||||
|
|
||||||
close: $ => ";",
|
|
||||||
|
|
||||||
identifier: $ => /[a-z|_|.]+/,
|
identifier: $ => /[a-z|_|.]+/,
|
||||||
|
|
||||||
value: $ => choice(
|
value: $ => choice(
|
||||||
|
@ -45,29 +45,12 @@
|
|||||||
"statement": {
|
"statement": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "closed_statement"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "open_statement"
|
"name": "open_statement"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"closed_statement": {
|
|
||||||
"type": "SEQ",
|
|
||||||
"members": [
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "expression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "close"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"open_statement": {
|
"open_statement": {
|
||||||
"type": "PREC_LEFT",
|
"type": "PREC_LEFT",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
@ -102,10 +85,6 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"close": {
|
|
||||||
"type": "STRING",
|
|
||||||
"value": ";"
|
|
||||||
},
|
|
||||||
"identifier": {
|
"identifier": {
|
||||||
"type": "PATTERN",
|
"type": "PATTERN",
|
||||||
"value": "[a-z|_|.]+"
|
"value": "[a-z|_|.]+"
|
||||||
|
@ -4,25 +4,6 @@
|
|||||||
"named": true,
|
"named": true,
|
||||||
"fields": {}
|
"fields": {}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "closed_statement",
|
|
||||||
"named": true,
|
|
||||||
"fields": {},
|
|
||||||
"children": {
|
|
||||||
"multiple": true,
|
|
||||||
"required": true,
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"type": "close",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "expression",
|
|
||||||
"named": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "comment",
|
"type": "comment",
|
||||||
"named": true,
|
"named": true,
|
||||||
@ -170,10 +151,6 @@
|
|||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
|
||||||
"type": "closed_statement",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "open_statement",
|
"type": "open_statement",
|
||||||
"named": true
|
"named": true
|
||||||
@ -252,10 +229,6 @@
|
|||||||
"type": "==",
|
"type": "==",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "close",
|
|
||||||
"named": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "else",
|
"type": "else",
|
||||||
"named": false
|
"named": false
|
||||||
|
880
src/parser.c
880
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user