From 99f4295b50bc02b7024deeb59324a3332b560fbd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 5 Dec 2010 22:19:34 -0800 Subject: [PATCH] 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. --- src/language/lexer/q2c.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- 2.30.2