stdlib/lang/bolt.bolt: Mock a macro that generates the Bolt AST
This commit is contained in:
parent
d72301fa07
commit
3a7c65025f
1 changed files with 28 additions and 24 deletions
|
@ -19,32 +19,36 @@ mod Bolt::Lang {
|
||||||
end: Pos,
|
end: Pos,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Identifier {
|
define_nodes! {
|
||||||
text: String,
|
|
||||||
span: Option<Span>,
|
Identifier : Symbol {
|
||||||
orig_node: Option<Node>,
|
text: String,
|
||||||
parent: Option<Node>,
|
},
|
||||||
|
|
||||||
|
Statement,
|
||||||
|
|
||||||
|
ReturnStatement : Statement {
|
||||||
|
expression: Option<Expression>,
|
||||||
|
},
|
||||||
|
|
||||||
|
ConditionalCase {
|
||||||
|
test: Option<Expression>,
|
||||||
|
result: Vec<FunctionBodyElement>,
|
||||||
|
},
|
||||||
|
|
||||||
|
ConditionalStatement : Statement {
|
||||||
|
cases: Vec<ConditionalCase>,
|
||||||
|
},
|
||||||
|
|
||||||
|
Expression,
|
||||||
|
|
||||||
|
ReferenceExpression : Expression {
|
||||||
|
modulePath: Option<ModulePath>,
|
||||||
|
name: Symbol,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Token
|
|
||||||
= Identifier
|
|
||||||
|
|
||||||
pub struct ConditionalCase {
|
|
||||||
test: Option<Expression>,
|
|
||||||
result: Vec<FunctionBodyElement>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct ConditionalStatement {
|
|
||||||
cases: Vec<ConditionalCase>,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type Statement
|
|
||||||
= ReturnStatement
|
|
||||||
| ConditionalStatement
|
|
||||||
|
|
||||||
pub type Expression
|
|
||||||
= ReferenceExpression
|
|
||||||
|
|
||||||
pub type Transformer = fn (node: Node) -> Node;
|
pub type Transformer = fn (node: Node) -> Node;
|
||||||
|
|
||||||
fn build_predicate_from_pattern(pattern: Pattern) -> Expression {
|
fn build_predicate_from_pattern(pattern: Pattern) -> Expression {
|
||||||
|
|
Loading…
Reference in a new issue