int
yylex(void)
{
- int c, nl = 0;
+ int c;
while ((c = getchar ()) == ' ' || c == '\t' || c =='\n'){
- if (c == '\n'){
- nl = 1;
+ if (c == '\n')
line++;
- }
}
- if (nl)
- return '\n';
-
if (c == EOF)
return 0;
int d = getchar();
if (d >= 0) {
switch (CC(c,d)) {
- case CC('!','='): return NEQ;
- case CC('!','~'): return NRE;
- case CC('<','='): return LE;
- case CC('>','='): return GE;
- case CC('=','='): return EQ;
- case CC('~','~'): return RE;
- case CC('-','>'): return ARROW;
+ case CC('!','='): yylval.n = CC('!','='); return NEQ;
+ case CC('!','~'): yylval.n = CC('!','='); return NRE;
+ case CC('<','='): yylval.n = CC('<','='); return LE;
+ case CC('>','='): yylval.n = CC('>','='); return GE;
+ case CC('=','='): yylval.n = CC('=','='); return EQ;
+ case CC('~','~'): yylval.n = CC('~','~'); return RE;
+ case CC('-','>'): yylval.n = CC('-','>'); return ARROW;
}
ungetc(d,stdin);
}
case '<':
case '>':
case '=':
+ case ';':
+ case '.':
+ yylval.n = c;
return c;
case '"':
if (i >= BUFSIZE-1)
parse_err("Too long identifier, max allowed length is %d",BUFSIZE-1);
}
+ ungetc(c,stdin);
buf[i] = 0;
yylval.str = xstrdup(buf);
parse_err("Keyword too long");
}
buf[i] = 0;
+ ungetc(c,stdin);
n = (sizeof(k)/sizeof(struct keys));
for (i = 0; i < n; i++){