new backquote syntax

This commit is contained in:
rsc 2005-11-29 04:23:33 +00:00
parent c8661ffad4
commit 6c7ed6b0e6

View file

@ -341,6 +341,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)
{
@ -360,6 +387,9 @@ loop:
}
return Eof;
case '`':
return bqsymbol();
case '"':
eatstring();
return Tstring;