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;
1482 /* We actually store only HOST_BITS_PER_CHAR bits in each part.
1483 The code below which fills the parts array assumes that a host
1484 int is at least twice as wide as a host char, and that
1485 HOST_BITS_PER_WIDE_INT is an even multiple of HOST_BITS_PER_CHAR.
1486 Two HOST_WIDE_INTs is the largest int literal we can store.
1487 In order to detect overflow below, the number of parts (TOTAL_PARTS)
1488 must be exactly the number of parts needed to hold the bits
1489 of two HOST_WIDE_INTs. */
1490 #define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2)
1491 unsigned int parts[TOTAL_PARTS];
1493 enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON}
1494 floatflag = NOT_FLOAT;
1496 for (count = 0; count < TOTAL_PARTS; count++)
1504 *p++ = (c = GETC());
1505 if ((c == 'x') || (c == 'X'))
1508 *p++ = (c = GETC());
1510 /* Leading 0 forces octal unless the 0 is the only digit. */
1511 else if (c >= '0' && c <= '9')
1520 /* Read all the digits-and-decimal-points. */
1523 || (ISALNUM (c) && c != 'l' && c != 'L'
1524 && c != 'u' && c != 'U'
1525 && c != 'i' && c != 'I' && c != 'j' && c != 'J'
1526 && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
1530 if (base == 16 && pedantic)
1531 error ("floating constant may not be in radix 16");
1532 if (floatflag == TOO_MANY_POINTS)
1533 /* We have already emitted an error. Don't need another. */
1535 else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON)
1537 error ("malformed floating constant");
1538 floatflag = TOO_MANY_POINTS;
1539 /* Avoid another error from atof by forcing all characters
1540 from here on to be ignored. */
1544 floatflag = AFTER_POINT;
1549 /* Accept '.' as the start of a floating-point number
1550 only when it is followed by a digit.
1551 Otherwise, unread the following non-digit
1552 and use the '.' as a structural token. */
1553 if (p == token_buffer + 2 && !ISDIGIT (c))
1564 error ("parse error at `..'");
1567 token_buffer[1] = 0;
1574 /* It is not a decimal point.
1575 It should be a digit (perhaps a hex digit). */
1581 else if (base <= 10)
1583 if (c == 'e' || c == 'E')
1586 floatflag = AFTER_EXPON;
1587 break; /* start of exponent */
1589 error ("nondigits in number and not hexadecimal");
1592 else if (base == 16 && (c == 'p' || c == 'P'))
1594 floatflag = AFTER_EXPON;
1595 break; /* start of exponent */
1605 if (c >= largest_digit)
1609 for (count = 0; count < TOTAL_PARTS; count++)
1611 parts[count] *= base;
1615 += (parts[count-1] >> HOST_BITS_PER_CHAR);
1617 &= (1 << HOST_BITS_PER_CHAR) - 1;
1623 /* If the highest-order part overflows (gets larger than
1624 a host char will hold) then the whole number has
1625 overflowed. Record this and truncate the highest-order
1627 if (parts[TOTAL_PARTS - 1] >> HOST_BITS_PER_CHAR)
1630 parts[TOTAL_PARTS - 1] &= (1 << HOST_BITS_PER_CHAR) - 1;
1633 if (p >= token_buffer + maxtoken - 3)
1634 p = extend_token_buffer (p);
1635 *p++ = (c = GETC());
1640 error ("numeric constant with no digits");
1642 if (largest_digit >= base)
1643 error ("numeric constant contains digits beyond the radix");
1645 /* Remove terminating char from the token buffer and delimit the string */
1648 if (floatflag != NOT_FLOAT)
1650 tree type = double_type_node;
1652 int conversion_errno = 0;
1653 REAL_VALUE_TYPE value;
1654 struct pf_args args;
1656 /* Read explicit exponent if any, and put it in tokenbuf. */
1658 if ((base == 10 && ((c == 'e') || (c == 'E')))
1659 || (base == 16 && (c == 'p' || c == 'P')))
1661 if (p >= token_buffer + maxtoken - 3)
1662 p = extend_token_buffer (p);
1665 if ((c == '+') || (c == '-'))
1670 /* Exponent is decimal, even if string is a hex float. */
1672 error ("floating constant exponent has no digits");
1675 if (p >= token_buffer + maxtoken - 3)
1676 p = extend_token_buffer (p);
1681 if (base == 16 && floatflag != AFTER_EXPON)
1682 error ("hexadecimal floating constant has no exponent");
1686 /* Setup input for parse_float() */
1692 args.conversion_errno = conversion_errno;
1694 /* Convert string to a double, checking for overflow. */
1695 if (do_float_handler (parse_float, (PTR) &args))
1697 /* Receive output from parse_float() */
1702 /* We got an exception from parse_float() */
1703 error ("floating constant out of range");
1707 /* Receive output from parse_float() */
1711 conversion_errno = args.conversion_errno;
1714 /* ERANGE is also reported for underflow,
1715 so test the value to distinguish overflow from that. */
1716 if (conversion_errno == ERANGE && !flag_traditional && pedantic
1717 && (REAL_VALUES_LESS (dconst1, value)
1718 || REAL_VALUES_LESS (value, dconstm1)))
1719 warning ("floating point number exceeds range of `double'");
1722 /* If the result is not a number, assume it must have been
1723 due to some error message above, so silently convert
1725 if (REAL_VALUE_ISNAN (value))
1728 /* Create a node with determined type and value. */
1730 yylval.ttype = build_complex (NULL_TREE,
1731 convert (type, integer_zero_node),
1732 build_real (type, value));
1734 yylval.ttype = build_real (type, value);
1738 tree traditional_type, ansi_type, type;
1739 HOST_WIDE_INT high, low;
1740 int spec_unsigned = 0;
1742 int spec_long_long = 0;
1746 traditional_type = ansi_type = type = NULL_TREE;
1749 if (c == 'u' || c == 'U')
1752 error ("two `u's in integer constant");
1755 else if (c == 'l' || c == 'L')
1760 error ("three `l's in integer constant");
1761 else if (pedantic && ! in_system_header && warn_long_long)
1762 pedwarn ("ANSI C forbids long long integer constants");
1767 else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
1770 error ("more than one `i' or `j' in numeric constant");
1772 pedwarn ("ANSI C forbids imaginary numeric constants");
1777 if (p >= token_buffer + maxtoken - 3)
1778 p = extend_token_buffer (p);
1783 /* If the literal overflowed, pedwarn about it now. */
1787 pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);
1790 /* This is simplified by the fact that our constant
1791 is always positive. */
1795 for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
1797 high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
1798 / HOST_BITS_PER_CHAR)]
1799 << (i * HOST_BITS_PER_CHAR));
1800 low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
1803 yylval.ttype = build_int_2 (low, high);
1804 TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
1806 /* If warn_traditional, calculate both the ANSI type and the
1807 traditional type, then see if they disagree.
1808 Otherwise, calculate only the type for the dialect in use. */
1809 if (warn_traditional || flag_traditional)
1811 /* Calculate the traditional type. */
1812 /* Traditionally, any constant is signed;
1813 but if unsigned is specified explicitly, obey that.
1814 Use the smallest size with the right number of bits,
1815 except for one special case with decimal constants. */
1816 if (! spec_long && base != 10
1817 && int_fits_type_p (yylval.ttype, unsigned_type_node))
1818 traditional_type = (spec_unsigned ? unsigned_type_node
1819 : integer_type_node);
1820 /* A decimal constant must be long
1821 if it does not fit in type int.
1822 I think this is independent of whether
1823 the constant is signed. */
1824 else if (! spec_long && base == 10
1825 && int_fits_type_p (yylval.ttype, integer_type_node))
1826 traditional_type = (spec_unsigned ? unsigned_type_node
1827 : integer_type_node);
1828 else if (! spec_long_long)
1829 traditional_type = (spec_unsigned ? long_unsigned_type_node
1830 : long_integer_type_node);
1831 else if (int_fits_type_p (yylval.ttype,
1833 ? long_long_unsigned_type_node
1834 : long_long_integer_type_node))
1835 traditional_type = (spec_unsigned
1836 ? long_long_unsigned_type_node
1837 : long_long_integer_type_node);
1839 traditional_type = (spec_unsigned
1840 ? widest_unsigned_literal_type_node
1841 : widest_integer_literal_type_node);
1843 if (warn_traditional || ! flag_traditional)
1845 /* Calculate the ANSI type. */
1846 if (! spec_long && ! spec_unsigned
1847 && int_fits_type_p (yylval.ttype, integer_type_node))
1848 ansi_type = integer_type_node;
1849 else if (! spec_long && (base != 10 || spec_unsigned)
1850 && int_fits_type_p (yylval.ttype, unsigned_type_node))
1851 ansi_type = unsigned_type_node;
1852 else if (! spec_unsigned && !spec_long_long
1853 && int_fits_type_p (yylval.ttype, long_integer_type_node))
1854 ansi_type = long_integer_type_node;
1855 else if (! spec_long_long
1856 && int_fits_type_p (yylval.ttype,
1857 long_unsigned_type_node))
1858 ansi_type = long_unsigned_type_node;
1859 else if (! spec_unsigned
1860 && int_fits_type_p (yylval.ttype,
1861 long_long_integer_type_node))
1862 ansi_type = long_long_integer_type_node;
1863 else if (int_fits_type_p (yylval.ttype,
1864 long_long_unsigned_type_node))
1865 ansi_type = long_long_unsigned_type_node;
1866 else if (! spec_unsigned
1867 && int_fits_type_p (yylval.ttype,
1868 widest_integer_literal_type_node))
1869 ansi_type = widest_integer_literal_type_node;
1871 ansi_type = widest_unsigned_literal_type_node;
1874 type = flag_traditional ? traditional_type : ansi_type;
1876 if (warn_traditional && traditional_type != ansi_type)
1878 if (TYPE_PRECISION (traditional_type)
1879 != TYPE_PRECISION (ansi_type))
1880 warning ("width of integer constant changes with -traditional");
1881 else if (TREE_UNSIGNED (traditional_type)
1882 != TREE_UNSIGNED (ansi_type))
1883 warning ("integer constant is unsigned in ANSI C, signed with -traditional");
1885 warning ("width of integer constant may change on other systems with -traditional");
1888 if (pedantic && !flag_traditional && !spec_long_long && !warn
1889 && (TYPE_PRECISION (long_integer_type_node)
1890 < TYPE_PRECISION (type)))
1893 pedwarn ("integer constant larger than the maximum value of an unsigned long int");
1896 if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
1897 warning ("decimal constant is so large that it is unsigned");
1901 if (TYPE_PRECISION (type)
1902 <= TYPE_PRECISION (integer_type_node))
1904 = build_complex (NULL_TREE, integer_zero_node,
1905 convert (integer_type_node,
1908 error ("complex integer constant is too wide for `complex int'");
1910 else if (flag_traditional && !int_fits_type_p (yylval.ttype, type))
1911 /* The traditional constant 0x80000000 is signed
1912 but doesn't fit in the range of int.
1913 This will change it to -0x80000000, which does fit. */
1915 TREE_TYPE (yylval.ttype) = unsigned_type (type);
1916 yylval.ttype = convert (type, yylval.ttype);
1917 TREE_OVERFLOW (yylval.ttype)
1918 = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0;
1921 TREE_TYPE (yylval.ttype) = type;
1924 /* If it's still an integer (not a complex), and it doesn't
1925 fit in the type we choose for it, then pedwarn. */
1928 && TREE_CODE (TREE_TYPE (yylval.ttype)) == INTEGER_TYPE
1929 && ! int_fits_type_p (yylval.ttype, TREE_TYPE (yylval.ttype)))
1930 pedwarn ("integer constant is larger than the maximum value for its type");
1936 if (ISALNUM (c) || c == '.' || c == '_' || c == '$'
1937 || (!flag_traditional && (c == '-' || c == '+')
1938 && (p[-1] == 'e' || p[-1] == 'E')))
1939 error ("missing white space after number `%s'", token_buffer);
1941 value = CONSTANT; break;
1947 register int result = 0;
1948 register int num_chars = 0;
1950 unsigned width = TYPE_PRECISION (char_type_node);
1952 #ifdef MULTIBYTE_CHARS
1953 int longest_char = local_mb_cur_max ();
1954 (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
1957 max_chars = TYPE_PRECISION (integer_type_node) / width;
1959 width = WCHAR_TYPE_SIZE;
1966 if (c == '\'' || c == EOF)
1973 c = readescape (&ignore);
1976 if (width < HOST_BITS_PER_INT
1977 && (unsigned) c >= ((unsigned)1 << width))
1978 pedwarn ("escape sequence out of range for character");
1979 #ifdef MAP_CHARACTER
1981 c = MAP_CHARACTER (c);
1987 pedwarn ("ANSI C forbids newline in character constant");
1992 #ifdef MULTIBYTE_CHARS
1996 for (i = 1; i <= longest_char; ++i)
1998 if (i > maxtoken - 4)
1999 extend_token_buffer (token_buffer);
2001 token_buffer[i] = c;
2002 char_len = local_mbtowc (& wc,
2011 /* mbtowc sometimes needs an extra char before accepting */
2016 /* Merge character into result; ignore excess chars. */
2017 for (i = 1; i <= char_len; ++i)
2021 if (width < HOST_BITS_PER_INT)
2022 result = (result << width)
2024 & ((1 << width) - 1));
2026 result = token_buffer[i];
2028 num_chars += char_len;
2037 warning ("Ignoring invalid multibyte character");
2038 /* Replace all but the first byte. */
2039 for (--i; i > 1; --i)
2040 UNGETC (token_buffer[i]);
2041 wc = token_buffer[1];
2043 #ifdef MAP_CHARACTER
2044 c = MAP_CHARACTER (wc);
2049 #else /* ! MULTIBYTE_CHARS */
2050 #ifdef MAP_CHARACTER
2051 c = MAP_CHARACTER (c);
2053 #endif /* ! MULTIBYTE_CHARS */
2058 if (chars_seen == 1) /* only keep the first one */
2063 /* Merge character into result; ignore excess chars. */
2064 num_chars += (width / TYPE_PRECISION (char_type_node));
2065 if (num_chars < max_chars + 1)
2067 if (width < HOST_BITS_PER_INT)
2068 result = (result << width) | (c & ((1 << width) - 1));
2075 error ("malformatted character constant");
2076 else if (chars_seen == 0)
2077 error ("empty character constant");
2078 else if (num_chars > max_chars)
2080 num_chars = max_chars;
2081 error ("character constant too long");
2083 else if (chars_seen != 1 && ! flag_traditional && warn_multichar)
2084 warning ("multi-character character constant");
2086 /* If char type is signed, sign-extend the constant. */
2089 int num_bits = num_chars * width;
2091 /* We already got an error; avoid invalid shift. */
2092 yylval.ttype = build_int_2 (0, 0);
2093 else if (TREE_UNSIGNED (char_type_node)
2094 || ((result >> (num_bits - 1)) & 1) == 0)
2096 = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
2097 >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2101 = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
2102 >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2104 TREE_TYPE (yylval.ttype) = integer_type_node;
2108 yylval.ttype = build_int_2 (result, 0);
2109 TREE_TYPE (yylval.ttype) = wchar_type_node;
2119 unsigned width = wide_flag ? WCHAR_TYPE_SIZE
2120 : TYPE_PRECISION (char_type_node);
2121 #ifdef MULTIBYTE_CHARS
2122 int longest_char = local_mb_cur_max ();
2123 (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
2126 p = token_buffer + 1;
2128 while (c != '"' && c >= 0)
2133 c = readescape (&ignore);
2136 if (width < HOST_BITS_PER_INT
2137 && (unsigned) c >= ((unsigned)1 << width))
2138 pedwarn ("escape sequence out of range for character");
2143 pedwarn ("ANSI C forbids newline in string constant");
2148 #ifdef MULTIBYTE_CHARS
2152 for (i = 0; i < longest_char; ++i)
2154 if (p + i >= token_buffer + maxtoken)
2155 p = extend_token_buffer (p);
2158 char_len = local_mbtowc (& wc, p, i + 1);
2165 warning ("Ignoring invalid multibyte character");
2166 /* Replace all except the first byte. */
2168 for (--i; i > 0; --i)
2172 /* mbtowc sometimes needs an extra char before accepting */
2182 #endif /* MULTIBYTE_CHARS */
2185 /* Add this single character into the buffer either as a wchar_t
2186 or as a single byte. */
2189 unsigned width = TYPE_PRECISION (char_type_node);
2190 unsigned bytemask = (1 << width) - 1;
2193 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2194 p = extend_token_buffer (p);
2196 for (byte = 0; byte < WCHAR_BYTES; ++byte)
2199 if (byte >= (int) sizeof (c))
2202 value = (c >> (byte * width)) & bytemask;
2203 if (BYTES_BIG_ENDIAN)
2204 p[WCHAR_BYTES - byte - 1] = value;
2212 if (p >= token_buffer + maxtoken)
2213 p = extend_token_buffer (p);
2221 /* Terminate the string value, either with a single byte zero
2222 or with a wide zero. */
2225 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2226 p = extend_token_buffer (p);
2227 bzero (p, WCHAR_BYTES);
2232 if (p >= token_buffer + maxtoken)
2233 p = extend_token_buffer (p);
2238 error ("Unterminated string constant");
2240 /* We have read the entire constant.
2241 Construct a STRING_CST for the result. */
2245 yylval.ttype = build_string (p - (token_buffer + 1),
2247 TREE_TYPE (yylval.ttype) = wchar_array_type_node;
2252 /* Return an Objective-C @"..." constant string object. */
2253 yylval.ttype = build_objc_string (p - (token_buffer + 1),
2255 TREE_TYPE (yylval.ttype) = char_array_type_node;
2256 value = OBJC_STRING;
2260 yylval.ttype = build_string (p - (token_buffer + 1),
2262 TREE_TYPE (yylval.ttype) = char_array_type_node;
2290 yylval.code = PLUS_EXPR; break;
2292 yylval.code = MINUS_EXPR; break;
2294 yylval.code = BIT_AND_EXPR; break;
2296 yylval.code = BIT_IOR_EXPR; break;
2298 yylval.code = MULT_EXPR; break;
2300 yylval.code = TRUNC_DIV_EXPR; break;
2302 yylval.code = TRUNC_MOD_EXPR; break;
2304 yylval.code = BIT_XOR_EXPR; break;
2306 yylval.code = LSHIFT_EXPR; break;
2308 yylval.code = RSHIFT_EXPR; break;
2310 yylval.code = LT_EXPR; break;
2312 yylval.code = GT_EXPR; break;
2315 token_buffer[1] = c1 = GETC();
2316 token_buffer[2] = 0;
2323 value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
2325 value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
2327 value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
2329 value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
2331 value = ASSIGN; goto done;
2337 value = PLUSPLUS; goto done;
2339 value = MINUSMINUS; goto done;
2341 value = ANDAND; goto done;
2343 value = OROR; goto done;
2356 { value = POINTSAT; goto done; }
2360 { value = ']'; goto done; }
2364 { value = '{'; indent_level++; goto done; }
2366 { value = '['; goto done; }
2370 { value = '}'; indent_level--; goto done; }
2374 token_buffer[1] = 0;
2376 if ((c == '<') || (c == '>'))
2377 value = ARITHCOMPARE;
2383 /* Don't make yyparse think this is eof. */
2402 /* yylloc.last_line = lineno; */
2407 /* Sets the value of the 'yydebug' variable to VALUE.
2408 This is a function so we don't have to have YYDEBUG defined
2409 in order to build the compiler. */
2418 warning ("YYDEBUG not defined.");