1 /* Lexical analyzer for C and Objective C.
2 Copyright (C) 1987, 88, 89, 92, 94-97, 1998 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
36 /* MULTIBYTE_CHARS support only works for native compilers.
37 ??? Ideally what we want is to model widechar support after
38 the current floating point support. */
40 #undef MULTIBYTE_CHARS
43 #ifdef MULTIBYTE_CHARS
46 #endif /* MULTIBYTE_CHARS */
50 extern cpp_reader parse_in
;
51 extern cpp_options parse_options
;
53 /* Stream for reading from the input file. */
57 extern void yyprint
PROTO((FILE *, int, YYSTYPE
));
59 /* The elements of `ridpointers' are identifier nodes
60 for the reserved type names and storage classes.
61 It is indexed by a RID_... value. */
62 tree ridpointers
[(int) RID_MAX
];
64 /* Cause the `yydebug' variable to be defined. */
68 extern unsigned char *yy_cur
, *yy_lim
;
70 extern int yy_get_token ();
72 #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
73 #define UNGETC(c) ((c) == EOF ? 0 : yy_cur--)
75 #define GETC() getc (finput)
76 #define UNGETC(c) ungetc (c, finput)
79 /* the declaration found for the last IDENTIFIER token read in.
80 yylex must look this up to detect typedefs, which get token type TYPENAME,
81 so it is left around in case the identifier is not a typedef but is
82 used in a context which makes it a reference to a variable. */
85 /* Nonzero enables objc features. */
91 /* File used for outputting assembler code. */
92 extern FILE *asm_out_file
;
94 #ifndef WCHAR_TYPE_SIZE
96 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
98 #define WCHAR_TYPE_SIZE BITS_PER_WORD
102 /* Number of bytes in a wide character. */
103 #define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
105 static int maxtoken
; /* Current nominal length of token buffer. */
106 char *token_buffer
; /* Pointer to token buffer.
107 Actual allocated length is maxtoken + 2.
108 This is not static because objc-parse.y uses it. */
110 static int indent_level
= 0; /* Number of { minus number of }. */
112 /* Nonzero if end-of-file has been seen on input. */
113 static int end_of_file
;
116 /* Buffered-back input character; faster than using ungetc. */
117 static int nextchar
= -1;
120 #ifdef HANDLE_GENERIC_PRAGMAS
121 static int handle_generic_pragma
PROTO((int));
122 #endif /* HANDLE_GENERIC_PRAGMAS */
123 static int whitespace_cr
PROTO((int));
124 static int skip_white_space
PROTO((int));
125 static int skip_white_space_on_line
PROTO((void));
126 static char *extend_token_buffer
PROTO((const char *));
127 static int readescape
PROTO((int *));
128 static void parse_float
PROTO((PTR
));
130 /* Do not insert generated code into the source, instead, include it.
131 This allows us to build gcc automatically even for targets that
132 need to add or modify the reserved keyword lists. */
135 /* Return something to represent absolute declarators containing a *.
136 TARGET is the absolute declarator that the * contains.
137 TYPE_QUALS is a list of modifiers such as const or volatile
138 to apply to the pointer type, represented as identifiers.
140 We return an INDIRECT_REF whose "contents" are TARGET
141 and whose type is the modifier list. */
144 make_pointer_declarator (type_quals
, target
)
145 tree type_quals
, target
;
147 return build1 (INDIRECT_REF
, type_quals
, target
);
151 forget_protocol_qualifiers ()
153 int i
, n
= sizeof wordlist
/ sizeof (struct resword
);
155 for (i
= 0; i
< n
; i
++)
156 if ((int) wordlist
[i
].rid
>= (int) RID_IN
157 && (int) wordlist
[i
].rid
<= (int) RID_ONEWAY
)
158 wordlist
[i
].name
= "";
162 remember_protocol_qualifiers ()
164 int i
, n
= sizeof wordlist
/ sizeof (struct resword
);
166 for (i
= 0; i
< n
; i
++)
167 if (wordlist
[i
].rid
== RID_IN
)
168 wordlist
[i
].name
= "in";
169 else if (wordlist
[i
].rid
== RID_OUT
)
170 wordlist
[i
].name
= "out";
171 else if (wordlist
[i
].rid
== RID_INOUT
)
172 wordlist
[i
].name
= "inout";
173 else if (wordlist
[i
].rid
== RID_BYCOPY
)
174 wordlist
[i
].name
= "bycopy";
175 else if (wordlist
[i
].rid
== RID_BYREF
)
176 wordlist
[i
].name
= "byref";
177 else if (wordlist
[i
].rid
== RID_ONEWAY
)
178 wordlist
[i
].name
= "oneway";
182 init_parse (filename
)
186 /* Open input file. */
187 if (filename
== 0 || !strcmp (filename
, "-"))
193 finput
= fopen (filename
, "r");
195 pfatal_with_name (filename
);
197 #ifdef IO_BUFFER_SIZE
198 setvbuf (finput
, (char *) xmalloc (IO_BUFFER_SIZE
), _IOFBF
, IO_BUFFER_SIZE
);
200 #else /* !USE_CPPLIB */
201 parse_in
.show_column
= 1;
202 if (! cpp_start_read (&parse_in
, filename
))
205 if (filename
== 0 || !strcmp (filename
, "-"))
208 /* cpp_start_read always puts at least one line directive into the
209 token buffer. We must arrange to read it out here. */
210 yy_cur
= parse_in
.token_buffer
;
211 yy_lim
= CPP_PWRITTEN (&parse_in
);
223 cpp_finish (&parse_in
);
232 /* Make identifier nodes long enough for the language-specific slots. */
233 set_identifier_size (sizeof (struct lang_identifier
));
235 /* Start it at 0, because check_newline is called at the very beginning
236 and will increment it to 1. */
239 #ifdef MULTIBYTE_CHARS
240 /* Change to the native locale for multibyte conversions. */
241 setlocale (LC_CTYPE
, "");
242 literal_codeset
= getenv ("LANG");
246 token_buffer
= (char *) xmalloc (maxtoken
+ 2);
248 ridpointers
[(int) RID_INT
] = get_identifier ("int");
249 ridpointers
[(int) RID_CHAR
] = get_identifier ("char");
250 ridpointers
[(int) RID_VOID
] = get_identifier ("void");
251 ridpointers
[(int) RID_FLOAT
] = get_identifier ("float");
252 ridpointers
[(int) RID_DOUBLE
] = get_identifier ("double");
253 ridpointers
[(int) RID_SHORT
] = get_identifier ("short");
254 ridpointers
[(int) RID_LONG
] = get_identifier ("long");
255 ridpointers
[(int) RID_UNSIGNED
] = get_identifier ("unsigned");
256 ridpointers
[(int) RID_SIGNED
] = get_identifier ("signed");
257 ridpointers
[(int) RID_INLINE
] = get_identifier ("inline");
258 ridpointers
[(int) RID_CONST
] = get_identifier ("const");
259 ridpointers
[(int) RID_RESTRICT
] = get_identifier ("restrict");
260 ridpointers
[(int) RID_VOLATILE
] = get_identifier ("volatile");
261 ridpointers
[(int) RID_AUTO
] = get_identifier ("auto");
262 ridpointers
[(int) RID_STATIC
] = get_identifier ("static");
263 ridpointers
[(int) RID_EXTERN
] = get_identifier ("extern");
264 ridpointers
[(int) RID_TYPEDEF
] = get_identifier ("typedef");
265 ridpointers
[(int) RID_REGISTER
] = get_identifier ("register");
266 ridpointers
[(int) RID_ITERATOR
] = get_identifier ("iterator");
267 ridpointers
[(int) RID_COMPLEX
] = get_identifier ("complex");
268 ridpointers
[(int) RID_ID
] = get_identifier ("id");
269 ridpointers
[(int) RID_IN
] = get_identifier ("in");
270 ridpointers
[(int) RID_OUT
] = get_identifier ("out");
271 ridpointers
[(int) RID_INOUT
] = get_identifier ("inout");
272 ridpointers
[(int) RID_BYCOPY
] = get_identifier ("bycopy");
273 ridpointers
[(int) RID_BYREF
] = get_identifier ("byref");
274 ridpointers
[(int) RID_ONEWAY
] = get_identifier ("oneway");
275 forget_protocol_qualifiers();
277 /* Some options inhibit certain reserved words.
278 Clear those words out of the hash table so they won't be recognized. */
279 #define UNSET_RESERVED_WORD(STRING) \
280 do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
281 if (s) s->name = ""; } while (0)
283 if (! doing_objc_thang
)
284 UNSET_RESERVED_WORD ("id");
286 if (flag_traditional
)
288 UNSET_RESERVED_WORD ("const");
289 UNSET_RESERVED_WORD ("restrict");
290 UNSET_RESERVED_WORD ("volatile");
291 UNSET_RESERVED_WORD ("typeof");
292 UNSET_RESERVED_WORD ("signed");
293 UNSET_RESERVED_WORD ("inline");
294 UNSET_RESERVED_WORD ("iterator");
295 UNSET_RESERVED_WORD ("complex");
297 else if (!flag_isoc9x
)
298 UNSET_RESERVED_WORD ("restrict");
302 UNSET_RESERVED_WORD ("asm");
303 UNSET_RESERVED_WORD ("typeof");
304 UNSET_RESERVED_WORD ("inline");
305 UNSET_RESERVED_WORD ("iterator");
306 UNSET_RESERVED_WORD ("complex");
311 reinit_parse_for_function ()
315 /* Function used when yydebug is set, to print a token in more detail. */
318 yyprint (file
, yychar
, yylval
)
330 if (IDENTIFIER_POINTER (t
))
331 fprintf (file
, " `%s'", IDENTIFIER_POINTER (t
));
336 if (TREE_CODE (t
) == INTEGER_CST
)
338 #if HOST_BITS_PER_WIDE_INT == 64
339 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
342 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
349 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
355 TREE_INT_CST_HIGH (t
), TREE_INT_CST_LOW (t
));
360 /* Iff C is a carriage return, warn about it - if appropriate -
361 and return nonzero. */
366 static int newline_warning
= 0;
370 /* ANSI C says the effects of a carriage return in a source file
372 if (pedantic
&& !newline_warning
)
374 warning ("carriage return in source file");
375 warning ("(we only warn about the first carriage return)");
383 /* If C is not whitespace, return C.
384 Otherwise skip whitespace and return first nonwhite char read. */
394 /* We don't recognize comments here, because
395 cpp output can include / and * consecutively as operators.
396 Also, there's no need, since cpp removes all comments. */
399 c
= check_newline ();
420 error ("stray '\\' in program");
430 /* Skips all of the white space at the current location in the input file.
431 Must use and reset nextchar if it has the next character. */
434 position_after_white_space ()
440 c
= nextchar
, nextchar
= -1;
445 UNGETC (skip_white_space (c
));
448 /* Like skip_white_space, but don't advance beyond the end of line.
449 Moreover, we don't get passed a character to start with. */
451 skip_white_space_on_line ()
480 /* Make the token buffer longer, preserving the data in it.
481 P should point to just beyond the last valid character in the old buffer.
482 The value we return is a pointer to the new buffer
483 at a place corresponding to P. */
486 extend_token_buffer (p
)
489 int offset
= p
- token_buffer
;
491 maxtoken
= maxtoken
* 2 + 10;
492 token_buffer
= (char *) xrealloc (token_buffer
, maxtoken
+ 2);
494 return token_buffer
+ offset
;
497 #if defined HANDLE_PRAGMA
498 /* Local versions of these macros, that can be passed as function pointers. */
513 /* At the beginning of a line, increment the line number
514 and process any #-directive on this line.
515 If the line is a #-directive, read the entire line and return a newline.
516 Otherwise, return the line's first non-whitespace character. */
526 /* Read first nonwhite char on the line. */
529 while (c
== ' ' || c
== '\t')
534 /* If not #, return it so caller will use it. */
538 /* Read first nonwhite char after the `#'. */
541 while (c
== ' ' || c
== '\t')
544 /* If a letter follows, then if the word here is `line', skip
545 it and ignore it; otherwise, ignore the line, with an error
546 if the word isn't `pragma', `ident', `define', or `undef'. */
548 if ((c
>= 'a' && c
<= 'z') || (c
>= 'A' && c
<= 'Z'))
557 && ((c
= GETC()) == ' ' || c
== '\t' || c
== '\n'
558 || whitespace_cr (c
) ))
560 while (c
== ' ' || c
== '\t' || whitespace_cr (c
))
565 #if defined HANDLE_PRAGMA || defined HANDLE_GENERIC_PRAGMAS
568 if (token
!= IDENTIFIER
)
570 #endif /* HANDLE_PRAGMA || HANDLE_GENERIC_PRAGMAS */
573 /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS (if
574 both are defined), in order to give the back end a chance to
575 override the interpretation of generic style pragmas. */
579 c
= nextchar
, nextchar
= -1;
582 #endif /* !USE_CPPLIB */
584 if (TREE_CODE (yylval
.ttype
) != IDENTIFIER_NODE
)
587 if (HANDLE_PRAGMA (pragma_getc
, pragma_ungetc
,
588 IDENTIFIER_POINTER (yylval
.ttype
)))
590 #endif /* HANDLE_PRAGMA */
592 #ifdef HANDLE_GENERIC_PRAGMAS
593 if (handle_generic_pragma (token
))
595 #endif /* HANDLE_GENERIC_PRAGMAS */
597 /* Issue a warning message if we have been asked to do so.
598 Ignoring unknown pragmas in system header file unless
599 an explcit -Wunknown-pragmas has been given. */
600 if (warn_unknown_pragmas
> 1
601 || (warn_unknown_pragmas
&& ! in_system_header
))
602 warning ("ignoring pragma: %s", token_buffer
);
615 && ((c
= GETC()) == ' ' || c
== '\t' || c
== '\n'))
618 debug_define (lineno
, GET_DIRECTIVE_LINE ());
628 && ((c
= GETC()) == ' ' || c
== '\t' || c
== '\n'))
631 debug_undef (lineno
, GET_DIRECTIVE_LINE ());
640 && ((c
= GETC()) == ' ' || c
== '\t'))
649 && ((c
= GETC()) == ' ' || c
== '\t'))
651 /* #ident. The pedantic warning is now in cccp.c. */
653 /* Here we have just seen `#ident '.
654 A string constant should follow. */
656 c
= skip_white_space_on_line ();
658 /* If no argument, ignore the line. */
665 || TREE_CODE (yylval
.ttype
) != STRING_CST
)
667 error ("invalid #ident");
673 #ifdef ASM_OUTPUT_IDENT
674 ASM_OUTPUT_IDENT (asm_out_file
, TREE_STRING_POINTER (yylval
.ttype
));
678 /* Skip the rest of this line. */
683 error ("undefined or invalid # directive");
688 /* Here we have either `#line' or `# <nonletter>'.
689 In either case, it should be a line number; a digit should follow. */
691 /* Can't use skip_white_space here, but must handle all whitespace
692 that is not '\n', lest we get a recursion for '\r' '\n' when
695 c
= skip_white_space_on_line ();
697 /* If the # is the only nonwhite char on the line,
698 just ignore it. Check the new newline. */
702 /* Something follows the #; read a token. */
707 if (token
== CONSTANT
708 && TREE_CODE (yylval
.ttype
) == INTEGER_CST
)
710 int old_lineno
= lineno
;
712 /* subtract one, because it is the following line that
713 gets the specified number */
715 int l
= TREE_INT_CST_LOW (yylval
.ttype
) - 1;
717 /* Is this the last nonwhite stuff on the line? */
718 c
= skip_white_space_on_line ();
721 /* No more: store the line number and check following line. */
727 /* More follows: it must be a string constant (filename). */
729 /* Read the string constant. */
732 if (token
!= STRING
|| TREE_CODE (yylval
.ttype
) != STRING_CST
)
734 error ("invalid #line");
739 = (char *) permalloc (TREE_STRING_LENGTH (yylval
.ttype
) + 1);
740 strcpy (input_filename
, TREE_STRING_POINTER (yylval
.ttype
));
743 /* Each change of file name
744 reinitializes whether we are now in a system header. */
745 in_system_header
= 0;
747 if (main_input_filename
== 0)
748 main_input_filename
= input_filename
;
750 /* Is this the last nonwhite stuff on the line? */
751 c
= skip_white_space_on_line ();
754 /* Update the name in the top element of input_file_stack. */
755 if (input_file_stack
)
756 input_file_stack
->name
= input_filename
;
765 /* `1' after file name means entering new file.
766 `2' after file name means just left a file. */
768 if (token
== CONSTANT
769 && TREE_CODE (yylval
.ttype
) == INTEGER_CST
)
771 if (TREE_INT_CST_LOW (yylval
.ttype
) == 1)
773 /* Pushing to a new file. */
775 = (struct file_stack
*) xmalloc (sizeof (struct file_stack
));
776 input_file_stack
->line
= old_lineno
;
777 p
->next
= input_file_stack
;
778 p
->name
= input_filename
;
779 p
->indent_level
= indent_level
;
780 input_file_stack
= p
;
781 input_file_stack_tick
++;
782 debug_start_source_file (input_filename
);
785 else if (TREE_INT_CST_LOW (yylval
.ttype
) == 2)
787 /* Popping out of a file. */
788 if (input_file_stack
->next
)
790 struct file_stack
*p
= input_file_stack
;
791 if (indent_level
!= p
->indent_level
)
793 warning_with_file_and_line
794 (p
->name
, old_lineno
,
795 "This file contains more `%c's than `%c's.",
796 indent_level
> p
->indent_level
? '{' : '}',
797 indent_level
> p
->indent_level
? '}' : '{');
799 input_file_stack
= p
->next
;
801 input_file_stack_tick
++;
802 debug_end_source_file (input_file_stack
->line
);
805 error ("#-lines for entering and leaving files don't match");
811 /* Now that we've pushed or popped the input stack,
812 update the name in the top element. */
813 if (input_file_stack
)
814 input_file_stack
->name
= input_filename
;
816 /* If we have handled a `1' or a `2',
817 see if there is another number to read. */
820 /* Is this the last nonwhite stuff on the line? */
821 c
= skip_white_space_on_line ();
830 /* `3' after file name means this is a system header file. */
832 if (token
== CONSTANT
833 && TREE_CODE (yylval
.ttype
) == INTEGER_CST
834 && TREE_INT_CST_LOW (yylval
.ttype
) == 3)
835 in_system_header
= 1, used_up
= 1;
839 /* Is this the last nonwhite stuff on the line? */
840 c
= skip_white_space_on_line ();
846 warning ("unrecognized text at end of #line");
849 error ("invalid #-line");
851 /* skip the rest of this line. */
854 if (c
!= '\n' && c
!= EOF
&& nextchar
>= 0)
855 c
= nextchar
, nextchar
= -1;
857 while (c
!= '\n' && c
!= EOF
)
862 #ifdef HANDLE_GENERIC_PRAGMAS
864 /* Handle a #pragma directive.
865 TOKEN is the token we read after `#pragma'. Processes the entire input
866 line and return non-zero iff the pragma has been successfully parsed. */
868 /* This function has to be in this file, in order to get at
872 handle_generic_pragma (token
)
885 handle_pragma_token (token_buffer
, yylval
.ttype
);
888 handle_pragma_token (token_buffer
, NULL
);
892 c
= nextchar
, nextchar
= -1;
897 while (c
== ' ' || c
== '\t')
901 if (c
== '\n' || c
== EOF
)
902 return handle_pragma_token (NULL
, NULL
);
908 #endif /* HANDLE_GENERIC_PRAGMAS */
910 #define ENDFILE -1 /* token that represents end-of-file */
912 /* Read an escape sequence, returning its equivalent as a character,
913 or store 1 in *ignore_ptr if it is backslash-newline. */
916 readescape (ignore_ptr
)
919 register int c
= GETC();
921 register unsigned count
;
922 unsigned firstdig
= 0;
928 if (warn_traditional
)
929 warning ("the meaning of `\\x' varies with -traditional");
931 if (flag_traditional
)
940 if (!(c
>= 'a' && c
<= 'f')
941 && !(c
>= 'A' && c
<= 'F')
942 && !(c
>= '0' && c
<= '9'))
948 if (c
>= 'a' && c
<= 'f')
949 code
+= c
- 'a' + 10;
950 if (c
>= 'A' && c
<= 'F')
951 code
+= c
- 'A' + 10;
952 if (c
>= '0' && c
<= '9')
954 if (code
!= 0 || count
!= 0)
963 error ("\\x used with no following hex digits");
965 /* Digits are all 0's. Ok. */
967 else if ((count
- 1) * 4 >= TYPE_PRECISION (integer_type_node
)
969 && (((unsigned)1 << (TYPE_PRECISION (integer_type_node
) - (count
- 1) * 4))
971 pedwarn ("hex escape out of range");
974 case '0': case '1': case '2': case '3': case '4':
975 case '5': case '6': case '7':
978 while ((c
<= '7') && (c
>= '0') && (count
++ < 3))
980 code
= (code
* 8) + (c
- '0');
986 case '\\': case '\'': case '"':
995 return TARGET_NEWLINE
;
1010 if (warn_traditional
)
1011 warning ("the meaning of `\\a' varies with -traditional");
1013 if (flag_traditional
)
1018 #if 0 /* Vertical tab is present in common usage compilers. */
1019 if (flag_traditional
)
1027 pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c
);
1033 /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */
1037 /* `\%' is used to prevent SCCS from getting confused. */
1040 pedwarn ("non-ANSI escape sequence `\\%c'", c
);
1043 if (c
>= 040 && c
< 0177)
1044 pedwarn ("unknown escape sequence `\\%c'", c
);
1046 pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c
);
1054 const char *string
= _(msgid
);
1056 /* We can't print string and character constants well
1057 because the token_buffer contains the result of processing escapes. */
1059 error ("%s at end of input", string
);
1060 else if (token_buffer
[0] == 0)
1061 error ("%s at null character", string
);
1062 else if (token_buffer
[0] == '"')
1063 error ("%s before string constant", string
);
1064 else if (token_buffer
[0] == '\'')
1065 error ("%s before character constant", string
);
1066 else if (token_buffer
[0] < 040 || (unsigned char) token_buffer
[0] >= 0177)
1067 error ("%s before character 0%o", string
, (unsigned char) token_buffer
[0]);
1069 error ("%s before `%s'", string
, token_buffer
);
1079 char long_long_flag
;
1082 struct try_type type_sequence
[] =
1084 { &integer_type_node
, 0, 0, 0},
1085 { &unsigned_type_node
, 1, 0, 0},
1086 { &long_integer_type_node
, 0, 1, 0},
1087 { &long_unsigned_type_node
, 1, 1, 0},
1088 { &long_long_integer_type_node
, 0, 1, 1},
1089 { &long_long_unsigned_type_node
, 1, 1, 1}
1102 int conversion_errno
;
1104 REAL_VALUE_TYPE value
;
1111 struct pf_args
* args
= (struct pf_args
*) data
;
1112 int fflag
= 0, lflag
= 0;
1113 /* Copy token_buffer now, while it has just the number
1114 and not the suffixes; once we add `f' or `i',
1115 REAL_VALUE_ATOF may not work any more. */
1116 char *copy
= (char *) alloca (args
->p
- token_buffer
+ 1);
1117 bcopy (token_buffer
, copy
, args
->p
- token_buffer
+ 1);
1123 /* Read the suffixes to choose a data type. */
1128 error ("more than one `f' in numeric constant");
1134 error ("more than one `l' in numeric constant");
1140 error ("more than one `i' or `j' in numeric constant");
1142 pedwarn ("ANSI C forbids imaginary numeric constants");
1153 if (args
->p
>= token_buffer
+ maxtoken
- 3)
1154 args
->p
= extend_token_buffer (args
->p
);
1155 *(args
->p
++) = args
->c
;
1160 /* The second argument, machine_mode, of REAL_VALUE_ATOF
1161 tells the desired precision of the binary result
1162 of decimal-to-binary conversion. */
1167 error ("both `f' and `l' in floating constant");
1169 args
->type
= float_type_node
;
1171 if (args
->base
== 16)
1172 args
->value
= REAL_VALUE_HTOF (copy
, TYPE_MODE (args
->type
));
1174 args
->value
= REAL_VALUE_ATOF (copy
, TYPE_MODE (args
->type
));
1175 args
->conversion_errno
= errno
;
1176 /* A diagnostic is required here by some ANSI C testsuites.
1177 This is not pedwarn, because some people don't want
1178 an error for this. */
1179 if (REAL_VALUE_ISINF (args
->value
) && pedantic
)
1180 warning ("floating point number exceeds range of `float'");
1184 args
->type
= long_double_type_node
;
1186 if (args
->base
== 16)
1187 args
->value
= REAL_VALUE_HTOF (copy
, TYPE_MODE (args
->type
));
1189 args
->value
= REAL_VALUE_ATOF (copy
, TYPE_MODE (args
->type
));
1190 args
->conversion_errno
= errno
;
1191 if (REAL_VALUE_ISINF (args
->value
) && pedantic
)
1192 warning ("floating point number exceeds range of `long double'");
1197 if (args
->base
== 16)
1198 args
->value
= REAL_VALUE_HTOF (copy
, TYPE_MODE (args
->type
));
1200 args
->value
= REAL_VALUE_ATOF (copy
, TYPE_MODE (args
->type
));
1201 args
->conversion_errno
= errno
;
1202 if (REAL_VALUE_ISINF (args
->value
) && pedantic
)
1203 warning ("floating point number exceeds range of `double'");
1218 c
= nextchar
, nextchar
= -1;
1223 /* Effectively do c = skip_white_space (c)
1224 but do it faster in the usual cases. */
1237 /* Call skip_white_space so we can warn if appropriate. */
1242 c
= skip_white_space (c
);
1244 goto found_nonwhite
;
1248 token_buffer
[0] = c
;
1249 token_buffer
[1] = 0;
1251 /* yylloc.first_line = lineno; */
1257 token_buffer
[0] = 0;
1262 /* Capital L may start a wide-string or wide-character constant. */
1264 register int c
= GETC();
1273 goto string_constant
;
1280 if (!doing_objc_thang
)
1287 /* '@' may start a constant string object. */
1288 register int c
= GETC ();
1292 goto string_constant
;
1295 /* Fall through to treat '@' as the start of an identifier. */
1298 case 'A': case 'B': case 'C': case 'D': case 'E':
1299 case 'F': case 'G': case 'H': case 'I': case 'J':
1300 case 'K': case 'M': case 'N': case 'O':
1301 case 'P': case 'Q': case 'R': case 'S': case 'T':
1302 case 'U': case 'V': case 'W': case 'X': case 'Y':
1304 case 'a': case 'b': case 'c': case 'd': case 'e':
1305 case 'f': case 'g': case 'h': case 'i': case 'j':
1306 case 'k': case 'l': case 'm': case 'n': case 'o':
1307 case 'p': case 'q': case 'r': case 's': case 't':
1308 case 'u': case 'v': case 'w': case 'x': case 'y':
1314 while (ISALNUM (c
) || c
== '_' || c
== '$' || c
== '@')
1316 /* Make sure this char really belongs in an identifier. */
1319 if (! dollars_in_ident
)
1320 error ("`$' in identifier");
1322 pedwarn ("`$' in identifier");
1325 if (p
>= token_buffer
+ maxtoken
)
1326 p
= extend_token_buffer (p
);
1342 /* Try to recognize a keyword. Uses minimum-perfect hash function */
1345 register struct resword
*ptr
;
1347 if ((ptr
= is_reserved_word (token_buffer
, p
- token_buffer
)))
1350 yylval
.ttype
= ridpointers
[(int) ptr
->rid
];
1351 value
= (int) ptr
->token
;
1353 /* Only return OBJECTNAME if it is a typedef. */
1354 if (doing_objc_thang
&& value
== OBJECTNAME
)
1356 lastiddecl
= lookup_name(yylval
.ttype
);
1358 if (lastiddecl
== NULL_TREE
1359 || TREE_CODE (lastiddecl
) != TYPE_DECL
)
1363 /* Even if we decided to recognize asm, still perhaps warn. */
1365 && (value
== ASM_KEYWORD
|| value
== TYPEOF
1366 || ptr
->rid
== RID_INLINE
)
1367 && token_buffer
[0] != '_')
1368 pedwarn ("ANSI does not permit the keyword `%s'",
1373 /* If we did not find a keyword, look for an identifier
1376 if (value
== IDENTIFIER
)
1378 if (token_buffer
[0] == '@')
1379 error("invalid identifier `%s'", token_buffer
);
1381 yylval
.ttype
= get_identifier (token_buffer
);
1382 lastiddecl
= lookup_name (yylval
.ttype
);
1384 if (lastiddecl
!= 0 && TREE_CODE (lastiddecl
) == TYPE_DECL
)
1386 /* A user-invisible read-only initialized variable
1387 should be replaced by its value.
1388 We handle only strings since that's the only case used in C. */
1389 else if (lastiddecl
!= 0 && TREE_CODE (lastiddecl
) == VAR_DECL
1390 && DECL_IGNORED_P (lastiddecl
)
1391 && TREE_READONLY (lastiddecl
)
1392 && DECL_INITIAL (lastiddecl
) != 0
1393 && TREE_CODE (DECL_INITIAL (lastiddecl
)) == STRING_CST
)
1395 tree stringval
= DECL_INITIAL (lastiddecl
);
1397 /* Copy the string value so that we won't clobber anything
1398 if we put something in the TREE_CHAIN of this one. */
1399 yylval
.ttype
= build_string (TREE_STRING_LENGTH (stringval
),
1400 TREE_STRING_POINTER (stringval
));
1403 else if (doing_objc_thang
)
1405 tree objc_interface_decl
= is_class_name (yylval
.ttype
);
1407 if (objc_interface_decl
)
1410 yylval
.ttype
= objc_interface_decl
;
1420 /* Check first for common special case: single-digit 0 or 1. */
1423 UNGETC (next_c
); /* Always undo this lookahead. */
1424 if (!ISALNUM (next_c
) && next_c
!= '.')
1426 token_buffer
[0] = (char)c
, token_buffer
[1] = '\0';
1427 yylval
.ttype
= (c
== '0') ? integer_zero_node
: integer_one_node
;
1433 case '2': case '3': case '4':
1434 case '5': case '6': case '7': case '8': case '9':
1439 int largest_digit
= 0;
1441 /* for multi-precision arithmetic,
1442 we actually store only HOST_BITS_PER_CHAR bits in each part.
1443 The number of parts is chosen so as to be sufficient to hold
1444 the enough bits to fit into the two HOST_WIDE_INTs that contain
1445 the integer value (this is always at least as many bits as are
1446 in a target `long long' value, but may be wider). */
1447 #define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
1448 int parts
[TOTAL_PARTS
];
1451 enum anon1
{ NOT_FLOAT
, AFTER_POINT
, TOO_MANY_POINTS
, AFTER_EXPON
}
1452 floatflag
= NOT_FLOAT
;
1454 for (count
= 0; count
< TOTAL_PARTS
; count
++)
1462 *p
++ = (c
= GETC());
1463 if ((c
== 'x') || (c
== 'X'))
1466 *p
++ = (c
= GETC());
1468 /* Leading 0 forces octal unless the 0 is the only digit. */
1469 else if (c
>= '0' && c
<= '9')
1478 /* Read all the digits-and-decimal-points. */
1481 || (ISALNUM (c
) && c
!= 'l' && c
!= 'L'
1482 && c
!= 'u' && c
!= 'U'
1483 && c
!= 'i' && c
!= 'I' && c
!= 'j' && c
!= 'J'
1484 && (floatflag
== NOT_FLOAT
|| ((c
!= 'f') && (c
!= 'F')))))
1488 if (base
== 16 && pedantic
)
1489 error ("floating constant may not be in radix 16");
1490 if (floatflag
== TOO_MANY_POINTS
)
1491 /* We have already emitted an error. Don't need another. */
1493 else if (floatflag
== AFTER_POINT
|| floatflag
== AFTER_EXPON
)
1495 error ("malformed floating constant");
1496 floatflag
= TOO_MANY_POINTS
;
1497 /* Avoid another error from atof by forcing all characters
1498 from here on to be ignored. */
1502 floatflag
= AFTER_POINT
;
1507 /* Accept '.' as the start of a floating-point number
1508 only when it is followed by a digit.
1509 Otherwise, unread the following non-digit
1510 and use the '.' as a structural token. */
1511 if (p
== token_buffer
+ 2 && !ISDIGIT (c
))
1522 error ("parse error at `..'");
1525 token_buffer
[1] = 0;
1532 /* It is not a decimal point.
1533 It should be a digit (perhaps a hex digit). */
1539 else if (base
<= 10)
1541 if (c
== 'e' || c
== 'E')
1544 floatflag
= AFTER_EXPON
;
1545 break; /* start of exponent */
1547 error ("nondigits in number and not hexadecimal");
1550 else if (base
== 16 && (c
== 'p' || c
== 'P'))
1552 floatflag
= AFTER_EXPON
;
1553 break; /* start of exponent */
1563 if (c
>= largest_digit
)
1567 for (count
= 0; count
< TOTAL_PARTS
; count
++)
1569 parts
[count
] *= base
;
1573 += (parts
[count
-1] >> HOST_BITS_PER_CHAR
);
1575 &= (1 << HOST_BITS_PER_CHAR
) - 1;
1581 /* If the extra highest-order part ever gets anything in it,
1582 the number is certainly too big. */
1583 if (parts
[TOTAL_PARTS
- 1] != 0)
1586 if (p
>= token_buffer
+ maxtoken
- 3)
1587 p
= extend_token_buffer (p
);
1588 *p
++ = (c
= GETC());
1593 error ("numeric constant with no digits");
1595 if (largest_digit
>= base
)
1596 error ("numeric constant contains digits beyond the radix");
1598 /* Remove terminating char from the token buffer and delimit the string */
1601 if (floatflag
!= NOT_FLOAT
)
1603 tree type
= double_type_node
;
1605 int conversion_errno
= 0;
1606 REAL_VALUE_TYPE value
;
1607 struct pf_args args
;
1609 /* Read explicit exponent if any, and put it in tokenbuf. */
1611 if ((base
== 10 && ((c
== 'e') || (c
== 'E')))
1612 || (base
== 16 && (c
== 'p' || c
== 'P')))
1614 if (p
>= token_buffer
+ maxtoken
- 3)
1615 p
= extend_token_buffer (p
);
1618 if ((c
== '+') || (c
== '-'))
1623 /* Exponent is decimal, even if string is a hex float. */
1625 error ("floating constant exponent has no digits");
1628 if (p
>= token_buffer
+ maxtoken
- 3)
1629 p
= extend_token_buffer (p
);
1634 if (base
== 16 && floatflag
!= AFTER_EXPON
)
1635 error ("hexadecimal floating constant has no exponent");
1639 /* Setup input for parse_float() */
1645 args
.conversion_errno
= conversion_errno
;
1647 /* Convert string to a double, checking for overflow. */
1648 if (do_float_handler (parse_float
, (PTR
) &args
))
1650 /* Receive output from parse_float() */
1655 /* We got an exception from parse_float() */
1656 error ("floating constant out of range");
1660 /* Receive output from parse_float() */
1664 conversion_errno
= args
.conversion_errno
;
1667 /* ERANGE is also reported for underflow,
1668 so test the value to distinguish overflow from that. */
1669 if (conversion_errno
== ERANGE
&& !flag_traditional
&& pedantic
1670 && (REAL_VALUES_LESS (dconst1
, value
)
1671 || REAL_VALUES_LESS (value
, dconstm1
)))
1672 warning ("floating point number exceeds range of `double'");
1675 /* If the result is not a number, assume it must have been
1676 due to some error message above, so silently convert
1678 if (REAL_VALUE_ISNAN (value
))
1681 /* Create a node with determined type and value. */
1683 yylval
.ttype
= build_complex (NULL_TREE
,
1684 convert (type
, integer_zero_node
),
1685 build_real (type
, value
));
1687 yylval
.ttype
= build_real (type
, value
);
1691 tree traditional_type
, ansi_type
, type
;
1692 HOST_WIDE_INT high
, low
;
1693 int spec_unsigned
= 0;
1695 int spec_long_long
= 0;
1699 traditional_type
= ansi_type
= type
= NULL_TREE
;
1702 if (c
== 'u' || c
== 'U')
1705 error ("two `u's in integer constant");
1708 else if (c
== 'l' || c
== 'L')
1713 error ("three `l's in integer constant");
1714 else if (pedantic
&& ! in_system_header
&& warn_long_long
)
1715 pedwarn ("ANSI C forbids long long integer constants");
1720 else if (c
== 'i' || c
== 'j' || c
== 'I' || c
== 'J')
1723 error ("more than one `i' or `j' in numeric constant");
1725 pedwarn ("ANSI C forbids imaginary numeric constants");
1730 if (p
>= token_buffer
+ maxtoken
- 3)
1731 p
= extend_token_buffer (p
);
1736 /* If it won't fit in the host's representation for integers,
1741 pedwarn ("integer constant out of range");
1743 /* This is simplified by the fact that our constant
1744 is always positive. */
1748 for (i
= 0; i
< HOST_BITS_PER_WIDE_INT
/ HOST_BITS_PER_CHAR
; i
++)
1750 high
|= ((HOST_WIDE_INT
) parts
[i
+ (HOST_BITS_PER_WIDE_INT
1751 / HOST_BITS_PER_CHAR
)]
1752 << (i
* HOST_BITS_PER_CHAR
));
1753 low
|= (HOST_WIDE_INT
) parts
[i
] << (i
* HOST_BITS_PER_CHAR
);
1756 yylval
.ttype
= build_int_2 (low
, high
);
1757 TREE_TYPE (yylval
.ttype
) = long_long_unsigned_type_node
;
1759 /* If warn_traditional, calculate both the ANSI type and the
1760 traditional type, then see if they disagree.
1761 Otherwise, calculate only the type for the dialect in use. */
1762 if (warn_traditional
|| flag_traditional
)
1764 /* Calculate the traditional type. */
1765 /* Traditionally, any constant is signed;
1766 but if unsigned is specified explicitly, obey that.
1767 Use the smallest size with the right number of bits,
1768 except for one special case with decimal constants. */
1769 if (! spec_long
&& base
!= 10
1770 && int_fits_type_p (yylval
.ttype
, unsigned_type_node
))
1771 traditional_type
= (spec_unsigned
? unsigned_type_node
1772 : integer_type_node
);
1773 /* A decimal constant must be long
1774 if it does not fit in type int.
1775 I think this is independent of whether
1776 the constant is signed. */
1777 else if (! spec_long
&& base
== 10
1778 && int_fits_type_p (yylval
.ttype
, integer_type_node
))
1779 traditional_type
= (spec_unsigned
? unsigned_type_node
1780 : integer_type_node
);
1781 else if (! spec_long_long
)
1782 traditional_type
= (spec_unsigned
? long_unsigned_type_node
1783 : long_integer_type_node
);
1785 traditional_type
= (spec_unsigned
1786 ? long_long_unsigned_type_node
1787 : long_long_integer_type_node
);
1789 if (warn_traditional
|| ! flag_traditional
)
1791 /* Calculate the ANSI type. */
1792 if (! spec_long
&& ! spec_unsigned
1793 && int_fits_type_p (yylval
.ttype
, integer_type_node
))
1794 ansi_type
= integer_type_node
;
1795 else if (! spec_long
&& (base
!= 10 || spec_unsigned
)
1796 && int_fits_type_p (yylval
.ttype
, unsigned_type_node
))
1797 ansi_type
= unsigned_type_node
;
1798 else if (! spec_unsigned
&& !spec_long_long
1799 && int_fits_type_p (yylval
.ttype
, long_integer_type_node
))
1800 ansi_type
= long_integer_type_node
;
1801 else if (! spec_long_long
1802 && int_fits_type_p (yylval
.ttype
,
1803 long_unsigned_type_node
))
1804 ansi_type
= long_unsigned_type_node
;
1805 else if (! spec_unsigned
1806 && int_fits_type_p (yylval
.ttype
,
1807 long_long_integer_type_node
))
1808 ansi_type
= long_long_integer_type_node
;
1810 ansi_type
= long_long_unsigned_type_node
;
1813 type
= flag_traditional
? traditional_type
: ansi_type
;
1815 if (warn_traditional
&& traditional_type
!= ansi_type
)
1817 if (TYPE_PRECISION (traditional_type
)
1818 != TYPE_PRECISION (ansi_type
))
1819 warning ("width of integer constant changes with -traditional");
1820 else if (TREE_UNSIGNED (traditional_type
)
1821 != TREE_UNSIGNED (ansi_type
))
1822 warning ("integer constant is unsigned in ANSI C, signed with -traditional");
1824 warning ("width of integer constant may change on other systems with -traditional");
1827 if (pedantic
&& !flag_traditional
&& !spec_long_long
&& !warn
1828 && (TYPE_PRECISION (long_integer_type_node
)
1829 < TYPE_PRECISION (type
)))
1832 pedwarn ("integer constant out of range");
1835 if (base
== 10 && ! spec_unsigned
&& TREE_UNSIGNED (type
))
1836 warning ("decimal constant is so large that it is unsigned");
1840 if (TYPE_PRECISION (type
)
1841 <= TYPE_PRECISION (integer_type_node
))
1843 = build_complex (NULL_TREE
, integer_zero_node
,
1844 convert (integer_type_node
,
1847 error ("complex integer constant is too wide for `complex int'");
1849 else if (flag_traditional
&& !int_fits_type_p (yylval
.ttype
, type
))
1850 /* The traditional constant 0x80000000 is signed
1851 but doesn't fit in the range of int.
1852 This will change it to -0x80000000, which does fit. */
1854 TREE_TYPE (yylval
.ttype
) = unsigned_type (type
);
1855 yylval
.ttype
= convert (type
, yylval
.ttype
);
1856 TREE_OVERFLOW (yylval
.ttype
)
1857 = TREE_CONSTANT_OVERFLOW (yylval
.ttype
) = 0;
1860 TREE_TYPE (yylval
.ttype
) = type
;
1863 /* If it's still an integer (not a complex), and it doesn't
1864 fit in the type we choose for it, then pedwarn. */
1867 && TREE_CODE (TREE_TYPE (yylval
.ttype
)) == INTEGER_TYPE
1868 && ! int_fits_type_p (yylval
.ttype
, TREE_TYPE (yylval
.ttype
)))
1869 pedwarn ("integer constant out of range");
1875 if (ISALNUM (c
) || c
== '.' || c
== '_' || c
== '$'
1876 || (!flag_traditional
&& (c
== '-' || c
== '+')
1877 && (p
[-1] == 'e' || p
[-1] == 'E')))
1878 error ("missing white space after number `%s'", token_buffer
);
1880 value
= CONSTANT
; break;
1886 register int result
= 0;
1887 register int num_chars
= 0;
1889 unsigned width
= TYPE_PRECISION (char_type_node
);
1891 #ifdef MULTIBYTE_CHARS
1892 int longest_char
= local_mb_cur_max ();
1893 (void) local_mbtowc (NULL_PTR
, NULL_PTR
, 0);
1896 max_chars
= TYPE_PRECISION (integer_type_node
) / width
;
1898 width
= WCHAR_TYPE_SIZE
;
1905 if (c
== '\'' || c
== EOF
)
1912 c
= readescape (&ignore
);
1915 if (width
< HOST_BITS_PER_INT
1916 && (unsigned) c
>= ((unsigned)1 << width
))
1917 pedwarn ("escape sequence out of range for character");
1918 #ifdef MAP_CHARACTER
1920 c
= MAP_CHARACTER (c
);
1926 pedwarn ("ANSI C forbids newline in character constant");
1931 #ifdef MULTIBYTE_CHARS
1935 for (i
= 1; i
<= longest_char
; ++i
)
1937 if (i
> maxtoken
- 4)
1938 extend_token_buffer (token_buffer
);
1940 token_buffer
[i
] = c
;
1941 char_len
= local_mbtowc (& wc
,
1950 /* mbtowc sometimes needs an extra char before accepting */
1955 /* Merge character into result; ignore excess chars. */
1956 for (i
= 1; i
<= char_len
; ++i
)
1960 if (width
< HOST_BITS_PER_INT
)
1961 result
= (result
<< width
)
1963 & ((1 << width
) - 1));
1965 result
= token_buffer
[i
];
1967 num_chars
+= char_len
;
1975 warning ("Ignoring invalid multibyte character");
1978 #ifdef MAP_CHARACTER
1980 c
= MAP_CHARACTER (c
);
1983 #else /* ! MULTIBYTE_CHARS */
1984 #ifdef MAP_CHARACTER
1985 c
= MAP_CHARACTER (c
);
1987 #endif /* ! MULTIBYTE_CHARS */
1992 if (chars_seen
== 1) /* only keep the first one */
1997 /* Merge character into result; ignore excess chars. */
1998 num_chars
+= (width
/ TYPE_PRECISION (char_type_node
));
1999 if (num_chars
< max_chars
+ 1)
2001 if (width
< HOST_BITS_PER_INT
)
2002 result
= (result
<< width
) | (c
& ((1 << width
) - 1));
2009 error ("malformatted character constant");
2010 else if (chars_seen
== 0)
2011 error ("empty character constant");
2012 else if (num_chars
> max_chars
)
2014 num_chars
= max_chars
;
2015 error ("character constant too long");
2017 else if (chars_seen
!= 1 && ! flag_traditional
&& warn_multichar
)
2018 warning ("multi-character character constant");
2020 /* If char type is signed, sign-extend the constant. */
2023 int num_bits
= num_chars
* width
;
2025 /* We already got an error; avoid invalid shift. */
2026 yylval
.ttype
= build_int_2 (0, 0);
2027 else if (TREE_UNSIGNED (char_type_node
)
2028 || ((result
>> (num_bits
- 1)) & 1) == 0)
2030 = build_int_2 (result
& (~(unsigned HOST_WIDE_INT
) 0
2031 >> (HOST_BITS_PER_WIDE_INT
- num_bits
)),
2035 = build_int_2 (result
| ~(~(unsigned HOST_WIDE_INT
) 0
2036 >> (HOST_BITS_PER_WIDE_INT
- num_bits
)),
2038 TREE_TYPE (yylval
.ttype
) = integer_type_node
;
2042 yylval
.ttype
= build_int_2 (result
, 0);
2043 TREE_TYPE (yylval
.ttype
) = wchar_type_node
;
2053 unsigned width
= wide_flag
? WCHAR_TYPE_SIZE
2054 : TYPE_PRECISION (char_type_node
);
2055 #ifdef MULTIBYTE_CHARS
2056 int longest_char
= local_mb_cur_max ();
2057 (void) local_mbtowc (NULL_PTR
, NULL_PTR
, 0);
2060 p
= token_buffer
+ 1;
2062 while (c
!= '"' && c
>= 0)
2067 c
= readescape (&ignore
);
2070 if (width
< HOST_BITS_PER_INT
2071 && (unsigned) c
>= ((unsigned)1 << width
))
2072 pedwarn ("escape sequence out of range for character");
2077 pedwarn ("ANSI C forbids newline in string constant");
2082 #ifdef MULTIBYTE_CHARS
2086 for (i
= 0; i
< longest_char
; ++i
)
2088 if (p
+ i
>= token_buffer
+ maxtoken
)
2089 p
= extend_token_buffer (p
);
2092 char_len
= local_mbtowc (& wc
, p
, i
+ 1);
2098 warning ("Ignoring invalid multibyte character");
2101 /* mbtowc sometimes needs an extra char before accepting */
2112 #endif /* MULTIBYTE_CHARS */
2115 /* Add this single character into the buffer either as a wchar_t
2116 or as a single byte. */
2119 unsigned width
= TYPE_PRECISION (char_type_node
);
2120 unsigned bytemask
= (1 << width
) - 1;
2123 if (p
+ WCHAR_BYTES
> token_buffer
+ maxtoken
)
2124 p
= extend_token_buffer (p
);
2126 for (byte
= 0; byte
< WCHAR_BYTES
; ++byte
)
2129 if (byte
>= (int) sizeof (c
))
2132 value
= (c
>> (byte
* width
)) & bytemask
;
2133 if (BYTES_BIG_ENDIAN
)
2134 p
[WCHAR_BYTES
- byte
- 1] = value
;
2142 if (p
>= token_buffer
+ maxtoken
)
2143 p
= extend_token_buffer (p
);
2151 /* Terminate the string value, either with a single byte zero
2152 or with a wide zero. */
2155 if (p
+ WCHAR_BYTES
> token_buffer
+ maxtoken
)
2156 p
= extend_token_buffer (p
);
2157 bzero (p
, WCHAR_BYTES
);
2162 if (p
>= token_buffer
+ maxtoken
)
2163 p
= extend_token_buffer (p
);
2168 error ("Unterminated string constant");
2170 /* We have read the entire constant.
2171 Construct a STRING_CST for the result. */
2175 yylval
.ttype
= build_string (p
- (token_buffer
+ 1),
2177 TREE_TYPE (yylval
.ttype
) = wchar_array_type_node
;
2182 /* Return an Objective-C @"..." constant string object. */
2183 yylval
.ttype
= build_objc_string (p
- (token_buffer
+ 1),
2185 TREE_TYPE (yylval
.ttype
) = char_array_type_node
;
2186 value
= OBJC_STRING
;
2190 yylval
.ttype
= build_string (p
- (token_buffer
+ 1),
2192 TREE_TYPE (yylval
.ttype
) = char_array_type_node
;
2220 yylval
.code
= PLUS_EXPR
; break;
2222 yylval
.code
= MINUS_EXPR
; break;
2224 yylval
.code
= BIT_AND_EXPR
; break;
2226 yylval
.code
= BIT_IOR_EXPR
; break;
2228 yylval
.code
= MULT_EXPR
; break;
2230 yylval
.code
= TRUNC_DIV_EXPR
; break;
2232 yylval
.code
= TRUNC_MOD_EXPR
; break;
2234 yylval
.code
= BIT_XOR_EXPR
; break;
2236 yylval
.code
= LSHIFT_EXPR
; break;
2238 yylval
.code
= RSHIFT_EXPR
; break;
2240 yylval
.code
= LT_EXPR
; break;
2242 yylval
.code
= GT_EXPR
; break;
2245 token_buffer
[1] = c1
= GETC();
2246 token_buffer
[2] = 0;
2253 value
= ARITHCOMPARE
; yylval
.code
= LE_EXPR
; goto done
;
2255 value
= ARITHCOMPARE
; yylval
.code
= GE_EXPR
; goto done
;
2257 value
= EQCOMPARE
; yylval
.code
= NE_EXPR
; goto done
;
2259 value
= EQCOMPARE
; yylval
.code
= EQ_EXPR
; goto done
;
2261 value
= ASSIGN
; goto done
;
2267 value
= PLUSPLUS
; goto done
;
2269 value
= MINUSMINUS
; goto done
;
2271 value
= ANDAND
; goto done
;
2273 value
= OROR
; goto done
;
2286 { value
= POINTSAT
; goto done
; }
2290 { value
= ']'; goto done
; }
2294 { value
= '{'; indent_level
++; goto done
; }
2296 { value
= '['; goto done
; }
2300 { value
= '}'; indent_level
--; goto done
; }
2304 token_buffer
[1] = 0;
2306 if ((c
== '<') || (c
== '>'))
2307 value
= ARITHCOMPARE
;
2313 /* Don't make yyparse think this is eof. */
2332 /* yylloc.last_line = lineno; */
2337 /* Sets the value of the 'yydebug' variable to VALUE.
2338 This is a function so we don't have to have YYDEBUG defined
2339 in order to build the compiler. */
2348 warning ("YYDEBUG not defined.");