Parser - Set expressions
This commit is contained in:
parent
a5172e103b
commit
a52e386e8d
1 changed files with 7 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::{ClassDecl, ExprNode, FunDecl, GetExpr, ProgramNode, StmtNode},
|
ast::{ClassDecl, ExprNode, FunDecl, GetExpr, ProgramNode, SetExpr, StmtNode},
|
||||||
errors::{ErrorHandler, ErrorKind, SloxError, SloxResult},
|
errors::{ErrorHandler, ErrorKind, SloxError, SloxResult},
|
||||||
tokens::{Token, TokenType},
|
tokens::{Token, TokenType},
|
||||||
};
|
};
|
||||||
|
@ -532,6 +532,12 @@ impl Parser {
|
||||||
value: Box::new(value),
|
value: Box::new(value),
|
||||||
id: self.make_id(),
|
id: self.make_id(),
|
||||||
})
|
})
|
||||||
|
} else if let ExprNode::Get(get_expr) = expr {
|
||||||
|
Ok(ExprNode::Set(SetExpr {
|
||||||
|
instance: get_expr.instance,
|
||||||
|
name: get_expr.name,
|
||||||
|
value: Box::new(value),
|
||||||
|
}))
|
||||||
} else {
|
} else {
|
||||||
Err(SloxError::with_token(
|
Err(SloxError::with_token(
|
||||||
ErrorKind::Parse,
|
ErrorKind::Parse,
|
||||||
|
|
Loading…
Reference in a new issue