From: Ben Pfaff Date: Mon, 6 Dec 2010 06:19:34 +0000 (-0800) Subject: q2c: Prefer lex_match_id() over lex_match_hyphenated_word() in emitted code. X-Git-Tag: v0.7.7~109 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99f4295b50bc02b7024deeb59324a3332b560fbd;p=pspp-builds.git q2c: Prefer lex_match_id() over lex_match_hyphenated_word() in emitted code. Until now, q2c has used lex_match_hyphenated_word() wherever it was necessary to match a plain identifier. But it is better to use lex_match_id() when it can be, because it is simpler and faster, so this commit does that. --- diff --git a/src/language/lexer/q2c.c b/src/language/lexer/q2c.c index cf5a04ee..73602bd6 100644 --- a/src/language/lexer/q2c.c +++ b/src/language/lexer/q2c.c @@ -1422,12 +1422,14 @@ make_match (const char *t) "|| lex_match_id (lexer, \"FALSE\"))"); else if (isdigit ((unsigned char) t[0])) sprintf (s, "lex_match_int (lexer, %s)", t); - else + else if (strchr (t, hyphen_proxy)) { char *c = unmunge (t); sprintf (s, "lex_match_hyphenated_word (lexer, \"%s\")", c); free (c); } + else + sprintf (s, "lex_match_id (lexer, \"%s\")", t); return s; }