OSDN Git Service

* combine.c (make_extraction, force_to_mode): Avoid warning on
[pf3gnuchains/gcc-fork.git] / gcc / c-lex.c
1 /* Lexical analyzer for C and Objective C.
2    Copyright (C) 1987, 88, 89, 92, 94-99, 2000 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
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)
9 any later version.
10
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.
15
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.  */
20
21 #include "config.h"
22 #include "system.h"
23
24 #include "rtl.h"
25 #include "tree.h"
26 #include "input.h"
27 #include "output.h"
28 #include "c-lex.h"
29 #include "c-tree.h"
30 #include "flags.h"
31 #include "c-parse.h"
32 #include "c-pragma.h"
33 #include "toplev.h"
34 #include "intl.h"
35 #include "ggc.h"
36 #include "tm_p.h"
37
38 /* MULTIBYTE_CHARS support only works for native compilers.
39    ??? Ideally what we want is to model widechar support after
40    the current floating point support.  */
41 #ifdef CROSS_COMPILE
42 #undef MULTIBYTE_CHARS
43 #endif
44
45 #ifdef MULTIBYTE_CHARS
46 #include "mbchar.h"
47 #include <locale.h>
48 #endif /* MULTIBYTE_CHARS */
49 #ifndef GET_ENVIRONMENT
50 #define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ((ENV_VALUE) = getenv (ENV_NAME))
51 #endif
52
53 #if USE_CPPLIB
54 #include "cpplib.h"
55 extern cpp_reader  parse_in;
56 extern cpp_options parse_options;
57 #else
58 /* Stream for reading from the input file.  */
59 FILE *finput;
60 #endif
61
62 extern void yyprint                     PARAMS ((FILE *, int, YYSTYPE));
63
64 /* The elements of `ridpointers' are identifier nodes
65    for the reserved type names and storage classes.
66    It is indexed by a RID_... value.  */
67 tree ridpointers[(int) RID_MAX];
68
69 /* Cause the `yydebug' variable to be defined.  */
70 #define YYDEBUG 1
71
72 #if USE_CPPLIB
73 extern unsigned char *yy_cur, *yy_lim;
74 extern enum cpp_token cpp_token;
75
76 extern int yy_get_token ();
77
78 #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
79 #define UNGETC(c) ((c) == EOF ? 0 : yy_cur--)
80
81 #else /* ! USE_CPPLIB */
82
83 #define GETC() getch ()
84 #define UNGETC(c) put_back (c)
85
86 struct putback_buffer {
87   char *buffer;
88   int   buffer_size;
89   int   index;
90 };
91
92 static struct putback_buffer putback = {NULL, 0, -1};
93
94 static inline int getch PARAMS ((void));
95
96 static inline int
97 getch ()
98 {
99   if (putback.index != -1)
100     {
101       int ch = putback.buffer[putback.index];
102       --putback.index;
103       return ch;
104     }
105   return getc (finput);
106 }
107
108 static inline void put_back PARAMS ((int));
109
110 static inline void
111 put_back (ch)
112      int ch;
113 {
114   if (ch != EOF)
115     {
116       if (putback.index == putback.buffer_size - 1)
117         {
118           putback.buffer_size += 16;
119           putback.buffer = xrealloc (putback.buffer, putback.buffer_size);
120         }
121       putback.buffer[++putback.index] = ch;
122     }
123 }
124 #endif /* ! USE_CPPLIB */
125
126 int linemode;
127
128 /* the declaration found for the last IDENTIFIER token read in.
129    yylex must look this up to detect typedefs, which get token type TYPENAME,
130    so it is left around in case the identifier is not a typedef but is
131    used in a context which makes it a reference to a variable.  */
132 tree lastiddecl;
133
134 /* Nonzero enables objc features.  */
135
136 int doing_objc_thang;
137
138 extern int yydebug;
139
140 /* File used for outputting assembler code.  */
141 extern FILE *asm_out_file;
142
143 #undef WCHAR_TYPE_SIZE
144 #define WCHAR_TYPE_SIZE TYPE_PRECISION (wchar_type_node)
145
146 /* Number of bytes in a wide character.  */
147 #define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
148
149 static int maxtoken;            /* Current nominal length of token buffer.  */
150 char *token_buffer;     /* Pointer to token buffer.
151                            Actual allocated length is maxtoken + 2.
152                            This is not static because objc-parse.y uses it.  */
153
154 static int indent_level;        /* Number of { minus number of }. */
155
156 /* Nonzero tells yylex to ignore \ in string constants.  */
157 static int ignore_escape_flag;
158
159 /* Nonzero if end-of-file has been seen on input.  */
160 static int end_of_file;
161
162 #ifdef HANDLE_GENERIC_PRAGMAS
163 static int handle_generic_pragma        PARAMS ((int));
164 #endif /* HANDLE_GENERIC_PRAGMAS */
165 static int whitespace_cr                PARAMS ((int));
166 static int skip_white_space             PARAMS ((int));
167 static char *extend_token_buffer        PARAMS ((const char *));
168 static int readescape                   PARAMS ((int *));
169 static void parse_float                 PARAMS ((PTR));
170 static void extend_token_buffer_to      PARAMS ((int));
171 static int read_line_number             PARAMS ((int *));
172 \f
173 /* Do not insert generated code into the source, instead, include it.
174    This allows us to build gcc automatically even for targets that
175    need to add or modify the reserved keyword lists.  */
176 #include "c-gperf.h"
177 \f
178 /* Return something to represent absolute declarators containing a *.
179    TARGET is the absolute declarator that the * contains.
180    TYPE_QUALS is a list of modifiers such as const or volatile
181    to apply to the pointer type, represented as identifiers.
182
183    We return an INDIRECT_REF whose "contents" are TARGET
184    and whose type is the modifier list.  */
185
186 tree
187 make_pointer_declarator (type_quals, target)
188      tree type_quals, target;
189 {
190   return build1 (INDIRECT_REF, type_quals, target);
191 }
192 \f
193 void
194 forget_protocol_qualifiers ()
195 {
196   int i, n = sizeof wordlist / sizeof (struct resword);
197
198   for (i = 0; i < n; i++)
199     if ((int) wordlist[i].rid >= (int) RID_IN
200         && (int) wordlist[i].rid <= (int) RID_ONEWAY)
201       wordlist[i].name = "";
202 }
203
204 void
205 remember_protocol_qualifiers ()
206 {
207   int i, n = sizeof wordlist / sizeof (struct resword);
208
209   for (i = 0; i < n; i++)
210     if (wordlist[i].rid == RID_IN)
211       wordlist[i].name = "in";
212     else if (wordlist[i].rid == RID_OUT)
213       wordlist[i].name = "out";
214     else if (wordlist[i].rid == RID_INOUT)
215       wordlist[i].name = "inout";
216     else if (wordlist[i].rid == RID_BYCOPY)
217       wordlist[i].name = "bycopy";
218     else if (wordlist[i].rid == RID_BYREF)
219       wordlist[i].name = "byref";
220     else if (wordlist[i].rid == RID_ONEWAY)
221       wordlist[i].name = "oneway";
222 }
223 \f
224 char *
225 init_parse (filename)
226      char *filename;
227 {
228 #if !USE_CPPLIB
229   /* Open input file.  */
230   if (filename == 0 || !strcmp (filename, "-"))
231     {
232       finput = stdin;
233       filename = "stdin";
234     }
235   else
236     finput = fopen (filename, "r");
237   if (finput == 0)
238     pfatal_with_name (filename);
239
240 #ifdef IO_BUFFER_SIZE
241   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
242 #endif
243 #else /* !USE_CPPLIB */
244   parse_in.show_column = 1;
245   if (! cpp_start_read (&parse_in, filename))
246     abort ();
247
248   if (filename == 0 || !strcmp (filename, "-"))
249     filename = "stdin";
250
251   /* cpp_start_read always puts at least one line directive into the
252      token buffer.  We must arrange to read it out here. */
253   yy_cur = parse_in.token_buffer;
254   yy_lim = CPP_PWRITTEN (&parse_in);
255   cpp_token = CPP_DIRECTIVE;
256 #endif
257
258   init_lex ();
259   init_pragma ();
260
261   return filename;
262 }
263
264 void
265 finish_parse ()
266 {
267 #if USE_CPPLIB
268   cpp_finish (&parse_in);
269   errorcount += parse_in.errors;
270 #else
271   fclose (finput);
272 #endif
273 }
274
275 void
276 init_lex ()
277 {
278   /* Make identifier nodes long enough for the language-specific slots.  */
279   set_identifier_size (sizeof (struct lang_identifier));
280
281   /* Start it at 0, because check_newline is called at the very beginning
282      and will increment it to 1.  */
283   lineno = 0;
284
285 #ifdef MULTIBYTE_CHARS
286   /* Change to the native locale for multibyte conversions.  */
287   setlocale (LC_CTYPE, "");
288   GET_ENVIRONMENT (literal_codeset, "LANG");
289 #endif
290
291   maxtoken = 40;
292   token_buffer = (char *) xmalloc (maxtoken + 2);
293
294   ridpointers[(int) RID_INT] = get_identifier ("int");
295   ridpointers[(int) RID_CHAR] = get_identifier ("char");
296   ridpointers[(int) RID_VOID] = get_identifier ("void");
297   ridpointers[(int) RID_FLOAT] = get_identifier ("float");
298   ridpointers[(int) RID_DOUBLE] = get_identifier ("double");
299   ridpointers[(int) RID_SHORT] = get_identifier ("short");
300   ridpointers[(int) RID_LONG] = get_identifier ("long");
301   ridpointers[(int) RID_UNSIGNED] = get_identifier ("unsigned");
302   ridpointers[(int) RID_SIGNED] = get_identifier ("signed");
303   ridpointers[(int) RID_INLINE] = get_identifier ("inline");
304   ridpointers[(int) RID_CONST] = get_identifier ("const");
305   ridpointers[(int) RID_RESTRICT] = get_identifier ("restrict");
306   ridpointers[(int) RID_VOLATILE] = get_identifier ("volatile");
307   ridpointers[(int) RID_AUTO] = get_identifier ("auto");
308   ridpointers[(int) RID_STATIC] = get_identifier ("static");
309   ridpointers[(int) RID_EXTERN] = get_identifier ("extern");
310   ridpointers[(int) RID_TYPEDEF] = get_identifier ("typedef");
311   ridpointers[(int) RID_REGISTER] = get_identifier ("register");
312   ridpointers[(int) RID_ITERATOR] = get_identifier ("iterator");
313   ridpointers[(int) RID_COMPLEX] = get_identifier ("complex");
314   ridpointers[(int) RID_ID] = get_identifier ("id");
315   ridpointers[(int) RID_IN] = get_identifier ("in");
316   ridpointers[(int) RID_OUT] = get_identifier ("out");
317   ridpointers[(int) RID_INOUT] = get_identifier ("inout");
318   ridpointers[(int) RID_BYCOPY] = get_identifier ("bycopy");
319   ridpointers[(int) RID_BYREF] = get_identifier ("byref");
320   ridpointers[(int) RID_ONEWAY] = get_identifier ("oneway");
321   forget_protocol_qualifiers();
322
323   /* Some options inhibit certain reserved words.
324      Clear those words out of the hash table so they won't be recognized.  */
325 #define UNSET_RESERVED_WORD(STRING) \
326   do { struct resword *s = is_reserved_word (STRING, sizeof (STRING) - 1); \
327        if (s) s->name = ""; } while (0)
328
329   if (! doing_objc_thang)
330     UNSET_RESERVED_WORD ("id");
331
332   if (flag_traditional)
333     {
334       UNSET_RESERVED_WORD ("const");
335       UNSET_RESERVED_WORD ("restrict");
336       UNSET_RESERVED_WORD ("volatile");
337       UNSET_RESERVED_WORD ("typeof");
338       UNSET_RESERVED_WORD ("signed");
339       UNSET_RESERVED_WORD ("inline");
340       UNSET_RESERVED_WORD ("iterator");
341       UNSET_RESERVED_WORD ("complex");
342     }
343   else if (!flag_isoc99)
344     UNSET_RESERVED_WORD ("restrict");
345
346   if (flag_no_asm)
347     {
348       UNSET_RESERVED_WORD ("asm");
349       UNSET_RESERVED_WORD ("typeof");
350       UNSET_RESERVED_WORD ("inline");
351       UNSET_RESERVED_WORD ("iterator");
352       UNSET_RESERVED_WORD ("complex");
353     }
354 }
355
356 void
357 reinit_parse_for_function ()
358 {
359 }
360 \f
361 /* Function used when yydebug is set, to print a token in more detail.  */
362
363 void
364 yyprint (file, yychar, yylval)
365      FILE *file;
366      int yychar;
367      YYSTYPE yylval;
368 {
369   tree t;
370   switch (yychar)
371     {
372     case IDENTIFIER:
373     case TYPENAME:
374     case OBJECTNAME:
375       t = yylval.ttype;
376       if (IDENTIFIER_POINTER (t))
377         fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
378       break;
379
380     case CONSTANT:
381       t = yylval.ttype;
382       if (TREE_CODE (t) == INTEGER_CST)
383         fprintf (file,
384 #if HOST_BITS_PER_WIDE_INT == 64
385 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
386                  " 0x%x%016x",
387 #else
388 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
389                  " 0x%lx%016lx",
390 #else
391                  " 0x%llx%016llx",
392 #endif
393 #endif
394 #else
395 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
396                  " 0x%lx%08lx",
397 #else
398                  " 0x%x%08x",
399 #endif
400 #endif
401                  TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
402       break;
403     }
404 }
405 \f
406 /* Iff C is a carriage return, warn about it - if appropriate -
407    and return nonzero.  */
408 static int
409 whitespace_cr (c)
410      int c;
411 {
412   static int newline_warning = 0;
413
414   if (c == '\r')
415     {
416       /* ANSI C says the effects of a carriage return in a source file
417          are undefined.  */
418       if (pedantic && !newline_warning)
419         {
420           warning ("carriage return in source file");
421           warning ("(we only warn about the first carriage return)");
422           newline_warning = 1;
423         }
424       return 1;
425     }
426   return 0;
427 }
428
429 /* If C is not whitespace, return C.
430    Otherwise skip whitespace and return first nonwhite char read.  */
431
432 static int
433 skip_white_space (c)
434      register int c;
435 {
436   for (;;)
437     {
438       switch (c)
439         {
440           /* We don't recognize comments here, because
441              cpp output can include / and * consecutively as operators.
442              Also, there's no need, since cpp removes all comments.  */
443
444         case '\n':
445           if (linemode)
446             {
447               UNGETC (c);
448               return EOF;
449             }
450           c = check_newline ();
451           break;
452
453         case ' ':
454         case '\t':
455         case '\f':
456         case '\v':
457         case '\b':
458 #if USE_CPPLIB
459           /* While processing a # directive we don't get CPP_HSPACE
460              tokens, so we also need to handle whitespace the normal way.  */
461           if (cpp_token == CPP_HSPACE)
462             c = yy_get_token ();
463           else
464 #endif
465             c = GETC();
466           break;
467
468         case '\r':
469           whitespace_cr (c);
470           c = GETC();
471           break;
472
473         case '\\':
474           c = GETC();
475           if (c == '\n')
476             lineno++;
477           else
478             error ("stray '\\' in program");
479           c = GETC();
480           break;
481
482         default:
483           return (c);
484         }
485     }
486 }
487
488 /* Skips all of the white space at the current location in the input file.  */
489
490 void
491 position_after_white_space ()
492 {
493   register int c;
494
495   c = GETC();
496
497   UNGETC (skip_white_space (c));
498 }
499
500 /* Make the token buffer longer, preserving the data in it.
501    P should point to just beyond the last valid character in the old buffer.
502    The value we return is a pointer to the new buffer
503    at a place corresponding to P.  */
504
505 static void
506 extend_token_buffer_to (size)
507      int size;
508 {
509   do
510     maxtoken = maxtoken * 2 + 10;
511   while (maxtoken < size);
512   token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
513 }
514
515 static char *
516 extend_token_buffer (p)
517      const char *p;
518 {
519   int offset = p - token_buffer;
520   extend_token_buffer_to (offset);
521   return token_buffer + offset;
522 }
523 \f
524 #if defined HANDLE_PRAGMA
525 /* Local versions of these macros, that can be passed as function pointers.  */
526 static int
527 pragma_getc ()
528 {
529   return GETC ();
530 }
531
532 static void
533 pragma_ungetc (arg)
534      int arg;
535 {
536   UNGETC (arg);
537 }
538 #endif
539
540 static int
541 read_line_number (num)
542      int *num;
543 {
544   register int token = yylex ();
545
546   if (token == CONSTANT
547       && TREE_CODE (yylval.ttype) == INTEGER_CST)
548     {
549       *num = TREE_INT_CST_LOW (yylval.ttype);
550       return 1;
551     }
552   else
553     {
554       if (token != END_OF_LINE)
555         error ("invalid #-line");
556       return 0;
557     }
558 }
559   
560 /* At the beginning of a line, increment the line number
561    and process any #-directive on this line.
562    If the line is a #-directive, read the entire line and return a newline.
563    Otherwise, return the line's first non-whitespace character.
564
565    Note that in the case of USE_CPPLIB, we get the whole line as one
566    CPP_DIRECTIVE token.  */
567
568 int
569 check_newline ()
570 {
571   register int c;
572   register int token;
573   int saw_line;
574   enum { act_none, act_push, act_pop } action;
575   int old_lineno, action_number, l;
576
577  restart:
578   /* Read first nonwhite char on the line.  */
579
580 #ifdef USE_CPPLIB
581   c = GETC ();
582   /* In some cases where we're leaving an include file, we can get multiple
583      CPP_HSPACE tokens in a row, so we need to loop.  */
584   while (cpp_token == CPP_HSPACE)
585     c = yy_get_token ();
586 #else
587   do
588     c = GETC ();
589   while (c == ' ' || c == '\t');
590 #endif
591
592   lineno++;
593
594   if (c != '#')
595     {
596       /* Sequences of multiple newlines are very common; optimize them.  */
597       if (c == '\n')
598         goto restart;
599
600       /* If not #, return it so caller will use it.  */
601       return c;
602     }
603
604   /* Don't read beyond this line.  */
605   saw_line = 0;
606   linemode = 1;
607   
608 #if USE_CPPLIB
609   if (cpp_token == CPP_VSPACE)
610     {
611       /* Format is "<space> <line number> <filename> <newline>".
612          Only the line number is interesting, and even that
613          we can get more efficiently than scanning the line.  */
614       yy_cur = yy_lim - 1;
615       lineno = parse_in.lineno - 1;
616       goto skipline;
617     }
618 #endif
619
620   token = yylex ();
621
622   if (token == IDENTIFIER)
623     {
624       /* If a letter follows, then if the word here is `line', skip
625          it and ignore it; otherwise, ignore the line, with an error
626          if the word isn't `pragma'.  */
627
628       const char *name = IDENTIFIER_POINTER (yylval.ttype);
629
630       if (!strcmp (name, "pragma"))
631         {
632           token = yylex ();
633           if (token != IDENTIFIER
634               || TREE_CODE (yylval.ttype) != IDENTIFIER_NODE)
635             goto skipline;
636
637 #ifdef HANDLE_PRAGMA
638           /* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS
639              (if both are defined), in order to give the back
640              end a chance to override the interpretation of
641              SYSV style pragmas.  */
642           if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
643                              IDENTIFIER_POINTER (yylval.ttype)))
644             goto skipline;
645 #endif /* HANDLE_PRAGMA */
646               
647 #ifdef HANDLE_GENERIC_PRAGMAS
648           if (handle_generic_pragma (token))
649             goto skipline;
650 #endif /* HANDLE_GENERIC_PRAGMAS */
651
652           /* Issue a warning message if we have been asked to do so.
653              Ignoring unknown pragmas in system header file unless
654              an explcit -Wunknown-pragmas has been given. */
655           if (warn_unknown_pragmas > 1
656               || (warn_unknown_pragmas && ! in_system_header))
657             warning ("ignoring pragma: %s", token_buffer);
658
659           goto skipline;
660         }
661       else if (!strcmp (name, "define"))
662         {
663           debug_define (lineno, GET_DIRECTIVE_LINE ());
664           goto skipline;
665         }
666       else if (!strcmp (name, "undef"))
667         {
668           debug_undef (lineno, GET_DIRECTIVE_LINE ());
669           goto skipline;
670         }
671       else if (!strcmp (name, "line"))
672         {
673           saw_line = 1;
674           token = yylex ();
675           goto linenum;
676         }
677       else if (!strcmp (name, "ident"))
678         {
679           /* #ident.  The pedantic warning is now in cccp.c.  */
680
681           /* Here we have just seen `#ident '.
682              A string constant should follow.  */
683
684           token = yylex ();
685           if (token == END_OF_LINE)
686             goto skipline;
687           if (token != STRING
688               || TREE_CODE (yylval.ttype) != STRING_CST)
689             {
690               error ("invalid #ident");
691               goto skipline;
692             }
693
694           if (! flag_no_ident)
695             {
696 #ifdef ASM_OUTPUT_IDENT
697               ASM_OUTPUT_IDENT (asm_out_file,
698                                 TREE_STRING_POINTER (yylval.ttype));
699 #endif
700             }
701
702           /* Skip the rest of this line.  */
703           goto skipline;
704         }
705
706       error ("undefined or invalid # directive `%s'", name);
707       goto skipline;
708     }
709
710   /* If the # is the only nonwhite char on the line,
711      just ignore it.  Check the new newline.  */
712   if (token == END_OF_LINE)
713     goto skipline;
714
715 linenum:
716   /* Here we have either `#line' or `# <nonletter>'.
717      In either case, it should be a line number; a digit should follow.  */
718
719   if (token != CONSTANT
720       || TREE_CODE (yylval.ttype) != INTEGER_CST)
721     {
722       error ("invalid #-line");
723       goto skipline;
724     }
725
726   /* subtract one, because it is the following line that
727      gets the specified number */
728
729   l = TREE_INT_CST_LOW (yylval.ttype) - 1;
730
731   /* More follows: it must be a string constant (filename).
732      It would be neat to use cpplib to quickly process the string, but
733      (1) we don't have a handy tokenization of the string, and
734      (2) I don't know how well that would work in the presense
735      of filenames that contain wide characters.  */
736
737   if (saw_line)
738     {
739       /* Don't treat \ as special if we are processing #line 1 "...".
740          If you want it to be treated specially, use # 1 "...".  */
741       ignore_escape_flag = 1;
742     }
743
744   /* Read the string constant.  */
745   token = yylex ();
746
747   ignore_escape_flag = 0;
748
749   if (token == END_OF_LINE)
750     {
751       /* No more: store the line number and check following line.  */
752       lineno = l;
753       goto skipline;
754     }
755
756   if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
757     {
758       error ("invalid #line");
759       goto skipline;
760     }
761
762   input_filename = TREE_STRING_POINTER (yylval.ttype);
763
764   if (main_input_filename == 0)
765     main_input_filename = input_filename;
766
767   old_lineno = lineno;
768   action = act_none;
769   action_number = 0;
770   lineno = l;
771
772   /* Each change of file name
773      reinitializes whether we are now in a system header.  */
774   in_system_header = 0;
775
776   if (!read_line_number (&action_number))
777     {
778       /* Update the name in the top element of input_file_stack.  */
779       if (input_file_stack)
780         input_file_stack->name = input_filename;
781     }
782
783   /* `1' after file name means entering new file.
784      `2' after file name means just left a file.  */
785
786   if (action_number == 1)
787     {
788       action = act_push;
789       read_line_number (&action_number);
790     }
791   else if (action_number == 2)
792     {
793       action = act_pop;
794       read_line_number (&action_number);
795     }
796   if (action_number == 3)
797     {
798       /* `3' after file name means this is a system header file.  */
799       in_system_header = 1;
800       read_line_number (&action_number);
801     }
802
803   /* Do the actions implied by the preceding numbers.  */
804
805   if (action == act_push)
806     {
807       /* Pushing to a new file.  */
808       struct file_stack *p
809         = (struct file_stack *) xmalloc (sizeof (struct file_stack));
810       input_file_stack->line = old_lineno;
811       p->next = input_file_stack;
812       p->name = input_filename;
813       p->indent_level = indent_level;
814       input_file_stack = p;
815       input_file_stack_tick++;
816       debug_start_source_file (input_filename);
817     }
818   else if (action == act_pop)
819     {
820       /* Popping out of a file.  */
821       if (input_file_stack->next)
822         {
823           struct file_stack *p = input_file_stack;
824           if (indent_level != p->indent_level)
825             {
826               warning_with_file_and_line
827                 (p->name, old_lineno,
828                  "This file contains more `%c's than `%c's.",
829                  indent_level > p->indent_level ? '{' : '}',
830                  indent_level > p->indent_level ? '}' : '{');
831             }
832           input_file_stack = p->next;
833           free (p);
834           input_file_stack_tick++;
835           debug_end_source_file (input_file_stack->line);
836         }
837       else
838         error ("#-lines for entering and leaving files don't match");
839     }
840
841   /* Now that we've pushed or popped the input stack,
842      update the name in the top element.  */
843   if (input_file_stack)
844     input_file_stack->name = input_filename;
845
846   /* skip the rest of this line.  */
847  skipline:
848   linemode = 0;
849   end_of_file = 0;
850
851   do
852     c = GETC();
853   while (c != '\n' && c != EOF);
854   return c;
855 }
856 \f
857 #ifdef HANDLE_GENERIC_PRAGMAS
858
859 /* Handle a #pragma directive.
860    TOKEN is the token we read after `#pragma'.  Processes the entire input
861    line and return non-zero iff the pragma has been successfully parsed.  */
862
863 /* This function has to be in this file, in order to get at
864    the token types.  */
865
866 static int
867 handle_generic_pragma (token)
868      register int token;
869 {
870   for (;;)
871     {
872       switch (token)
873         {
874         case IDENTIFIER:
875         case TYPENAME:
876         case STRING:
877         case CONSTANT:
878           handle_pragma_token (token_buffer, yylval.ttype);
879           break;
880
881         case END_OF_LINE:
882           return handle_pragma_token (NULL_PTR, NULL_TREE);
883
884         default:
885           handle_pragma_token (token_buffer, NULL);
886         }
887
888       token = yylex ();
889     }
890 }
891
892 #endif /* HANDLE_GENERIC_PRAGMAS */
893 \f
894 #define ENDFILE -1  /* token that represents end-of-file */
895
896 /* Read an escape sequence, returning its equivalent as a character,
897    or store 1 in *ignore_ptr if it is backslash-newline.  */
898
899 static int
900 readescape (ignore_ptr)
901      int *ignore_ptr;
902 {
903   register int c = GETC();
904   register int code;
905   register unsigned count;
906   unsigned firstdig = 0;
907   int nonnull;
908
909   switch (c)
910     {
911     case 'x':
912       if (warn_traditional)
913         warning ("the meaning of `\\x' varies with -traditional");
914
915       if (flag_traditional)
916         return c;
917
918       code = 0;
919       count = 0;
920       nonnull = 0;
921       while (1)
922         {
923           c = GETC();
924           if (! ISXDIGIT (c))
925             {
926               UNGETC (c);
927               break;
928             }
929           code *= 16;
930           if (c >= 'a' && c <= 'f')
931             code += c - 'a' + 10;
932           if (c >= 'A' && c <= 'F')
933             code += c - 'A' + 10;
934           if (c >= '0' && c <= '9')
935             code += c - '0';
936           if (code != 0 || count != 0)
937             {
938               if (count == 0)
939                 firstdig = code;
940               count++;
941             }
942           nonnull = 1;
943         }
944       if (! nonnull)
945         error ("\\x used with no following hex digits");
946       else if (count == 0)
947         /* Digits are all 0's.  Ok.  */
948         ;
949       else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
950                || (count > 1
951                    && (((unsigned)1
952                         << (TYPE_PRECISION (integer_type_node)
953                             - (count - 1) * 4))
954                        <= firstdig)))
955         pedwarn ("hex escape out of range");
956       return code;
957
958     case '0':  case '1':  case '2':  case '3':  case '4':
959     case '5':  case '6':  case '7':
960       code = 0;
961       count = 0;
962       while ((c <= '7') && (c >= '0') && (count++ < 3))
963         {
964           code = (code * 8) + (c - '0');
965           c = GETC();
966         }
967       UNGETC (c);
968       return code;
969
970     case '\\': case '\'': case '"':
971       return c;
972
973     case '\n':
974       lineno++;
975       *ignore_ptr = 1;
976       return 0;
977
978     case 'n':
979       return TARGET_NEWLINE;
980
981     case 't':
982       return TARGET_TAB;
983
984     case 'r':
985       return TARGET_CR;
986
987     case 'f':
988       return TARGET_FF;
989
990     case 'b':
991       return TARGET_BS;
992
993     case 'a':
994       if (warn_traditional)
995         warning ("the meaning of `\\a' varies with -traditional");
996
997       if (flag_traditional)
998         return c;
999       return TARGET_BELL;
1000
1001     case 'v':
1002 #if 0 /* Vertical tab is present in common usage compilers.  */
1003       if (flag_traditional)
1004         return c;
1005 #endif
1006       return TARGET_VT;
1007
1008     case 'e':
1009     case 'E':
1010       if (pedantic)
1011         pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
1012       return TARGET_ESC;
1013
1014     case '?':
1015       return c;
1016
1017       /* `\(', etc, are used at beginning of line to avoid confusing Emacs.  */
1018     case '(':
1019     case '{':
1020     case '[':
1021       /* `\%' is used to prevent SCCS from getting confused.  */
1022     case '%':
1023       if (pedantic)
1024         pedwarn ("unknown escape sequence `\\%c'", c);
1025       return c;
1026     }
1027   if (ISGRAPH (c))
1028     pedwarn ("unknown escape sequence `\\%c'", c);
1029   else
1030     pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
1031   return c;
1032 }
1033 \f
1034 void
1035 yyerror (msgid)
1036      const char *msgid;
1037 {
1038   const char *string = _(msgid);
1039
1040   /* We can't print string and character constants well
1041      because the token_buffer contains the result of processing escapes.  */
1042   if (end_of_file)
1043     error ("%s at end of input", string);
1044   else if (token_buffer[0] == 0)
1045     error ("%s at null character", string);
1046   else if (token_buffer[0] == '"')
1047     error ("%s before string constant", string);
1048   else if (token_buffer[0] == '\'')
1049     error ("%s before character constant", string);
1050   else if (!ISGRAPH(token_buffer[0]))
1051     error ("%s before character 0%o", string, (unsigned char) token_buffer[0]);
1052   else
1053     error ("%s before `%s'", string, token_buffer);
1054 }
1055
1056 #if 0
1057
1058 struct try_type
1059 {
1060   tree *node_var;
1061   char unsigned_flag;
1062   char long_flag;
1063   char long_long_flag;
1064 };
1065
1066 struct try_type type_sequence[] =
1067 {
1068   { &integer_type_node, 0, 0, 0},
1069   { &unsigned_type_node, 1, 0, 0},
1070   { &long_integer_type_node, 0, 1, 0},
1071   { &long_unsigned_type_node, 1, 1, 0},
1072   { &long_long_integer_type_node, 0, 1, 1},
1073   { &long_long_unsigned_type_node, 1, 1, 1}
1074 };
1075 #endif /* 0 */
1076 \f
1077 struct pf_args
1078 {
1079   /* Input */
1080   int base;
1081   char * p;
1082   /* I/O */
1083   int c;
1084   /* Output */
1085   int imag;
1086   tree type;
1087   int conversion_errno;
1088   REAL_VALUE_TYPE value;
1089 };
1090  
1091 static void
1092 parse_float (data)
1093   PTR data;
1094 {
1095   struct pf_args * args = (struct pf_args *) data;
1096   int fflag = 0, lflag = 0;
1097   /* Copy token_buffer now, while it has just the number
1098      and not the suffixes; once we add `f' or `i',
1099      REAL_VALUE_ATOF may not work any more.  */
1100   char *copy = (char *) alloca (args->p - token_buffer + 1);
1101   bcopy (token_buffer, copy, args->p - token_buffer + 1);
1102   args->imag = 0;
1103   args->conversion_errno = 0;
1104   args->type = double_type_node;
1105
1106   while (1)
1107     {
1108       int lose = 0;
1109
1110       /* Read the suffixes to choose a data type.  */
1111       switch (args->c)
1112         {
1113         case 'f': case 'F':
1114           if (fflag)
1115             error ("more than one `f' in numeric constant");
1116           fflag = 1;
1117           break;
1118
1119         case 'l': case 'L':
1120           if (lflag)
1121             error ("more than one `l' in numeric constant");
1122           lflag = 1;
1123           break;
1124
1125         case 'i': case 'I':
1126           if (args->imag)
1127             error ("more than one `i' or `j' in numeric constant");
1128           else if (pedantic)
1129             pedwarn ("ANSI C forbids imaginary numeric constants");
1130           args->imag = 1;
1131           break;
1132
1133         default:
1134           lose = 1;
1135         }
1136
1137       if (lose)
1138         break;
1139
1140       if (args->p >= token_buffer + maxtoken - 3)
1141         args->p = extend_token_buffer (args->p);
1142       *(args->p++) = args->c;
1143       *(args->p) = 0;
1144       args->c = GETC();
1145     }
1146
1147   /* The second argument, machine_mode, of REAL_VALUE_ATOF
1148      tells the desired precision of the binary result
1149      of decimal-to-binary conversion.  */
1150
1151   if (fflag)
1152     {
1153       if (lflag)
1154         error ("both `f' and `l' in floating constant");
1155
1156       args->type = float_type_node;
1157       errno = 0;
1158       if (args->base == 16)
1159         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1160       else
1161         args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1162       args->conversion_errno = errno;
1163       /* A diagnostic is required here by some ANSI C testsuites.
1164          This is not pedwarn, because some people don't want
1165          an error for this.  */
1166       if (REAL_VALUE_ISINF (args->value) && pedantic)
1167         warning ("floating point number exceeds range of `float'");
1168     }
1169   else if (lflag)
1170     {
1171       args->type = long_double_type_node;
1172       errno = 0;
1173       if (args->base == 16)
1174         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1175       else
1176         args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1177       args->conversion_errno = errno;
1178       if (REAL_VALUE_ISINF (args->value) && pedantic)
1179         warning ("floating point number exceeds range of `long double'");
1180     }
1181   else
1182     {
1183       errno = 0;
1184       if (args->base == 16)
1185         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1186       else
1187         args->value = REAL_VALUE_ATOF (copy, TYPE_MODE (args->type));
1188       args->conversion_errno = errno;
1189       if (REAL_VALUE_ISINF (args->value) && pedantic)
1190         warning ("floating point number exceeds range of `double'");
1191     }
1192 }
1193  
1194 /* Get the next character, staying within the current token if possible.
1195    If we're lexing a token, we don't want to look beyond the end of the
1196    token cpplib has prepared for us; otherwise, we end up reading in the
1197    next token, which screws up feed_input.  So just return a null
1198    character.  */
1199
1200 static inline int token_getch PARAMS ((void));
1201
1202 static inline int
1203 token_getch ()
1204 {
1205 #if USE_CPPLIB
1206   if (yy_cur == yy_lim)
1207     return '\0';
1208 #endif
1209   return GETC ();
1210 }
1211
1212 static inline void token_put_back PARAMS ((int));
1213
1214 static inline void
1215 token_put_back (ch)
1216      int ch;
1217 {
1218 #if USE_CPPLIB
1219   if (ch == '\0')
1220     return;
1221 #endif
1222   UNGETC (ch);
1223 }
1224
1225 /* Read a single token from the input stream, and assign it lexical
1226    semantics.  */
1227
1228 int
1229 yylex ()
1230 {
1231   register int c;
1232   register char *p;
1233   register int value;
1234   int wide_flag = 0;
1235   int objc_flag = 0;
1236
1237   c = GETC();
1238
1239   /* Effectively do c = skip_white_space (c)
1240      but do it faster in the usual cases.  */
1241   while (1)
1242     switch (c)
1243       {
1244       case ' ':
1245       case '\t':
1246       case '\f':
1247       case '\v':
1248       case '\b':
1249 #if USE_CPPLIB
1250         if (cpp_token == CPP_HSPACE)
1251           c = yy_get_token ();
1252         else
1253 #endif
1254           c = GETC();
1255         break;
1256
1257       case '\r':
1258         /* Call skip_white_space so we can warn if appropriate.  */
1259
1260       case '\n':
1261       case '/':
1262       case '\\':
1263         c = skip_white_space (c);
1264       default:
1265         goto found_nonwhite;
1266       }
1267  found_nonwhite:
1268
1269   token_buffer[0] = c;
1270   token_buffer[1] = 0;
1271
1272 /*  yylloc.first_line = lineno; */
1273
1274   switch (c)
1275     {
1276     case EOF:
1277       end_of_file = 1;
1278       token_buffer[0] = 0;
1279       if (linemode)
1280         value = END_OF_LINE;
1281       else
1282         value = ENDFILE;
1283       break;
1284
1285     case 'L':
1286 #if USE_CPPLIB
1287       if (cpp_token == CPP_NAME)
1288         goto letter;
1289 #endif
1290       /* Capital L may start a wide-string or wide-character constant.  */
1291       {
1292         register int c = token_getch();
1293         if (c == '\'')
1294           {
1295             wide_flag = 1;
1296             goto char_constant;
1297           }
1298         if (c == '"')
1299           {
1300             wide_flag = 1;
1301             goto string_constant;
1302           }
1303         token_put_back (c);
1304       }
1305       goto letter;
1306
1307     case '@':
1308       if (!doing_objc_thang)
1309         {
1310           value = c;
1311           break;
1312         }
1313       else
1314         {
1315           /* '@' may start a constant string object.  */
1316           register int c = token_getch ();
1317           if (c == '"')
1318             {
1319               objc_flag = 1;
1320               goto string_constant;
1321             }
1322           token_put_back (c);
1323           /* Fall through to treat '@' as the start of an identifier.  */
1324         }
1325
1326     case 'A':  case 'B':  case 'C':  case 'D':  case 'E':
1327     case 'F':  case 'G':  case 'H':  case 'I':  case 'J':
1328     case 'K':             case 'M':  case 'N':  case 'O':
1329     case 'P':  case 'Q':  case 'R':  case 'S':  case 'T':
1330     case 'U':  case 'V':  case 'W':  case 'X':  case 'Y':
1331     case 'Z':
1332     case 'a':  case 'b':  case 'c':  case 'd':  case 'e':
1333     case 'f':  case 'g':  case 'h':  case 'i':  case 'j':
1334     case 'k':  case 'l':  case 'm':  case 'n':  case 'o':
1335     case 'p':  case 'q':  case 'r':  case 's':  case 't':
1336     case 'u':  case 'v':  case 'w':  case 'x':  case 'y':
1337     case 'z':
1338     case '_':
1339     case '$':
1340     letter:
1341 #if USE_CPPLIB
1342       if (cpp_token == CPP_NAME)
1343         {
1344           /* Note that one character has already been read from
1345              yy_cur into token_buffer.  Also, cpplib complains about
1346              $ in identifiers, so we don't have to.  */
1347
1348           int len = yy_lim - yy_cur + 1;
1349           if (len >= maxtoken)
1350             extend_token_buffer_to (len + 1);
1351           memcpy (token_buffer + 1, yy_cur, len);
1352           p = token_buffer + len;
1353           yy_cur = yy_lim;
1354         }
1355       else
1356 #endif
1357         {
1358           p = token_buffer;
1359           while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
1360             {
1361               /* Make sure this char really belongs in an identifier.  */
1362               if (c == '$')
1363                 {
1364                   if (! dollars_in_ident)
1365                     error ("`$' in identifier");
1366                   else if (pedantic)
1367                     pedwarn ("`$' in identifier");
1368                 }
1369
1370               if (p >= token_buffer + maxtoken)
1371                 p = extend_token_buffer (p);
1372
1373               *p++ = c;
1374               c = token_getch();
1375             }
1376
1377           *p = 0;
1378           token_put_back (c);
1379         }
1380
1381       value = IDENTIFIER;
1382       yylval.itype = 0;
1383
1384       /* Try to recognize a keyword.  Uses minimum-perfect hash function */
1385
1386       {
1387         register struct resword *ptr;
1388
1389         if ((ptr = is_reserved_word (token_buffer, p - token_buffer)))
1390           {
1391             if (ptr->rid)
1392               yylval.ttype = ridpointers[(int) ptr->rid];
1393             value = (int) ptr->token;
1394
1395             /* Only return OBJECTNAME if it is a typedef.  */
1396             if (doing_objc_thang && value == OBJECTNAME)
1397               {
1398                 lastiddecl = lookup_name(yylval.ttype);
1399
1400                 if (lastiddecl == NULL_TREE
1401                     || TREE_CODE (lastiddecl) != TYPE_DECL)
1402                   value = IDENTIFIER;
1403               }
1404
1405             /* Even if we decided to recognize asm, still perhaps warn.  */
1406             if (pedantic
1407                 && (value == ASM_KEYWORD || value == TYPEOF
1408                     || ptr->rid == RID_INLINE)
1409                 && token_buffer[0] != '_')
1410               pedwarn ("ANSI does not permit the keyword `%s'",
1411                        token_buffer);
1412           }
1413       }
1414
1415       /* If we did not find a keyword, look for an identifier
1416          (or a typename).  */
1417
1418       if (value == IDENTIFIER)
1419         {
1420           if (token_buffer[0] == '@')
1421             error("invalid identifier `%s'", token_buffer);
1422
1423           yylval.ttype = get_identifier (token_buffer);
1424           lastiddecl = lookup_name (yylval.ttype);
1425
1426           if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL)
1427             value = TYPENAME;
1428           /* A user-invisible read-only initialized variable
1429              should be replaced by its value.
1430              We handle only strings since that's the only case used in C.  */
1431           else if (lastiddecl != 0 && TREE_CODE (lastiddecl) == VAR_DECL
1432                    && DECL_IGNORED_P (lastiddecl)
1433                    && TREE_READONLY (lastiddecl)
1434                    && DECL_INITIAL (lastiddecl) != 0
1435                    && TREE_CODE (DECL_INITIAL (lastiddecl)) == STRING_CST)
1436             {
1437               tree stringval = DECL_INITIAL (lastiddecl);
1438
1439               /* Copy the string value so that we won't clobber anything
1440                  if we put something in the TREE_CHAIN of this one.  */
1441               yylval.ttype = build_string (TREE_STRING_LENGTH (stringval),
1442                                            TREE_STRING_POINTER (stringval));
1443               value = STRING;
1444             }
1445           else if (doing_objc_thang)
1446             {
1447               tree objc_interface_decl = is_class_name (yylval.ttype);
1448
1449               if (objc_interface_decl)
1450                 {
1451                   value = CLASSNAME;
1452                   yylval.ttype = objc_interface_decl;
1453                 }
1454             }
1455         }
1456
1457       break;
1458
1459     case '.':
1460 #if USE_CPPLIB
1461       if (yy_cur < yy_lim)
1462 #endif
1463         {
1464           /* It's hard to preserve tokenization on '.' because
1465              it could be a symbol by itself, or it could be the
1466              start of a floating point number and cpp won't tell us.  */
1467           register int c1 = token_getch ();
1468           token_buffer[1] = c1;
1469           if (c1 == '.')
1470             {
1471               c1 = token_getch ();
1472               if (c1 == '.')
1473                 {
1474                   token_buffer[2] = c1;
1475                   token_buffer[3] = 0;
1476                   value = ELLIPSIS;
1477                   goto done;
1478                 }
1479               error ("parse error at `..'");
1480             }
1481           if (ISDIGIT (c1))
1482             {
1483               token_put_back (c1);
1484               goto number;
1485             }
1486           token_put_back (c1);
1487         }
1488       value = '.';
1489       token_buffer[1] = 0;
1490       break;
1491
1492     case '0':  case '1':
1493       /* Optimize for most frequent case.  */
1494       {
1495         register int cond;
1496
1497 #if USE_CPPLIB
1498         cond = (yy_cur == yy_lim);
1499 #else
1500         register int c1 = token_getch ();
1501         token_put_back (c1);
1502         cond = (! ISALNUM (c1) && c1 != '.');
1503 #endif
1504         if (cond)
1505           {
1506             yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node;
1507             value = CONSTANT;
1508             break;
1509           }
1510         /*FALLTHRU*/
1511       }
1512     case '2':  case '3':  case '4':
1513     case '5':  case '6':  case '7':  case '8':  case '9':
1514     number:
1515       {
1516         int base = 10;
1517         int count = 0;
1518         int largest_digit = 0;
1519         int numdigits = 0;
1520         int overflow = 0;
1521
1522         /* We actually store only HOST_BITS_PER_CHAR bits in each part.
1523            The code below which fills the parts array assumes that a host
1524            int is at least twice as wide as a host char, and that 
1525            HOST_BITS_PER_WIDE_INT is an even multiple of HOST_BITS_PER_CHAR.
1526            Two HOST_WIDE_INTs is the largest int literal we can store.
1527            In order to detect overflow below, the number of parts (TOTAL_PARTS)
1528            must be exactly the number of parts needed to hold the bits
1529            of two HOST_WIDE_INTs. */
1530 #define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2)
1531         unsigned int parts[TOTAL_PARTS];
1532
1533         enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON}
1534           floatflag = NOT_FLOAT;
1535
1536         for (count = 0; count < TOTAL_PARTS; count++)
1537           parts[count] = 0;
1538
1539         p = token_buffer;
1540         *p++ = c;
1541
1542         if (c == '0')
1543           {
1544             *p++ = (c = token_getch());
1545             if ((c == 'x') || (c == 'X'))
1546               {
1547                 base = 16;
1548                 *p++ = (c = token_getch());
1549               }
1550             /* Leading 0 forces octal unless the 0 is the only digit.  */
1551             else if (c >= '0' && c <= '9')
1552               {
1553                 base = 8;
1554                 numdigits++;
1555               }
1556             else
1557               numdigits++;
1558           }
1559
1560         /* Read all the digits-and-decimal-points.  */
1561
1562         while (c == '.'
1563                || (ISALNUM (c) && c != 'l' && c != 'L'
1564                    && c != 'u' && c != 'U'
1565                    && c != 'i' && c != 'I' && c != 'j' && c != 'J'
1566                    && (floatflag == NOT_FLOAT
1567                        || ((base != 16) && (c != 'f') && (c != 'F'))
1568                        || base == 16)))   
1569           {
1570             if (c == '.')
1571               {
1572                 if (base == 16 && pedantic)
1573                   pedwarn ("floating constant may not be in radix 16");
1574                 if (floatflag == TOO_MANY_POINTS)
1575                   /* We have already emitted an error.  Don't need another.  */
1576                   ;
1577                 else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON)
1578                   {
1579                     error ("malformed floating constant");
1580                     floatflag = TOO_MANY_POINTS;
1581                     /* Avoid another error from atof by forcing all characters
1582                        from here on to be ignored.  */
1583                     p[-1] = '\0';
1584                   }
1585                 else
1586                   floatflag = AFTER_POINT;
1587
1588                 if (base == 8)
1589                   base = 10;
1590                 *p++ = c = token_getch();
1591                 /* Accept '.' as the start of a floating-point number
1592                    only when it is followed by a digit.  */
1593                 if (p == token_buffer + 2 && !ISDIGIT (c))
1594                   abort ();
1595               }
1596             else
1597               {
1598                 /* It is not a decimal point.
1599                    It should be a digit (perhaps a hex digit).  */
1600
1601                 if (ISDIGIT (c))
1602                   {
1603                     c = c - '0';
1604                   }
1605                 else if (base <= 10)
1606                   {
1607                     if (c == 'e' || c == 'E')
1608                       {
1609                         base = 10;
1610                         floatflag = AFTER_EXPON;
1611                         break;   /* start of exponent */
1612                       }
1613                     error ("nondigits in number and not hexadecimal");
1614                     c = 0;
1615                   }
1616                 else if (base == 16 && (c == 'p' || c == 'P'))
1617                   {
1618                     floatflag = AFTER_EXPON;
1619                     break;   /* start of exponent */
1620                   }
1621                 else if (c >= 'a')
1622                   {
1623                     c = c - 'a' + 10;
1624                   }
1625                 else
1626                   {
1627                     c = c - 'A' + 10;
1628                   }
1629                 if (c >= largest_digit)
1630                   largest_digit = c;
1631                 numdigits++;
1632
1633                 for (count = 0; count < TOTAL_PARTS; count++)
1634                   {
1635                     parts[count] *= base;
1636                     if (count)
1637                       {
1638                         parts[count]
1639                           += (parts[count-1] >> HOST_BITS_PER_CHAR);
1640                         parts[count-1]
1641                           &= (1 << HOST_BITS_PER_CHAR) - 1;
1642                       }
1643                     else
1644                       parts[0] += c;
1645                   }
1646
1647                 /* If the highest-order part overflows (gets larger than
1648                    a host char will hold) then the whole number has 
1649                    overflowed.  Record this and truncate the highest-order
1650                    part. */
1651                 if (parts[TOTAL_PARTS - 1] >> HOST_BITS_PER_CHAR)
1652                   {
1653                     overflow = 1;
1654                     parts[TOTAL_PARTS - 1] &= (1 << HOST_BITS_PER_CHAR) - 1;
1655                   }
1656
1657                 if (p >= token_buffer + maxtoken - 3)
1658                   p = extend_token_buffer (p);
1659                 *p++ = (c = token_getch());
1660               }
1661           }
1662
1663         /* This can happen on input like `int i = 0x;' */
1664         if (numdigits == 0)
1665           error ("numeric constant with no digits");
1666
1667         if (largest_digit >= base)
1668           error ("numeric constant contains digits beyond the radix");
1669
1670         /* Remove terminating char from the token buffer and delimit the
1671            string.  */
1672         *--p = 0;
1673
1674         if (floatflag != NOT_FLOAT)
1675           {
1676             tree type;
1677             int imag, conversion_errno;
1678             REAL_VALUE_TYPE value;
1679             struct pf_args args;
1680
1681             /* Read explicit exponent if any, and put it in tokenbuf.  */
1682
1683             if ((base == 10 && ((c == 'e') || (c == 'E')))
1684                 || (base == 16 && (c == 'p' || c == 'P')))
1685               {
1686                 if (p >= token_buffer + maxtoken - 3)
1687                   p = extend_token_buffer (p);
1688                 *p++ = c;
1689                 c = token_getch();
1690                 if ((c == '+') || (c == '-'))
1691                   {
1692                     *p++ = c;
1693                     c = token_getch();
1694                   }
1695                 /* Exponent is decimal, even if string is a hex float.  */
1696                 if (! ISDIGIT (c))
1697                   error ("floating constant exponent has no digits");
1698                 while (ISDIGIT (c))
1699                   {
1700                     if (p >= token_buffer + maxtoken - 3)
1701                       p = extend_token_buffer (p);
1702                     *p++ = c;
1703                     c = token_getch ();
1704                   }
1705               }
1706             if (base == 16 && floatflag != AFTER_EXPON)
1707               error ("hexadecimal floating constant has no exponent");
1708
1709             *p = 0;
1710
1711             /* Setup input for parse_float() */
1712             args.base = base;
1713             args.p = p;
1714             args.c = c;
1715
1716             /* Convert string to a double, checking for overflow.  */
1717             if (do_float_handler (parse_float, (PTR) &args))
1718               {
1719                 /* Receive output from parse_float() */
1720                 value = args.value;
1721               }
1722             else
1723               {
1724                 /* We got an exception from parse_float() */
1725                 error ("floating constant out of range");
1726                 value = dconst0;
1727               }
1728
1729             /* Receive output from parse_float() */
1730             c = args.c;
1731             imag = args.imag;
1732             type = args.type;
1733             conversion_errno = args.conversion_errno;
1734             
1735 #ifdef ERANGE
1736             /* ERANGE is also reported for underflow,
1737                so test the value to distinguish overflow from that.  */
1738             if (conversion_errno == ERANGE && !flag_traditional && pedantic
1739                 && (REAL_VALUES_LESS (dconst1, value)
1740                     || REAL_VALUES_LESS (value, dconstm1)))
1741               warning ("floating point number exceeds range of `double'");
1742 #endif
1743
1744             /* If the result is not a number, assume it must have been
1745                due to some error message above, so silently convert
1746                it to a zero.  */
1747             if (REAL_VALUE_ISNAN (value))
1748               value = dconst0;
1749
1750             /* Create a node with determined type and value.  */
1751             if (imag)
1752               yylval.ttype = build_complex (NULL_TREE,
1753                                             convert (type, integer_zero_node),
1754                                             build_real (type, value));
1755             else
1756               yylval.ttype = build_real (type, value);
1757           }
1758         else
1759           {
1760             tree traditional_type, ansi_type, type;
1761             HOST_WIDE_INT high, low;
1762             int spec_unsigned = 0;
1763             int spec_long = 0;
1764             int spec_long_long = 0;
1765             int spec_imag = 0;
1766             int warn = 0, i;
1767
1768             traditional_type = ansi_type = type = NULL_TREE;
1769             while (1)
1770               {
1771                 if (c == 'u' || c == 'U')
1772                   {
1773                     if (spec_unsigned)
1774                       error ("two `u's in integer constant");
1775                     spec_unsigned = 1;
1776                   }
1777                 else if (c == 'l' || c == 'L')
1778                   {
1779                     if (spec_long)
1780                       {
1781                         if (spec_long_long)
1782                           error ("three `l's in integer constant");
1783                         else if (pedantic && ! in_system_header && warn_long_long)
1784                           pedwarn ("ANSI C forbids long long integer constants");
1785                         spec_long_long = 1;
1786                       }
1787                     spec_long = 1;
1788                   }
1789                 else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
1790                   {
1791                     if (spec_imag)
1792                       error ("more than one `i' or `j' in numeric constant");
1793                     else if (pedantic)
1794                       pedwarn ("ANSI C forbids imaginary numeric constants");
1795                     spec_imag = 1;
1796                   }
1797                 else
1798                   break;
1799                 if (p >= token_buffer + maxtoken - 3)
1800                   p = extend_token_buffer (p);
1801                 *p++ = c;
1802                 c = token_getch();
1803               }
1804
1805             /* If the literal overflowed, pedwarn about it now. */
1806             if (overflow)
1807               {
1808                 warn = 1;
1809                 pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);
1810               }
1811
1812             /* This is simplified by the fact that our constant
1813                is always positive.  */
1814
1815             high = low = 0;
1816
1817             for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
1818               {
1819                 high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
1820                                                     / HOST_BITS_PER_CHAR)]
1821                          << (i * HOST_BITS_PER_CHAR));
1822                 low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
1823               }
1824
1825             yylval.ttype = build_int_2 (low, high);
1826             TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
1827
1828             /* If warn_traditional, calculate both the ANSI type and the
1829                traditional type, then see if they disagree.
1830                Otherwise, calculate only the type for the dialect in use.  */
1831             if (warn_traditional || flag_traditional)
1832               {
1833                 /* Calculate the traditional type.  */
1834                 /* Traditionally, any constant is signed;
1835                    but if unsigned is specified explicitly, obey that.
1836                    Use the smallest size with the right number of bits,
1837                    except for one special case with decimal constants.  */
1838                 if (! spec_long && base != 10
1839                     && int_fits_type_p (yylval.ttype, unsigned_type_node))
1840                   traditional_type = (spec_unsigned ? unsigned_type_node
1841                                       : integer_type_node);
1842                 /* A decimal constant must be long
1843                    if it does not fit in type int.
1844                    I think this is independent of whether
1845                    the constant is signed.  */
1846                 else if (! spec_long && base == 10
1847                          && int_fits_type_p (yylval.ttype, integer_type_node))
1848                   traditional_type = (spec_unsigned ? unsigned_type_node
1849                                       : integer_type_node);
1850                 else if (! spec_long_long)
1851                   traditional_type = (spec_unsigned ? long_unsigned_type_node
1852                                       : long_integer_type_node);
1853                 else if (int_fits_type_p (yylval.ttype,
1854                                           spec_unsigned 
1855                                           ? long_long_unsigned_type_node
1856                                           : long_long_integer_type_node)) 
1857                   traditional_type = (spec_unsigned
1858                                       ? long_long_unsigned_type_node
1859                                       : long_long_integer_type_node);
1860                 else
1861                   traditional_type = (spec_unsigned
1862                                       ? widest_unsigned_literal_type_node
1863                                       : widest_integer_literal_type_node);
1864               }
1865             if (warn_traditional || ! flag_traditional)
1866               {
1867                 /* Calculate the ANSI type.  */
1868                 if (! spec_long && ! spec_unsigned
1869                     && int_fits_type_p (yylval.ttype, integer_type_node))
1870                   ansi_type = integer_type_node;
1871                 else if (! spec_long && (base != 10 || spec_unsigned)
1872                          && int_fits_type_p (yylval.ttype, unsigned_type_node))
1873                   ansi_type = unsigned_type_node;
1874                 else if (! spec_unsigned && !spec_long_long
1875                          && int_fits_type_p (yylval.ttype, long_integer_type_node))
1876                   ansi_type = long_integer_type_node;
1877                 else if (! spec_long_long
1878                          && int_fits_type_p (yylval.ttype,
1879                                              long_unsigned_type_node))
1880                   ansi_type = long_unsigned_type_node;
1881                 else if (! spec_unsigned
1882                          && int_fits_type_p (yylval.ttype,
1883                                              long_long_integer_type_node))
1884                   ansi_type = long_long_integer_type_node;
1885                 else if (int_fits_type_p (yylval.ttype,
1886                                           long_long_unsigned_type_node))
1887                   ansi_type = long_long_unsigned_type_node;
1888                 else if (! spec_unsigned
1889                          && int_fits_type_p (yylval.ttype,
1890                                              widest_integer_literal_type_node))
1891                   ansi_type = widest_integer_literal_type_node;
1892                 else
1893                   ansi_type = widest_unsigned_literal_type_node;
1894               }
1895
1896             type = flag_traditional ? traditional_type : ansi_type;
1897
1898             /* We assume that constants specified in a non-decimal
1899                base are bit patterns, and that the programmer really
1900                meant what they wrote.  */
1901             if (warn_traditional && base == 10
1902                 && traditional_type != ansi_type)
1903               {
1904                 if (TYPE_PRECISION (traditional_type)
1905                     != TYPE_PRECISION (ansi_type))
1906                   warning ("width of integer constant changes with -traditional");
1907                 else if (TREE_UNSIGNED (traditional_type)
1908                          != TREE_UNSIGNED (ansi_type))
1909                   warning ("integer constant is unsigned in ANSI C, signed with -traditional");
1910                 else
1911                   warning ("width of integer constant may change on other systems with -traditional");
1912               }
1913
1914             if (pedantic && !flag_traditional && !spec_long_long && !warn
1915                 && (TYPE_PRECISION (long_integer_type_node)
1916                     < TYPE_PRECISION (type)))
1917               {
1918                 warn = 1;
1919                 pedwarn ("integer constant larger than the maximum value of an unsigned long int");
1920               }
1921
1922             if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
1923               warning ("decimal constant is so large that it is unsigned");
1924
1925             if (spec_imag)
1926               {
1927                 if (TYPE_PRECISION (type)
1928                     <= TYPE_PRECISION (integer_type_node))
1929                   yylval.ttype
1930                     = build_complex (NULL_TREE, integer_zero_node,
1931                                      convert (integer_type_node,
1932                                               yylval.ttype));
1933                 else
1934                   error ("complex integer constant is too wide for `complex int'");
1935               }
1936             else if (flag_traditional && !int_fits_type_p (yylval.ttype, type))
1937               /* The traditional constant 0x80000000 is signed
1938                  but doesn't fit in the range of int.
1939                  This will change it to -0x80000000, which does fit.  */
1940               {
1941                 TREE_TYPE (yylval.ttype) = unsigned_type (type);
1942                 yylval.ttype = convert (type, yylval.ttype);
1943                 TREE_OVERFLOW (yylval.ttype)
1944                   = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0;
1945               }
1946             else
1947               TREE_TYPE (yylval.ttype) = type;
1948
1949
1950             /* If it's still an integer (not a complex), and it doesn't
1951                fit in the type we choose for it, then pedwarn. */
1952
1953             if (! warn
1954                 && TREE_CODE (TREE_TYPE (yylval.ttype)) == INTEGER_TYPE
1955                 && ! int_fits_type_p (yylval.ttype, TREE_TYPE (yylval.ttype)))
1956               pedwarn ("integer constant is larger than the maximum value for its type");
1957           }
1958
1959         token_put_back (c);
1960         *p = 0;
1961
1962         if (ISALNUM (c) || c == '.' || c == '_' || c == '$'
1963             || (!flag_traditional && (c == '-' || c == '+')
1964                 && (p[-1] == 'e' || p[-1] == 'E')))
1965           error ("missing white space after number `%s'", token_buffer);
1966
1967         value = CONSTANT; break;
1968       }
1969
1970     case '\'':
1971     char_constant:
1972       {
1973         register int result = 0;
1974         register int num_chars = 0;
1975         int chars_seen = 0;
1976         unsigned width = TYPE_PRECISION (char_type_node);
1977         int max_chars;
1978 #ifdef MULTIBYTE_CHARS
1979         int longest_char = local_mb_cur_max ();
1980         (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
1981 #endif
1982
1983         max_chars = TYPE_PRECISION (integer_type_node) / width;
1984         if (wide_flag)
1985           width = WCHAR_TYPE_SIZE;
1986
1987         while (1)
1988           {
1989           tryagain:
1990             c = token_getch();
1991
1992             if (c == '\'' || c == EOF)
1993               break;
1994
1995             ++chars_seen;
1996             if (c == '\\')
1997               {
1998                 int ignore = 0;
1999                 c = readescape (&ignore);
2000                 if (ignore)
2001                   goto tryagain;
2002                 if (width < HOST_BITS_PER_INT
2003                     && (unsigned) c >= ((unsigned)1 << width))
2004                   pedwarn ("escape sequence out of range for character");
2005 #ifdef MAP_CHARACTER
2006                 if (ISPRINT (c))
2007                   c = MAP_CHARACTER (c);
2008 #endif
2009               }
2010             else if (c == '\n')
2011               {
2012                 if (pedantic)
2013                   pedwarn ("ANSI C forbids newline in character constant");
2014                 lineno++;
2015               }
2016             else
2017               {
2018 #ifdef MULTIBYTE_CHARS
2019                 wchar_t wc;
2020                 int i;
2021                 int char_len = -1;
2022                 for (i = 1; i <= longest_char; ++i)
2023                   {
2024                     if (i > maxtoken - 4)
2025                       extend_token_buffer (token_buffer);
2026
2027                     token_buffer[i] = c;
2028                     char_len = local_mbtowc (& wc,
2029                                              token_buffer + 1,
2030                                              i);
2031                     if (char_len != -1)
2032                       break;
2033                     c = token_getch ();
2034                   }
2035                 if (char_len > 1)
2036                   {
2037                     /* mbtowc sometimes needs an extra char before accepting */
2038                     if (char_len < i)
2039                       token_put_back (c);
2040                     if (! wide_flag)
2041                       {
2042                         /* Merge character into result; ignore excess chars.  */
2043                         for (i = 1; i <= char_len; ++i)
2044                           {
2045                             if (i > max_chars)
2046                               break;
2047                             if (width < HOST_BITS_PER_INT)
2048                               result = (result << width)
2049                                 | (token_buffer[i]
2050                                    & ((1 << width) - 1));
2051                             else
2052                               result = token_buffer[i];
2053                           }
2054                         num_chars += char_len;
2055                         goto tryagain;
2056                       }
2057                     c = wc;
2058                   }
2059                 else
2060                   {
2061                     if (char_len == -1)
2062                       {
2063                         warning ("Ignoring invalid multibyte character");
2064                         /* Replace all but the first byte.  */
2065                         for (--i; i > 1; --i)
2066                           token_put_back (token_buffer[i]);
2067                         wc = token_buffer[1];
2068                       }
2069 #ifdef MAP_CHARACTER
2070                       c = MAP_CHARACTER (wc);
2071 #else
2072                       c = wc;
2073 #endif
2074                   }
2075 #else /* ! MULTIBYTE_CHARS */
2076 #ifdef MAP_CHARACTER
2077                 c = MAP_CHARACTER (c);
2078 #endif
2079 #endif /* ! MULTIBYTE_CHARS */
2080               }
2081
2082             if (wide_flag)
2083               {
2084                 if (chars_seen == 1) /* only keep the first one */
2085                   result = c;
2086                 goto tryagain;
2087               }
2088
2089             /* Merge character into result; ignore excess chars.  */
2090             num_chars += (width / TYPE_PRECISION (char_type_node));
2091             if (num_chars < max_chars + 1)
2092               {
2093                 if (width < HOST_BITS_PER_INT)
2094                   result = (result << width) | (c & ((1 << width) - 1));
2095                 else
2096                   result = c;
2097               }
2098           }
2099
2100         if (c != '\'')
2101           error ("malformed character constant");
2102         else if (chars_seen == 0)
2103           error ("empty character constant");
2104         else if (num_chars > max_chars)
2105           {
2106             num_chars = max_chars;
2107             error ("character constant too long");
2108           }
2109         else if (chars_seen != 1 && ! flag_traditional && warn_multichar)
2110           warning ("multi-character character constant");
2111
2112         /* If char type is signed, sign-extend the constant.  */
2113         if (! wide_flag)
2114           {
2115             int num_bits = num_chars * width;
2116             if (num_bits == 0)
2117               /* We already got an error; avoid invalid shift.  */
2118               yylval.ttype = build_int_2 (0, 0);
2119             else if (TREE_UNSIGNED (char_type_node)
2120                      || ((result >> (num_bits - 1)) & 1) == 0)
2121               yylval.ttype
2122                 = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
2123                                          >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2124                                0);
2125             else
2126               yylval.ttype
2127                 = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
2128                                           >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2129                                -1);
2130             TREE_TYPE (yylval.ttype) = integer_type_node;
2131           }
2132         else
2133           {
2134             yylval.ttype = build_int_2 (result, 0);
2135             TREE_TYPE (yylval.ttype) = wchar_type_node;
2136           }
2137
2138         value = CONSTANT;
2139         break;
2140       }
2141
2142     case '"':
2143     string_constant:
2144       {
2145         unsigned width = wide_flag ? WCHAR_TYPE_SIZE
2146                                    : TYPE_PRECISION (char_type_node);
2147 #ifdef MULTIBYTE_CHARS
2148         int longest_char = local_mb_cur_max ();
2149         (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
2150 #endif
2151         c = token_getch ();
2152         p = token_buffer + 1;
2153
2154         while (c != '"' && c != EOF)
2155           {
2156             /* ignore_escape_flag is set for reading the filename in #line.  */
2157             if (!ignore_escape_flag && c == '\\')
2158               {
2159                 int ignore = 0;
2160                 c = readescape (&ignore);
2161                 if (ignore)
2162                   goto skipnewline;
2163                 if (width < HOST_BITS_PER_INT
2164                     && (unsigned) c >= ((unsigned)1 << width))
2165                   pedwarn ("escape sequence out of range for character");
2166               }
2167             else if (c == '\n')
2168               {
2169                 if (pedantic)
2170                   pedwarn ("ANSI C forbids newline in string constant");
2171                 lineno++;
2172               }
2173             else
2174               {
2175 #ifdef MULTIBYTE_CHARS
2176                 wchar_t wc;
2177                 int i;
2178                 int char_len = -1;
2179                 for (i = 0; i < longest_char; ++i)
2180                   {
2181                     if (p + i >= token_buffer + maxtoken)
2182                       p = extend_token_buffer (p);
2183                     p[i] = c;
2184
2185                     char_len = local_mbtowc (& wc, p, i + 1);
2186                     if (char_len != -1)
2187                       break;
2188                     c = token_getch ();
2189                   }
2190                 if (char_len == -1)
2191                   {
2192                     warning ("Ignoring invalid multibyte character");
2193                     /* Replace all except the first byte.  */
2194                     token_put_back (c);
2195                     for (--i; i > 0; --i)
2196                       token_put_back (p[i]);
2197                     char_len = 1;
2198                   }
2199                 /* mbtowc sometimes needs an extra char before accepting */
2200                 if (char_len <= i)
2201                   token_put_back (c);
2202                 if (! wide_flag)
2203                   {
2204                     p += (i + 1);
2205                     c = token_getch ();
2206                     continue;
2207                   }
2208                 c = wc;
2209 #endif /* MULTIBYTE_CHARS */
2210               }
2211
2212             /* Add this single character into the buffer either as a wchar_t
2213                or as a single byte.  */
2214             if (wide_flag)
2215               {
2216                 unsigned width = TYPE_PRECISION (char_type_node);
2217                 unsigned bytemask = (1 << width) - 1;
2218                 int byte;
2219
2220                 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2221                   p = extend_token_buffer (p);
2222
2223                 for (byte = 0; byte < WCHAR_BYTES; ++byte)
2224                   {
2225                     int value;
2226                     if (byte >= (int) sizeof (c))
2227                       value = 0;
2228                     else
2229                       value = (c >> (byte * width)) & bytemask;
2230                     if (BYTES_BIG_ENDIAN)
2231                       p[WCHAR_BYTES - byte - 1] = value;
2232                     else
2233                       p[byte] = value;
2234                   }
2235                 p += WCHAR_BYTES;
2236               }
2237             else
2238               {
2239                 if (p >= token_buffer + maxtoken)
2240                   p = extend_token_buffer (p);
2241                 *p++ = c;
2242               }
2243
2244           skipnewline:
2245             c = token_getch ();
2246           }
2247
2248         /* Terminate the string value, either with a single byte zero
2249            or with a wide zero.  */
2250         if (wide_flag)
2251           {
2252             if (p + WCHAR_BYTES > token_buffer + maxtoken)
2253               p = extend_token_buffer (p);
2254             bzero (p, WCHAR_BYTES);
2255             p += WCHAR_BYTES;
2256           }
2257         else
2258           {
2259             if (p >= token_buffer + maxtoken)
2260               p = extend_token_buffer (p);
2261             *p++ = 0;
2262           }
2263
2264         if (c == EOF)
2265           error ("Unterminated string constant");
2266
2267         /* We have read the entire constant.
2268            Construct a STRING_CST for the result.  */
2269
2270         if (wide_flag)
2271           {
2272             yylval.ttype = build_string (p - (token_buffer + 1),
2273                                          token_buffer + 1);
2274             TREE_TYPE (yylval.ttype) = wchar_array_type_node;
2275             value = STRING;
2276           }
2277         else if (objc_flag)
2278           {
2279             /* Return an Objective-C @"..." constant string object.  */
2280             yylval.ttype = build_objc_string (p - (token_buffer + 1),
2281                                               token_buffer + 1);
2282             TREE_TYPE (yylval.ttype) = char_array_type_node;
2283             value = OBJC_STRING;
2284           }
2285         else
2286           {
2287             yylval.ttype = build_string (p - (token_buffer + 1),
2288                                          token_buffer + 1);
2289             TREE_TYPE (yylval.ttype) = char_array_type_node;
2290             value = STRING;
2291           }
2292
2293         break;
2294       }
2295
2296     case '+':
2297     case '-':
2298     case '&':
2299     case '|':
2300     case ':':
2301     case '<':
2302     case '>':
2303     case '*':
2304     case '/':
2305     case '%':
2306     case '^':
2307     case '!':
2308     case '=':
2309       {
2310         register int c1;
2311
2312       combine:
2313
2314         switch (c)
2315           {
2316           case '+':
2317             yylval.code = PLUS_EXPR; break;
2318           case '-':
2319             yylval.code = MINUS_EXPR; break;
2320           case '&':
2321             yylval.code = BIT_AND_EXPR; break;
2322           case '|':
2323             yylval.code = BIT_IOR_EXPR; break;
2324           case '*':
2325             yylval.code = MULT_EXPR; break;
2326           case '/':
2327             yylval.code = TRUNC_DIV_EXPR; break;
2328           case '%':
2329             yylval.code = TRUNC_MOD_EXPR; break;
2330           case '^':
2331             yylval.code = BIT_XOR_EXPR; break;
2332           case LSHIFT:
2333             yylval.code = LSHIFT_EXPR; break;
2334           case RSHIFT:
2335             yylval.code = RSHIFT_EXPR; break;
2336           case '<':
2337             yylval.code = LT_EXPR; break;
2338           case '>':
2339             yylval.code = GT_EXPR; break;
2340           }
2341
2342         token_buffer[1] = c1 = token_getch();
2343         token_buffer[2] = 0;
2344
2345         if (c1 == '=')
2346           {
2347             switch (c)
2348               {
2349               case '<':
2350                 value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
2351               case '>':
2352                 value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
2353               case '!':
2354                 value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
2355               case '=':
2356                 value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
2357               }
2358             value = ASSIGN; goto done;
2359           }
2360         else if (c == c1)
2361           switch (c)
2362             {
2363             case '+':
2364               value = PLUSPLUS; goto done;
2365             case '-':
2366               value = MINUSMINUS; goto done;
2367             case '&':
2368               value = ANDAND; goto done;
2369             case '|':
2370               value = OROR; goto done;
2371             case '<':
2372               c = LSHIFT;
2373               goto combine;
2374             case '>':
2375               c = RSHIFT;
2376               goto combine;
2377             }
2378         else
2379           switch (c)
2380             {
2381             case '-':
2382               if (c1 == '>')
2383                 { value = POINTSAT; goto done; }
2384               break;
2385
2386               /* digraphs */
2387             case ':':
2388               if (c1 == '>')
2389                 { value = ']'; goto done; }
2390               break;
2391             case '<':
2392               if (c1 == '%')
2393                 { value = '{'; indent_level++; goto done; }
2394               if (c1 == ':')
2395                 { value = '['; goto done; }
2396               break;
2397             case '%':
2398               if (c1 == '>')
2399                 { value = '}'; indent_level--; goto done; }
2400               break;
2401             }
2402
2403         token_put_back (c1);
2404         token_buffer[1] = 0;
2405
2406         if ((c == '<') || (c == '>'))
2407           value = ARITHCOMPARE;
2408         else value = c;
2409         break;
2410       }
2411
2412     case 0:
2413       /* Don't make yyparse think this is eof.  */
2414       value = 1;
2415       break;
2416
2417     case '{':
2418       indent_level++;
2419       value = c;
2420       break;
2421
2422     case '}':
2423       indent_level--;
2424       value = c;
2425       break;
2426
2427     default:
2428       value = c;
2429     }
2430
2431 done:
2432 /*  yylloc.last_line = lineno; */
2433
2434   return value;
2435 }
2436
2437 /* Sets the value of the 'yydebug' variable to VALUE.
2438    This is a function so we don't have to have YYDEBUG defined
2439    in order to build the compiler.  */
2440
2441 void
2442 set_yydebug (value)
2443      int value;
2444 {
2445 #if YYDEBUG != 0
2446   yydebug = value;
2447 #else
2448   warning ("YYDEBUG not defined.");
2449 #endif
2450 }