diff options
Diffstat (limited to 'lexer.c')
-rw-r--r-- | lexer.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -9,7 +9,7 @@ Rune primdyadopnames[] = L"⍣.∘⍤⍥@⍠⌺"; Rune primhybridnames[] = L"/\⌿⍀"; Statement * -lexline(Rune *line, Symtab *symtab) +lexline(Rune *line) { int offset = 0; int len = runestrlen(line); @@ -30,7 +30,7 @@ lexline(Rune *line, Symtab *symtab) case '[': stmt->toks[stmt->ntoks].tag = LBracketTag; break; case ']': stmt->toks[stmt->ntoks].tag = RBracketTag; break; case L'←': stmt->toks[stmt->ntoks].tag = ArrowTag; break; - case L'⋄': stmt->next = lexline(&line[offset+1], symtab); goto end; + case L'⋄': stmt->next = lexline(&line[offset+1]); goto end; case L'⍝': goto end; } offset++; @@ -73,6 +73,12 @@ lexline(Rune *line, Symtab *symtab) *p = 0; stmt->toks[stmt->ntoks].tag = ArrayTag; stmt->toks[stmt->ntoks].array = mkscalarint(atoll(buf)); + }else if(runestrchr(L"⍺⍵", line[offset])){ + Rune *name = L"?"; + name[0] = line[offset]; + stmt->toks[stmt->ntoks].tag = NameTag; + stmt->toks[stmt->ntoks].symbol = getsym(currentsymtab, name); + offset++; }else if(isalpharune(line[offset]) || line[offset] == L'⎕'){ int quadname = L'⎕' == line[offset]; Rune buf[64]; @@ -87,7 +93,7 @@ lexline(Rune *line, Symtab *symtab) } *p = 0; stmt->toks[stmt->ntoks].tag = NameTag; - stmt->toks[stmt->ntoks].symbol = getsym(symtab, buf); + stmt->toks[stmt->ntoks].symbol = getsym(currentsymtab, buf); }else{ syntax_error: print("Can't lex: %S\n", &line[offset]); |