summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c7
-rw-r--r--lexer.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index ee0de84..658dde8 100644
--- a/eval.c
+++ b/eval.c
@@ -225,7 +225,11 @@ nameis(Datum left, Datum right)
Datum
assign(Datum left, Datum right)
{
- if(left.symbol->setfn != nil)
+ if(runestrcmp(left.symbol->name, L"⍵") == 0)
+ throwerror(nil, ESyntax);
+ else if(runestrcmp(left.symbol->name, L"⍺") == 0 && !left.symbol->undefined)
+ goto end;
+ else if(left.symbol->setfn != nil)
left.symbol->setfn(right);
else{
if(left.symbol->undefined == 0 && left.symbol->value.tag == ArrayTag)
@@ -237,6 +241,7 @@ assign(Datum left, Datum right)
incref(right.array); /* for the binding */
}
}
+end:
right.shy = 1;
if(right.tag == ArrayTag)
incref(right.array); /* for the returned array */
diff --git a/lexer.c b/lexer.c
index 24d7e00..706db23 100644
--- a/lexer.c
+++ b/lexer.c
@@ -168,7 +168,7 @@ get_digits:
}else if(runestrchr(L"⍺⍵", peek)){
Rune name[2] = {peek, 0};
stmt->toks[stmt->ntoks].tag = NameTag;
- stmt->toks[stmt->ntoks].symbol = getsym(name, 0);
+ stmt->toks[stmt->ntoks].symbol = getsym(name, 1);
}else if(isalpharune(peek)){
Rune buf[64];
Rune *p = buf;