summaryrefslogtreecommitdiff
path: root/src/core/interpret.c
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-10-19 00:12:57 +0000
committerPaul Buetow <paul@buetow.org>2008-10-19 00:12:57 +0000
commit982e35bd0bd9bc9b55c0f898556c3e1831141258 (patch)
tree95d12d94983ac396c693f96825cc3beea8cad50c /src/core/interpret.c
parent41e590f05d295a40ba4633d493be1ffe28f16ddf (diff)
synonyms work
Diffstat (limited to 'src/core/interpret.c')
-rw-r--r--src/core/interpret.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/core/interpret.c b/src/core/interpret.c
index a69e85a..2c80163 100644
--- a/src/core/interpret.c
+++ b/src/core/interpret.c
@@ -222,6 +222,22 @@ _var_assign(Interpret *p_interpret) {
if (p_interpret->tt == TT_ASSIGN) {
_NEXT
+ if (p_interpret->tt == TT_VID) {
+ _NEXT
+ if (p_interpret->tt != TT_IDENT)
+ _INTERPRET_ERROR("Expected identifier", p_interpret->p_token);
+
+ char *c_name_ = token_get_val(p_interpret->p_token);
+ Symbol *p_symbol = scope_get(p_interpret->p_scope, c_name_);
+
+ if (p_symbol == NULL)
+ _INTERPRET_ERROR("No such symbol", p_interpret->p_token);
+
+ symbol_ref_up(p_symbol);
+ scope_newset(p_interpret->p_scope, c_name, p_symbol);
+ _NEXT
+
+ } else {
Stack *p_stack = p_interpret->p_stack;
p_interpret->p_stack = stack_new();
@@ -236,11 +252,10 @@ _var_assign(Interpret *p_interpret) {
p_token = stack_top(p_interpret->p_stack);
Symbol *p_symbol = symbol_new(SYM_VARIABLE, p_token);
scope_newset(p_interpret->p_scope, c_name, p_symbol);
-
} else {
return (0);
}
-
+ }
} else {
Token *p_token = token_new_integer(0);
Symbol *p_symbol = symbol_new(SYM_VARIABLE, p_token);
@@ -912,6 +927,7 @@ _term(Interpret *p_interpret) {
}
break;
+ /*
case TT_PARANT_AL:
{
Token *p_token = p_interpret->p_token;
@@ -922,6 +938,7 @@ _term(Interpret *p_interpret) {
_INTERPRET_ERROR("arrays not yet fully implemented", p_token_arr);
}
break;
+ */
case TT_PARANT_L:
{