diff options
author | rsc <devnull@localhost> | 2005-11-29 04:23:33 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-11-29 04:23:33 +0000 |
commit | 6c7ed6b0e6086e32710a0d42e034bce6bdaad7b0 (patch) | |
tree | f529eb7064546a0f8aa98014412f1e71683fe937 /src/cmd/acid | |
parent | c8661ffad4c2bbf1dd9138c4e8de7d86396cd070 (diff) | |
download | plan9port-6c7ed6b0e6086e32710a0d42e034bce6bdaad7b0.tar.gz plan9port-6c7ed6b0e6086e32710a0d42e034bce6bdaad7b0.tar.bz2 plan9port-6c7ed6b0e6086e32710a0d42e034bce6bdaad7b0.zip |
new backquote syntax
Diffstat (limited to 'src/cmd/acid')
-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; |