aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-02-12 07:36:00 +0000
committerRichard Stallman <rms@gnu.org>1993-02-12 07:36:00 +0000
commitf3acae4d7c0868869eb29ab7cf885dab0ae55bd7 (patch)
tree5313bcfd427bc4dd7cc8666b8eb9ef018024feb7
parentaee3a549b0ef027b81642ff57a9e72e7cb49f591 (diff)
downloadgcc-f3acae4d7c0868869eb29ab7cf885dab0ae55bd7.zip
gcc-f3acae4d7c0868869eb29ab7cf885dab0ae55bd7.tar.gz
gcc-f3acae4d7c0868869eb29ab7cf885dab0ae55bd7.tar.bz2
(yylex): For wide char constant, use wchar_type_node.
Swallow any preprocessing number as a (possibly erroneous) number. From-SVN: r3464
-rw-r--r--gcc/c-lex.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index d818f33..043e67c 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -1279,7 +1279,7 @@ yylex ()
}
else if (base <= 10)
{
- if ((c&~040) == 'E')
+ if (c == 'e' || c == 'E')
{
base = 10;
floatflag = AFTER_POINT;
@@ -1411,7 +1411,9 @@ yylex ()
break;
}
/* Note: garbage_chars is -1 if first char is *not* garbage. */
- while (isalnum (c))
+ while (isalnum (c) || c == '.' || c == '_'
+ || (!flag_traditional && (c == '+' || c == '-')
+ && (p[-1] == 'e' || p[-1] == 'E')))
{
if (p >= token_buffer + maxtoken - 3)
p = extend_token_buffer (p);
@@ -1459,10 +1461,14 @@ yylex ()
}
else
{
- if (isalnum (c))
+ if (isalnum (c) || c == '.' || c == '_'
+ || (!flag_traditional && (c == '+' || c == '-')
+ && (p[-1] == 'e' || p[-1] == 'E')))
{
error ("garbage at end of number");
- while (isalnum (c))
+ while (isalnum (c) || c == '.' || c == '_'
+ || (!flag_traditional && (c == '+' || c == '-')
+ && (p[-1] == 'e' || p[-1] == 'E')))
{
if (p >= token_buffer + maxtoken - 3)
p = extend_token_buffer (p);
@@ -1702,6 +1708,7 @@ yylex ()
= build_int_2 (result | ~((unsigned HOST_WIDE_INT) ~0
>> (HOST_BITS_PER_WIDE_INT - num_bits)),
-1);
+ TREE_TYPE (yylval.ttype) = integer_type_node;
}
else
{
@@ -1722,9 +1729,9 @@ yylex ()
}
#endif
yylval.ttype = build_int_2 (result, 0);
+ TREE_TYPE (yylval.ttype) = wchar_type_node;
}
- TREE_TYPE (yylval.ttype) = integer_type_node;
value = CONSTANT;
break;
}