1
0

Begin syntax revision

This commit is contained in:
Jeff 2023-10-31 01:09:29 -04:00
parent 9c565e810e
commit 42339e1171
17 changed files with 8738 additions and 7450 deletions

2
Cargo.lock generated
View File

@ -459,7 +459,7 @@ dependencies = [
[[package]]
name = "dust-lang"
version = "0.3.4"
version = "0.3.5"
dependencies = [
"ansi_term",
"async-std",

View File

@ -10,7 +10,7 @@ take_turn = function <current_room opponent_card> {
remove_card = function <opponent_card> {
for card_list in cards {
removed = remove card in card_list {
removed = remove card from card_list {
card == opponent_card
}
}
@ -21,16 +21,16 @@ remove_card = function <opponent_card> {
}
make_guess = function <current_room> {
if ((length suspects) == 1)
&& ((length rooms) == 1)
&& ((length weapons) == 1)
if (length suspects) == 1
&& (length rooms) == 1
&& (length weapons) == 1
{
(output 'It was '
+ suspects.{0}
+ suspects:0
+ ' in the '
+ rooms.{0}
+ rooms:0
+ ' with the '
+ weapons.{0}
+ weapons:0
+ '!')
} else {
(output 'I accuse '
@ -42,3 +42,5 @@ make_guess = function <current_room> {
+ '!')
}
}
(make_guess 'Library')

View File

@ -1,6 +1,6 @@
list = [1 2 3]
async for i in list {
for i in list {
i += 1
(output i)
}

View File

@ -1,60 +0,0 @@
# Function
x = "bar"
func = function <> {
x = "foo"
x
}
assert_equal("foo", (func))
assert_equal("bar", x)
# For Loop
x = 42
for number in [1 2 3] {
x += number
}
assert_equal(48, x)
# Async Loops
## Transform Loop
x = 42
y = [1 2 3]
transform number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)
## Filter Loop
x = 42
y = [1 2 3]
transform number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)
## Filter Loop
x = 42
y = [1 2 3]
filter number in y {
number += x
x = 1000
}
assert_equal([43, 44, 45], y)
assert_equal(42, x)

View File

@ -1,5 +1,5 @@
data = (from_json (read "examples/assets/jq_data.json"))
transform item in data {
item.{commit}.{committer}.{name}
item:commit:committer:name
}

View File

@ -6,41 +6,58 @@ use crate::{AbstractTree, Error, Expression, Identifier, Item, List, Map, Result
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
pub struct Filter {
identifier: Identifier,
expression: Expression,
item: Item,
count: Option<Expression>,
item_id: Identifier,
collection: Expression,
predicate: Item,
}
impl AbstractTree for Filter {
fn from_syntax_node(source: &str, node: Node) -> Result<Self> {
let identifier_node = node.child(1).unwrap();
let identifier = Identifier::from_syntax_node(source, identifier_node)?;
let count = match node.child_by_field_name("count") {
Some(node) => Some(Expression::from_syntax_node(source, node)?),
None => None,
};
let expression_node = node.child(3).unwrap();
let expression = Expression::from_syntax_node(source, expression_node)?;
let item_id_node = node.child(1).unwrap();
let item_id = Identifier::from_syntax_node(source, item_id_node)?;
let item_node = node.child(5).unwrap();
let item = Item::from_syntax_node(source, item_node)?;
let collection_node = node.child(3).unwrap();
let collection = Expression::from_syntax_node(source, collection_node)?;
let predicate_node = node.child(5).unwrap();
let predicate = Item::from_syntax_node(source, predicate_node)?;
Ok(Filter {
identifier,
expression,
item,
count,
item_id,
collection,
predicate,
})
}
fn run(&self, source: &str, context: &mut Map) -> Result<Value> {
let value = self.expression.run(source, context)?;
let value = self.collection.run(source, context)?;
let values = value.as_list()?.items();
let key = self.identifier.inner();
let key = self.item_id.inner();
let new_values = List::new();
let count = match &self.count {
Some(expression) => Some(expression.run(source, context)?.as_integer()? as usize),
None => None,
};
values.par_iter().try_for_each(|value| {
if let Some(max) = count {
if new_values.items().len() == max {
return Ok(());
}
}
let mut context = Map::new();
context.variables_mut().insert(key.clone(), value.clone());
let should_include = self.item.run(source, &mut context)?.as_boolean()?;
let should_include = self.predicate.run(source, &mut context)?.as_boolean()?;
if should_include {
new_values.items_mut().push(value.clone());

View File

@ -17,10 +17,9 @@ impl AbstractTree for For {
let for_node = node.child(0).unwrap();
let is_async = match for_node.kind() {
"for" => false,
"async for" => true,
_ => {
return Err(Error::UnexpectedSyntaxNode {
expected: "\"for\" or \"async for\"",
expected: "for",
actual: for_node.kind(),
location: for_node.start_position(),
relevant_source: source[for_node.byte_range()].to_string(),

View File

@ -59,12 +59,6 @@ fn remove_loop() {
evaluate(&file_contents).unwrap();
}
#[test]
fn scope() {
let file_contents = read_to_string("examples/scope.ds").unwrap();
evaluate(&file_contents).unwrap();
}
#[test]
fn table() {
let file_contents = read_to_string("examples/table.ds").unwrap();

View File

@ -10,12 +10,13 @@ async { (output 'Whaddup') }
(item
(statement
(async
(statement
(expression
(tool
(expression
(value
(string))))))))))
(item
(statement
(expression
(tool
(expression
(value
(string)))))))))))
==================
Complex Async Statements
@ -23,12 +24,12 @@ Complex Async Statements
async {
if 1 % 2 == 0 {
(output 'true')
true
} else {
(output 'false')
false
}
(output 'foobar')
'foobar'
}
---
@ -37,106 +38,21 @@ async {
(item
(statement
(async
(statement
(if_else
(if
(expression
(logic
(expression
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(tool
(expression
(value
(string)))))))
(else
(statement
(expression
(tool
(expression
(value
(string)))))))))
(statement
(expression
(tool
(expression
(value
(string))))))))))
==================
Simple Async Await Statements
==================
x = async {
1
}
---
(root
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(async
(statement
(expression
(value
(integer))))))))))
==================
Complex Async Await Statements
==================
x = async {
i = 0
while i < 5 {
(output i)
i += 1
}
(read "examples/assets/faithful.csv")
}
---
(root
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(async
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer))))))
(statement
(while
(item
(statement
(if_else
(if
(expression
(logic
(expression
(identifier))
(math
(expression
(value
(integer)))
(math_operator)
(expression
(value
(integer)))))
(logic_operator)
(expression
(value
@ -144,20 +60,15 @@ x = async {
(item
(statement
(expression
(tool
(expression
(identifier)))))
(value
(boolean))))))
(else
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(value
(integer)))))))))
(statement
(expression
(tool
(expression
(value
(string))))))))))))
(expression
(value
(boolean))))))))
(statement
(expression
(value
(string)))))))))

View File

@ -14,10 +14,11 @@ if true { "True" }
(expression
(value
(boolean)))
(statement
(expression
(value
(string)))))))))
(item
(statement
(expression
(value
(string))))))))))
==================
Complex If
@ -65,10 +66,11 @@ if (1 == 1) && (2 == 2) && (3 == 3) { "True" }
(expression
(value
(integer)))))))))
(item
(statement
(expression
(value
(string)))))))))
(string))))))))))
==================
If Assignment
@ -90,10 +92,11 @@ x = if true { 1 }
(expression
(value
(boolean)))
(statement
(expression
(value
(integer)))))))))))
(item
(statement
(expression
(value
(integer))))))))))))
==================
If Else
@ -111,15 +114,17 @@ if false { "True" } else { "False" }
(expression
(value
(boolean)))
(statement
(expression
(value
(string)))))
(item
(statement
(expression
(value
(string))))))
(else
(statement
(expression
(value
(string)))))))))
(item
(statement
(expression
(value
(string))))))))))
==================
If Else If
@ -147,10 +152,11 @@ if 1 == 1 {
(expression
(value
(integer)))))
(statement
(expression
(value
(string)))))
(item
(statement
(expression
(value
(string))))))
(else_if
(expression
(logic
@ -161,10 +167,11 @@ if 1 == 1 {
(expression
(value
(integer)))))
(statement
(expression
(value
(string)))))))))
(item
(statement
(expression
(value
(string))))))))))
==================
If Else Else If Else
@ -190,18 +197,20 @@ if false {
(expression
(value
(boolean)))
(statement
(expression
(value
(string)))))
(item
(statement
(expression
(value
(string))))))
(else_if
(expression
(value
(boolean)))
(statement
(expression
(value
(string)))))
(item
(statement
(expression
(value
(string))))))
(else_if
(expression
(logic
@ -218,12 +227,14 @@ if false {
(expression
(value
(integer)))))
(statement
(expression
(value
(string)))))
(item
(statement
(expression
(value
(string))))))
(else
(statement
(expression
(value
(string)))))))))
(item
(statement
(expression
(value
(string))))))))))

View File

@ -33,17 +33,13 @@ for i in [1, 2, 3] {
(identifier))))))))))
==================
Complex For Loop
Nested For Loop
==================
for list in list_of_lists {
for item in list {
(output item)
}
if (length list) > 1 {
(output "List is long...")
}
}
---
@ -66,23 +62,4 @@ for list in list_of_lists {
(expression
(tool
(expression
(identifier))))))))
(statement
(if_else
(if
(expression
(logic
(expression
(tool
(expression
(identifier))))
(logic_operator)
(expression
(value
(integer)))))
(statement
(expression
(tool
(expression
(value
(string))))))))))))))
(identifier)))))))))))))

View File

@ -0,0 +1,77 @@
==================
Reduce Loop
==================
reduce i to acc in [1, 2, 3] {
acc += i
}
---
(root
(item
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
(expression
(value
(integer)))
(expression
(value
(integer)))
(expression
(value
(integer))))))
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(identifier))))))))))
==================
Reduce Loop Assignment
==================
together = reduce i to acc in ["one", "two", "three"] {
acc += i
}
---
(root
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(reduce
(identifier)
(identifier)
(expression
(value
(list
(expression
(value
(string)))
(expression
(value
(string)))
(expression
(value
(string))))))
(item
(statement
(assignment
(identifier)
(assignment_operator)
(statement
(expression
(identifier))))))))))))

View File

@ -2,7 +2,7 @@
Remove Loop
==================
remove i in [1, 2, 3] {
remove i from [1, 2, 3] {
i <= 2
}
@ -40,7 +40,7 @@ remove i in [1, 2, 3] {
Remove Loop Assignment
==================
removed = remove i in ["one", "two", "three"] {
removed = remove i from ["one", "two", "three"] {
i == "two"
}

View File

@ -4,24 +4,29 @@ module.exports = grammar({
word: $ => $.identifier,
rules: {
root: $ => repeat1($.item),
item: $ => prec.left(repeat1($.statement)),
root: $ => repeat1($.statement),
statement: $ => prec.left(choice(
$.comment,
repeat1($._statement_kind),
seq('{', $._statement_kind, '}'),
// ))
_statement_kind: $ => prec.left(choice(
$.assignment,
$.expression,
$.if_else,
$.insert,
$.select,
$.while,
$.async,
$.for,
$.transform,
$.comment,
$.expression,
$.filter,
$.find,
$.for,
$.if_else,
$.insert,
$.match,
$.reduce,
$.remove,
$.select,
$.transform,
$.while,
)),
comment: $ => seq(/[#]+.*/),
@ -32,13 +37,13 @@ module.exports = grammar({
),
_expression_kind: $ => choice(
$.value,
$.function_call,
$.identifier,
$.index,
$.math,
$.logic,
$.function_call,
$.math,
$.tool,
$.value,
),
identifier: $ => /[_a-zA-Z]+[_a-zA-Z0-9]?/,
@ -54,21 +59,19 @@ module.exports = grammar({
$.map,
),
_numeric: $ => token(repeat1(
choice('1', '2', '3', '4', '5', '6', '7', '8', '9', '0')
)),
integer: $ => prec.left(token(seq(
optional('-'),
repeat1(
choice('1', '2', '3', '4', '5', '6', '7', '8', '9', '0')
),
))),
integer: $ => prec.left(seq(
optional(token.immediate('-')),
$._numeric,
)),
float: $ => prec.left(seq(
optional(token.immediate('-')),
$._numeric,
token.immediate('.'),
$._numeric,
)),
float: $ => prec.left(token(seq(
optional('-'),
repeat1(choice('1', '2', '3', '4', '5', '6', '7', '8', '9', '0')),
'.',
repeat1(choice('1', '2', '3', '4', '5', '6', '7', '8', '9', '0')),
))),
string: $ => /("[^"]*?")|('[^']*?')|(`[^`]*?`)/,
@ -85,7 +88,7 @@ module.exports = grammar({
map: $ => seq(
'{',
repeat(seq($.identifier, "=", $.expression)),
$.assignment,
'}',
),
@ -103,7 +106,7 @@ module.exports = grammar({
'function',
optional(seq('<', repeat(seq($.identifier, optional(','))), '>')),
'{',
$.item,
$.statement,
'}',
),
@ -192,11 +195,23 @@ module.exports = grammar({
')',
)),
match: $ => seq(
'match',
$.expression,
'{',
repeat1(seq(
$.expression,
'=>',
$.statement,
)),
'}',
),
while: $ => seq(
'while',
$.expression,
'{',
$.item,
$.statement,
'}',
),
@ -206,7 +221,7 @@ module.exports = grammar({
'in',
$.expression,
'{',
$.item,
$.statement,
'}',
),
@ -216,17 +231,18 @@ module.exports = grammar({
'in',
$.expression,
'{',
$.item,
$.statement,
'}',
),
filter: $ => seq(
'filter',
$.identifier,
field('count', optional($.expression)),
field('statement_id', $.identifier),
'in',
$.expression,
field('collection', $.expression),
'{',
$.item,
field('predicate', $.statement),
'}',
),
@ -236,17 +252,29 @@ module.exports = grammar({
'in',
$.expression,
'{',
$.item,
$.statement,
'}',
),
remove: $ => seq(
'remove',
$.identifier,
'from',
$.expression,
'{',
$.statement,
'}',
),
reduce: $ => seq(
'reduce',
$.identifier,
'to',
$.identifier,
'in',
$.expression,
'{',
$.item,
$.statement,
'}',
),
@ -257,7 +285,7 @@ module.exports = grammar({
'>',
'from',
$.expression,
optional(seq('{', $.item, '}')),
optional(seq('{', $.statement, '}')),
)),
insert: $ => prec.right(seq(

View File

@ -6,18 +6,7 @@
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "item"
}
},
"item": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "statement"
}
"name": "statement"
}
},
"statement": {
@ -27,44 +16,53 @@
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "comment"
"type": "REPEAT1",
"content": {
"type": "SYMBOL",
"name": "_statement_kind"
}
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "_statement_kind"
},
{
"type": "STRING",
"value": "}"
}
]
}
]
}
},
"_statement_kind": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "assignment"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "SYMBOL",
"name": "if_else"
},
{
"type": "SYMBOL",
"name": "insert"
},
{
"type": "SYMBOL",
"name": "select"
},
{
"type": "SYMBOL",
"name": "while"
},
{
"type": "SYMBOL",
"name": "async"
},
{
"type": "SYMBOL",
"name": "for"
"name": "comment"
},
{
"type": "SYMBOL",
"name": "transform"
"name": "expression"
},
{
"type": "SYMBOL",
@ -74,9 +72,41 @@
"type": "SYMBOL",
"name": "find"
},
{
"type": "SYMBOL",
"name": "for"
},
{
"type": "SYMBOL",
"name": "if_else"
},
{
"type": "SYMBOL",
"name": "insert"
},
{
"type": "SYMBOL",
"name": "match"
},
{
"type": "SYMBOL",
"name": "reduce"
},
{
"type": "SYMBOL",
"name": "remove"
},
{
"type": "SYMBOL",
"name": "select"
},
{
"type": "SYMBOL",
"name": "transform"
},
{
"type": "SYMBOL",
"name": "while"
}
]
}
@ -121,7 +151,7 @@
"members": [
{
"type": "SYMBOL",
"name": "value"
"name": "function_call"
},
{
"type": "SYMBOL",
@ -131,21 +161,21 @@
"type": "SYMBOL",
"name": "index"
},
{
"type": "SYMBOL",
"name": "math"
},
{
"type": "SYMBOL",
"name": "logic"
},
{
"type": "SYMBOL",
"name": "function_call"
"name": "math"
},
{
"type": "SYMBOL",
"name": "tool"
},
{
"type": "SYMBOL",
"name": "value"
}
]
},
@ -190,122 +220,200 @@
}
]
},
"_numeric": {
"type": "TOKEN",
"content": {
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "1"
},
{
"type": "STRING",
"value": "2"
},
{
"type": "STRING",
"value": "3"
},
{
"type": "STRING",
"value": "4"
},
{
"type": "STRING",
"value": "5"
},
{
"type": "STRING",
"value": "6"
},
{
"type": "STRING",
"value": "7"
},
{
"type": "STRING",
"value": "8"
},
{
"type": "STRING",
"value": "9"
},
{
"type": "STRING",
"value": "0"
}
]
}
}
},
"integer": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "TOKEN",
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "-"
},
{
"type": "BLANK"
}
},
{
"type": "BLANK"
]
},
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "1"
},
{
"type": "STRING",
"value": "2"
},
{
"type": "STRING",
"value": "3"
},
{
"type": "STRING",
"value": "4"
},
{
"type": "STRING",
"value": "5"
},
{
"type": "STRING",
"value": "6"
},
{
"type": "STRING",
"value": "7"
},
{
"type": "STRING",
"value": "8"
},
{
"type": "STRING",
"value": "9"
},
{
"type": "STRING",
"value": "0"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_numeric"
}
]
}
]
}
}
},
"float": {
"type": "PREC_LEFT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "IMMEDIATE_TOKEN",
"content": {
"type": "TOKEN",
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "-"
},
{
"type": "BLANK"
}
},
{
"type": "BLANK"
]
},
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "1"
},
{
"type": "STRING",
"value": "2"
},
{
"type": "STRING",
"value": "3"
},
{
"type": "STRING",
"value": "4"
},
{
"type": "STRING",
"value": "5"
},
{
"type": "STRING",
"value": "6"
},
{
"type": "STRING",
"value": "7"
},
{
"type": "STRING",
"value": "8"
},
{
"type": "STRING",
"value": "9"
},
{
"type": "STRING",
"value": "0"
}
]
}
]
},
{
"type": "SYMBOL",
"name": "_numeric"
},
{
"type": "IMMEDIATE_TOKEN",
"content": {
},
{
"type": "STRING",
"value": "."
},
{
"type": "REPEAT1",
"content": {
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "1"
},
{
"type": "STRING",
"value": "2"
},
{
"type": "STRING",
"value": "3"
},
{
"type": "STRING",
"value": "4"
},
{
"type": "STRING",
"value": "5"
},
{
"type": "STRING",
"value": "6"
},
{
"type": "STRING",
"value": "7"
},
{
"type": "STRING",
"value": "8"
},
{
"type": "STRING",
"value": "9"
},
{
"type": "STRING",
"value": "0"
}
]
}
}
},
{
"type": "SYMBOL",
"name": "_numeric"
}
]
]
}
}
},
"string": {
@ -370,24 +478,8 @@
"value": "{"
},
{
"type": "REPEAT",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "="
},
{
"type": "SYMBOL",
"name": "expression"
}
]
}
"type": "SYMBOL",
"name": "assignment"
},
{
"type": "STRING",
@ -495,7 +587,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -852,6 +944,47 @@
]
}
},
"match": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "match"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT1",
"content": {
"type": "SEQ",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "=>"
},
{
"type": "SYMBOL",
"name": "statement"
}
]
}
},
{
"type": "STRING",
"value": "}"
}
]
},
"while": {
"type": "SEQ",
"members": [
@ -869,7 +1002,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -902,7 +1035,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -935,7 +1068,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -951,24 +1084,52 @@
"value": "filter"
},
{
"type": "SYMBOL",
"name": "identifier"
"type": "FIELD",
"name": "count",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "FIELD",
"name": "statement_id",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "STRING",
"value": "in"
},
{
"type": "SYMBOL",
"name": "expression"
"type": "FIELD",
"name": "collection",
"content": {
"type": "SYMBOL",
"name": "expression"
}
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "item"
"type": "FIELD",
"name": "predicate",
"content": {
"type": "SYMBOL",
"name": "statement"
}
},
{
"type": "STRING",
@ -1001,7 +1162,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -1020,6 +1181,47 @@
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "from"
},
{
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "SYMBOL",
"name": "statement"
},
{
"type": "STRING",
"value": "}"
}
]
},
"reduce": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "reduce"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "to"
},
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "STRING",
"value": "in"
@ -1034,7 +1236,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",
@ -1104,7 +1306,7 @@
},
{
"type": "SYMBOL",
"name": "item"
"name": "statement"
},
{
"type": "STRING",

View File

@ -128,24 +128,47 @@
{
"type": "filter",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "expression",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "item",
"named": true
}
]
"fields": {
"collection": {
"multiple": false,
"required": true,
"types": [
{
"type": "expression",
"named": true
}
]
},
"count": {
"multiple": false,
"required": false,
"types": [
{
"type": "expression",
"named": true
}
]
},
"predicate": {
"multiple": false,
"required": true,
"types": [
{
"type": "statement",
"named": true
}
]
},
"statement_id": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
}
}
},
{
@ -165,7 +188,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -193,7 +216,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -212,7 +235,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -318,21 +341,6 @@
"named": true,
"fields": {}
},
{
"type": "item",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "statement",
"named": true
}
]
}
},
{
"type": "list",
"named": true,
@ -376,16 +384,31 @@
"type": "map",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "assignment",
"named": true
}
]
}
},
{
"type": "match",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": false,
"required": true,
"types": [
{
"type": "expression",
"named": true
},
{
"type": "identifier",
"type": "statement",
"named": true
}
]
@ -415,6 +438,29 @@
"named": true,
"fields": {}
},
{
"type": "reduce",
"named": true,
"fields": {},
"children": {
"multiple": true,
"required": true,
"types": [
{
"type": "expression",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "statement",
"named": true
}
]
}
},
{
"type": "remove",
"named": true,
@ -432,7 +478,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -447,7 +493,7 @@
"required": true,
"types": [
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -470,7 +516,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -481,7 +527,7 @@
"named": true,
"fields": {},
"children": {
"multiple": false,
"multiple": true,
"required": true,
"types": [
{
@ -520,6 +566,14 @@
"type": "insert",
"named": true
},
{
"type": "match",
"named": true
},
{
"type": "reduce",
"named": true
},
{
"type": "remove",
"named": true
@ -590,7 +644,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -652,7 +706,7 @@
"named": true
},
{
"type": "item",
"type": "statement",
"named": true
}
]
@ -702,10 +756,6 @@
"type": "-=",
"named": false
},
{
"type": ".",
"named": false
},
{
"type": "..",
"named": false
@ -734,6 +784,10 @@
"type": "==",
"named": false
},
{
"type": "=>",
"named": false
},
{
"type": ">",
"named": false
@ -846,6 +900,10 @@
"type": "length",
"named": false
},
{
"type": "match",
"named": false
},
{
"type": "metadata",
"named": false
@ -886,6 +944,10 @@
"type": "read",
"named": false
},
{
"type": "reduce",
"named": false
},
{
"type": "remove",
"named": false
@ -914,6 +976,10 @@
"type": "table",
"named": false
},
{
"type": "to",
"named": false
},
{
"type": "to_float",
"named": false

File diff suppressed because it is too large Load Diff