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;
52 extern int errorcount;
54 /* Stream for reading from the input file. */
58 extern void yyprint PROTO((FILE *, int, YYSTYPE));
60 /* The elements of `ridpointers' are identifier nodes
61 for the reserved type names and storage classes.
62 It is indexed by a RID_... value. */
63 tree ridpointers[(int) RID_MAX];
65 /* Cause the `yydebug' variable to be defined. */
69 extern unsigned char *yy_cur, *yy_lim;
71 extern int yy_get_token ();
73 #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
74 #define UNGETC(c) ((c) == EOF ? 0 : yy_cur--)
76 #else /* ! USE_CPPLIB */
78 #define GETC() getch ()
79 #define UNGETC(c) put_back (c)
81 struct putback_buffer {
87 static struct putback_buffer putback = {NULL, 0, -1};
92 if (putback.index != -1)
94 int ch = putback.buffer[putback.index];
107 if (putback.index == putback.buffer_size - 1)
109 putback.buffer_size += 16;
110 putback.buffer = xrealloc (putback.buffer, putback.buffer_size);
112 putback.buffer[++putback.index] = ch;
115 #endif /* ! USE_CPPLIB */
117 /* the declaration found for the last IDENTIFIER token read in.
118 yylex must look this up to detect typedefs, which get token type TYPENAME,
119 so it is left around in case the identifier is not a typedef but is
120 used in a context which makes it a reference to a variable. */
123 /* Nonzero enables objc features. */
125 int doing_objc_thang;
129 /* File used for outputting assembler code. */
130 extern FILE *asm_out_file;
132 #ifndef WCHAR_TYPE_SIZE
134 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
136 #define WCHAR_TYPE_SIZE BITS_PER_WORD
140 /* Number of bytes in a wide character. */
141 #define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
143 static int maxtoken; /* Current nominal length of token buffer. */
144 char *token_buffer; /* Pointer to token buffer.
145 Actual allocated length is maxtoken + 2.
146 This is not static because objc-parse.y uses it. */
148 static int indent_level = 0; /* Number of { minus number of }. */
150 /* Nonzero if end-of-file has been seen on input. */
151 static int end_of_file;
154 /* Buffered-back input character; faster than using ungetc. */
155 static int nextchar = -1;
158 #ifdef HANDLE_GENERIC_PRAGMAS
159 static int handle_generic_pragma PROTO((int));
160 #endif /* HANDLE_GENERIC_PRAGMAS */
161 static int whitespace_cr PROTO((int));
162 static int skip_white_space PROTO((int));
163 static int skip_white_space_on_line PROTO((void));
164 static char *extend_token_buffer PROTO((const char *));
165 static int readescape PROTO((int *));
166 static void parse_float PROTO((PTR));
168 /* Do not insert generated code into the source, instead, include it.
169 This allows us to build gcc automatically even for targets that
170 need to add or modify the reserved keyword lists. */
173 /* Return something to represent absolute declarators containing a *.
174 TARGET is the absolute declarator that the * contains.
175 TYPE_QUALS is a list of modifiers such as const or volatile
176 to apply to the pointer type, represented as identifiers.
178 We return an INDIRECT_REF whose "contents" are TARGET
179 and whose type is the modifier list. */
182 make_pointer_declarator (type_quals, target)
183 tree type_quals, target;
185 return build1 (INDIRECT_REF, type_quals, target);
189 forget_protocol_qualifiers ()
191 int i, n = sizeof wordlist / sizeof (struct resword);
193 for (i = 0; i < n; i++)
194 if ((int) wordlist[i].rid >= (int) RID_IN
195 && (int) wordlist[i].rid <= (int) RID_ONEWAY)
196 wordlist[i].name = "";
200 remember_protocol_qualifiers ()
202 int i, n = sizeof wordlist / sizeof (struct resword);
204 for (i = 0; i < n; i++)
205 if (wordlist[i].rid == RID_IN)
206 wordlist[i].name = "in";
207 else if (wordlist[i].rid == RID_OUT)
208 wordlist[i].name = "out";
209 else if (wordlist[i].rid == RID_INOUT)
210 wordlist[i].name = "inout";
211 else if (wordlist[i].rid == RID_BYCOPY)
212 wordlist[i].name = "bycopy";
213 else if (wordlist[i].rid == RID_BYREF)
214 wordlist[i].name = "byref";
215 else if (wordlist[i].rid == RID_ONEWAY)
216 wordlist[i].name = "oneway";
220 init_parse (filename)
224 /* Open input file. */
225 if (filename == 0 || !strcmp (filename, "-"))
231 finput = fopen (filename, "r");
233 pfatal_with_name (filename);
235 #ifdef IO_BUFFER_SIZE
236 setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
238 #else /* !USE_CPPLIB */
239 parse_in.show_column = 1;
240 if (! cpp_start_read (&parse_in, filename))
243 if (filename == 0 || !strcmp (filename, "-"))
246 /* cpp_start_read always puts at least one line directive into the
247 token buffer. We must arrange to read it out here. */
248 yy_cur = parse_in.token_buffer;
249 yy_lim = CPP_PWRITTEN (&parse_in);
261 cpp_finish (&parse_in);
262 errorcount += parse_in.errors;
271 /* Make identifier nodes long enough for the language-specific slots. */
272 set_identifier_size (sizeof (struct lang_identifier));
274 /* Start it at 0, because check_newline is called at the very beginning
275 and will increment it to 1. */
278 #ifdef MULTIBYTE_CHARS
279 /* Change to the native locale for multibyte conversions. */
280 setlocale (LC_CTYPE, "");
281 literal_codeset = getenv ("LANG");
285 token_buffer = (char *) xmalloc (maxtoken + 2);
287 ridpointers[(int) RID_INT] = get_identifier ("int");
288 ridpointers[(int) RID_CHAR] = get_identifier ("char");
289 ridpointers[(int) RID_VOID] = get_identifier ("void");
290 ridpointers[(int) RID_FLOAT] = get_identifier ("float");
291 ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
292 ridpointers[(int) RID_SHORT] = get_identifier ("short");
293 ridpointers[(int) RID_LONG] = get_identifier ("long");
294 ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
295 ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
296 ridpointers[(int) RID_INLINE] = get_identifier ("inline");
297 ridpointers[(int) RID_CONST] = get_identifier ("const");
298 ridpointers[(int) RID_RESTRICT] = get_identifier ("restrict");
299 ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
300 ridpointers[(int) RID_AUTO] = get_identifier ("auto");
301 ridpointers[(int) RID_STATIC] = get_identifier ("static");
302 ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
303 ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
304 ridpointers[(int) RID_REGISTER] = get_identifier ("register");
305 ridpointers[(int) RID_ITERATOR] = get_identifier ("iterator");
306 ridpointers[(int) RID_COMPLEX] = get_identifier ("complex");
307 ridpointers[(int) RID_ID] = get_identifier ("id");
308 ridpointers[(int) RID_IN] = get_identifier ("in");
309 ridpointers[(int) RID_OUT] = get_identifier ("out");
310 ridpointers[(int) RID_INOUT] = get_identifier ("inout");
311 ridpointers[(int) RID_BYCOPY] = get_identifier ("bycopy");
312 ridpointers[(int) RID_BYREF] = get_identifier ("byref");
313 ridpointers[(int) RID_ONEWAY] = get_identifier ("oneway");
314 forget_protocol_qualifiers();
316 /* Some options inhibit certain reserved words.
317 Clear those words out of the hash table so they won't be recognized. */
318 #define UNSET_RESERVED_WORD(STRING) \
319 do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
320 if (s) s->name = ""; } while (0)
322 if (! doing_objc_thang)
323 UNSET_RESERVED_WORD ("id");
325 if (flag_traditional)
327 UNSET_RESERVED_WORD ("const");
328 UNSET_RESERVED_WORD ("restrict");
329 UNSET_RESERVED_WORD ("volatile");
330 UNSET_RESERVED_WORD ("typeof");
331 UNSET_RESERVED_WORD ("signed");
332 UNSET_RESERVED_WORD ("inline");
333 UNSET_RESERVED_WORD ("iterator");
334 UNSET_RESERVED_WORD ("complex");
336 else if (!flag_isoc9x)
337 UNSET_RESERVED_WORD ("restrict");
341 UNSET_RESERVED_WORD ("asm");
342 UNSET_RESERVED_WORD ("typeof");
343 UNSET_RESERVED_WORD ("inline");
344 UNSET_RESERVED_WORD ("iterator");
345 UNSET_RESERVED_WORD ("complex");
350 reinit_parse_for_function ()
354 /* Function used when yydebug is set, to print a token in more detail. */
357 yyprint (file, yychar, yylval)
369 if (IDENTIFIER_POINTER (t))
370 fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
375 if (TREE_CODE (t) == INTEGER_CST)
377 #if HOST_BITS_PER_WIDE_INT == 64
378 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
381 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
388 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
394 TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
399 /* Iff C is a carriage return, warn about it - if appropriate -
400 and return nonzero. */
405 static int newline_warning = 0;
409 /* ANSI C says the effects of a carriage return in a source file
411 if (pedantic && !newline_warning)
413 warning ("carriage return in source file");
414 warning ("(we only warn about the first carriage return)");
422 /* If C is not whitespace, return C.
423 Otherwise skip whitespace and return first nonwhite char read. */
433 /* We don't recognize comments here, because
434 cpp output can include / and * consecutively as operators.
435 Also, there's no need, since cpp removes all comments. */
438 c = check_newline ();
459 error ("stray '\\' in program");
469 /* Skips all of the white space at the current location in the input file.
470 Must use and reset nextchar if it has the next character. */
473 position_after_white_space ()
479 c = nextchar, nextchar = -1;
484 UNGETC (skip_white_space (c));
487 /* Like skip_white_space, but don't advance beyond the end of line.
488 Moreover, we don't get passed a character to start with. */
490 skip_white_space_on_line ()
519 /* Make the token buffer longer, preserving the data in it.
520 P should point to just beyond the last valid character in the old buffer.
521 The value we return is a pointer to the new buffer
522 at a place corresponding to P. */
525 extend_token_buffer (p)
528 int offset = p - token_buffer;
530 maxtoken = maxtoken * 2 + 10;
531 token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
533 return token_buffer + offset;
536 #if defined HANDLE_PRAGMA
537 /* Local versions of these macros, that can be passed as function pointers. */
552 /* At the beginning of a line, increment the line number
553 and process any #-directive on this line.
554 If the line is a #-directive, read the entire line and return a newline.
555 Otherwise, return the line's first non-whitespace character. */
565 /* Read first nonwhite char on the line. */
568 while (c == ' ' || c == '\t')
573 /* If not #, return it so caller will use it. */
577 /* Read first nonwhite char after the `#'. */
580 while (c == ' ' || c == '\t')
583 /* If a letter follows, then if the word here is `line', skip
584 it and ignore it; otherwise, ignore the line, with an error
585 if the word isn't `pragma', `ident', `define', or `undef'. */
587 if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
596 && ((c = GETC()) == ' ' || c == '\t' || c == '\n'
597 || whitespace_cr (c) ))
599 while (c == ' ' || c == '\t' || whitespace_cr (c))
604 #if defined HANDLE_PRAGMA || defined HANDLE_GENERIC_PRAGMAS
607 if (token != IDENTIFIER)
609 #endif /* HANDLE_PRAGMA || HANDLE_GENERIC_PRAGMAS */
612 /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS (if
613 both are defined), in order to give the back end a chance to
614 override the interpretation of generic style pragmas. */
618 c = nextchar, nextchar = -1;
621 #endif /* !USE_CPPLIB */
623 if (TREE_CODE (yylval.ttype) != IDENTIFIER_NODE)
626 if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
627 IDENTIFIER_POINTER (yylval.ttype)))
629 #endif /* HANDLE_PRAGMA */
631 #ifdef HANDLE_GENERIC_PRAGMAS
632 if (handle_generic_pragma (token))
634 #endif /* HANDLE_GENERIC_PRAGMAS */
636 /* Issue a warning message if we have been asked to do so.
637 Ignoring unknown pragmas in system header file unless
638 an explcit -Wunknown-pragmas has been given. */
639 if (warn_unknown_pragmas > 1
640 || (warn_unknown_pragmas && ! in_system_header))
641 warning ("ignoring pragma: %s", token_buffer);
654 && ((c = GETC()) == ' ' || c == '\t' || c == '\n'))
657 debug_define (lineno, GET_DIRECTIVE_LINE ());
667 && ((c = GETC()) == ' ' || c == '\t' || c == '\n'))
670 debug_undef (lineno, GET_DIRECTIVE_LINE ());
679 && ((c = GETC()) == ' ' || c == '\t'))
688 && ((c = GETC()) == ' ' || c == '\t'))
690 /* #ident. The pedantic warning is now in cccp.c. */
692 /* Here we have just seen `#ident '.
693 A string constant should follow. */
695 c = skip_white_space_on_line ();
697 /* If no argument, ignore the line. */
704 || TREE_CODE (yylval.ttype) != STRING_CST)
706 error ("invalid #ident");
712 #ifdef ASM_OUTPUT_IDENT
713 ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
717 /* Skip the rest of this line. */
722 error ("undefined or invalid # directive");
727 /* Here we have either `#line' or `# <nonletter>'.
728 In either case, it should be a line number; a digit should follow. */
730 /* Can't use skip_white_space here, but must handle all whitespace
731 that is not '\n', lest we get a recursion for '\r' '\n' when
734 c = skip_white_space_on_line ();
736 /* If the # is the only nonwhite char on the line,
737 just ignore it. Check the new newline. */
741 /* Something follows the #; read a token. */
746 if (token == CONSTANT
747 && TREE_CODE (yylval.ttype) == INTEGER_CST)
749 int old_lineno = lineno;
751 /* subtract one, because it is the following line that
752 gets the specified number */
754 int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
756 /* Is this the last nonwhite stuff on the line? */
757 c = skip_white_space_on_line ();
760 /* No more: store the line number and check following line. */
766 /* More follows: it must be a string constant (filename). */
768 /* Read the string constant. */
771 if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
773 error ("invalid #line");
778 = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
779 strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
782 /* Each change of file name
783 reinitializes whether we are now in a system header. */
784 in_system_header = 0;
786 if (main_input_filename == 0)
787 main_input_filename = input_filename;
789 /* Is this the last nonwhite stuff on the line? */
790 c = skip_white_space_on_line ();
793 /* Update the name in the top element of input_file_stack. */
794 if (input_file_stack)
795 input_file_stack->name = input_filename;
804 /* `1' after file name means entering new file.
805 `2' after file name means just left a file. */
807 if (token == CONSTANT
808 && TREE_CODE (yylval.ttype) == INTEGER_CST)
810 if (TREE_INT_CST_LOW (yylval.ttype) == 1)
812 /* Pushing to a new file. */
814 = (struct file_stack *) xmalloc (sizeof (struct file_stack));
815 input_file_stack->line = old_lineno;
816 p->next = input_file_stack;
817 p->name = input_filename;
818 p->indent_level = indent_level;
819 input_file_stack = p;
820 input_file_stack_tick++;
821 debug_start_source_file (input_filename);
824 else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
826 /* Popping out of a file. */
827 if (input_file_stack->next)
829 struct file_stack *p = input_file_stack;
830 if (indent_level != p->indent_level)
832 warning_with_file_and_line
833 (p->name, old_lineno,
834 "This file contains more `%c's than `%c's.",
835 indent_level > p->indent_level ? '{' : '}',
836 indent_level > p->indent_level ? '}' : '{');
838 input_file_stack = p->next;
840 input_file_stack_tick++;
841 debug_end_source_file (input_file_stack->line);
844 error ("#-lines for entering and leaving files don't match");
850 /* Now that we've pushed or popped the input stack,
851 update the name in the top element. */
852 if (input_file_stack)
853 input_file_stack->name = input_filename;
855 /* If we have handled a `1' or a `2',
856 see if there is another number to read. */
859 /* Is this the last nonwhite stuff on the line? */
860 c = skip_white_space_on_line ();
869 /* `3' after file name means this is a system header file. */
871 if (token == CONSTANT
872 && TREE_CODE (yylval.ttype) == INTEGER_CST
873 && TREE_INT_CST_LOW (yylval.ttype) == 3)
874 in_system_header = 1, used_up = 1;
878 /* Is this the last nonwhite stuff on the line? */
879 c = skip_white_space_on_line ();
885 warning ("unrecognized text at end of #line");
888 error ("invalid #-line");
890 /* skip the rest of this line. */
893 if (c != '\n' && c != EOF && nextchar >= 0)
894 c = nextchar, nextchar = -1;
896 while (c != '\n' && c != EOF)
901 #ifdef HANDLE_GENERIC_PRAGMAS
903 /* Handle a #pragma directive.
904 TOKEN is the token we read after `#pragma'. Processes the entire input
905 line and return non-zero iff the pragma has been successfully parsed. */
907 /* This function has to be in this file, in order to get at
911 handle_generic_pragma (token)
924 handle_pragma_token (token_buffer, yylval.ttype);
927 handle_pragma_token (token_buffer, NULL);
931 c = nextchar, nextchar = -1;
936 while (c == ' ' || c == '\t')
940 if (c == '\n' || c == EOF)
941 return handle_pragma_token (NULL, NULL);
947 #endif /* HANDLE_GENERIC_PRAGMAS */
949 #define ENDFILE -1 /* token that represents end-of-file */
951 /* Read an escape sequence, returning its equivalent as a character,
952 or store 1 in *ignore_ptr if it is backslash-newline. */
955 readescape (ignore_ptr)
958 register int c = GETC();
960 register unsigned count;
961 unsigned firstdig = 0;
967 if (warn_traditional)
968 warning ("the meaning of `\\x' varies with -traditional");
970 if (flag_traditional)
979 if (!(c >= 'a' && c <= 'f')
980 && !(c >= 'A' && c <= 'F')
981 && !(c >= '0' && c <= '9'))
987 if (c >= 'a' && c <= 'f')
988 code += c - 'a' + 10;
989 if (c >= 'A' && c <= 'F')
990 code += c - 'A' + 10;
991 if (c >= '0' && c <= '9')
993 if (code != 0 || count != 0)
1002 error ("\\x used with no following hex digits");
1003 else if (count == 0)
1004 /* Digits are all 0's. Ok. */
1006 else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
1008 && (((unsigned)1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
1010 pedwarn ("hex escape out of range");
1013 case '0': case '1': case '2': case '3': case '4':
1014 case '5': case '6': case '7':
1017 while ((c <= '7') && (c >= '0') && (count++ < 3))
1019 code = (code * 8) + (c - '0');
1025 case '\\': case '\'': case '"':
1034 return TARGET_NEWLINE;
1049 if (warn_traditional)
1050 warning ("the meaning of `\\a' varies with -traditional");
1052 if (flag_traditional)
1057 #if 0 /* Vertical tab is present in common usage compilers. */
1058 if (flag_traditional)
1066 pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
1072 /* `\(', etc, are used at beginning of line to avoid confusing Emacs. */
1076 /* `\%' is used to prevent SCCS from getting confused. */
1079 pedwarn ("non-ANSI escape sequence `\\%c'", c);
1082 if (c >= 040 && c < 0177)
1083 pedwarn ("unknown escape sequence `\\%c'", c);
1085 pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
1093 const char *string = _(msgid);
1095 /* We can't print string and character constants well
1096 because the token_buffer contains the result of processing escapes. */
1098 error ("%s at end of input", string);
1099 else if (token_buffer[0] == 0)
1100 error ("%s at null character", string);
1101 else if (token_buffer[0] == '"')
1102 error ("%s before string constant", string);
1103 else if (token_buffer[0] == '\'')
1104 error ("%s before character constant", string);
1105 else if (token_buffer[0] < 040 || (unsigned char) token_buffer[0] >= 0177)
1106 error ("%s before character 0%o", string, (unsigned char) token_buffer[0]);
1108 error ("%s before `%s'", string, token_buffer);
1118 char long_long_flag;
1121 struct try_type type_sequence[] =
1123 { &integer_type_node, 0, 0, 0},
1124 { &unsigned_type_node, 1, 0, 0},
1125 { &long_integer_type_node, 0, 1, 0},
1126 { &long_unsigned_type_node, 1, 1, 0},
1127 { &long_long_integer_type_node, 0, 1, 1},
1128 { &long_long_unsigned_type_node, 1, 1, 1}
1141 int conversion_errno;
1143 REAL_VALUE_TYPE value;
1150 struct pf_args * args = (struct pf_args *) data;
1151 int fflag = 0, lflag = 0;
1152 /* Copy token_buffer now, while it has just the number
1153 and not the suffixes; once we add `f' or `i',
1154 REAL_VALUE_ATOF may not work any more. */
1155 char *copy = (char *) alloca (args->p - token_buffer + 1);
1156 bcopy (token_buffer, copy, args->p - token_buffer + 1);
1162 /* Read the suffixes to choose a data type. */
1167 error ("more than one `f' in numeric constant");
1173 error ("more than one `l' in numeric constant");
1179 error ("more than one `i' or `j' in numeric constant");
1181 pedwarn ("ANSI C forbids imaginary numeric constants");
1192 if (args->p >= token_buffer + maxtoken - 3)
1193 args->p = extend_token_buffer (args->p);
1194 *(args->p++) = args->c;
1199 /* The second argument, machine_mode, of REAL_VALUE_ATOF
1200 tells the desired precision of the binary result
1201 of decimal-to-binary conversion. */
1206 error ("both `f' and `l' in floating constant");
1208 args->type = float_type_node;
1210 if (args->base == 16)
1211 args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1213 args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1214 args->conversion_errno = errno;
1215 /* A diagnostic is required here by some ANSI C testsuites.
1216 This is not pedwarn, because some people don't want
1217 an error for this. */
1218 if (REAL_VALUE_ISINF (args->value) && pedantic)
1219 warning ("floating point number exceeds range of `float'");
1223 args->type = long_double_type_node;
1225 if (args->base == 16)
1226 args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1228 args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1229 args->conversion_errno = errno;
1230 if (REAL_VALUE_ISINF (args->value) && pedantic)
1231 warning ("floating point number exceeds range of `long double'");
1236 if (args->base == 16)
1237 args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1239 args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1240 args->conversion_errno = errno;
1241 if (REAL_VALUE_ISINF (args->value) && pedantic)
1242 warning ("floating point number exceeds range of `double'");
1257 c = nextchar, nextchar = -1;
1262 /* Effectively do c = skip_white_space (c)
1263 but do it faster in the usual cases. */
1276 /* Call skip_white_space so we can warn if appropriate. */
1281 c = skip_white_space (c);
1283 goto found_nonwhite;
1287 token_buffer[0] = c;
1288 token_buffer[1] = 0;
1290 /* yylloc.first_line = lineno; */
1296 token_buffer[0] = 0;
1301 /* Capital L may start a wide-string or wide-character constant. */
1303 register int c = GETC();
1312 goto string_constant;
1319 if (!doing_objc_thang)
1326 /* '@' may start a constant string object. */
1327 register int c = GETC ();
1331 goto string_constant;
1334 /* Fall through to treat '@' as the start of an identifier. */
1337 case 'A': case 'B': case 'C': case 'D': case 'E':
1338 case 'F': case 'G': case 'H': case 'I': case 'J':
1339 case 'K': case 'M': case 'N': case 'O':
1340 case 'P': case 'Q': case 'R': case 'S': case 'T':
1341 case 'U': case 'V': case 'W': case 'X': case 'Y':
1343 case 'a': case 'b': case 'c': case 'd': case 'e':
1344 case 'f': case 'g': case 'h': case 'i': case 'j':
1345 case 'k': case 'l': case 'm': case 'n': case 'o':
1346 case 'p': case 'q': case 'r': case 's': case 't':
1347 case 'u': case 'v': case 'w': case 'x': case 'y':
1353 while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
1355 /* Make sure this char really belongs in an identifier. */
1358 if (! dollars_in_ident)
1359 error ("`$' in identifier");
1361 pedwarn ("`$' in identifier");
1364 if (p >= token_buffer + maxtoken)
1365 p = extend_token_buffer (p);
1381 /* Try to recognize a keyword. Uses minimum-perfect hash function */
1384 register struct resword *ptr;
1386 if ((ptr = is_reserved_word (token_buffer, p - token_buffer)))
1389 yylval.ttype = ridpointers[(int) ptr->rid];
1390 value = (int) ptr->token;
1392 /* Only return OBJECTNAME if it is a typedef. */
1393 if (doing_objc_thang && value == OBJECTNAME)
1395 lastiddecl = lookup_name(yylval.ttype);
1397 if (lastiddecl == NULL_TREE
1398 || TREE_CODE (lastiddecl) != TYPE_DECL)
1402 /* Even if we decided to recognize asm, still perhaps warn. */
1404 && (value == ASM_KEYWORD || value == TYPEOF
1405 || ptr->rid == RID_INLINE)
1406 && token_buffer[0] != '_')
1407 pedwarn ("ANSI does not permit the keyword `%s'",
1412 /* If we did not find a keyword, look for an identifier
1415 if (value == IDENTIFIER)
1417 if (token_buffer[0] == '@')
1418 error("invalid identifier `%s'", token_buffer);
1420 yylval.ttype = get_identifier (token_buffer);
1421 lastiddecl = lookup_name (yylval.ttype);
1423 if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL)
1425 /* A user-invisible read-only initialized variable
1426 should be replaced by its value.
1427 We handle only strings since that's the only case used in C. */
1428 else if (lastiddecl != 0 && TREE_CODE (lastiddecl) == VAR_DECL
1429 && DECL_IGNORED_P (lastiddecl)
1430 && TREE_READONLY (lastiddecl)
1431 && DECL_INITIAL (lastiddecl) != 0
1432 && TREE_CODE (DECL_INITIAL (lastiddecl)) == STRING_CST)
1434 tree stringval = DECL_INITIAL (lastiddecl);
1436 /* Copy the string value so that we won't clobber anything
1437 if we put something in the TREE_CHAIN of this one. */
1438 yylval.ttype = build_string (TREE_STRING_LENGTH (stringval),
1439 TREE_STRING_POINTER (stringval));
1442 else if (doing_objc_thang)
1444 tree objc_interface_decl = is_class_name (yylval.ttype);
1446 if (objc_interface_decl)
1449 yylval.ttype = objc_interface_decl;
1459 /* Check first for common special case: single-digit 0 or 1. */
1462 UNGETC (next_c); /* Always undo this lookahead. */
1463 if (!ISALNUM (next_c) && next_c != '.')
1465 token_buffer[0] = (char)c, token_buffer[1] = '\0';
1466 yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node;
1472 case '2': case '3': case '4':
1473 case '5': case '6': case '7': case '8': case '9':
1478 int largest_digit = 0;
1480 /* for multi-precision arithmetic,
1481 we actually store only HOST_BITS_PER_CHAR bits in each part.
1482 The number of parts is chosen so as to be sufficient to hold
1483 the enough bits to fit into the two HOST_WIDE_INTs that contain
1484 the integer value (this is always at least as many bits as are
1485 in a target `long long' value, but may be wider). */
1486 #define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
1487 int parts[TOTAL_PARTS];
1490 enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON}
1491 floatflag = NOT_FLOAT;
1493 for (count = 0; count < TOTAL_PARTS; count++)
1501 *p++ = (c = GETC());
1502 if ((c == 'x') || (c == 'X'))
1505 *p++ = (c = GETC());
1507 /* Leading 0 forces octal unless the 0 is the only digit. */
1508 else if (c >= '0' && c <= '9')
1517 /* Read all the digits-and-decimal-points. */
1520 || (ISALNUM (c) && c != 'l' && c != 'L'
1521 && c != 'u' && c != 'U'
1522 && c != 'i' && c != 'I' && c != 'j' && c != 'J'
1523 && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
1527 if (base == 16 && pedantic)
1528 error ("floating constant may not be in radix 16");
1529 if (floatflag == TOO_MANY_POINTS)
1530 /* We have already emitted an error. Don't need another. */
1532 else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON)
1534 error ("malformed floating constant");
1535 floatflag = TOO_MANY_POINTS;
1536 /* Avoid another error from atof by forcing all characters
1537 from here on to be ignored. */
1541 floatflag = AFTER_POINT;
1546 /* Accept '.' as the start of a floating-point number
1547 only when it is followed by a digit.
1548 Otherwise, unread the following non-digit
1549 and use the '.' as a structural token. */
1550 if (p == token_buffer + 2 && !ISDIGIT (c))
1561 error ("parse error at `..'");
1564 token_buffer[1] = 0;
1571 /* It is not a decimal point.
1572 It should be a digit (perhaps a hex digit). */
1578 else if (base <= 10)
1580 if (c == 'e' || c == 'E')
1583 floatflag = AFTER_EXPON;
1584 break; /* start of exponent */
1586 error ("nondigits in number and not hexadecimal");
1589 else if (base == 16 && (c == 'p' || c == 'P'))
1591 floatflag = AFTER_EXPON;
1592 break; /* start of exponent */
1602 if (c >= largest_digit)
1606 for (count = 0; count < TOTAL_PARTS; count++)
1608 parts[count] *= base;
1612 += (parts[count-1] >> HOST_BITS_PER_CHAR);
1614 &= (1 << HOST_BITS_PER_CHAR) - 1;
1620 /* If the extra highest-order part ever gets anything in it,
1621 the number is certainly too big. */
1622 if (parts[TOTAL_PARTS - 1] != 0)
1625 if (p >= token_buffer + maxtoken - 3)
1626 p = extend_token_buffer (p);
1627 *p++ = (c = GETC());
1632 error ("numeric constant with no digits");
1634 if (largest_digit >= base)
1635 error ("numeric constant contains digits beyond the radix");
1637 /* Remove terminating char from the token buffer and delimit the string */
1640 if (floatflag != NOT_FLOAT)
1642 tree type = double_type_node;
1644 int conversion_errno = 0;
1645 REAL_VALUE_TYPE value;
1646 struct pf_args args;
1648 /* Read explicit exponent if any, and put it in tokenbuf. */
1650 if ((base == 10 && ((c == 'e') || (c == 'E')))
1651 || (base == 16 && (c == 'p' || c == 'P')))
1653 if (p >= token_buffer + maxtoken - 3)
1654 p = extend_token_buffer (p);
1657 if ((c == '+') || (c == '-'))
1662 /* Exponent is decimal, even if string is a hex float. */
1664 error ("floating constant exponent has no digits");
1667 if (p >= token_buffer + maxtoken - 3)
1668 p = extend_token_buffer (p);
1673 if (base == 16 && floatflag != AFTER_EXPON)
1674 error ("hexadecimal floating constant has no exponent");
1678 /* Setup input for parse_float() */
1684 args.conversion_errno = conversion_errno;
1686 /* Convert string to a double, checking for overflow. */
1687 if (do_float_handler (parse_float, (PTR) &args))
1689 /* Receive output from parse_float() */
1694 /* We got an exception from parse_float() */
1695 error ("floating constant out of range");
1699 /* Receive output from parse_float() */
1703 conversion_errno = args.conversion_errno;
1706 /* ERANGE is also reported for underflow,
1707 so test the value to distinguish overflow from that. */
1708 if (conversion_errno == ERANGE && !flag_traditional && pedantic
1709 && (REAL_VALUES_LESS (dconst1, value)
1710 || REAL_VALUES_LESS (value, dconstm1)))
1711 warning ("floating point number exceeds range of `double'");
1714 /* If the result is not a number, assume it must have been
1715 due to some error message above, so silently convert
1717 if (REAL_VALUE_ISNAN (value))
1720 /* Create a node with determined type and value. */
1722 yylval.ttype = build_complex (NULL_TREE,
1723 convert (type, integer_zero_node),
1724 build_real (type, value));
1726 yylval.ttype = build_real (type, value);
1730 tree traditional_type, ansi_type, type;
1731 HOST_WIDE_INT high, low;
1732 int spec_unsigned = 0;
1734 int spec_long_long = 0;
1738 traditional_type = ansi_type = type = NULL_TREE;
1741 if (c == 'u' || c == 'U')
1744 error ("two `u's in integer constant");
1747 else if (c == 'l' || c == 'L')
1752 error ("three `l's in integer constant");
1753 else if (pedantic && ! in_system_header && warn_long_long)
1754 pedwarn ("ANSI C forbids long long integer constants");
1759 else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
1762 error ("more than one `i' or `j' in numeric constant");
1764 pedwarn ("ANSI C forbids imaginary numeric constants");
1769 if (p >= token_buffer + maxtoken - 3)
1770 p = extend_token_buffer (p);
1775 /* If it won't fit in the host's representation for integers,
1780 pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);
1782 /* This is simplified by the fact that our constant
1783 is always positive. */
1787 for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
1789 high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
1790 / HOST_BITS_PER_CHAR)]
1791 << (i * HOST_BITS_PER_CHAR));
1792 low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
1795 yylval.ttype = build_int_2 (low, high);
1796 TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
1798 /* If warn_traditional, calculate both the ANSI type and the
1799 traditional type, then see if they disagree.
1800 Otherwise, calculate only the type for the dialect in use. */
1801 if (warn_traditional || flag_traditional)
1803 /* Calculate the traditional type. */
1804 /* Traditionally, any constant is signed;
1805 but if unsigned is specified explicitly, obey that.
1806 Use the smallest size with the right number of bits,
1807 except for one special case with decimal constants. */
1808 if (! spec_long && base != 10
1809 && int_fits_type_p (yylval.ttype, unsigned_type_node))
1810 traditional_type = (spec_unsigned ? unsigned_type_node
1811 : integer_type_node);
1812 /* A decimal constant must be long
1813 if it does not fit in type int.
1814 I think this is independent of whether
1815 the constant is signed. */
1816 else if (! spec_long && base == 10
1817 && int_fits_type_p (yylval.ttype, integer_type_node))
1818 traditional_type = (spec_unsigned ? unsigned_type_node
1819 : integer_type_node);
1820 else if (! spec_long_long)
1821 traditional_type = (spec_unsigned ? long_unsigned_type_node
1822 : long_integer_type_node);
1823 else if (int_fits_type_p (yylval.ttype,
1825 ? long_long_unsigned_type_node
1826 : long_long_integer_type_node))
1827 traditional_type = (spec_unsigned
1828 ? long_long_unsigned_type_node
1829 : long_long_integer_type_node);
1831 traditional_type = (spec_unsigned
1832 ? widest_unsigned_literal_type_node
1833 : widest_integer_literal_type_node);
1835 if (warn_traditional || ! flag_traditional)
1837 /* Calculate the ANSI type. */
1838 if (! spec_long && ! spec_unsigned
1839 && int_fits_type_p (yylval.ttype, integer_type_node))
1840 ansi_type = integer_type_node;
1841 else if (! spec_long && (base != 10 || spec_unsigned)
1842 && int_fits_type_p (yylval.ttype, unsigned_type_node))
1843 ansi_type = unsigned_type_node;
1844 else if (! spec_unsigned && !spec_long_long
1845 && int_fits_type_p (yylval.ttype, long_integer_type_node))
1846 ansi_type = long_integer_type_node;
1847 else if (! spec_long_long
1848 && int_fits_type_p (yylval.ttype,
1849 long_unsigned_type_node))
1850 ansi_type = long_unsigned_type_node;
1851 else if (! spec_unsigned
1852 && int_fits_type_p (yylval.ttype,
1853 long_long_integer_type_node))
1854 ansi_type = long_long_integer_type_node;
1855 else if (int_fits_type_p (yylval.ttype,
1856 long_long_unsigned_type_node))
1857 ansi_type = long_long_unsigned_type_node;
1858 else if (! spec_unsigned
1859 && int_fits_type_p (yylval.ttype,
1860 widest_integer_literal_type_node))
1861 ansi_type = widest_integer_literal_type_node;
1863 ansi_type = widest_unsigned_literal_type_node;
1866 type = flag_traditional ? traditional_type : ansi_type;
1868 if (warn_traditional && traditional_type != ansi_type)
1870 if (TYPE_PRECISION (traditional_type)
1871 != TYPE_PRECISION (ansi_type))
1872 warning ("width of integer constant changes with -traditional");
1873 else if (TREE_UNSIGNED (traditional_type)
1874 != TREE_UNSIGNED (ansi_type))
1875 warning ("integer constant is unsigned in ANSI C, signed with -traditional");
1877 warning ("width of integer constant may change on other systems with -traditional");
1880 if (pedantic && !flag_traditional && !spec_long_long && !warn
1881 && (TYPE_PRECISION (long_integer_type_node)
1882 < TYPE_PRECISION (type)))
1885 pedwarn ("integer constant larger than the maximum value of an unsigned long int");
1888 if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
1889 warning ("decimal constant is so large that it is unsigned");
1893 if (TYPE_PRECISION (type)
1894 <= TYPE_PRECISION (integer_type_node))
1896 = build_complex (NULL_TREE, integer_zero_node,
1897 convert (integer_type_node,
1900 error ("complex integer constant is too wide for `complex int'");
1902 else if (flag_traditional && !int_fits_type_p (yylval.ttype, type))
1903 /* The traditional constant 0x80000000 is signed
1904 but doesn't fit in the range of int.
1905 This will change it to -0x80000000, which does fit. */
1907 TREE_TYPE (yylval.ttype) = unsigned_type (type);
1908 yylval.ttype = convert (type, yylval.ttype);
1909 TREE_OVERFLOW (yylval.ttype)
1910 = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0;
1913 TREE_TYPE (yylval.ttype) = type;
1916 /* If it's still an integer (not a complex), and it doesn't
1917 fit in the type we choose for it, then pedwarn. */
1920 && TREE_CODE (TREE_TYPE (yylval.ttype)) == INTEGER_TYPE
1921 && ! int_fits_type_p (yylval.ttype, TREE_TYPE (yylval.ttype)))
1922 pedwarn ("integer constant is larger than the maximum value for its type");
1928 if (ISALNUM (c) || c == '.' || c == '_' || c == '$'
1929 || (!flag_traditional && (c == '-' || c == '+')
1930 && (p[-1] == 'e' || p[-1] == 'E')))
1931 error ("missing white space after number `%s'", token_buffer);
1933 value = CONSTANT; break;
1939 register int result = 0;
1940 register int num_chars = 0;
1942 unsigned width = TYPE_PRECISION (char_type_node);
1944 #ifdef MULTIBYTE_CHARS
1945 int longest_char = local_mb_cur_max ();
1946 (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
1949 max_chars = TYPE_PRECISION (integer_type_node) / width;
1951 width = WCHAR_TYPE_SIZE;
1958 if (c == '\'' || c == EOF)
1965 c = readescape (&ignore);
1968 if (width < HOST_BITS_PER_INT
1969 && (unsigned) c >= ((unsigned)1 << width))
1970 pedwarn ("escape sequence out of range for character");
1971 #ifdef MAP_CHARACTER
1973 c = MAP_CHARACTER (c);
1979 pedwarn ("ANSI C forbids newline in character constant");
1984 #ifdef MULTIBYTE_CHARS
1988 for (i = 1; i <= longest_char; ++i)
1990 if (i > maxtoken - 4)
1991 extend_token_buffer (token_buffer);
1993 token_buffer[i] = c;
1994 char_len = local_mbtowc (& wc,
2003 /* mbtowc sometimes needs an extra char before accepting */
2008 /* Merge character into result; ignore excess chars. */
2009 for (i = 1; i <= char_len; ++i)
2013 if (width < HOST_BITS_PER_INT)
2014 result = (result << width)
2016 & ((1 << width) - 1));
2018 result = token_buffer[i];
2020 num_chars += char_len;
2029 warning ("Ignoring invalid multibyte character");
2030 /* Replace all but the first byte. */
2031 for (--i; i > 1; --i)
2032 UNGETC (token_buffer[i]);
2033 wc = token_buffer[1];
2035 #ifdef MAP_CHARACTER
2036 c = MAP_CHARACTER (wc);
2041 #else /* ! MULTIBYTE_CHARS */
2042 #ifdef MAP_CHARACTER
2043 c = MAP_CHARACTER (c);
2045 #endif /* ! MULTIBYTE_CHARS */
2050 if (chars_seen == 1) /* only keep the first one */
2055 /* Merge character into result; ignore excess chars. */
2056 num_chars += (width / TYPE_PRECISION (char_type_node));
2057 if (num_chars < max_chars + 1)
2059 if (width < HOST_BITS_PER_INT)
2060 result = (result << width) | (c & ((1 << width) - 1));
2067 error ("malformatted character constant");
2068 else if (chars_seen == 0)
2069 error ("empty character constant");
2070 else if (num_chars > max_chars)
2072 num_chars = max_chars;
2073 error ("character constant too long");
2075 else if (chars_seen != 1 && ! flag_traditional && warn_multichar)
2076 warning ("multi-character character constant");
2078 /* If char type is signed, sign-extend the constant. */
2081 int num_bits = num_chars * width;
2083 /* We already got an error; avoid invalid shift. */
2084 yylval.ttype = build_int_2 (0, 0);
2085 else if (TREE_UNSIGNED (char_type_node)
2086 || ((result >> (num_bits - 1)) & 1) == 0)
2088 = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
2089 >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2093 = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
2094 >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2096 TREE_TYPE (yylval.ttype) = integer_type_node;
2100 yylval.ttype = build_int_2 (result, 0);
2101 TREE_TYPE (yylval.ttype) = wchar_type_node;
2111 unsigned width = wide_flag ? WCHAR_TYPE_SIZE
2112 : TYPE_PRECISION (char_type_node);
2113 #ifdef MULTIBYTE_CHARS
2114 int longest_char = local_mb_cur_max ();
2115 (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
2118 p = token_buffer + 1;
2120 while (c != '"' && c >= 0)
2125 c = readescape (&ignore);
2128 if (width < HOST_BITS_PER_INT
2129 && (unsigned) c >= ((unsigned)1 << width))
2130 pedwarn ("escape sequence out of range for character");
2135 pedwarn ("ANSI C forbids newline in string constant");
2140 #ifdef MULTIBYTE_CHARS
2144 for (i = 0; i < longest_char; ++i)
2146 if (p + i >= token_buffer + maxtoken)
2147 p = extend_token_buffer (p);
2150 char_len = local_mbtowc (& wc, p, i + 1);
2157 warning ("Ignoring invalid multibyte character");
2158 /* Replace all except the first byte. */
2160 for (--i; i > 0; --i)
2164 /* mbtowc sometimes needs an extra char before accepting */
2174 #endif /* MULTIBYTE_CHARS */
2177 /* Add this single character into the buffer either as a wchar_t
2178 or as a single byte. */
2181 unsigned width = TYPE_PRECISION (char_type_node);
2182 unsigned bytemask = (1 << width) - 1;
2185 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2186 p = extend_token_buffer (p);
2188 for (byte = 0; byte < WCHAR_BYTES; ++byte)
2191 if (byte >= (int) sizeof (c))
2194 value = (c >> (byte * width)) & bytemask;
2195 if (BYTES_BIG_ENDIAN)
2196 p[WCHAR_BYTES - byte - 1] = value;
2204 if (p >= token_buffer + maxtoken)
2205 p = extend_token_buffer (p);
2213 /* Terminate the string value, either with a single byte zero
2214 or with a wide zero. */
2217 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2218 p = extend_token_buffer (p);
2219 bzero (p, WCHAR_BYTES);
2224 if (p >= token_buffer + maxtoken)
2225 p = extend_token_buffer (p);
2230 error ("Unterminated string constant");
2232 /* We have read the entire constant.
2233 Construct a STRING_CST for the result. */
2237 yylval.ttype = build_string (p - (token_buffer + 1),
2239 TREE_TYPE (yylval.ttype) = wchar_array_type_node;
2244 /* Return an Objective-C @"..." constant string object. */
2245 yylval.ttype = build_objc_string (p - (token_buffer + 1),
2247 TREE_TYPE (yylval.ttype) = char_array_type_node;
2248 value = OBJC_STRING;
2252 yylval.ttype = build_string (p - (token_buffer + 1),
2254 TREE_TYPE (yylval.ttype) = char_array_type_node;
2282 yylval.code = PLUS_EXPR; break;
2284 yylval.code = MINUS_EXPR; break;
2286 yylval.code = BIT_AND_EXPR; break;
2288 yylval.code = BIT_IOR_EXPR; break;
2290 yylval.code = MULT_EXPR; break;
2292 yylval.code = TRUNC_DIV_EXPR; break;
2294 yylval.code = TRUNC_MOD_EXPR; break;
2296 yylval.code = BIT_XOR_EXPR; break;
2298 yylval.code = LSHIFT_EXPR; break;
2300 yylval.code = RSHIFT_EXPR; break;
2302 yylval.code = LT_EXPR; break;
2304 yylval.code = GT_EXPR; break;
2307 token_buffer[1] = c1 = GETC();
2308 token_buffer[2] = 0;
2315 value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
2317 value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
2319 value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
2321 value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
2323 value = ASSIGN; goto done;
2329 value = PLUSPLUS; goto done;
2331 value = MINUSMINUS; goto done;
2333 value = ANDAND; goto done;
2335 value = OROR; goto done;
2348 { value = POINTSAT; goto done; }
2352 { value = ']'; goto done; }
2356 { value = '{'; indent_level++; goto done; }
2358 { value = '['; goto done; }
2362 { value = '}'; indent_level--; goto done; }
2366 token_buffer[1] = 0;
2368 if ((c == '<') || (c == '>'))
2369 value = ARITHCOMPARE;
2375 /* Don't make yyparse think this is eof. */
2394 /* yylloc.last_line = lineno; */
2399 /* Sets the value of the 'yydebug' variable to VALUE.
2400 This is a function so we don't have to have YYDEBUG defined
2401 in order to build the compiler. */
2410 warning ("YYDEBUG not defined.");