aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acid
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-11-29 04:23:33 +0000
committerrsc <devnull@localhost>2005-11-29 04:23:33 +0000
commit6c7ed6b0e6086e32710a0d42e034bce6bdaad7b0 (patch)
treef529eb7064546a0f8aa98014412f1e71683fe937 /src/cmd/acid
parentc8661ffad4c2bbf1dd9138c4e8de7d86396cd070 (diff)
downloadplan9port-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.c30
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;