Remove semicolons from language

This commit is contained in:
Jeff 2023-09-29 13:04:19 -04:00
parent 3c0ac94fdd
commit 9aef6712fe
7 changed files with 353 additions and 638 deletions

@ -1 +1 @@
Subproject commit 8bcf59f216178622a0f2711dbea82e7a280f7ed0
Subproject commit 823bb3130591716771190e3123c5772250e00dc7

View File

@ -2,14 +2,14 @@
If/Then
==================
if true then "True";
if true then "True"
---
(root
(item
(statement
(closed_statement
(open_statement
(expression
(control_flow
(expression
@ -19,22 +19,21 @@ if true then "True";
(open_statement
(expression
(value
(string)))))))
(close)))))
(string)))))))))))
==================
If/Then Assignment
==================
x = if true then 1;
x = if true then 1
---
(root
(item
(statement
(closed_statement
(open_statement
(expression
(operation
(expression
@ -49,6 +48,5 @@ x = if true then 1;
(open_statement
(expression
(value
(integer)))))))))
(close)))))
(integer)))))))))))))

View File

@ -2,47 +2,44 @@
Simple Statements
==================
1;
"one";
x;
1
"one"
x
---
(root
(item
(statement
(closed_statement
(open_statement
(expression
(value
(integer)))
(close))))
(integer))))))
(item
(statement
(closed_statement
(open_statement
(expression
(value
(string)))
(close))))
(string))))))
(item
(statement
(closed_statement
(open_statement
(expression
(identifier))
(close)))))
(identifier))))))
==================
Simple Assignment
==================
x = 1;
y = "one";
x = 1
y = "one"
---
(root
(item
(statement
(closed_statement
(open_statement
(expression
(operation
(expression
@ -50,11 +47,10 @@ y = "one";
(operator)
(expression
(value
(integer)))))
(close))))
(integer))))))))
(item
(statement
(closed_statement
(open_statement
(expression
(operation
(expression
@ -62,21 +58,20 @@ y = "one";
(operator)
(expression
(value
(string)))))
(close)))))
(string)))))))))
==================
Complex Assignment
==================
x = 1 + 1;
x = 1 + 1
---
(root
(item
(statement
(closed_statement
(open_statement
(expression
(operation
(expression
@ -90,5 +85,4 @@ x = 1 + 1;
(operator)
(expression
(value
(integer)))))
(close)))))
(integer)))))))))

View File

@ -14,12 +14,9 @@ module.exports = grammar({
comment: $ => prec.left(seq(token('#'), /.*/)),
statement: $ => choice(
$.closed_statement,
$.open_statement,
),
closed_statement: $ => seq($.expression, $.close),
open_statement: $ => prec.left(seq($.expression)),
expression: $ => choice(
@ -29,8 +26,6 @@ module.exports = grammar({
$.control_flow,
),
close: $ => ";",
identifier: $ => /[a-z|_|.]+/,
value: $ => choice(

View File

@ -45,29 +45,12 @@
"statement": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "closed_statement"
},
{
"type": "SYMBOL",
"name": "open_statement"
}
]
},
"closed_statement": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "close"
}
]
},
"open_statement": {
"type": "PREC_LEFT",
"value": 0,
@ -102,10 +85,6 @@
}
]
},
"close": {
"type": "STRING",
"value": ";"
},
"identifier": {
"type": "PATTERN",
"value": "[a-z|_|.]+"

View File

@ -4,25 +4,6 @@
"named": true,
"fields": {}
},
{
"type": "closed_statement",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "close",
"named": true
},
{
"type": "expression",
"named": true
}
]
}
},
{
"type": "comment",
"named": true,
@ -170,10 +151,6 @@
"multiple": false,
"required": true,
"types": [
{
"type": "closed_statement",
"named": true
},
{
"type": "open_statement",
"named": true
@ -252,10 +229,6 @@
"type": "==",
"named": false
},
{
"type": "close",
"named": true
},
{
"type": "else",
"named": false

File diff suppressed because it is too large Load Diff