Add string to AST
This commit is contained in:
parent
fc3dcf792d
commit
dbdae42c1b
@ -28,6 +28,7 @@ enum Token {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
enum ASTNode {
|
enum ASTNode {
|
||||||
Name(String),
|
Name(String),
|
||||||
|
LangString(String),
|
||||||
Number(f64),
|
Number(f64),
|
||||||
BinOp(Box<ASTNode>, Box<ASTNode>, Box<ASTNode>),
|
BinOp(Box<ASTNode>, Box<ASTNode>, Box<ASTNode>),
|
||||||
Binding(String, Box<ASTNode>)
|
Binding(String, Box<ASTNode>)
|
||||||
@ -181,7 +182,7 @@ fn let_expression<'a>(input: &mut Iter<Token>) -> ParseResult {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(&StrLiteral(ref value)) = next {
|
if let Some(&StrLiteral(ref value)) = next {
|
||||||
let ast = ASTNode::Binding(name.clone(), Box::new(ASTNode::Name(value.clone())));
|
let ast = ASTNode::Binding(name.clone(), Box::new(ASTNode::LangString(value.clone())));
|
||||||
return ParseResult::Ok(ast);
|
return ParseResult::Ok(ast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user