From 0540df402426e64d636dd57341795321dec8add1 Mon Sep 17 00:00:00 2001 From: greg Date: Fri, 30 Aug 2019 19:10:16 -0700 Subject: [PATCH] Rename Val -> Sym --- schala-lang/language/src/eval.rs | 8 ++++---- schala-lang/language/src/reduced_ast.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/schala-lang/language/src/eval.rs b/schala-lang/language/src/eval.rs index d9a68c4..a17f9db 100644 --- a/schala-lang/language/src/eval.rs +++ b/schala-lang/language/src/eval.rs @@ -132,7 +132,7 @@ impl Expr { match self { ConditionalTargetSigilValue => replacement.clone(), - Unit | Lit(_) | Func(_) | Val(_) | Constructor { .. } | + Unit | Lit(_) | Func(_) | Sym(_) | Constructor { .. } | CaseMatch { .. } | UnimplementedSigilValue | ReductionError(_) => self, Tuple(exprs) => Tuple(exprs.into_iter().map(|e| e.replace_conditional_target_sigil(replacement)).collect()), Call { f, args } => { @@ -212,7 +212,7 @@ impl<'a> State<'a> { Node::Expr(expr) => match expr { literal @ Lit(_) => Ok(Node::Expr(literal)), Call { box f, args } => self.call_expression(f, args), - Val(v) => self.value(v), + Sym(v) => self.handle_sym(v), Constructor { arity, ref name, tag, .. } if arity == 0 => Ok(Node::PrimObject { name: name.clone(), tag, items: vec![] }), constructor @ Constructor { .. } => Ok(Node::Expr(constructor)), func @ Func(_) => Ok(Node::Expr(func)), @@ -371,7 +371,7 @@ impl<'a> State<'a> { fn assign_expression(&mut self, val: Expr, expr: Expr) -> EvalResult { let name = match val { - Expr::Val(name) => name, + Expr::Sym(name) => name, _ => return Err(format!("Trying to assign to a non-value")), }; @@ -459,7 +459,7 @@ impl<'a> State<'a> { } //TODO if I don't need to lookup by name here... - fn value(&mut self, name: Rc) -> EvalResult { + fn handle_sym(&mut self, name: Rc) -> EvalResult { use self::ValueEntry::*; use self::Func::*; //TODO add a layer of indirection here to talk to the symbol table first, and only then look up diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 7302b26..5b58a1a 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -43,7 +43,7 @@ pub enum Expr { Lit(Lit), Tuple(Vec), Func(Func), - Val(Rc), + Sym(Rc), Constructor { type_name: Rc, name: Rc, @@ -160,7 +160,7 @@ impl Expression { tag: index.clone(), arity: type_args.len(), }, - _ => Expr::Val(name.clone()), + _ => Expr::Sym(name.clone()), }, Call { f, arguments } => reduce_call_expression(f, arguments, symbol_table), TupleLiteral(exprs) => Expr::Tuple(exprs.iter().map(|e| e.node().reduce(symbol_table)).collect()),