diff options
-rw-r--r-- | src/cmd/acid/lex.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cmd/acid/lex.c b/src/cmd/acid/lex.c index ed7f459d..f265d6c9 100644 --- a/src/cmd/acid/lex.c +++ b/src/cmd/acid/lex.c @@ -342,6 +342,33 @@ eatnl(void) } int +bqsymbol(void) +{ + int c; + char *p; + Lsym *s; + + symbol[0] = 0; + p = symbol; + while((c = lexc()) != '`'){ + if(c == Eof) + error("eof in backquote"); + if(c == '\n') + error("newline in backquote"); + *p++ = c; + } + if(p >= symbol+sizeof symbol) + sysfatal("overflow in bqsymbol"); + *p = 0; + + s = look(symbol); + if(s == 0) + s = enter(symbol, Tid); + yylval.sym = s; + return s->lexval; +} + +int yylex(void) { int c; @@ -360,6 +387,9 @@ loop: } return Eof; + case '`': + return bqsymbol(); + case '"': eatstring(); return Tstring; |