Implement new grammar
This commit is contained in:
parent
d7ff4e57c5
commit
532c751c36
167
Cargo.lock
generated
Normal file
167
Cargo.lock
generated
Normal file
@ -0,0 +1,167 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.149"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.7.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da"
|
||||
|
||||
[[package]]
|
||||
name = "scopeguard"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter"
|
||||
version = "0.20.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree-sitter-dust"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"rayon",
|
||||
"tree-sitter",
|
||||
]
|
@ -20,6 +20,7 @@ include = [
|
||||
path = "bindings/rust/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
rayon = "1.8.0"
|
||||
tree-sitter = "~0.20.10"
|
||||
|
||||
[build-dependencies]
|
||||
|
@ -13,7 +13,8 @@ not_a_comment
|
||||
(expression
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
(statement
|
||||
(comment))))
|
||||
|
||||
==================
|
||||
Partial Line Comments
|
||||
@ -29,4 +30,5 @@ not_a_comment # comment
|
||||
(expression
|
||||
(identifier))))
|
||||
(item
|
||||
(comment)))
|
||||
(statement
|
||||
(comment))))
|
||||
|
@ -2,7 +2,7 @@
|
||||
If
|
||||
==================
|
||||
|
||||
if true then "True"
|
||||
if true { "True" }
|
||||
|
||||
---
|
||||
|
||||
@ -10,19 +10,20 @@ if true then "True"
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(if
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))
|
||||
(string)))))))))
|
||||
|
||||
==================
|
||||
If Assignment
|
||||
==================
|
||||
|
||||
x = if true then 1
|
||||
x = if true { 1 }
|
||||
|
||||
---
|
||||
|
||||
@ -31,21 +32,23 @@ x = if true then 1
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(if_else
|
||||
(if
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))))
|
||||
(integer)))))))))))
|
||||
|
||||
==================
|
||||
If Else
|
||||
==================
|
||||
|
||||
if false then "True" else "False"
|
||||
if false { "True" } else { "False" }
|
||||
|
||||
---
|
||||
|
||||
@ -53,26 +56,29 @@ if false then "True" else "False"
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(if
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(string)))))
|
||||
(else
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))
|
||||
(string)))))))))
|
||||
|
||||
==================
|
||||
If Else If
|
||||
==================
|
||||
|
||||
if 1 == 1
|
||||
then "math is fun"
|
||||
else if 4 == 9
|
||||
then "math is broken"
|
||||
if 1 == 1 {
|
||||
"math is fun"
|
||||
} else if 4 == 9 {
|
||||
"math is broken"
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
@ -80,6 +86,7 @@ else if 4 == 9
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(if
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
@ -92,9 +99,8 @@ else if 4 == 9
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(string)))))
|
||||
(else_if
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
@ -107,19 +113,21 @@ else if 4 == 9
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))
|
||||
(string)))))))))
|
||||
|
||||
==================
|
||||
If Else Else If Else
|
||||
==================
|
||||
|
||||
if false
|
||||
then "no"
|
||||
else if false
|
||||
then "no"
|
||||
else if 1 + 1 == 9
|
||||
then "not the answer"
|
||||
else "42"
|
||||
if false {
|
||||
"no"
|
||||
} else if false {
|
||||
"no"
|
||||
} else if 1 + 1 == 9 {
|
||||
"not the answer"
|
||||
} else {
|
||||
"42"
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
@ -127,24 +135,23 @@ else "42"
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(if
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(string)))))
|
||||
(else_if
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(string)))))
|
||||
(else_if
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
@ -163,8 +170,9 @@ else "42"
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(string)))))
|
||||
(else
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))))
|
||||
(string)))))))))
|
||||
|
@ -12,10 +12,11 @@ function { "Hiya" }
|
||||
(expression
|
||||
(value
|
||||
(function
|
||||
(item
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))
|
||||
(string)))))))))))
|
||||
|
||||
==================
|
||||
Function Call
|
||||
@ -54,16 +55,17 @@ function <message number> {
|
||||
(function
|
||||
(identifier)
|
||||
(identifier)
|
||||
(item
|
||||
(statement
|
||||
(expression
|
||||
(tool_call
|
||||
(output
|
||||
(function_call
|
||||
(identifier)
|
||||
(expression
|
||||
(identifier))))))
|
||||
(identifier)))))
|
||||
(statement
|
||||
(expression
|
||||
(tool_call
|
||||
(output
|
||||
(function_call
|
||||
(identifier)
|
||||
(expression
|
||||
(identifier))))))))))))
|
||||
|
||||
@ -98,8 +100,10 @@ Complex Function Call
|
||||
(value
|
||||
(map
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer))
|
||||
(integer)))
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))))
|
||||
(integer)))))))))))
|
||||
|
@ -12,16 +12,18 @@ List Declaration
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(string)))
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
(integer)))))))))
|
||||
|
||||
==================
|
||||
List Assignment
|
||||
==================
|
||||
|
||||
foobar = ['answer', 42]
|
||||
foobar = ['foobar']
|
||||
|
||||
---
|
||||
|
||||
@ -30,14 +32,14 @@ foobar = ['answer', 42]
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(integer))))))))))
|
||||
(string)))))))))))
|
||||
|
||||
==================
|
||||
List Nesting
|
||||
@ -53,38 +55,18 @@ List Nesting
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(value
|
||||
(list
|
||||
(value
|
||||
(integer))
|
||||
(value
|
||||
(list
|
||||
(value
|
||||
(integer))))))))))))
|
||||
|
||||
==================
|
||||
Optional Commas
|
||||
==================
|
||||
|
||||
['answers' [42 [666]]]
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(string)))
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(integer)))
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(integer))
|
||||
(value
|
||||
(list
|
||||
(value
|
||||
(integer))))))))))))
|
||||
(integer)))))))))))))))
|
||||
|
@ -15,8 +15,9 @@ Simple Map
|
||||
(value
|
||||
(map
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))
|
||||
(integer)))))))))
|
||||
|
||||
==================
|
||||
Map Assignment
|
||||
@ -33,13 +34,15 @@ x = {
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(map
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))))
|
||||
(integer)))))))))))
|
||||
|
||||
==================
|
||||
Map Access
|
||||
|
170
corpus/match.txt
170
corpus/match.txt
@ -1,170 +0,0 @@
|
||||
==================
|
||||
If
|
||||
==================
|
||||
|
||||
if true then "True"
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))
|
||||
|
||||
==================
|
||||
If Assignment
|
||||
==================
|
||||
|
||||
x = if true then 1
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(integer))))))))))
|
||||
|
||||
==================
|
||||
If Else
|
||||
==================
|
||||
|
||||
if false then "True" else "False"
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))
|
||||
|
||||
==================
|
||||
If Else If
|
||||
==================
|
||||
|
||||
if 1 == 1
|
||||
then "math is fun"
|
||||
else if 4 == 9
|
||||
then "math is broken"
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))
|
||||
|
||||
==================
|
||||
If Else Else If Else
|
||||
==================
|
||||
|
||||
if false
|
||||
then "no"
|
||||
else if false
|
||||
then "no"
|
||||
else if 1 + 1 == 9
|
||||
then "not the answer"
|
||||
else "42"
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(value
|
||||
(boolean)))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(if_else
|
||||
(expression
|
||||
(logic
|
||||
(expression
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(logic_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))))
|
@ -38,6 +38,7 @@ y = "one"
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
@ -46,6 +47,7 @@ y = "one"
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
@ -64,6 +66,7 @@ x = 1 + 1
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(expression
|
||||
(math
|
||||
(expression
|
||||
|
@ -16,11 +16,15 @@ table <text, number> {
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(string)))
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))
|
||||
(integer))))))))))))
|
||||
|
||||
==================
|
||||
Table Assignment
|
||||
@ -37,17 +41,22 @@ foobar = table <text, number> {
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(expression
|
||||
(value
|
||||
(table
|
||||
(identifier)
|
||||
(identifier)
|
||||
(expression
|
||||
(value
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(string)))
|
||||
(expression
|
||||
(value
|
||||
(integer)))))))))))
|
||||
(integer))))))))))))))
|
||||
|
||||
==================
|
||||
Table Access
|
||||
@ -86,8 +95,10 @@ insert ['bob was here', 0] into foobar
|
||||
(statement
|
||||
(insert
|
||||
(list
|
||||
(expression
|
||||
(value
|
||||
(string))
|
||||
(string)))
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(integer))))
|
||||
(identifier)))))
|
||||
|
@ -3,7 +3,7 @@ While Loop
|
||||
==================
|
||||
|
||||
while true {
|
||||
(output "This is a bad idea...")
|
||||
(print "This is a bad idea...")
|
||||
}
|
||||
|
||||
---
|
||||
@ -18,17 +18,17 @@ while true {
|
||||
(item
|
||||
(statement
|
||||
(expression
|
||||
(tool_call
|
||||
(output
|
||||
(function_call
|
||||
(tool)
|
||||
(expression
|
||||
(value
|
||||
(string))))))))))))
|
||||
(string)))))))))))
|
||||
|
||||
==================
|
||||
While Assignment
|
||||
While Loop Assignment
|
||||
==================
|
||||
|
||||
foo = while true {
|
||||
answer = while false {
|
||||
42
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@ foo = while true {
|
||||
(statement
|
||||
(assignment
|
||||
(identifier)
|
||||
(assignment_operator)
|
||||
(statement
|
||||
(while
|
||||
(expression
|
||||
|
@ -1,43 +0,0 @@
|
||||
==================
|
||||
Simple Yield
|
||||
==================
|
||||
|
||||
1 -> output
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(yield
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(expression
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
Complex Yield
|
||||
==================
|
||||
|
||||
1 + 1 -> to_string -> output
|
||||
|
||||
---
|
||||
|
||||
(root
|
||||
(item
|
||||
(statement
|
||||
(yield
|
||||
(expression
|
||||
(math
|
||||
(expression
|
||||
(value
|
||||
(integer)))
|
||||
(math_operator)
|
||||
(expression
|
||||
(value
|
||||
(integer)))))
|
||||
(expression
|
||||
(identifier))
|
||||
(expression
|
||||
(identifier))))))
|
138
grammar.js
138
grammar.js
@ -6,38 +6,24 @@ module.exports = grammar({
|
||||
rules: {
|
||||
root: $ => repeat1($.item),
|
||||
|
||||
item: $ => choice(
|
||||
$.comment,
|
||||
$.statement,
|
||||
),
|
||||
|
||||
comment: $ => seq('#', /.*/), // TODO: New comment that can be used anyhere.
|
||||
// Keep this comment type for later use.
|
||||
item: $ => prec.left(repeat1($.statement)),
|
||||
|
||||
statement: $ => choice(
|
||||
$.comment,
|
||||
$.assignment,
|
||||
$.expression,
|
||||
$.if_else,
|
||||
$.yield,
|
||||
$.insert,
|
||||
$.select,
|
||||
$.loop,
|
||||
$.match,
|
||||
$.while,
|
||||
),
|
||||
|
||||
yield: $ => seq(
|
||||
$.expression,
|
||||
'->',
|
||||
$.expression,
|
||||
repeat(prec.left(seq('->', $.expression)))
|
||||
),
|
||||
comment: $ => seq(/[#]+.*/),
|
||||
|
||||
expression: $ => prec.right(choice(
|
||||
$.value,
|
||||
$.identifier,
|
||||
$.function_call,
|
||||
$.tool_call,
|
||||
$.math,
|
||||
$.logic,
|
||||
)),
|
||||
@ -68,7 +54,7 @@ module.exports = grammar({
|
||||
|
||||
list: $ => seq(
|
||||
'[',
|
||||
repeat1(seq($.value, optional(','))),
|
||||
repeat(seq($.expression, optional(','))),
|
||||
']'
|
||||
),
|
||||
|
||||
@ -76,7 +62,7 @@ module.exports = grammar({
|
||||
'function',
|
||||
optional(seq('<', repeat(seq($.identifier, optional(','))), '>')),
|
||||
'{',
|
||||
repeat1($.item),
|
||||
$.item,
|
||||
'}',
|
||||
),
|
||||
|
||||
@ -84,13 +70,13 @@ module.exports = grammar({
|
||||
'table',
|
||||
seq('<', repeat1(seq($.identifier, optional(','))), '>'),
|
||||
'{',
|
||||
repeat($.list),
|
||||
repeat($.expression),
|
||||
'}',
|
||||
),
|
||||
|
||||
map: $ => seq(
|
||||
'{',
|
||||
repeat(seq($.identifier, "=", $.value)), // TODO: Replace value with expression
|
||||
repeat(seq($.identifier, "=", $.expression)),
|
||||
'}',
|
||||
),
|
||||
|
||||
@ -119,48 +105,56 @@ module.exports = grammar({
|
||||
'!=',
|
||||
'&&',
|
||||
'||',
|
||||
'>',
|
||||
'<',
|
||||
">=",
|
||||
"<=",
|
||||
),
|
||||
|
||||
assignment: $ => prec.right(seq(
|
||||
$.identifier,
|
||||
choice("=", "+=", "-="),
|
||||
$.assignment_operator,
|
||||
$.statement,
|
||||
)),
|
||||
|
||||
select: $ => prec.right(seq(
|
||||
'select',
|
||||
$.identifier,
|
||||
'from',
|
||||
$.identifier,
|
||||
optional(
|
||||
seq('where', $.expression)
|
||||
assignment_operator: $ => choice(
|
||||
"=",
|
||||
"+=",
|
||||
"-=",
|
||||
),
|
||||
|
||||
if_else: $ => prec.left(seq(
|
||||
$.if,
|
||||
repeat(seq($.else_if)),
|
||||
optional(seq($.else)),
|
||||
)),
|
||||
|
||||
insert: $ => prec.right(1, seq(
|
||||
'insert',
|
||||
repeat1($.list),
|
||||
'into',
|
||||
$.identifier,
|
||||
optional(
|
||||
seq('where', $.logic)
|
||||
),
|
||||
)),
|
||||
|
||||
if_else: $ => prec.left(1, seq(
|
||||
if: $ => seq(
|
||||
'if',
|
||||
$.expression,
|
||||
'then',
|
||||
'{',
|
||||
$.statement,
|
||||
optional(seq(
|
||||
'}',
|
||||
),
|
||||
|
||||
else_if: $ => seq(
|
||||
'else if',
|
||||
$.expression,
|
||||
'{',
|
||||
$.statement,
|
||||
'}',
|
||||
),
|
||||
|
||||
else: $ => seq(
|
||||
'else',
|
||||
'{',
|
||||
$.statement,
|
||||
)),
|
||||
)),
|
||||
'}',
|
||||
),
|
||||
|
||||
function_call: $ => prec.right(seq(
|
||||
'(',
|
||||
$.identifier,
|
||||
choice($.identifier, $.tool),
|
||||
repeat(seq($.expression, optional(','))),
|
||||
')',
|
||||
)),
|
||||
@ -173,36 +167,40 @@ module.exports = grammar({
|
||||
'}',
|
||||
),
|
||||
|
||||
loop: $ => seq(
|
||||
'loop',
|
||||
for: $ => seq(
|
||||
'for',
|
||||
$.identifier,
|
||||
'in',
|
||||
$.expression,
|
||||
'{',
|
||||
repeat($.statement),
|
||||
'break',
|
||||
optional($.value),
|
||||
$.item,
|
||||
'}',
|
||||
),
|
||||
|
||||
match: $ => prec.right(seq(
|
||||
'match',
|
||||
$.expression,
|
||||
repeat1(seq($.expression, '=>', $.statement)),
|
||||
'catch',
|
||||
$.statement
|
||||
)),
|
||||
|
||||
tool_call: $ => prec.right(1, seq(
|
||||
'(',
|
||||
$._tool,
|
||||
')',
|
||||
)),
|
||||
|
||||
_tool: $ => choice(
|
||||
$.input,
|
||||
$.output,
|
||||
tool: $ => choice(
|
||||
'print',
|
||||
'read',
|
||||
'write',
|
||||
),
|
||||
|
||||
input: $ => seq('input', $.expression),
|
||||
output: $ => seq('output', $.expression),
|
||||
read: $ => seq('read', $.expression),
|
||||
select: $ => prec.right(seq(
|
||||
'select',
|
||||
$.identifier,
|
||||
'from',
|
||||
$.identifier,
|
||||
optional(
|
||||
seq('where', $.expression)
|
||||
),
|
||||
)),
|
||||
|
||||
insert: $ => prec.right(seq(
|
||||
'insert',
|
||||
repeat1($.list),
|
||||
'into',
|
||||
$.identifier,
|
||||
optional(
|
||||
seq('where', $.logic)
|
||||
),
|
||||
)),
|
||||
}
|
||||
});
|
||||
|
450
src/grammar.json
450
src/grammar.json
@ -10,34 +10,23 @@
|
||||
}
|
||||
},
|
||||
"item": {
|
||||
"type": "PREC_LEFT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
}
|
||||
},
|
||||
"statement": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "comment"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "#"
|
||||
},
|
||||
{
|
||||
"type": "PATTERN",
|
||||
"value": ".*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"statement": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "assignment"
|
||||
@ -50,10 +39,6 @@
|
||||
"type": "SYMBOL",
|
||||
"name": "if_else"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "yield"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "insert"
|
||||
@ -62,54 +47,18 @@
|
||||
"type": "SYMBOL",
|
||||
"name": "select"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "loop"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "match"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "while"
|
||||
}
|
||||
]
|
||||
},
|
||||
"yield": {
|
||||
"comment": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "->"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "PREC_LEFT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "->"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
"type": "PATTERN",
|
||||
"value": "[#]+.*"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -131,10 +80,6 @@
|
||||
"type": "SYMBOL",
|
||||
"name": "function_call"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "tool_call"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "math"
|
||||
@ -220,13 +165,13 @@
|
||||
"value": "["
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "value"
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
@ -306,11 +251,8 @@
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
@ -370,7 +312,7 @@
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "list"
|
||||
"name": "expression"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -401,7 +343,7 @@
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "value"
|
||||
"name": "expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -497,6 +439,22 @@
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "||"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ">"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "<"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ">="
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "<="
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -511,6 +469,17 @@
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "assignment_operator"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"assignment_operator": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
@ -527,34 +496,27 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"select": {
|
||||
"type": "PREC_RIGHT",
|
||||
"if_else": {
|
||||
"type": "PREC_LEFT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "select"
|
||||
"type": "SYMBOL",
|
||||
"name": "if"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "from"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
"name": "else_if"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
@ -562,13 +524,9 @@
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "where"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
"name": "else"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -580,59 +538,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"insert": {
|
||||
"type": "PREC_RIGHT",
|
||||
"value": 1,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "insert"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "list"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "into"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "where"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "logic"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"if_else": {
|
||||
"type": "PREC_LEFT",
|
||||
"value": 1,
|
||||
"content": {
|
||||
"if": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
@ -645,16 +551,44 @@
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "then"
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"else_if": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "else if"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
},
|
||||
"else": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
@ -662,18 +596,18 @@
|
||||
"value": "else"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
"type": "STRING",
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"function_call": {
|
||||
"type": "PREC_RIGHT",
|
||||
@ -685,10 +619,19 @@
|
||||
"type": "STRING",
|
||||
"value": "("
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "tool"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
@ -745,39 +688,32 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"loop": {
|
||||
"for": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "loop"
|
||||
"value": "for"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "in"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "break"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "value"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
"name": "item"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
@ -785,7 +721,24 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"match": {
|
||||
"tool": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "print"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "read"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "write"
|
||||
}
|
||||
]
|
||||
},
|
||||
"select": {
|
||||
"type": "PREC_RIGHT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
@ -793,116 +746,93 @@
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "match"
|
||||
"value": "select"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "from"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "where"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"insert": {
|
||||
"type": "PREC_RIGHT",
|
||||
"value": 0,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "insert"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT1",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "=>"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
"name": "list"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "catch"
|
||||
"value": "into"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "statement"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"tool_call": {
|
||||
"type": "PREC_RIGHT",
|
||||
"value": 1,
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "("
|
||||
"name": "identifier"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_tool"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ")"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"_tool": {
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "input"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "output"
|
||||
}
|
||||
]
|
||||
},
|
||||
"input": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "input"
|
||||
"value": "where"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
"name": "logic"
|
||||
}
|
||||
]
|
||||
},
|
||||
"output": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "output"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
},
|
||||
"read": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "read"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"extras": [
|
||||
{
|
||||
|
@ -7,6 +7,10 @@
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "assignment_operator",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
@ -18,6 +22,11 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "assignment_operator",
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"named": true,
|
||||
@ -28,6 +37,40 @@
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "else",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "else_if",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true,
|
||||
@ -52,10 +95,6 @@
|
||||
"type": "math",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "tool_call",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
"named": true
|
||||
@ -97,12 +136,16 @@
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "tool",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "if_else",
|
||||
"type": "if",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
@ -121,15 +164,23 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"type": "if_else",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"type": "else",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "else_if",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -163,13 +214,9 @@
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
@ -183,10 +230,10 @@
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "value",
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -216,25 +263,6 @@
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "loop",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "statement",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "map",
|
||||
"named": true,
|
||||
@ -242,32 +270,13 @@
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "statement",
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
@ -297,21 +306,6 @@
|
||||
"named": true,
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "output",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "root",
|
||||
"named": true,
|
||||
@ -358,6 +352,10 @@
|
||||
"type": "assignment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
@ -370,14 +368,6 @@
|
||||
"type": "insert",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "loop",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "select",
|
||||
"named": true
|
||||
@ -385,10 +375,6 @@
|
||||
{
|
||||
"type": "while",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "yield",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -401,35 +387,21 @@
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "identifier",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "list",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "tool_call",
|
||||
"type": "tool",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "input",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "output",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
"fields": {}
|
||||
},
|
||||
{
|
||||
"type": "value",
|
||||
@ -493,29 +465,10 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "yield",
|
||||
"named": true,
|
||||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "expression",
|
||||
"named": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "!=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "#",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "%",
|
||||
"named": false
|
||||
@ -556,10 +509,6 @@
|
||||
"type": "-=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "->",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "/",
|
||||
"named": false
|
||||
@ -568,6 +517,10 @@
|
||||
"type": "<",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "<=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "=",
|
||||
"named": false
|
||||
@ -577,11 +530,11 @@
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "=>",
|
||||
"type": ">",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": ">",
|
||||
"type": ">=",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
@ -592,18 +545,14 @@
|
||||
"type": "]",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "break",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "catch",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "else",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "else if",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "false",
|
||||
"named": false
|
||||
@ -612,6 +561,10 @@
|
||||
"type": "float",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "for",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "from",
|
||||
"named": false
|
||||
@ -629,7 +582,7 @@
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"type": "in",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
@ -645,15 +598,7 @@
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "loop",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "match",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "output",
|
||||
"type": "print",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
@ -672,10 +617,6 @@
|
||||
"type": "table",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "then",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "true",
|
||||
"named": false
|
||||
@ -688,6 +629,10 @@
|
||||
"type": "while",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "write",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "{",
|
||||
"named": false
|
||||
|
16404
src/parser.c
16404
src/parser.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user