Use a single rule to match all punctuation, with a lookup table to
return the correct token. This gives a small size reduction for
the scanner.
}
%}
-"..." return T_ELLIPSIS;
-";" return T_SEMICOLON;
-"*" return T_ASTERISK;
-"(" return T_LPAREN;
-")" return T_RPAREN;
-"[" return T_LBRACKET;
-"]" return T_RBRACKET;
-"," return T_COMMA;
+"..."|[][;*(),] {
+ static const unsigned char tab[2][8] = {
+ "*[](),.;",
+ {
+ T_ASTERISK & 0xff,
+ T_LBRACKET & 0xff,
+ T_RBRACKET & 0xff,
+ T_LPAREN & 0xff,
+ T_RPAREN & 0xff,
+ T_COMMA & 0xff,
+ T_ELLIPSIS & 0xff,
+ T_SEMICOLON & 0xff
+ }
+ };
+
+ unsigned char *match;
+ int x;
+
+ match = memchr(&tab, yytext[0], sizeof tab[0]);
+ x = match[sizeof tab[0]];
+
+ if (T_VOID >= 256)
+ x += 256;
+ return x;
+}
{INTEGER} {
char *end;