qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit 15be4030aca3dac7edffb75c55088c8b97a89435
parent a7f459b291b5cf7bc4f62061cadb14a93b0c29c1
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Fri,  3 Jul 2015 15:32:12 -0400

factoring? in the lexer

Diffstat:
Mlisc/parse.c | 18++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisc/parse.c b/lisc/parse.c @@ -119,6 +119,14 @@ lex() return TRParen; case '=': return TEq; + case '%': + t = TVar; + c = fgetc(inf); + goto Alpha; + case '@': + t = TLbl; + c = fgetc(inf); + goto Alpha; case '#': while (fgetc(inf) != '\n') ; @@ -145,14 +153,8 @@ lex() tokval.num *= sgn; return TNum; } - if (c == '%') { - t = TVar; - c = fgetc(inf); - } else if (c == '@') { - t = TLbl; - c = fgetc(inf); - } else - t = TXXX; + t = TXXX; +Alpha: if (!isalpha(c)) err("lexing failure"); i = 0;