Add statment_kind syntax node
This commit is contained in:
parent
1ce2178af5
commit
9f2b0461df
@ -6,39 +6,56 @@ use crate::{
|
|||||||
Match, SyntaxNode, Type, TypeDefinition, Value, While,
|
Match, SyntaxNode, Type, TypeDefinition, Value, While,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Abstract representation of a statement.
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
||||||
pub struct Statement {
|
pub struct Statement {
|
||||||
is_return: bool,
|
is_return: bool,
|
||||||
statement_inner: StatementInner,
|
statement_inner: StatementKind,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbstractTree for Statement {
|
impl AbstractTree for Statement {
|
||||||
fn from_syntax(node: SyntaxNode, source: &str, context: &Context) -> Result<Self, SyntaxError> {
|
fn from_syntax(
|
||||||
todo!()
|
node: SyntaxNode,
|
||||||
|
source: &str,
|
||||||
|
_context: &Context,
|
||||||
|
) -> Result<Self, SyntaxError> {
|
||||||
|
SyntaxError::expect_syntax_node(source, "statement", node)?;
|
||||||
|
|
||||||
|
let first_child = node.child(0).unwrap();
|
||||||
|
let is_return = first_child.kind() == "return";
|
||||||
|
let child = if is_return {
|
||||||
|
node.child(1).unwrap()
|
||||||
|
} else {
|
||||||
|
first_child
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(Statement {
|
||||||
|
is_return,
|
||||||
|
statement_inner: StatementKind::from_syntax(child, source, _context)?,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn expected_type(&self, context: &Context) -> Result<Type, ValidationError> {
|
fn expected_type(&self, _context: &Context) -> Result<Type, ValidationError> {
|
||||||
todo!()
|
self.statement_inner.expected_type(_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn validate(&self, source: &str, context: &Context) -> Result<(), ValidationError> {
|
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
|
||||||
todo!()
|
self.statement_inner.validate(_source, _context)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(&self, source: &str, context: &Context) -> Result<Value, RuntimeError> {
|
fn run(&self, _source: &str, _context: &Context) -> Result<Value, RuntimeError> {
|
||||||
todo!()
|
self.statement_inner.run(_source, _context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Format for Statement {
|
impl Format for Statement {
|
||||||
fn format(&self, output: &mut String, indent_level: u8) {
|
fn format(&self, _output: &mut String, _indent_level: u8) {
|
||||||
todo!()
|
self.statement_inner.format(_output, _indent_level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Abstract representation of a statement.
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, PartialOrd, Ord)]
|
||||||
pub enum StatementInner {
|
enum StatementKind {
|
||||||
Assignment(Box<Assignment>),
|
Assignment(Box<Assignment>),
|
||||||
Expression(Expression),
|
Expression(Expression),
|
||||||
IfElse(Box<IfElse>),
|
IfElse(Box<IfElse>),
|
||||||
@ -50,38 +67,38 @@ pub enum StatementInner {
|
|||||||
TypeDefinition(TypeDefinition),
|
TypeDefinition(TypeDefinition),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AbstractTree for StatementInner {
|
impl AbstractTree for StatementKind {
|
||||||
fn from_syntax(node: SyntaxNode, source: &str, context: &Context) -> Result<Self, SyntaxError> {
|
fn from_syntax(node: SyntaxNode, source: &str, context: &Context) -> Result<Self, SyntaxError> {
|
||||||
SyntaxError::expect_syntax_node(source, "statement", node)?;
|
SyntaxError::expect_syntax_node(source, "statement_kind", node)?;
|
||||||
|
|
||||||
let child = node.child(0).unwrap();
|
let child = node.child(0).unwrap();
|
||||||
|
|
||||||
match child.kind() {
|
match child.kind() {
|
||||||
"assignment" => Ok(StatementInner::Assignment(Box::new(
|
"assignment" => Ok(StatementKind::Assignment(Box::new(
|
||||||
Assignment::from_syntax(child, source, context)?,
|
Assignment::from_syntax(child, source, context)?,
|
||||||
))),
|
))),
|
||||||
"expression" => Ok(StatementInner::Expression(Expression::from_syntax(
|
"expression" => Ok(StatementKind::Expression(Expression::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?)),
|
)?)),
|
||||||
"if_else" => Ok(StatementInner::IfElse(Box::new(IfElse::from_syntax(
|
"if_else" => Ok(StatementKind::IfElse(Box::new(IfElse::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?))),
|
)?))),
|
||||||
"while" => Ok(StatementInner::While(Box::new(While::from_syntax(
|
"while" => Ok(StatementKind::While(Box::new(While::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?))),
|
)?))),
|
||||||
"block" => Ok(StatementInner::Block(Box::new(Block::from_syntax(
|
"block" => Ok(StatementKind::Block(Box::new(Block::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?))),
|
)?))),
|
||||||
"for" => Ok(StatementInner::For(Box::new(For::from_syntax(
|
"for" => Ok(StatementKind::For(Box::new(For::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?))),
|
)?))),
|
||||||
"index_assignment" => Ok(StatementInner::IndexAssignment(Box::new(
|
"index_assignment" => Ok(StatementKind::IndexAssignment(Box::new(
|
||||||
IndexAssignment::from_syntax(child, source, context)?,
|
IndexAssignment::from_syntax(child, source, context)?,
|
||||||
))),
|
))),
|
||||||
"match" => Ok(StatementInner::Match(Match::from_syntax(
|
"match" => Ok(StatementKind::Match(Match::from_syntax(
|
||||||
child, source, context,
|
child, source, context,
|
||||||
)?)),
|
)?)),
|
||||||
"type_definition" => Ok(StatementInner::TypeDefinition(TypeDefinition::from_syntax(
|
"type_definition" => Ok(StatementKind::TypeDefinition(TypeDefinition::from_syntax(
|
||||||
child, source, context
|
child, source, context
|
||||||
)?)),
|
)?)),
|
||||||
_ => Err(SyntaxError::UnexpectedSyntaxNode {
|
_ => Err(SyntaxError::UnexpectedSyntaxNode {
|
||||||
@ -96,17 +113,17 @@ impl AbstractTree for StatementInner {
|
|||||||
|
|
||||||
fn expected_type(&self, _context: &Context) -> Result<Type, ValidationError> {
|
fn expected_type(&self, _context: &Context) -> Result<Type, ValidationError> {
|
||||||
match self {
|
match self {
|
||||||
StatementInner::Assignment(assignment) => assignment.expected_type(_context),
|
StatementKind::Assignment(assignment) => assignment.expected_type(_context),
|
||||||
StatementInner::Expression(expression) => expression.expected_type(_context),
|
StatementKind::Expression(expression) => expression.expected_type(_context),
|
||||||
StatementInner::IfElse(if_else) => if_else.expected_type(_context),
|
StatementKind::IfElse(if_else) => if_else.expected_type(_context),
|
||||||
StatementInner::Match(r#match) => r#match.expected_type(_context),
|
StatementKind::Match(r#match) => r#match.expected_type(_context),
|
||||||
StatementInner::While(r#while) => r#while.expected_type(_context),
|
StatementKind::While(r#while) => r#while.expected_type(_context),
|
||||||
StatementInner::Block(block) => block.expected_type(_context),
|
StatementKind::Block(block) => block.expected_type(_context),
|
||||||
StatementInner::For(r#for) => r#for.expected_type(_context),
|
StatementKind::For(r#for) => r#for.expected_type(_context),
|
||||||
StatementInner::IndexAssignment(index_assignment) => {
|
StatementKind::IndexAssignment(index_assignment) => {
|
||||||
index_assignment.expected_type(_context)
|
index_assignment.expected_type(_context)
|
||||||
}
|
}
|
||||||
StatementInner::TypeDefinition(type_definition) => {
|
StatementKind::TypeDefinition(type_definition) => {
|
||||||
type_definition.expected_type(_context)
|
type_definition.expected_type(_context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,17 +131,17 @@ impl AbstractTree for StatementInner {
|
|||||||
|
|
||||||
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
|
fn validate(&self, _source: &str, _context: &Context) -> Result<(), ValidationError> {
|
||||||
match self {
|
match self {
|
||||||
StatementInner::Assignment(assignment) => assignment.validate(_source, _context),
|
StatementKind::Assignment(assignment) => assignment.validate(_source, _context),
|
||||||
StatementInner::Expression(expression) => expression.validate(_source, _context),
|
StatementKind::Expression(expression) => expression.validate(_source, _context),
|
||||||
StatementInner::IfElse(if_else) => if_else.validate(_source, _context),
|
StatementKind::IfElse(if_else) => if_else.validate(_source, _context),
|
||||||
StatementInner::Match(r#match) => r#match.validate(_source, _context),
|
StatementKind::Match(r#match) => r#match.validate(_source, _context),
|
||||||
StatementInner::While(r#while) => r#while.validate(_source, _context),
|
StatementKind::While(r#while) => r#while.validate(_source, _context),
|
||||||
StatementInner::Block(block) => block.validate(_source, _context),
|
StatementKind::Block(block) => block.validate(_source, _context),
|
||||||
StatementInner::For(r#for) => r#for.validate(_source, _context),
|
StatementKind::For(r#for) => r#for.validate(_source, _context),
|
||||||
StatementInner::IndexAssignment(index_assignment) => {
|
StatementKind::IndexAssignment(index_assignment) => {
|
||||||
index_assignment.validate(_source, _context)
|
index_assignment.validate(_source, _context)
|
||||||
}
|
}
|
||||||
StatementInner::TypeDefinition(type_definition) => {
|
StatementKind::TypeDefinition(type_definition) => {
|
||||||
type_definition.validate(_source, _context)
|
type_definition.validate(_source, _context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,39 +149,39 @@ impl AbstractTree for StatementInner {
|
|||||||
|
|
||||||
fn run(&self, _source: &str, _context: &Context) -> Result<Value, RuntimeError> {
|
fn run(&self, _source: &str, _context: &Context) -> Result<Value, RuntimeError> {
|
||||||
match self {
|
match self {
|
||||||
StatementInner::Assignment(assignment) => assignment.run(_source, _context),
|
StatementKind::Assignment(assignment) => assignment.run(_source, _context),
|
||||||
StatementInner::Expression(expression) => expression.run(_source, _context),
|
StatementKind::Expression(expression) => expression.run(_source, _context),
|
||||||
StatementInner::IfElse(if_else) => if_else.run(_source, _context),
|
StatementKind::IfElse(if_else) => if_else.run(_source, _context),
|
||||||
StatementInner::Match(r#match) => r#match.run(_source, _context),
|
StatementKind::Match(r#match) => r#match.run(_source, _context),
|
||||||
StatementInner::While(r#while) => r#while.run(_source, _context),
|
StatementKind::While(r#while) => r#while.run(_source, _context),
|
||||||
StatementInner::Block(block) => block.run(_source, _context),
|
StatementKind::Block(block) => block.run(_source, _context),
|
||||||
StatementInner::For(r#for) => r#for.run(_source, _context),
|
StatementKind::For(r#for) => r#for.run(_source, _context),
|
||||||
StatementInner::IndexAssignment(index_assignment) => {
|
StatementKind::IndexAssignment(index_assignment) => {
|
||||||
index_assignment.run(_source, _context)
|
index_assignment.run(_source, _context)
|
||||||
}
|
}
|
||||||
StatementInner::TypeDefinition(type_definition) => {
|
StatementKind::TypeDefinition(type_definition) => {
|
||||||
type_definition.run(_source, _context)
|
type_definition.run(_source, _context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Format for StatementInner {
|
impl Format for StatementKind {
|
||||||
fn format(&self, output: &mut String, indent_level: u8) {
|
fn format(&self, output: &mut String, indent_level: u8) {
|
||||||
StatementInner::indent(output, indent_level);
|
StatementKind::indent(output, indent_level);
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
StatementInner::Assignment(assignment) => assignment.format(output, indent_level),
|
StatementKind::Assignment(assignment) => assignment.format(output, indent_level),
|
||||||
StatementInner::Expression(expression) => expression.format(output, indent_level),
|
StatementKind::Expression(expression) => expression.format(output, indent_level),
|
||||||
StatementInner::IfElse(if_else) => if_else.format(output, indent_level),
|
StatementKind::IfElse(if_else) => if_else.format(output, indent_level),
|
||||||
StatementInner::Match(r#match) => r#match.format(output, indent_level),
|
StatementKind::Match(r#match) => r#match.format(output, indent_level),
|
||||||
StatementInner::While(r#while) => r#while.format(output, indent_level),
|
StatementKind::While(r#while) => r#while.format(output, indent_level),
|
||||||
StatementInner::Block(block) => block.format(output, indent_level),
|
StatementKind::Block(block) => block.format(output, indent_level),
|
||||||
StatementInner::For(r#for) => r#for.format(output, indent_level),
|
StatementKind::For(r#for) => r#for.format(output, indent_level),
|
||||||
StatementInner::IndexAssignment(index_assignment) => {
|
StatementKind::IndexAssignment(index_assignment) => {
|
||||||
index_assignment.format(output, indent_level)
|
index_assignment.format(output, indent_level)
|
||||||
}
|
}
|
||||||
StatementInner::TypeDefinition(type_definition) => {
|
StatementKind::TypeDefinition(type_definition) => {
|
||||||
type_definition.format(output, indent_level)
|
type_definition.format(output, indent_level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,14 +149,10 @@ impl Interpreter {
|
|||||||
|
|
||||||
check_for_error(root, source, &mut cursor)?;
|
check_for_error(root, source, &mut cursor)?;
|
||||||
|
|
||||||
println!("abstracting...");
|
|
||||||
|
|
||||||
let abstract_tree = Root::from_syntax(syntax_tree.root_node(), source, &self.context)?;
|
let abstract_tree = Root::from_syntax(syntax_tree.root_node(), source, &self.context)?;
|
||||||
|
|
||||||
abstract_tree.validate(source, &self.context)?;
|
abstract_tree.validate(source, &self.context)?;
|
||||||
|
|
||||||
println!("{abstract_tree:?}");
|
|
||||||
|
|
||||||
Ok(abstract_tree)
|
Ok(abstract_tree)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,13 @@ Simple As
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(as
|
(expression
|
||||||
(expression
|
(as
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(type)))))
|
(integer)))
|
||||||
|
(type))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
As Function
|
As Function
|
||||||
@ -25,13 +26,14 @@ foo as (int) -> int
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(as
|
(expression
|
||||||
(expression
|
(as
|
||||||
(identifier))
|
(expression
|
||||||
(type
|
(identifier))
|
||||||
(type)
|
(type
|
||||||
(type))))))
|
(type)
|
||||||
|
(type)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
As List in For Loop
|
As List in For Loop
|
||||||
@ -43,13 +45,14 @@ for i in foobar as [string] {}
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(for
|
(statement_kind
|
||||||
(identifier)
|
(for
|
||||||
(expression
|
(identifier)
|
||||||
(as
|
(expression
|
||||||
(expression
|
(as
|
||||||
(identifier))
|
(expression
|
||||||
(type
|
(identifier))
|
||||||
(type
|
(type
|
||||||
(identifier)))))
|
(type
|
||||||
(block))))
|
(identifier)))))
|
||||||
|
(block)))))
|
||||||
|
@ -8,12 +8,14 @@ x = y
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(identifier))))))
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(identifier))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Simple Assignment with Type
|
Simple Assignment with Type
|
||||||
@ -25,14 +27,16 @@ x <int> = y
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(assignment_operator)
|
(type))
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(identifier))))))
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(identifier))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Map Item Assignment
|
Map Item Assignment
|
||||||
@ -44,17 +48,19 @@ x:y = 1
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(index_assignment
|
(statement_kind
|
||||||
(index
|
(index_assignment
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(identifier)))
|
(index_expression
|
||||||
(assignment_operator)
|
(identifier)))
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer)))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
List Item Assignment
|
List Item Assignment
|
||||||
@ -66,15 +72,17 @@ x:9 = 'foobar'
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(index_assignment
|
(statement_kind
|
||||||
(index
|
(index_assignment
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(value
|
(index_expression
|
||||||
(integer))))
|
(value
|
||||||
(assignment_operator)
|
(integer))))
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string)))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))
|
||||||
|
@ -8,15 +8,17 @@ async { output ('Whaddup') }
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(block
|
(statement_kind
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(function_call
|
(statement_kind
|
||||||
(function_expression
|
|
||||||
(identifier))
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(function_call
|
||||||
(string)))))))))
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Complex Async Statements
|
Complex Async Statements
|
||||||
@ -36,37 +38,42 @@ async {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(block
|
(statement_kind
|
||||||
(statement
|
(block
|
||||||
(if_else
|
(statement
|
||||||
(if
|
(statement_kind
|
||||||
(expression
|
(if_else
|
||||||
(logic
|
(if
|
||||||
(expression
|
(expression
|
||||||
(math
|
(logic
|
||||||
(expression
|
(expression
|
||||||
(value
|
(math
|
||||||
(integer)))
|
(expression
|
||||||
(math_operator)
|
(value
|
||||||
|
(integer)))
|
||||||
|
(math_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(logic_operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer)))))
|
||||||
(logic_operator)
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer)))))
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(boolean)))))))
|
||||||
(expression
|
(else
|
||||||
(value
|
(block
|
||||||
(boolean))))))
|
(statement
|
||||||
(else
|
(statement_kind
|
||||||
(block
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(boolean))))))))))
|
||||||
(value
|
(statement
|
||||||
(boolean))))))))
|
(statement_kind
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(value
|
||||||
(value
|
(string)))))))))
|
||||||
(string)))))))
|
|
||||||
|
@ -10,15 +10,17 @@ Simple Block
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(block
|
(statement_kind
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(function_call
|
(statement_kind
|
||||||
(function_expression
|
|
||||||
(identifier))
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(function_call
|
||||||
(integer)))))))))
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Block with Return
|
Block with Return
|
||||||
@ -34,16 +36,20 @@ Block with Return
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(block
|
(statement_kind
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer))))
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(integer)))))
|
||||||
(value
|
(statement
|
||||||
(integer))))
|
(statement_kind
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(value
|
||||||
(value
|
(integer)))))
|
||||||
(integer)))))))
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))
|
||||||
|
@ -8,9 +8,10 @@ Simple Command
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)))))
|
(command
|
||||||
|
(command_text))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command Sequence
|
Command Sequence
|
||||||
@ -22,13 +23,15 @@ Command Sequence
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text))))
|
(command
|
||||||
|
(command_text)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)))))
|
(command
|
||||||
|
(command_text))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command with Arguments
|
Command with Arguments
|
||||||
@ -40,11 +43,12 @@ Command with Arguments
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)
|
(command
|
||||||
(command_argument)
|
(command_text)
|
||||||
(command_argument)))))
|
(command_argument)
|
||||||
|
(command_argument))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command Sequence with Arguments
|
Command Sequence with Arguments
|
||||||
@ -57,19 +61,21 @@ Command Sequence with Arguments
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)
|
(command
|
||||||
(command_argument)
|
(command_text)
|
||||||
(command_argument)
|
(command_argument)
|
||||||
(command_argument)
|
(command_argument)
|
||||||
(command_argument))))
|
(command_argument)
|
||||||
|
(command_argument)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)
|
(command
|
||||||
(command_argument)
|
(command_text)
|
||||||
(command_argument)))))
|
(command_argument)
|
||||||
|
(command_argument))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command Sequence with Arguments
|
Command Sequence with Arguments
|
||||||
@ -82,19 +88,21 @@ Command Sequence with Arguments
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)
|
(command
|
||||||
(command_argument)
|
(command_text)
|
||||||
(command_argument)
|
(command_argument)
|
||||||
(command_argument)
|
(command_argument)
|
||||||
(command_argument))))
|
(command_argument)
|
||||||
|
(command_argument)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(command
|
(expression
|
||||||
(command_text)
|
(command
|
||||||
(command_argument)
|
(command_text)
|
||||||
(command_argument)))))
|
(command_argument)
|
||||||
|
(command_argument))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command Assignment
|
Command Assignment
|
||||||
@ -107,24 +115,28 @@ cat_output = ^cat Cargo.toml;
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(command
|
(statement_kind
|
||||||
(command_text)
|
(expression
|
||||||
(command_argument)
|
(command
|
||||||
(command_argument))))))
|
(command_text)
|
||||||
|
(command_argument)
|
||||||
|
(command_argument))))))))
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(command
|
(statement_kind
|
||||||
(command_text)
|
(expression
|
||||||
(command_argument)))))))
|
(command
|
||||||
|
(command_text)
|
||||||
|
(command_argument)))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command with Semicolon
|
Command with Semicolon
|
||||||
@ -136,18 +148,21 @@ ls_output = ^ls --long -a; ls_output
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(command
|
(statement_kind
|
||||||
(command_text)
|
(expression
|
||||||
(command_argument)
|
(command
|
||||||
(command_argument))))))
|
(command_text)
|
||||||
|
(command_argument)
|
||||||
|
(command_argument))))))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command with Semicolon
|
Command with Semicolon
|
||||||
@ -159,18 +174,21 @@ ls_output = ^ls --long -a; ls_output
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(command
|
(statement_kind
|
||||||
(command_text)
|
(expression
|
||||||
(command_argument)
|
(command
|
||||||
(command_argument))))))
|
(command_text)
|
||||||
|
(command_argument)
|
||||||
|
(command_argument))))))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Command with Quoted Semicolon
|
Command with Quoted Semicolon
|
||||||
@ -182,14 +200,17 @@ ls_output = ^echo ';'; ls_output
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(command
|
(statement_kind
|
||||||
(command_text)
|
(expression
|
||||||
(command_argument))))))
|
(command
|
||||||
|
(command_text)
|
||||||
|
(command_argument))))))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
@ -9,8 +9,9 @@ not_a_comment
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Partial Line Comments
|
Partial Line Comments
|
||||||
@ -22,8 +23,9 @@ not_a_comment # comment
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Multiline Comments
|
Multiline Comments
|
||||||
@ -37,9 +39,11 @@ not_a_comment #
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier)))
|
(expression
|
||||||
|
(identifier))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string)))))
|
(value
|
||||||
|
(string))))))
|
||||||
|
@ -11,11 +11,12 @@ enum Foobar {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(type_definition
|
(statement_kind
|
||||||
(enum_definition
|
(type_definition
|
||||||
(identifier)
|
(enum_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)))))
|
(identifier)
|
||||||
|
(identifier))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Enum
|
Nested Enum
|
||||||
@ -33,17 +34,18 @@ enum Foobar {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(type_definition
|
(statement_kind
|
||||||
(enum_definition
|
(type_definition
|
||||||
(identifier)
|
(enum_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
(type)
|
(identifier)
|
||||||
(identifier)
|
(type)
|
||||||
(type_definition
|
(identifier)
|
||||||
(enum_definition
|
(type_definition
|
||||||
(identifier)
|
(enum_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)))))))
|
(identifier)
|
||||||
|
(identifier))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Simple Enum Instance
|
Simple Enum Instance
|
||||||
@ -55,11 +57,12 @@ Foobar::Foo
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(enum_instance
|
(value
|
||||||
(identifier)
|
(enum_instance
|
||||||
(identifier))))))
|
(identifier)
|
||||||
|
(identifier)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Enum Instance
|
Nested Enum Instance
|
||||||
@ -71,16 +74,17 @@ FooBar::Bar(BazBuf::Baz(123))
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(enum_instance
|
(value
|
||||||
(identifier)
|
(enum_instance
|
||||||
(identifier)
|
(identifier)
|
||||||
(expression
|
(identifier)
|
||||||
(value
|
(expression
|
||||||
(enum_instance
|
(value
|
||||||
(identifier)
|
(enum_instance
|
||||||
(identifier)
|
(identifier)
|
||||||
(expression
|
(identifier)
|
||||||
(value
|
(expression
|
||||||
(integer)))))))))))
|
(value
|
||||||
|
(integer))))))))))))
|
||||||
|
@ -14,62 +14,67 @@ fib = (i <int>) <int> {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(function
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(type_specification
|
(function
|
||||||
(type))
|
(identifier)
|
||||||
(type_specification
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(type_specification
|
||||||
(statement
|
(type))
|
||||||
(if_else
|
(block
|
||||||
(if
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(logic
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(identifier))
|
(expression
|
||||||
(logic_operator)
|
(logic
|
||||||
(expression
|
(expression
|
||||||
(value
|
(identifier))
|
||||||
(integer)))))
|
(logic_operator)
|
||||||
(block
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(integer)))))
|
||||||
(value
|
(block
|
||||||
(integer))))))
|
(statement
|
||||||
(else
|
(statement_kind
|
||||||
(block
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(integer)))))))
|
||||||
(math
|
(else
|
||||||
(expression
|
(block
|
||||||
(function_call
|
(statement
|
||||||
(function_expression
|
(statement_kind
|
||||||
(identifier))
|
|
||||||
(expression
|
(expression
|
||||||
(math
|
(math
|
||||||
(expression
|
(expression
|
||||||
(identifier))
|
(function_call
|
||||||
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(math
|
||||||
|
(expression
|
||||||
|
(identifier))
|
||||||
|
(math_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))
|
||||||
(math_operator)
|
(math_operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(function_call
|
||||||
(integer)))))))
|
(function_expression
|
||||||
(math_operator)
|
(identifier))
|
||||||
(expression
|
(expression
|
||||||
(function_call
|
(math
|
||||||
(function_expression
|
(expression
|
||||||
(identifier))
|
(identifier))
|
||||||
(expression
|
(math_operator)
|
||||||
(math
|
(expression
|
||||||
(expression
|
(value
|
||||||
(identifier))
|
(integer))))))))))))))))))))))))))
|
||||||
(math_operator)
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(integer))))))))))))))))))))))
|
|
||||||
|
@ -10,28 +10,30 @@ for i in [1, 2, 3] {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(for
|
(statement_kind
|
||||||
(identifier)
|
(for
|
||||||
(expression
|
(identifier)
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
|
||||||
(integer)))
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(integer)))
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(integer))))))
|
|
||||||
(block
|
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(function_call
|
|
||||||
(function_expression
|
|
||||||
(identifier))
|
|
||||||
(expression
|
(expression
|
||||||
(identifier)))))))))
|
(value
|
||||||
|
(integer)))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer))))))
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(function_call
|
||||||
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(identifier)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested For Loop
|
Nested For Loop
|
||||||
@ -47,21 +49,24 @@ for list in list_of_lists {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(for
|
(statement_kind
|
||||||
(identifier)
|
(for
|
||||||
(expression
|
(identifier)
|
||||||
(identifier))
|
(expression
|
||||||
(block
|
(identifier))
|
||||||
(statement
|
(block
|
||||||
(for
|
(statement
|
||||||
(identifier)
|
(statement_kind
|
||||||
(expression
|
(for
|
||||||
(identifier))
|
(identifier)
|
||||||
(block
|
|
||||||
(statement
|
|
||||||
(expression
|
(expression
|
||||||
(function_call
|
(identifier))
|
||||||
(function_expression
|
(block
|
||||||
(identifier))
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))))))))))
|
(expression
|
||||||
|
(function_call
|
||||||
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(identifier)))))))))))))))
|
||||||
|
@ -8,16 +8,18 @@ Anonymous Function
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(function
|
(value
|
||||||
(type_specification
|
(function
|
||||||
(type))
|
(type_specification
|
||||||
(block
|
(type))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string))))))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(string))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Function Assignment
|
Function Assignment
|
||||||
@ -31,30 +33,33 @@ foobar = (x <int>, y <int>) <int> {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(function
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(type_specification
|
(function
|
||||||
(type))
|
(identifier)
|
||||||
(identifier)
|
(type_specification
|
||||||
(type_specification
|
(type))
|
||||||
(type))
|
(identifier)
|
||||||
(type_specification
|
(type_specification
|
||||||
(type))
|
(type))
|
||||||
(block
|
(type_specification
|
||||||
(statement
|
(type))
|
||||||
(expression
|
(block
|
||||||
(math
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))
|
(expression
|
||||||
(math_operator)
|
(math
|
||||||
(expression
|
(expression
|
||||||
(identifier)))))))))))))
|
(identifier))
|
||||||
|
(math_operator)
|
||||||
|
(expression
|
||||||
|
(identifier))))))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Identifier Function Call
|
Identifier Function Call
|
||||||
@ -66,13 +71,14 @@ foobar("Hiya")
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(value
|
(expression
|
||||||
(string)))))))
|
(value
|
||||||
|
(string))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Index Function Call
|
Index Function Call
|
||||||
@ -84,17 +90,18 @@ foo:bar("Hiya")
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(index
|
(function_expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(identifier))))
|
(index_expression
|
||||||
(expression
|
(identifier))))
|
||||||
(value
|
(expression
|
||||||
(string)))))))
|
(value
|
||||||
|
(string))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Double Function Call
|
Double Function Call
|
||||||
@ -106,15 +113,16 @@ foobar()("Hiya")
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(function_call
|
(function_expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))))
|
(function_expression
|
||||||
(expression
|
(identifier))))
|
||||||
(value
|
(expression
|
||||||
(string)))))))
|
(value
|
||||||
|
(string))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Anonymous Function Call
|
Anonymous Function Call
|
||||||
@ -126,23 +134,25 @@ Anonymous Function Call
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(value
|
(function_expression
|
||||||
(function
|
(value
|
||||||
(identifier)
|
(function
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(type_specification
|
(type))
|
||||||
(type))
|
(type_specification
|
||||||
(block
|
(type))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(identifier)))))))
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(identifier))))))))
|
||||||
(string)))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(string))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Complex Function Call
|
Complex Function Call
|
||||||
@ -161,29 +171,32 @@ foobar(
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(value
|
(expression
|
||||||
(string)))
|
(value
|
||||||
(expression
|
(string)))
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(expression
|
(integer)))
|
||||||
(value
|
(expression
|
||||||
(map
|
(value
|
||||||
(identifier)
|
(map
|
||||||
(statement
|
(identifier)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer))))
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(statement
|
(integer)))))
|
||||||
(expression
|
(identifier)
|
||||||
(value
|
(statement
|
||||||
(integer)))))))))))
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Callback Function Call
|
Callback Function Call
|
||||||
@ -195,20 +208,22 @@ x(() <bool> { true })
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(value
|
(expression
|
||||||
(function
|
(value
|
||||||
(type_specification
|
(function
|
||||||
(type))
|
(type_specification
|
||||||
(block
|
(type))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(boolean))))))))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(boolean))))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Function Call
|
Nested Function Call
|
||||||
@ -220,14 +235,15 @@ from_json(read('file.json'))
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(value
|
(expression
|
||||||
(string)))))))))
|
(value
|
||||||
|
(string))))))))))
|
||||||
|
@ -11,14 +11,18 @@ x123x
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier)))
|
(expression
|
||||||
|
(identifier))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier)))
|
(expression
|
||||||
|
(identifier))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier)))
|
(expression
|
||||||
|
(identifier))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
@ -8,16 +8,18 @@ if true { "True" }
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string)))))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Complex If
|
Complex If
|
||||||
@ -29,46 +31,48 @@ if 1 == 1 && 2 == 2 && 3 == 3 { "True" }
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(logic_operator)
|
(integer)))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))
|
||||||
|
(logic_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(logic_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(string)))))))))))
|
||||||
(logic_operator)
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(integer)))))
|
|
||||||
(block
|
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(string)))))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested If
|
Nested If
|
||||||
@ -86,35 +90,39 @@ if true {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(if_else
|
(statement
|
||||||
(if
|
(statement_kind
|
||||||
(expression
|
(if_else
|
||||||
(logic
|
(if
|
||||||
(expression
|
(expression
|
||||||
(value
|
(logic
|
||||||
(integer)))
|
(expression
|
||||||
(logic_operator)
|
(value
|
||||||
(expression
|
(integer)))
|
||||||
(value
|
(logic_operator)
|
||||||
(integer)))))
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(integer)))))
|
||||||
(expression
|
(block
|
||||||
(value
|
(statement
|
||||||
(string))))))
|
(statement_kind
|
||||||
(else
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(string)))))))
|
||||||
(expression
|
(else
|
||||||
(value
|
(block
|
||||||
(string)))))))))))))
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string))))))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
If Else
|
If Else
|
||||||
@ -126,22 +134,25 @@ if false { "True" } else { "False" }
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string))))))
|
(expression
|
||||||
(else
|
(value
|
||||||
(block
|
(string)))))))
|
||||||
(statement
|
(else
|
||||||
(expression
|
(block
|
||||||
(value
|
(statement
|
||||||
(string)))))))))
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
If Else If
|
If Else If
|
||||||
@ -157,37 +168,40 @@ if 1 == 1 {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(logic_operator)
|
(integer)))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(block
|
(integer)))))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string))))))
|
(expression
|
||||||
(else_if
|
(value
|
||||||
(expression
|
(string)))))))
|
||||||
(logic
|
(else_if
|
||||||
(expression
|
(expression
|
||||||
(value
|
(logic
|
||||||
(integer)))
|
(expression
|
||||||
(logic_operator)
|
(value
|
||||||
(expression
|
(integer)))
|
||||||
(value
|
(logic_operator)
|
||||||
(integer)))))
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(integer)))))
|
||||||
(expression
|
(block
|
||||||
(value
|
(statement
|
||||||
(string)))))))))
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
If Else Else If Else
|
If Else Else If Else
|
||||||
@ -207,49 +221,54 @@ if false {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(if_else
|
(statement_kind
|
||||||
(if
|
(if_else
|
||||||
(expression
|
(if
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string))))))
|
|
||||||
(else_if
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(boolean)))
|
|
||||||
(block
|
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(string))))))
|
|
||||||
(else_if
|
|
||||||
(expression
|
|
||||||
(logic
|
|
||||||
(expression
|
|
||||||
(math
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))
|
(string)))))))
|
||||||
(math_operator)
|
(else_if
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(boolean)))
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(string)))))))
|
||||||
(logic_operator)
|
(else_if
|
||||||
(expression
|
(expression
|
||||||
(value
|
(logic
|
||||||
(integer)))))
|
(expression
|
||||||
(block
|
(math
|
||||||
(statement
|
(expression
|
||||||
(expression
|
(value
|
||||||
(value
|
(integer)))
|
||||||
(string))))))
|
(math_operator)
|
||||||
(else
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(integer)))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(string)))))))))
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))
|
||||||
|
(else
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))
|
||||||
|
@ -12,37 +12,40 @@ foobar:1:42
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(index
|
(expression
|
||||||
(index_expression
|
(index
|
||||||
(index
|
(index_expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))
|
(value
|
||||||
(index_expression
|
(integer)))))
|
||||||
(identifier)))))
|
(index_expression
|
||||||
|
(identifier))))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(index
|
(expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(identifier)))))
|
(index_expression
|
||||||
|
(identifier))))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(index
|
(expression
|
||||||
(index_expression
|
(index
|
||||||
(index
|
(index_expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))
|
(value
|
||||||
(index_expression
|
(integer)))))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))))
|
(value
|
||||||
|
(integer))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Indexes
|
Nested Indexes
|
||||||
@ -54,38 +57,39 @@ Nested Indexes
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(index
|
(expression
|
||||||
(index_expression
|
(index
|
||||||
(index
|
(index_expression
|
||||||
(index_expression
|
(index
|
||||||
(index
|
(index_expression
|
||||||
(index_expression
|
(index
|
||||||
(value
|
(index_expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(string)))
|
(value
|
||||||
(expression
|
(string)))
|
||||||
(value
|
(expression
|
||||||
(string))))))
|
(value
|
||||||
(expression
|
(string))))))
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(expression
|
(integer)))
|
||||||
(value
|
(expression
|
||||||
(integer))))))
|
(value
|
||||||
(index_expression
|
(integer))))))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))
|
(value
|
||||||
(index_expression
|
(integer)))))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))
|
(value
|
||||||
(index_expression
|
(integer)))))
|
||||||
(range))))))
|
(index_expression
|
||||||
|
(range)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Function Call Index
|
Function Call Index
|
||||||
@ -97,16 +101,17 @@ x:(y()):0
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(index
|
(expression
|
||||||
(index_expression
|
(index
|
||||||
(index
|
(index_expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(function_call
|
(index_expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))))))
|
(function_expression
|
||||||
(index_expression
|
(identifier))))))
|
||||||
(value
|
(index_expression
|
||||||
(integer)))))))
|
(value
|
||||||
|
(integer))))))))
|
||||||
|
@ -8,15 +8,16 @@ List Declaration
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(string)))
|
(value
|
||||||
(expression
|
(string)))
|
||||||
(value
|
(expression
|
||||||
(integer))))))))
|
(value
|
||||||
|
(integer)))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
List Nesting
|
List Nesting
|
||||||
@ -28,21 +29,22 @@ List Nesting
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(string)))
|
(value
|
||||||
(expression
|
(string)))
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(expression
|
(integer)))
|
||||||
(value
|
(expression
|
||||||
(list
|
(value
|
||||||
(expression
|
(list
|
||||||
(value
|
(expression
|
||||||
(integer))))))))))))))
|
(value
|
||||||
|
(integer)))))))))))))))
|
||||||
|
@ -8,15 +8,16 @@ true && false
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(logic_operator)
|
(boolean)))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(boolean)))))))
|
(value
|
||||||
|
(boolean))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Logic Sequence
|
Logic Sequence
|
||||||
@ -28,21 +29,22 @@ Logic Sequence
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(value
|
(expression
|
||||||
(integer)))
|
(value
|
||||||
(logic_operator)
|
(integer)))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(boolean)))))))
|
(value
|
||||||
|
(boolean))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Complex Logic Sequence
|
Complex Logic Sequence
|
||||||
@ -56,45 +58,46 @@ Complex Logic Sequence
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(identifier))))
|
(expression
|
||||||
(logic_operator)
|
(identifier))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(identifier))))
|
(expression
|
||||||
(logic_operator)
|
(identifier))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))))
|
(value
|
||||||
(logic_operator)
|
(integer)))))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(logic
|
(expression
|
||||||
(expression
|
(logic
|
||||||
(function_call
|
(expression
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))
|
(function_expression
|
||||||
(expression
|
(identifier))
|
||||||
(identifier))))
|
(expression
|
||||||
(logic_operator)
|
(identifier))))
|
||||||
(expression
|
(logic_operator)
|
||||||
(value
|
(expression
|
||||||
(integer)))))))))
|
(value
|
||||||
|
(integer))))))))))
|
||||||
|
@ -8,14 +8,16 @@ Simple Map
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(map
|
(value
|
||||||
(identifier)
|
(map
|
||||||
(statement
|
(identifier)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer)))))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Map with Types
|
Map with Types
|
||||||
@ -30,30 +32,33 @@ Map with Types
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(map
|
(value
|
||||||
(identifier)
|
(map
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(statement
|
(type))
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer))))
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(type_specification
|
(integer)))))
|
||||||
(type
|
(identifier)
|
||||||
(type)))
|
(type_specification
|
||||||
(statement
|
(type
|
||||||
(expression
|
(type)))
|
||||||
(value
|
(statement
|
||||||
(list
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string)))
|
(list
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string))))))))))))
|
(string)))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string))))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Maps
|
Nested Maps
|
||||||
@ -73,35 +78,42 @@ x = {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(map
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(statement
|
(map
|
||||||
(expression
|
(identifier)
|
||||||
(value
|
(statement
|
||||||
(map
|
(statement_kind
|
||||||
(identifier)
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(map
|
||||||
(value
|
(identifier)
|
||||||
(string))))
|
(statement
|
||||||
(identifier)
|
(statement_kind
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(map
|
|
||||||
(identifier)
|
|
||||||
(statement
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(string))))))))))))
|
(string)))))
|
||||||
(identifier)
|
(identifier)
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer)))))))))))
|
(value
|
||||||
|
(map
|
||||||
|
(identifier)
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))))))))
|
||||||
|
(identifier)
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer))))))))))))))
|
||||||
|
@ -13,25 +13,29 @@ match x {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(match
|
(statement_kind
|
||||||
(expression
|
(match
|
||||||
(identifier))
|
(expression
|
||||||
(match_pattern
|
(identifier))
|
||||||
(value
|
(match_pattern
|
||||||
(integer)))
|
(value
|
||||||
(statement
|
(integer)))
|
||||||
(block
|
(statement
|
||||||
(statement
|
(statement_kind
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(boolean))))))))
|
||||||
|
(match_pattern
|
||||||
|
(value
|
||||||
|
(integer)))
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(boolean))))))
|
(boolean)))))))))
|
||||||
(match_pattern
|
|
||||||
(value
|
|
||||||
(integer)))
|
|
||||||
(statement
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(boolean)))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Match Enum
|
Match Enum
|
||||||
@ -46,22 +50,25 @@ match foobar {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(match
|
(statement_kind
|
||||||
(expression
|
(match
|
||||||
(identifier))
|
|
||||||
(match_pattern
|
|
||||||
(enum_pattern
|
|
||||||
(identifier)
|
|
||||||
(identifier)))
|
|
||||||
(statement
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(identifier))
|
||||||
(boolean))))
|
(match_pattern
|
||||||
(match_pattern
|
(enum_pattern
|
||||||
(enum_pattern
|
(identifier)
|
||||||
(identifier)
|
(identifier)))
|
||||||
(identifier)))
|
(statement
|
||||||
(statement
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(boolean)))))))
|
(boolean)))))
|
||||||
|
(match_pattern
|
||||||
|
(enum_pattern
|
||||||
|
(identifier)
|
||||||
|
(identifier)))
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(boolean)))))))))
|
||||||
|
@ -8,11 +8,12 @@ Simple Command Pipe
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(pipe
|
(statement_kind
|
||||||
(command
|
(pipe
|
||||||
(command_text))
|
(command
|
||||||
(command
|
(command_text))
|
||||||
(command_text)))))
|
(command
|
||||||
|
(command_text))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Simple Function Pipe
|
Simple Function Pipe
|
||||||
@ -24,17 +25,18 @@ fs:read('file.txt') | output()
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(pipe
|
(statement_kind
|
||||||
(function_call
|
(pipe
|
||||||
(function_expression
|
(function_call
|
||||||
(index
|
(function_expression
|
||||||
(index_expression
|
(index
|
||||||
(identifier))
|
(index_expression
|
||||||
(index_expression
|
(identifier))
|
||||||
(identifier))))
|
(index_expression
|
||||||
(expression
|
(identifier))))
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
(function_call
|
(string))))
|
||||||
(function_expression
|
(function_call
|
||||||
(identifier))))))
|
(function_expression
|
||||||
|
(identifier)))))))
|
||||||
|
@ -8,6 +8,7 @@ Simple Range
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(range)))))
|
(value
|
||||||
|
(range))))))
|
||||||
|
@ -10,16 +10,19 @@ x
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer))))
|
(value
|
||||||
|
(integer)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
|
(string)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Simple Assignment
|
Simple Assignment
|
||||||
@ -32,21 +35,25 @@ y = "one"
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(integer))))))))
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(string)))))))
|
(expression
|
||||||
|
(value
|
||||||
|
(string)))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Complex Assignment
|
Complex Assignment
|
||||||
@ -62,38 +69,42 @@ x = if 1 + 1 == 2 {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(if_else
|
(statement
|
||||||
(if
|
(statement_kind
|
||||||
(expression
|
(if_else
|
||||||
(logic
|
(if
|
||||||
(expression
|
(expression
|
||||||
(math
|
(logic
|
||||||
(expression
|
(expression
|
||||||
(value
|
(math
|
||||||
(integer)))
|
(expression
|
||||||
(math_operator)
|
(value
|
||||||
|
(integer)))
|
||||||
|
(math_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(logic_operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer)))))
|
||||||
(logic_operator)
|
(block
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(integer)))))
|
(expression
|
||||||
(block
|
(value
|
||||||
(statement
|
(string)))))))
|
||||||
(expression
|
(else
|
||||||
(value
|
(block
|
||||||
(string))))))
|
(statement
|
||||||
(else
|
(statement_kind
|
||||||
(block
|
(expression
|
||||||
(statement
|
(value
|
||||||
(expression
|
(string))))))))))))))
|
||||||
(value
|
|
||||||
(string)))))))))))
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Expression Precedence
|
Expression Precedence
|
||||||
@ -105,28 +116,30 @@ x = 3 == 1 + 2 + 2
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(assignment
|
(statement_kind
|
||||||
(identifier)
|
(assignment
|
||||||
(assignment_operator)
|
(identifier)
|
||||||
(statement
|
(assignment_operator)
|
||||||
(expression
|
(statement
|
||||||
(math
|
(statement_kind
|
||||||
(expression
|
(expression
|
||||||
(math
|
(math
|
||||||
(expression
|
(expression
|
||||||
(logic
|
(math
|
||||||
(expression
|
(expression
|
||||||
(value
|
(logic
|
||||||
(integer)))
|
(expression
|
||||||
(logic_operator)
|
(value
|
||||||
|
(integer)))
|
||||||
|
(logic_operator)
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))
|
||||||
|
(math_operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer)))))
|
||||||
(math_operator)
|
(math_operator)
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))
|
(integer)))))))))))
|
||||||
(math_operator)
|
|
||||||
(expression
|
|
||||||
(value
|
|
||||||
(integer)))))))))
|
|
||||||
|
@ -11,15 +11,16 @@ struct Foo {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(type_definition
|
(statement_kind
|
||||||
(struct_definition
|
(type_definition
|
||||||
(identifier)
|
(struct_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(identifier)
|
(type))
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))))))
|
(type_specification
|
||||||
|
(type)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested Structure
|
Nested Structure
|
||||||
@ -38,31 +39,35 @@ struct Foo {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(type_definition
|
(statement_kind
|
||||||
(struct_definition
|
(type_definition
|
||||||
(identifier)
|
(struct_definition
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(identifier)
|
(type))
|
||||||
(type_specification
|
(identifier)
|
||||||
(type))
|
(type_specification
|
||||||
(statement
|
(type))
|
||||||
(expression
|
(statement
|
||||||
(value
|
(statement_kind
|
||||||
(float))))
|
(expression
|
||||||
(identifier)
|
(value
|
||||||
(type_specification
|
(float)))))
|
||||||
(type
|
(identifier)
|
||||||
(identifier)))
|
(type_specification
|
||||||
(statement
|
(type
|
||||||
(expression
|
(identifier)))
|
||||||
(value
|
(statement
|
||||||
(struct_instance
|
(statement_kind
|
||||||
(identifier)
|
(expression
|
||||||
(map
|
(value
|
||||||
(identifier)
|
(struct_instance
|
||||||
(statement
|
(identifier)
|
||||||
(expression
|
(map
|
||||||
(value
|
(identifier)
|
||||||
(integer)))))))))))))
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer))))))))))))))))
|
||||||
|
@ -9,13 +9,15 @@ false
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(boolean))))
|
(value
|
||||||
|
(boolean)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(boolean)))))
|
(value
|
||||||
|
(boolean))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Integers
|
Integers
|
||||||
@ -28,25 +30,30 @@ Integers
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer))))
|
(value
|
||||||
|
(integer)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer))))
|
(value
|
||||||
|
(integer)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer))))
|
(value
|
||||||
|
(integer)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer))))
|
(value
|
||||||
|
(integer)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(integer)))))
|
(value
|
||||||
|
(integer))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Floats
|
Floats
|
||||||
@ -68,43 +75,53 @@ infinity_gauntlet
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(float))))
|
(value
|
||||||
|
(float)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier)))
|
(expression
|
||||||
|
(identifier))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(identifier))))
|
(expression
|
||||||
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Strings
|
Strings
|
||||||
@ -116,22 +133,27 @@ Strings
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
|
(string)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
|
(string)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
|
(string)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string))))
|
(value
|
||||||
|
(string)))))
|
||||||
(statement
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(value
|
(expression
|
||||||
(string)))))
|
(value
|
||||||
|
(string))))))
|
||||||
|
@ -10,19 +10,21 @@ while true {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(while
|
(statement_kind
|
||||||
(expression
|
(while
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(expression
|
(statement
|
||||||
(function_call
|
(statement_kind
|
||||||
(function_expression
|
|
||||||
(identifier))
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(function_call
|
||||||
(string))))))))))
|
(function_expression
|
||||||
|
(identifier))
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(string))))))))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
Nested While Loop
|
Nested While Loop
|
||||||
@ -38,27 +40,31 @@ while true {
|
|||||||
|
|
||||||
(root
|
(root
|
||||||
(statement
|
(statement
|
||||||
(while
|
(statement_kind
|
||||||
(expression
|
(while
|
||||||
(value
|
(expression
|
||||||
(boolean)))
|
(value
|
||||||
(block
|
(boolean)))
|
||||||
(statement
|
(block
|
||||||
(while
|
(statement
|
||||||
(expression
|
(statement_kind
|
||||||
(logic
|
(while
|
||||||
(expression
|
(expression
|
||||||
(identifier))
|
(logic
|
||||||
(logic_operator)
|
(expression
|
||||||
(expression
|
(identifier))
|
||||||
(value
|
(logic_operator)
|
||||||
(integer)))))
|
|
||||||
(block
|
|
||||||
(statement
|
|
||||||
(assignment
|
|
||||||
(identifier)
|
|
||||||
(assignment_operator)
|
|
||||||
(statement
|
|
||||||
(expression
|
(expression
|
||||||
(value
|
(value
|
||||||
(integer)))))))))))))
|
(integer)))))
|
||||||
|
(block
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(assignment
|
||||||
|
(identifier)
|
||||||
|
(assignment_operator)
|
||||||
|
(statement
|
||||||
|
(statement_kind
|
||||||
|
(expression
|
||||||
|
(value
|
||||||
|
(integer)))))))))))))))))
|
||||||
|
@ -15,22 +15,27 @@ module.exports = grammar({
|
|||||||
prec.left(
|
prec.left(
|
||||||
seq(
|
seq(
|
||||||
optional('return'),
|
optional('return'),
|
||||||
choice(
|
$.statement_kind,
|
||||||
$.assignment,
|
|
||||||
$.block,
|
|
||||||
$.expression,
|
|
||||||
$.for,
|
|
||||||
$.if_else,
|
|
||||||
$.index_assignment,
|
|
||||||
$.match,
|
|
||||||
$.pipe,
|
|
||||||
$.while,
|
|
||||||
$.type_definition,
|
|
||||||
),
|
|
||||||
optional(';'),
|
optional(';'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
statement_kind: $ =>
|
||||||
|
prec.left(
|
||||||
|
choice(
|
||||||
|
$.assignment,
|
||||||
|
$.block,
|
||||||
|
$.expression,
|
||||||
|
$.for,
|
||||||
|
$.if_else,
|
||||||
|
$.index_assignment,
|
||||||
|
$.match,
|
||||||
|
$.pipe,
|
||||||
|
$.while,
|
||||||
|
$.type_definition,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
expression: $ =>
|
expression: $ =>
|
||||||
choice(
|
choice(
|
||||||
$._expression_kind,
|
$._expression_kind,
|
||||||
|
@ -36,49 +36,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "SYMBOL",
|
||||||
"members": [
|
"name": "statement_kind"
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "assignment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "block"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "expression"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "for"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "if_else"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "index_assignment"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "match"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "pipe"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "while"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "SYMBOL",
|
|
||||||
"name": "type_definition"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
@ -95,6 +54,55 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"statement_kind": {
|
||||||
|
"type": "PREC_LEFT",
|
||||||
|
"value": 0,
|
||||||
|
"content": {
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "assignment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "block"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "expression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "for"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "if_else"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "index_assignment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "match"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "pipe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "while"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "type_definition"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"expression": {
|
"expression": {
|
||||||
"type": "CHOICE",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
|
@ -606,6 +606,21 @@
|
|||||||
"type": "statement",
|
"type": "statement",
|
||||||
"named": true,
|
"named": true,
|
||||||
"fields": {},
|
"fields": {},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "statement_kind",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "statement_kind",
|
||||||
|
"named": true,
|
||||||
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": false,
|
"multiple": false,
|
||||||
"required": true,
|
"required": true,
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user