Variables globales (déclaration, affectation avec une expression et évaluation)
This commit is contained in:
@@ -26,12 +26,18 @@ pub struct Unary {
|
||||
pub right: Box<Expr>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Variable {
|
||||
pub name: Token,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum Expr {
|
||||
BinaryExpr(Binary),
|
||||
GroupingExpr(Grouping),
|
||||
LiteralExpr(Literal),
|
||||
UnaryExpr(Unary),
|
||||
VariableExpr(Variable),
|
||||
}
|
||||
|
||||
pub trait ExprVisitor<T> {
|
||||
@@ -40,5 +46,6 @@ pub trait ExprVisitor<T> {
|
||||
fn visit_literal(&mut self, l: &Literal) ->T;
|
||||
fn visit_unary(&mut self, u: &Unary) -> T;
|
||||
fn visit_expr(&mut self, e: &Expr) -> T;
|
||||
fn visit_variable(&mut self, v: &Variable) -> T;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user