aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-02-18 21:13:37 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-02-18 21:13:37 -0500
commitd669f5da3c4c5c74f5a55d3c81c795b44aa877aa (patch)
treec3344d850ee8b20ad47a857c62869d03ca10adbf /gcc
parentdc086e21e4bba1d558f0c9b0abb7800c762f8401 (diff)
downloadgcc-d669f5da3c4c5c74f5a55d3c81c795b44aa877aa.zip
gcc-d669f5da3c4c5c74f5a55d3c81c795b44aa877aa.tar.gz
gcc-d669f5da3c4c5c74f5a55d3c81c795b44aa877aa.tar.bz2
(yylex...
(yylex, case '0'..'9','.'): For cases '0' and '1', check for single digit constant before resorting to general number processing. From-SVN: r11297
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-lex.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 26f3911..89ff60b 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -1118,7 +1118,23 @@ yylex ()
break;
- case '0': case '1': case '2': case '3': case '4':
+ case '0': case '1':
+ {
+ int next_c;
+ /* Check first for common special case: single-digit 0 or 1. */
+
+ next_c = getc (finput);
+ ungetc (next_c, finput); /* Always undo this lookahead. */
+ if (!isalnum (next_c) && next_c != '.')
+ {
+ token_buffer[0] = (char)c, token_buffer[1] = '\0';
+ yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node;
+ value = CONSTANT;
+ break;
+ }
+ /*FALLTHRU*/
+ }
+ case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '.':
{