X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/341382c7c656350bb89b7b602084c5e0a8fa7d8f..3a3760ad26782403f6686183be3faa8b22cf849b:/src/scan.l diff --git a/src/scan.l b/src/scan.l index 7e3e365..6718381 100644 --- a/src/scan.l +++ b/src/scan.l @@ -132,29 +132,23 @@ INTEGER 0x[[:xdigit:]]+|0[0-7]+|[[:digit:]]+ %} "..."|[][;*(),] { + unsigned char *match; 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 + PACK_TOKEN(T_ASTERISK), + PACK_TOKEN(T_LBRACKET), + PACK_TOKEN(T_RBRACKET), + PACK_TOKEN(T_LPAREN), + PACK_TOKEN(T_RPAREN), + PACK_TOKEN(T_COMMA), + PACK_TOKEN(T_ELLIPSIS), + PACK_TOKEN(T_SEMICOLON) } }; - 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; + return UNPACK_TOKEN(match[sizeof tab[0]]); } {INTEGER} {