OSDN Git Service

Backport of GC branch patches part 1: kill eh status saving.
[pf3gnuchains/gcc-fork.git] / gcc / c-lex.c
1 /* Lexical analyzer for C and Objective C.
2    Copyright (C) 1987, 88, 89, 92, 94-97, 1998 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
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.  */
39 #ifdef CROSS_COMPILE
40 #undef MULTIBYTE_CHARS
41 #endif
42
43 #ifdef MULTIBYTE_CHARS
44 #include "mbchar.h"
45 #include <locale.h>
46 #endif /* MULTIBYTE_CHARS */
47
48 #if USE_CPPLIB
49 #include "cpplib.h"
50 extern cpp_reader  parse_in;
51 extern cpp_options parse_options;
52 extern int errorcount;
53 #else
54 /* Stream for reading from the input file.  */
55 FILE *finput;
56 #endif
57
58 extern void yyprint                     PROTO((FILE *, int, YYSTYPE));
59
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];
64
65 /* Cause the `yydebug' variable to be defined.  */
66 #define YYDEBUG 1
67
68 #if USE_CPPLIB
69 extern unsigned char *yy_cur, *yy_lim;
70
71 extern int yy_get_token ();
72
73 #define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
74 #define UNGETC(c) ((c) == EOF ? 0 : yy_cur--)
75
76 #else /* ! USE_CPPLIB */
77
78 #define GETC() getch ()
79 #define UNGETC(c) put_back (c)
80
81 struct putback_buffer {
82   char *buffer;
83   int   buffer_size;
84   int   index;
85 };
86
87 static struct putback_buffer putback = {NULL, 0, -1};
88
89 static inline int
90 getch ()
91 {
92   if (putback.index != -1)
93     {
94       int ch = putback.buffer[putback.index];
95       --putback.index;
96       return ch;
97     }
98   return getc (finput);
99 }
100
101 static inline void
102 put_back (ch)
103      int ch;
104 {
105   if (ch != EOF)
106     {
107       if (putback.index == putback.buffer_size - 1)
108         {
109           putback.buffer_size += 16;
110           putback.buffer = xrealloc (putback.buffer, putback.buffer_size);
111         }
112       putback.buffer[++putback.index] = ch;
113     }
114 }
115 #endif /* ! USE_CPPLIB */
116
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.  */
121 tree lastiddecl;
122
123 /* Nonzero enables objc features.  */
124
125 int doing_objc_thang;
126
127 extern int yydebug;
128
129 /* File used for outputting assembler code.  */
130 extern FILE *asm_out_file;
131
132 #ifndef WCHAR_TYPE_SIZE
133 #ifdef INT_TYPE_SIZE
134 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
135 #else
136 #define WCHAR_TYPE_SIZE BITS_PER_WORD
137 #endif
138 #endif
139
140 /* Number of bytes in a wide character.  */
141 #define WCHAR_BYTES (WCHAR_TYPE_SIZE / BITS_PER_UNIT)
142
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.  */
147
148 static int indent_level = 0;        /* Number of { minus number of }. */
149
150 /* Nonzero if end-of-file has been seen on input.  */
151 static int end_of_file;
152
153 #if !USE_CPPLIB
154 /* Buffered-back input character; faster than using ungetc.  */
155 static int nextchar = -1;
156 #endif
157
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));
167 \f
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.  */
171 #include "c-gperf.h"
172 \f
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.
177
178    We return an INDIRECT_REF whose "contents" are TARGET
179    and whose type is the modifier list.  */
180
181 tree
182 make_pointer_declarator (type_quals, target)
183      tree type_quals, target;
184 {
185   return build1 (INDIRECT_REF, type_quals, target);
186 }
187 \f
188 void
189 forget_protocol_qualifiers ()
190 {
191   int i, n = sizeof wordlist / sizeof (struct resword);
192
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 = "";
197 }
198
199 void
200 remember_protocol_qualifiers ()
201 {
202   int i, n = sizeof wordlist / sizeof (struct resword);
203
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";
217 }
218 \f
219 char *
220 init_parse (filename)
221      char *filename;
222 {
223 #if !USE_CPPLIB
224   /* Open input file.  */
225   if (filename == 0 || !strcmp (filename, "-"))
226     {
227       finput = stdin;
228       filename = "stdin";
229     }
230   else
231     finput = fopen (filename, "r");
232   if (finput == 0)
233     pfatal_with_name (filename);
234
235 #ifdef IO_BUFFER_SIZE
236   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
237 #endif
238 #else /* !USE_CPPLIB */
239   parse_in.show_column = 1;
240   if (! cpp_start_read (&parse_in, filename))
241     abort ();
242
243   if (filename == 0 || !strcmp (filename, "-"))
244     filename = "stdin";
245
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);
250 #endif
251
252   init_lex ();
253
254   return filename;
255 }
256
257 void
258 finish_parse ()
259 {
260 #if USE_CPPLIB
261   cpp_finish (&parse_in);
262   errorcount += parse_in.errors;
263 #else
264   fclose (finput);
265 #endif
266 }
267
268 void
269 init_lex ()
270 {
271   /* Make identifier nodes long enough for the language-specific slots.  */
272   set_identifier_size (sizeof (struct lang_identifier));
273
274   /* Start it at 0, because check_newline is called at the very beginning
275      and will increment it to 1.  */
276   lineno = 0;
277
278 #ifdef MULTIBYTE_CHARS
279   /* Change to the native locale for multibyte conversions.  */
280   setlocale (LC_CTYPE, "");
281   literal_codeset = getenv ("LANG");
282 #endif
283
284   maxtoken = 40;
285   token_buffer = (char *) xmalloc (maxtoken + 2);
286
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();
315
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)
321
322   if (! doing_objc_thang)
323     UNSET_RESERVED_WORD ("id");
324
325   if (flag_traditional)
326     {
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");
335     }
336   else if (!flag_isoc9x)
337     UNSET_RESERVED_WORD ("restrict");
338
339   if (flag_no_asm)
340     {
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");
346     }
347 }
348
349 void
350 reinit_parse_for_function ()
351 {
352 }
353 \f
354 /* Function used when yydebug is set, to print a token in more detail.  */
355
356 void
357 yyprint (file, yychar, yylval)
358      FILE *file;
359      int yychar;
360      YYSTYPE yylval;
361 {
362   tree t;
363   switch (yychar)
364     {
365     case IDENTIFIER:
366     case TYPENAME:
367     case OBJECTNAME:
368       t = yylval.ttype;
369       if (IDENTIFIER_POINTER (t))
370         fprintf (file, " `%s'", IDENTIFIER_POINTER (t));
371       break;
372
373     case CONSTANT:
374       t = yylval.ttype;
375       if (TREE_CODE (t) == INTEGER_CST)
376         fprintf (file,
377 #if HOST_BITS_PER_WIDE_INT == 64
378 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
379                  " 0x%x%016x",
380 #else
381 #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
382                  " 0x%lx%016lx",
383 #else
384                  " 0x%llx%016llx",
385 #endif
386 #endif
387 #else
388 #if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
389                  " 0x%lx%08lx",
390 #else
391                  " 0x%x%08x",
392 #endif
393 #endif
394                  TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
395       break;
396     }
397 }
398 \f
399 /* Iff C is a carriage return, warn about it - if appropriate -
400    and return nonzero.  */
401 static int
402 whitespace_cr (c)
403      int c;
404 {
405   static int newline_warning = 0;
406
407   if (c == '\r')
408     {
409       /* ANSI C says the effects of a carriage return in a source file
410          are undefined.  */
411       if (pedantic && !newline_warning)
412         {
413           warning ("carriage return in source file");
414           warning ("(we only warn about the first carriage return)");
415           newline_warning = 1;
416         }
417       return 1;
418     }
419   return 0;
420 }
421
422 /* If C is not whitespace, return C.
423    Otherwise skip whitespace and return first nonwhite char read.  */
424
425 static int
426 skip_white_space (c)
427      register int c;
428 {
429   for (;;)
430     {
431       switch (c)
432         {
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.  */
436
437         case '\n':
438           c = check_newline ();
439           break;
440
441         case ' ':
442         case '\t':
443         case '\f':
444         case '\v':
445         case '\b':
446           c = GETC();
447           break;
448
449         case '\r':
450           whitespace_cr (c);
451           c = GETC();
452           break;
453
454         case '\\':
455           c = GETC();
456           if (c == '\n')
457             lineno++;
458           else
459             error ("stray '\\' in program");
460           c = GETC();
461           break;
462
463         default:
464           return (c);
465         }
466     }
467 }
468
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.  */
471
472 void
473 position_after_white_space ()
474 {
475   register int c;
476
477 #if !USE_CPPLIB
478   if (nextchar != -1)
479     c = nextchar, nextchar = -1;
480   else
481 #endif
482     c = GETC();
483
484   UNGETC (skip_white_space (c));
485 }
486
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.  */
489 static int
490 skip_white_space_on_line ()
491 {
492   register int c;
493
494   while (1)
495     {
496       c = GETC();
497       switch (c)
498         {
499         case '\n':
500         default:
501           break;
502
503         case ' ':
504         case '\t':
505         case '\f':
506         case '\v':
507         case '\b':
508           continue;
509
510         case '\r':
511           whitespace_cr (c);
512           continue;
513         }
514       break;
515     }
516   return c;
517 }
518
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.  */
523
524 static char *
525 extend_token_buffer (p)
526      const char *p;
527 {
528   int offset = p - token_buffer;
529
530   maxtoken = maxtoken * 2 + 10;
531   token_buffer = (char *) xrealloc (token_buffer, maxtoken + 2);
532
533   return token_buffer + offset;
534 }
535 \f
536 #if defined HANDLE_PRAGMA
537 /* Local versions of these macros, that can be passed as function pointers.  */
538 static int
539 pragma_getc ()
540 {
541   return GETC();
542 }
543
544 static void
545 pragma_ungetc (arg)
546      int arg;
547 {
548   UNGETC (arg);
549 }
550 #endif
551
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.  */
556
557 int
558 check_newline ()
559 {
560   register int c;
561   register int token;
562
563   lineno++;
564
565   /* Read first nonwhite char on the line.  */
566
567   c = GETC();
568   while (c == ' ' || c == '\t')
569     c = GETC();
570
571   if (c != '#')
572     {
573       /* If not #, return it so caller will use it.  */
574       return c;
575     }
576
577   /* Read first nonwhite char after the `#'.  */
578
579   c = GETC();
580   while (c == ' ' || c == '\t')
581     c = GETC();
582
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'.  */
586
587   if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
588     {
589       if (c == 'p')
590         {
591           if (GETC() == 'r'
592               && GETC() == 'a'
593               && GETC() == 'g'
594               && GETC() == 'm'
595               && GETC() == 'a'
596               && ((c = GETC()) == ' ' || c == '\t' || c == '\n'
597                    || whitespace_cr (c) ))
598             {
599               while (c == ' ' || c == '\t' || whitespace_cr (c))
600                 c = GETC ();
601               if (c == '\n')
602                 return c;
603
604 #if defined HANDLE_PRAGMA || defined HANDLE_GENERIC_PRAGMAS
605               UNGETC (c);
606               token = yylex ();
607               if (token != IDENTIFIER)
608                 goto skipline;
609 #endif /* HANDLE_PRAGMA || HANDLE_GENERIC_PRAGMAS */
610
611 #ifdef HANDLE_PRAGMA
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.  */
615 #if !USE_CPPLIB
616               if (nextchar >= 0)
617                 {
618                   c = nextchar, nextchar = -1;
619                   UNGETC (c);
620                 }
621 #endif /* !USE_CPPLIB */
622
623               if (TREE_CODE (yylval.ttype) != IDENTIFIER_NODE)
624                 goto skipline;
625
626               if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
627                                  IDENTIFIER_POINTER (yylval.ttype)))
628                 return GETC ();
629 #endif /* HANDLE_PRAGMA */
630
631 #ifdef HANDLE_GENERIC_PRAGMAS
632               if (handle_generic_pragma (token))
633                 return GETC ();
634 #endif /* HANDLE_GENERIC_PRAGMAS */
635
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);
642
643               goto skipline;
644             }
645         }
646
647       else if (c == 'd')
648         {
649           if (GETC() == 'e'
650               && GETC() == 'f'
651               && GETC() == 'i'
652               && GETC() == 'n'
653               && GETC() == 'e'
654               && ((c = GETC()) == ' ' || c == '\t' || c == '\n'))
655             {
656               if (c != '\n')
657                 debug_define (lineno, GET_DIRECTIVE_LINE ());
658               goto skipline;
659             }
660         }
661       else if (c == 'u')
662         {
663           if (GETC() == 'n'
664               && GETC() == 'd'
665               && GETC() == 'e'
666               && GETC() == 'f'
667               && ((c = GETC()) == ' ' || c == '\t' || c == '\n'))
668             {
669               if (c != '\n')
670                 debug_undef (lineno, GET_DIRECTIVE_LINE ());
671               goto skipline;
672             }
673         }
674       else if (c == 'l')
675         {
676           if (GETC() == 'i'
677               && GETC() == 'n'
678               && GETC() == 'e'
679               && ((c = GETC()) == ' ' || c == '\t'))
680             goto linenum;
681         }
682       else if (c == 'i')
683         {
684           if (GETC() == 'd'
685               && GETC() == 'e'
686               && GETC() == 'n'
687               && GETC() == 't'
688               && ((c = GETC()) == ' ' || c == '\t'))
689             {
690               /* #ident.  The pedantic warning is now in cccp.c.  */
691
692               /* Here we have just seen `#ident '.
693                  A string constant should follow.  */
694
695               c = skip_white_space_on_line ();
696
697               /* If no argument, ignore the line.  */
698               if (c == '\n')
699                 return c;
700
701               UNGETC (c);
702               token = yylex ();
703               if (token != STRING
704                   || TREE_CODE (yylval.ttype) != STRING_CST)
705                 {
706                   error ("invalid #ident");
707                   goto skipline;
708                 }
709
710               if (!flag_no_ident)
711                 {
712 #ifdef ASM_OUTPUT_IDENT
713                   ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
714 #endif
715                 }
716
717               /* Skip the rest of this line.  */
718               goto skipline;
719             }
720         }
721
722       error ("undefined or invalid # directive");
723       goto skipline;
724     }
725
726 linenum:
727   /* Here we have either `#line' or `# <nonletter>'.
728      In either case, it should be a line number; a digit should follow.  */
729
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
732      calling yylex.  */
733   UNGETC (c);
734   c = skip_white_space_on_line ();
735
736   /* If the # is the only nonwhite char on the line,
737      just ignore it.  Check the new newline.  */
738   if (c == '\n')
739     return c;
740
741   /* Something follows the #; read a token.  */
742
743   UNGETC (c);
744   token = yylex ();
745
746   if (token == CONSTANT
747       && TREE_CODE (yylval.ttype) == INTEGER_CST)
748     {
749       int old_lineno = lineno;
750       int used_up = 0;
751       /* subtract one, because it is the following line that
752          gets the specified number */
753
754       int l = TREE_INT_CST_LOW (yylval.ttype) - 1;
755
756       /* Is this the last nonwhite stuff on the line?  */
757       c = skip_white_space_on_line ();
758       if (c == '\n')
759         {
760           /* No more: store the line number and check following line.  */
761           lineno = l;
762           return c;
763         }
764       UNGETC (c);
765
766       /* More follows: it must be a string constant (filename).  */
767
768       /* Read the string constant.  */
769       token = yylex ();
770
771       if (token != STRING || TREE_CODE (yylval.ttype) != STRING_CST)
772         {
773           error ("invalid #line");
774           goto skipline;
775         }
776
777       input_filename
778         = (char *) permalloc (TREE_STRING_LENGTH (yylval.ttype) + 1);
779       strcpy (input_filename, TREE_STRING_POINTER (yylval.ttype));
780       lineno = l;
781
782       /* Each change of file name
783          reinitializes whether we are now in a system header.  */
784       in_system_header = 0;
785
786       if (main_input_filename == 0)
787         main_input_filename = input_filename;
788
789       /* Is this the last nonwhite stuff on the line?  */
790       c = skip_white_space_on_line ();
791       if (c == '\n')
792         {
793           /* Update the name in the top element of input_file_stack.  */
794           if (input_file_stack)
795             input_file_stack->name = input_filename;
796
797           return c;
798         }
799       UNGETC (c);
800
801       token = yylex ();
802       used_up = 0;
803
804       /* `1' after file name means entering new file.
805          `2' after file name means just left a file.  */
806
807       if (token == CONSTANT
808           && TREE_CODE (yylval.ttype) == INTEGER_CST)
809         {
810           if (TREE_INT_CST_LOW (yylval.ttype) == 1)
811             {
812               /* Pushing to a new file.  */
813               struct file_stack *p
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);
822               used_up = 1;
823             }
824           else if (TREE_INT_CST_LOW (yylval.ttype) == 2)
825             {
826               /* Popping out of a file.  */
827               if (input_file_stack->next)
828                 {
829                   struct file_stack *p = input_file_stack;
830                   if (indent_level != p->indent_level)
831                     {
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 ? '}' : '{');
837                     }
838                   input_file_stack = p->next;
839                   free (p);
840                   input_file_stack_tick++;
841                   debug_end_source_file (input_file_stack->line);
842                 }
843               else
844                 error ("#-lines for entering and leaving files don't match");
845
846               used_up = 1;
847             }
848         }
849
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;
854
855       /* If we have handled a `1' or a `2',
856          see if there is another number to read.  */
857       if (used_up)
858         {
859           /* Is this the last nonwhite stuff on the line?  */
860           c = skip_white_space_on_line ();
861           if (c == '\n')
862             return c;
863           UNGETC (c);
864
865           token = yylex ();
866           used_up = 0;
867         }
868
869       /* `3' after file name means this is a system header file.  */
870
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;
875
876       if (used_up)
877         {
878           /* Is this the last nonwhite stuff on the line?  */
879           c = skip_white_space_on_line ();
880           if (c == '\n')
881             return c;
882           UNGETC (c);
883         }
884
885       warning ("unrecognized text at end of #line");
886     }
887   else
888     error ("invalid #-line");
889
890   /* skip the rest of this line.  */
891  skipline:
892 #if !USE_CPPLIB
893   if (c != '\n' && c != EOF && nextchar >= 0)
894     c = nextchar, nextchar = -1;
895 #endif
896   while (c != '\n' && c != EOF)
897     c = GETC();
898   return c;
899 }
900 \f
901 #ifdef HANDLE_GENERIC_PRAGMAS
902
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.  */
906
907 /* This function has to be in this file, in order to get at
908    the token types.  */
909
910 static int
911 handle_generic_pragma (token)
912      register int token;
913 {
914   register int c;
915
916   for (;;)
917     {
918       switch (token)
919         {
920         case IDENTIFIER:
921         case TYPENAME:
922         case STRING:
923         case CONSTANT:
924           handle_pragma_token (token_buffer, yylval.ttype);
925           break;
926         default:
927           handle_pragma_token (token_buffer, NULL);
928         }
929 #if !USE_CPPLIB
930       if (nextchar >= 0)
931         c = nextchar, nextchar = -1;
932       else
933 #endif
934         c = GETC ();
935
936       while (c == ' ' || c == '\t')
937         c = GETC ();
938       UNGETC (c);
939
940       if (c == '\n' || c == EOF)
941         return handle_pragma_token (NULL, NULL);
942
943       token = yylex ();
944     }
945 }
946
947 #endif /* HANDLE_GENERIC_PRAGMAS */
948 \f
949 #define ENDFILE -1  /* token that represents end-of-file */
950
951 /* Read an escape sequence, returning its equivalent as a character,
952    or store 1 in *ignore_ptr if it is backslash-newline.  */
953
954 static int
955 readescape (ignore_ptr)
956      int *ignore_ptr;
957 {
958   register int c = GETC();
959   register int code;
960   register unsigned count;
961   unsigned firstdig = 0;
962   int nonnull;
963
964   switch (c)
965     {
966     case 'x':
967       if (warn_traditional)
968         warning ("the meaning of `\\x' varies with -traditional");
969
970       if (flag_traditional)
971         return c;
972
973       code = 0;
974       count = 0;
975       nonnull = 0;
976       while (1)
977         {
978           c = GETC();
979           if (!(c >= 'a' && c <= 'f')
980               && !(c >= 'A' && c <= 'F')
981               && !(c >= '0' && c <= '9'))
982             {
983               UNGETC (c);
984               break;
985             }
986           code *= 16;
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')
992             code += c - '0';
993           if (code != 0 || count != 0)
994             {
995               if (count == 0)
996                 firstdig = code;
997               count++;
998             }
999           nonnull = 1;
1000         }
1001       if (! nonnull)
1002         error ("\\x used with no following hex digits");
1003       else if (count == 0)
1004         /* Digits are all 0's.  Ok.  */
1005         ;
1006       else if ((count - 1) * 4 >= TYPE_PRECISION (integer_type_node)
1007                || (count > 1
1008                    && (((unsigned)1 << (TYPE_PRECISION (integer_type_node) - (count - 1) * 4))
1009                        <= firstdig)))
1010         pedwarn ("hex escape out of range");
1011       return code;
1012
1013     case '0':  case '1':  case '2':  case '3':  case '4':
1014     case '5':  case '6':  case '7':
1015       code = 0;
1016       count = 0;
1017       while ((c <= '7') && (c >= '0') && (count++ < 3))
1018         {
1019           code = (code * 8) + (c - '0');
1020           c = GETC();
1021         }
1022       UNGETC (c);
1023       return code;
1024
1025     case '\\': case '\'': case '"':
1026       return c;
1027
1028     case '\n':
1029       lineno++;
1030       *ignore_ptr = 1;
1031       return 0;
1032
1033     case 'n':
1034       return TARGET_NEWLINE;
1035
1036     case 't':
1037       return TARGET_TAB;
1038
1039     case 'r':
1040       return TARGET_CR;
1041
1042     case 'f':
1043       return TARGET_FF;
1044
1045     case 'b':
1046       return TARGET_BS;
1047
1048     case 'a':
1049       if (warn_traditional)
1050         warning ("the meaning of `\\a' varies with -traditional");
1051
1052       if (flag_traditional)
1053         return c;
1054       return TARGET_BELL;
1055
1056     case 'v':
1057 #if 0 /* Vertical tab is present in common usage compilers.  */
1058       if (flag_traditional)
1059         return c;
1060 #endif
1061       return TARGET_VT;
1062
1063     case 'e':
1064     case 'E':
1065       if (pedantic)
1066         pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
1067       return 033;
1068
1069     case '?':
1070       return c;
1071
1072       /* `\(', etc, are used at beginning of line to avoid confusing Emacs.  */
1073     case '(':
1074     case '{':
1075     case '[':
1076       /* `\%' is used to prevent SCCS from getting confused.  */
1077     case '%':
1078       if (pedantic)
1079         pedwarn ("non-ANSI escape sequence `\\%c'", c);
1080       return c;
1081     }
1082   if (c >= 040 && c < 0177)
1083     pedwarn ("unknown escape sequence `\\%c'", c);
1084   else
1085     pedwarn ("unknown escape sequence: `\\' followed by char code 0x%x", c);
1086   return c;
1087 }
1088 \f
1089 void
1090 yyerror (msgid)
1091      const char *msgid;
1092 {
1093   const char *string = _(msgid);
1094
1095   /* We can't print string and character constants well
1096      because the token_buffer contains the result of processing escapes.  */
1097   if (end_of_file)
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]);
1107   else
1108     error ("%s before `%s'", string, token_buffer);
1109 }
1110
1111 #if 0
1112
1113 struct try_type
1114 {
1115   tree *node_var;
1116   char unsigned_flag;
1117   char long_flag;
1118   char long_long_flag;
1119 };
1120
1121 struct try_type type_sequence[] =
1122 {
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}
1129 };
1130 #endif /* 0 */
1131 \f
1132 struct pf_args
1133 {
1134   /* Input */
1135   int base;
1136   char * p;
1137   /* I/O */
1138   int c;
1139   int imag;
1140   tree type;
1141   int conversion_errno;
1142   /* Output */
1143   REAL_VALUE_TYPE value;
1144 };
1145  
1146 static void
1147 parse_float (data)
1148   PTR data;
1149 {
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);
1157
1158   while (1)
1159     {
1160       int lose = 0;
1161
1162       /* Read the suffixes to choose a data type.  */
1163       switch (args->c)
1164         {
1165         case 'f': case 'F':
1166           if (fflag)
1167             error ("more than one `f' in numeric constant");
1168           fflag = 1;
1169           break;
1170
1171         case 'l': case 'L':
1172           if (lflag)
1173             error ("more than one `l' in numeric constant");
1174           lflag = 1;
1175           break;
1176
1177         case 'i': case 'I':
1178           if (args->imag)
1179             error ("more than one `i' or `j' in numeric constant");
1180           else if (pedantic)
1181             pedwarn ("ANSI C forbids imaginary numeric constants");
1182           args->imag = 1;
1183           break;
1184
1185         default:
1186           lose = 1;
1187         }
1188
1189       if (lose)
1190         break;
1191
1192       if (args->p >= token_buffer + maxtoken - 3)
1193         args->p = extend_token_buffer (args->p);
1194       *(args->p++) = args->c;
1195       *(args->p) = 0;
1196       args->c = GETC();
1197     }
1198
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.  */
1202
1203   if (fflag)
1204     {
1205       if (lflag)
1206         error ("both `f' and `l' in floating constant");
1207
1208       args->type = float_type_node;
1209       errno = 0;
1210       if (args->base == 16)
1211         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1212       else
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'");
1220     }
1221   else if (lflag)
1222     {
1223       args->type = long_double_type_node;
1224       errno = 0;
1225       if (args->base == 16)
1226         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1227       else
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'");
1232     }
1233   else
1234     {
1235       errno = 0;
1236       if (args->base == 16)
1237         args->value = REAL_VALUE_HTOF (copy, TYPE_MODE (args->type));
1238       else
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'");
1243     }
1244 }
1245  
1246 int
1247 yylex ()
1248 {
1249   register int c;
1250   register char *p;
1251   register int value;
1252   int wide_flag = 0;
1253   int objc_flag = 0;
1254
1255 #if !USE_CPPLIB
1256   if (nextchar >= 0)
1257     c = nextchar, nextchar = -1;
1258   else
1259 #endif
1260     c = GETC();
1261
1262   /* Effectively do c = skip_white_space (c)
1263      but do it faster in the usual cases.  */
1264   while (1)
1265     switch (c)
1266       {
1267       case ' ':
1268       case '\t':
1269       case '\f':
1270       case '\v':
1271       case '\b':
1272         c = GETC();
1273         break;
1274
1275       case '\r':
1276         /* Call skip_white_space so we can warn if appropriate.  */
1277
1278       case '\n':
1279       case '/':
1280       case '\\':
1281         c = skip_white_space (c);
1282       default:
1283         goto found_nonwhite;
1284       }
1285  found_nonwhite:
1286
1287   token_buffer[0] = c;
1288   token_buffer[1] = 0;
1289
1290 /*  yylloc.first_line = lineno; */
1291
1292   switch (c)
1293     {
1294     case EOF:
1295       end_of_file = 1;
1296       token_buffer[0] = 0;
1297       value = ENDFILE;
1298       break;
1299
1300     case 'L':
1301       /* Capital L may start a wide-string or wide-character constant.  */
1302       {
1303         register int c = GETC();
1304         if (c == '\'')
1305           {
1306             wide_flag = 1;
1307             goto char_constant;
1308           }
1309         if (c == '"')
1310           {
1311             wide_flag = 1;
1312             goto string_constant;
1313           }
1314         UNGETC (c);
1315       }
1316       goto letter;
1317
1318     case '@':
1319       if (!doing_objc_thang)
1320         {
1321           value = c;
1322           break;
1323         }
1324       else
1325         {
1326           /* '@' may start a constant string object.  */
1327           register int c = GETC ();
1328           if (c == '"')
1329             {
1330               objc_flag = 1;
1331               goto string_constant;
1332             }
1333           UNGETC (c);
1334           /* Fall through to treat '@' as the start of an identifier.  */
1335         }
1336
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':
1342     case 'Z':
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':
1348     case 'z':
1349     case '_':
1350     case '$':
1351     letter:
1352       p = token_buffer;
1353       while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
1354         {
1355           /* Make sure this char really belongs in an identifier.  */
1356           if (c == '$')
1357             {
1358               if (! dollars_in_ident)
1359                 error ("`$' in identifier");
1360               else if (pedantic)
1361                 pedwarn ("`$' in identifier");
1362             }
1363
1364           if (p >= token_buffer + maxtoken)
1365             p = extend_token_buffer (p);
1366
1367           *p++ = c;
1368           c = GETC();
1369         }
1370
1371       *p = 0;
1372 #if USE_CPPLIB
1373       UNGETC (c);
1374 #else
1375       nextchar = c;
1376 #endif
1377
1378       value = IDENTIFIER;
1379       yylval.itype = 0;
1380
1381       /* Try to recognize a keyword.  Uses minimum-perfect hash function */
1382
1383       {
1384         register struct resword *ptr;
1385
1386         if ((ptr = is_reserved_word (token_buffer, p - token_buffer)))
1387           {
1388             if (ptr->rid)
1389               yylval.ttype = ridpointers[(int) ptr->rid];
1390             value = (int) ptr->token;
1391
1392             /* Only return OBJECTNAME if it is a typedef.  */
1393             if (doing_objc_thang && value == OBJECTNAME)
1394               {
1395                 lastiddecl = lookup_name(yylval.ttype);
1396
1397                 if (lastiddecl == NULL_TREE
1398                     || TREE_CODE (lastiddecl) != TYPE_DECL)
1399                   value = IDENTIFIER;
1400               }
1401
1402             /* Even if we decided to recognize asm, still perhaps warn.  */
1403             if (pedantic
1404                 && (value == ASM_KEYWORD || value == TYPEOF
1405                     || ptr->rid == RID_INLINE)
1406                 && token_buffer[0] != '_')
1407               pedwarn ("ANSI does not permit the keyword `%s'",
1408                        token_buffer);
1409           }
1410       }
1411
1412       /* If we did not find a keyword, look for an identifier
1413          (or a typename).  */
1414
1415       if (value == IDENTIFIER)
1416         {
1417           if (token_buffer[0] == '@')
1418             error("invalid identifier `%s'", token_buffer);
1419
1420           yylval.ttype = get_identifier (token_buffer);
1421           lastiddecl = lookup_name (yylval.ttype);
1422
1423           if (lastiddecl != 0 && TREE_CODE (lastiddecl) == TYPE_DECL)
1424             value = TYPENAME;
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)
1433             {
1434               tree stringval = DECL_INITIAL (lastiddecl);
1435
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));
1440               value = STRING;
1441             }
1442           else if (doing_objc_thang)
1443             {
1444               tree objc_interface_decl = is_class_name (yylval.ttype);
1445
1446               if (objc_interface_decl)
1447                 {
1448                   value = CLASSNAME;
1449                   yylval.ttype = objc_interface_decl;
1450                 }
1451             }
1452         }
1453
1454       break;
1455
1456     case '0':  case '1':
1457       {
1458         int next_c;
1459         /* Check first for common special case:  single-digit 0 or 1.  */
1460
1461         next_c = GETC ();
1462         UNGETC (next_c);        /* Always undo this lookahead.  */
1463         if (!ISALNUM (next_c) && next_c != '.')
1464           {
1465             token_buffer[0] = (char)c,  token_buffer[1] = '\0';
1466             yylval.ttype = (c == '0') ? integer_zero_node : integer_one_node;
1467             value = CONSTANT;
1468             break;
1469           }
1470         /*FALLTHRU*/
1471       }
1472     case '2':  case '3':  case '4':
1473     case '5':  case '6':  case '7':  case '8':  case '9':
1474     case '.':
1475       {
1476         int base = 10;
1477         int count = 0;
1478         int largest_digit = 0;
1479         int numdigits = 0;
1480         int overflow = 0;
1481
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];
1492
1493         enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON}
1494           floatflag = NOT_FLOAT;
1495
1496         for (count = 0; count < TOTAL_PARTS; count++)
1497           parts[count] = 0;
1498
1499         p = token_buffer;
1500         *p++ = c;
1501
1502         if (c == '0')
1503           {
1504             *p++ = (c = GETC());
1505             if ((c == 'x') || (c == 'X'))
1506               {
1507                 base = 16;
1508                 *p++ = (c = GETC());
1509               }
1510             /* Leading 0 forces octal unless the 0 is the only digit.  */
1511             else if (c >= '0' && c <= '9')
1512               {
1513                 base = 8;
1514                 numdigits++;
1515               }
1516             else
1517               numdigits++;
1518           }
1519
1520         /* Read all the digits-and-decimal-points.  */
1521
1522         while (c == '.'
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')))))
1527           {
1528             if (c == '.')
1529               {
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.  */
1534                   ;
1535                 else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON)
1536                   {
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.  */
1541                     p[-1] = '\0';
1542                   }
1543                 else
1544                   floatflag = AFTER_POINT;
1545
1546                 if (base == 8)
1547                   base = 10;
1548                 *p++ = c = GETC();
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))
1554                   {
1555                     if (c == '.')
1556                       {
1557                         c = GETC();
1558                         if (c == '.')
1559                           {
1560                             *p++ = c;
1561                             *p = 0;
1562                             return ELLIPSIS;
1563                           }
1564                         error ("parse error at `..'");
1565                       }
1566                     UNGETC (c);
1567                     token_buffer[1] = 0;
1568                     value = '.';
1569                     goto done;
1570                   }
1571               }
1572             else
1573               {
1574                 /* It is not a decimal point.
1575                    It should be a digit (perhaps a hex digit).  */
1576
1577                 if (ISDIGIT (c))
1578                   {
1579                     c = c - '0';
1580                   }
1581                 else if (base <= 10)
1582                   {
1583                     if (c == 'e' || c == 'E')
1584                       {
1585                         base = 10;
1586                         floatflag = AFTER_EXPON;
1587                         break;   /* start of exponent */
1588                       }
1589                     error ("nondigits in number and not hexadecimal");
1590                     c = 0;
1591                   }
1592                 else if (base == 16 && (c == 'p' || c == 'P'))
1593                   {
1594                     floatflag = AFTER_EXPON;
1595                     break;   /* start of exponent */
1596                   }
1597                 else if (c >= 'a')
1598                   {
1599                     c = c - 'a' + 10;
1600                   }
1601                 else
1602                   {
1603                     c = c - 'A' + 10;
1604                   }
1605                 if (c >= largest_digit)
1606                   largest_digit = c;
1607                 numdigits++;
1608
1609                 for (count = 0; count < TOTAL_PARTS; count++)
1610                   {
1611                     parts[count] *= base;
1612                     if (count)
1613                       {
1614                         parts[count]
1615                           += (parts[count-1] >> HOST_BITS_PER_CHAR);
1616                         parts[count-1]
1617                           &= (1 << HOST_BITS_PER_CHAR) - 1;
1618                       }
1619                     else
1620                       parts[0] += c;
1621                   }
1622                 
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
1626                    part. */
1627                 if (parts[TOTAL_PARTS - 1] >> HOST_BITS_PER_CHAR)
1628                   {
1629                     overflow = 1;
1630                     parts[TOTAL_PARTS - 1] &= (1 << HOST_BITS_PER_CHAR) - 1;
1631                   }
1632
1633                 if (p >= token_buffer + maxtoken - 3)
1634                   p = extend_token_buffer (p);
1635                 *p++ = (c = GETC());
1636               }
1637           }
1638
1639         if (numdigits == 0)
1640           error ("numeric constant with no digits");
1641
1642         if (largest_digit >= base)
1643           error ("numeric constant contains digits beyond the radix");
1644
1645         /* Remove terminating char from the token buffer and delimit the string */
1646         *--p = 0;
1647
1648         if (floatflag != NOT_FLOAT)
1649           {
1650             tree type = double_type_node;
1651             int imag = 0;
1652             int conversion_errno = 0;
1653             REAL_VALUE_TYPE value;
1654             struct pf_args args;
1655
1656             /* Read explicit exponent if any, and put it in tokenbuf.  */
1657
1658             if ((base == 10 && ((c == 'e') || (c == 'E')))
1659                 || (base == 16 && (c == 'p' || c == 'P')))
1660               {
1661                 if (p >= token_buffer + maxtoken - 3)
1662                   p = extend_token_buffer (p);
1663                 *p++ = c;
1664                 c = GETC();
1665                 if ((c == '+') || (c == '-'))
1666                   {
1667                     *p++ = c;
1668                     c = GETC();
1669                   }
1670                 /* Exponent is decimal, even if string is a hex float.  */
1671                 if (! ISDIGIT (c))
1672                   error ("floating constant exponent has no digits");
1673                 while (ISDIGIT (c))
1674                   {
1675                     if (p >= token_buffer + maxtoken - 3)
1676                       p = extend_token_buffer (p);
1677                     *p++ = c;
1678                     c = GETC();
1679                   }
1680               }
1681             if (base == 16 && floatflag != AFTER_EXPON)
1682               error ("hexadecimal floating constant has no exponent");
1683
1684             *p = 0;
1685
1686             /* Setup input for parse_float() */
1687             args.base = base;
1688             args.p = p;
1689             args.c = c;
1690             args.imag = imag;
1691             args.type = type;
1692             args.conversion_errno = conversion_errno;
1693
1694             /* Convert string to a double, checking for overflow.  */
1695             if (do_float_handler (parse_float, (PTR) &args))
1696               {
1697                 /* Receive output from parse_float() */
1698                 value = args.value;
1699               }
1700             else
1701               {
1702                 /* We got an exception from parse_float() */
1703                 error ("floating constant out of range");
1704                 value = dconst0;
1705               }
1706
1707             /* Receive output from parse_float() */
1708             c = args.c;
1709             imag = args.imag;
1710             type = args.type;
1711             conversion_errno = args.conversion_errno;
1712             
1713 #ifdef ERANGE
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'");
1720 #endif
1721
1722             /* If the result is not a number, assume it must have been
1723                due to some error message above, so silently convert
1724                it to a zero.  */
1725             if (REAL_VALUE_ISNAN (value))
1726               value = dconst0;
1727
1728             /* Create a node with determined type and value.  */
1729             if (imag)
1730               yylval.ttype = build_complex (NULL_TREE,
1731                                             convert (type, integer_zero_node),
1732                                             build_real (type, value));
1733             else
1734               yylval.ttype = build_real (type, value);
1735           }
1736         else
1737           {
1738             tree traditional_type, ansi_type, type;
1739             HOST_WIDE_INT high, low;
1740             int spec_unsigned = 0;
1741             int spec_long = 0;
1742             int spec_long_long = 0;
1743             int spec_imag = 0;
1744             int warn, i;
1745
1746             traditional_type = ansi_type = type = NULL_TREE;
1747             while (1)
1748               {
1749                 if (c == 'u' || c == 'U')
1750                   {
1751                     if (spec_unsigned)
1752                       error ("two `u's in integer constant");
1753                     spec_unsigned = 1;
1754                   }
1755                 else if (c == 'l' || c == 'L')
1756                   {
1757                     if (spec_long)
1758                       {
1759                         if (spec_long_long)
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");
1763                         spec_long_long = 1;
1764                       }
1765                     spec_long = 1;
1766                   }
1767                 else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
1768                   {
1769                     if (spec_imag)
1770                       error ("more than one `i' or `j' in numeric constant");
1771                     else if (pedantic)
1772                       pedwarn ("ANSI C forbids imaginary numeric constants");
1773                     spec_imag = 1;
1774                   }
1775                 else
1776                   break;
1777                 if (p >= token_buffer + maxtoken - 3)
1778                   p = extend_token_buffer (p);
1779                 *p++ = c;
1780                 c = GETC();
1781               }
1782
1783             /* If the literal overflowed, pedwarn about it now. */
1784             if (overflow)
1785               {
1786                 warn = 1;
1787                 pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);
1788               }
1789
1790             /* This is simplified by the fact that our constant
1791                is always positive.  */
1792
1793             high = low = 0;
1794
1795             for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
1796               {
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);
1801               }
1802
1803             yylval.ttype = build_int_2 (low, high);
1804             TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
1805
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)
1810               {
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,
1832                                           spec_unsigned 
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);
1838                 else
1839                   traditional_type = (spec_unsigned
1840                                       ? widest_unsigned_literal_type_node
1841                                       : widest_integer_literal_type_node);
1842               }
1843             if (warn_traditional || ! flag_traditional)
1844               {
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;
1870                 else
1871                   ansi_type = widest_unsigned_literal_type_node;
1872               }
1873
1874             type = flag_traditional ? traditional_type : ansi_type;
1875
1876             if (warn_traditional && traditional_type != ansi_type)
1877               {
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");
1884                 else
1885                   warning ("width of integer constant may change on other systems with -traditional");
1886               }
1887
1888             if (pedantic && !flag_traditional && !spec_long_long && !warn
1889                 && (TYPE_PRECISION (long_integer_type_node)
1890                     < TYPE_PRECISION (type)))
1891               {
1892                 warn = 1;
1893                 pedwarn ("integer constant larger than the maximum value of an unsigned long int");
1894               }
1895
1896             if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
1897               warning ("decimal constant is so large that it is unsigned");
1898
1899             if (spec_imag)
1900               {
1901                 if (TYPE_PRECISION (type)
1902                     <= TYPE_PRECISION (integer_type_node))
1903                   yylval.ttype
1904                     = build_complex (NULL_TREE, integer_zero_node,
1905                                      convert (integer_type_node,
1906                                               yylval.ttype));
1907                 else
1908                   error ("complex integer constant is too wide for `complex int'");
1909               }
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.  */
1914               {
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;
1919               }
1920             else
1921               TREE_TYPE (yylval.ttype) = type;
1922
1923
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. */
1926
1927             if (! warn
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");
1931           }
1932
1933         UNGETC (c);
1934         *p = 0;
1935
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);
1940
1941         value = CONSTANT; break;
1942       }
1943
1944     case '\'':
1945     char_constant:
1946       {
1947         register int result = 0;
1948         register int num_chars = 0;
1949         int chars_seen = 0;
1950         unsigned width = TYPE_PRECISION (char_type_node);
1951         int max_chars;
1952 #ifdef MULTIBYTE_CHARS
1953         int longest_char = local_mb_cur_max ();
1954         (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
1955 #endif
1956
1957         max_chars = TYPE_PRECISION (integer_type_node) / width;
1958         if (wide_flag)
1959           width = WCHAR_TYPE_SIZE;
1960
1961         while (1)
1962           {
1963           tryagain:
1964             c = GETC();
1965
1966             if (c == '\'' || c == EOF)
1967               break;
1968
1969             ++chars_seen;
1970             if (c == '\\')
1971               {
1972                 int ignore = 0;
1973                 c = readescape (&ignore);
1974                 if (ignore)
1975                   goto tryagain;
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
1980                 if (ISPRINT (c))
1981                   c = MAP_CHARACTER (c);
1982 #endif
1983               }
1984             else if (c == '\n')
1985               {
1986                 if (pedantic)
1987                   pedwarn ("ANSI C forbids newline in character constant");
1988                 lineno++;
1989               }
1990             else
1991               {
1992 #ifdef MULTIBYTE_CHARS
1993                 wchar_t wc;
1994                 int i;
1995                 int char_len = -1;
1996                 for (i = 1; i <= longest_char; ++i)
1997                   {
1998                     if (i > maxtoken - 4)
1999                       extend_token_buffer (token_buffer);
2000
2001                     token_buffer[i] = c;
2002                     char_len = local_mbtowc (& wc,
2003                                              token_buffer + 1,
2004                                              i);
2005                     if (char_len != -1)
2006                       break;
2007                     c = GETC ();
2008                   }
2009                 if (char_len > 1)
2010                   {
2011                     /* mbtowc sometimes needs an extra char before accepting */
2012                     if (char_len < i)
2013                       UNGETC (c);
2014                     if (! wide_flag)
2015                       {
2016                         /* Merge character into result; ignore excess chars.  */
2017                         for (i = 1; i <= char_len; ++i)
2018                           {
2019                             if (i > max_chars)
2020                               break;
2021                             if (width < HOST_BITS_PER_INT)
2022                               result = (result << width)
2023                                 | (token_buffer[i]
2024                                    & ((1 << width) - 1));
2025                             else
2026                               result = token_buffer[i];
2027                           }
2028                         num_chars += char_len;
2029                         goto tryagain;
2030                       }
2031                     c = wc;
2032                   }
2033                 else
2034                   {
2035                     if (char_len == -1)
2036                       {
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];
2042                       }
2043 #ifdef MAP_CHARACTER
2044                       c = MAP_CHARACTER (wc);
2045 #else
2046                       c = wc;
2047 #endif
2048                   }
2049 #else /* ! MULTIBYTE_CHARS */
2050 #ifdef MAP_CHARACTER
2051                 c = MAP_CHARACTER (c);
2052 #endif
2053 #endif /* ! MULTIBYTE_CHARS */
2054               }
2055
2056             if (wide_flag)
2057               {
2058                 if (chars_seen == 1) /* only keep the first one */
2059                   result = c;
2060                 goto tryagain;
2061               }
2062
2063             /* Merge character into result; ignore excess chars.  */
2064             num_chars += (width / TYPE_PRECISION (char_type_node));
2065             if (num_chars < max_chars + 1)
2066               {
2067                 if (width < HOST_BITS_PER_INT)
2068                   result = (result << width) | (c & ((1 << width) - 1));
2069                 else
2070                   result = c;
2071               }
2072           }
2073
2074         if (c != '\'')
2075           error ("malformatted character constant");
2076         else if (chars_seen == 0)
2077           error ("empty character constant");
2078         else if (num_chars > max_chars)
2079           {
2080             num_chars = max_chars;
2081             error ("character constant too long");
2082           }
2083         else if (chars_seen != 1 && ! flag_traditional && warn_multichar)
2084           warning ("multi-character character constant");
2085
2086         /* If char type is signed, sign-extend the constant.  */
2087         if (! wide_flag)
2088           {
2089             int num_bits = num_chars * width;
2090             if (num_bits == 0)
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)
2095               yylval.ttype
2096                 = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
2097                                          >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2098                                0);
2099             else
2100               yylval.ttype
2101                 = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
2102                                           >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2103                                -1);
2104             TREE_TYPE (yylval.ttype) = integer_type_node;
2105           }
2106         else
2107           {
2108             yylval.ttype = build_int_2 (result, 0);
2109             TREE_TYPE (yylval.ttype) = wchar_type_node;
2110           }
2111
2112         value = CONSTANT;
2113         break;
2114       }
2115
2116     case '"':
2117     string_constant:
2118       {
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);
2124 #endif
2125         c = GETC ();
2126         p = token_buffer + 1;
2127
2128         while (c != '"' && c >= 0)
2129           {
2130             if (c == '\\')
2131               {
2132                 int ignore = 0;
2133                 c = readescape (&ignore);
2134                 if (ignore)
2135                   goto skipnewline;
2136                 if (width < HOST_BITS_PER_INT
2137                     && (unsigned) c >= ((unsigned)1 << width))
2138                   pedwarn ("escape sequence out of range for character");
2139               }
2140             else if (c == '\n')
2141               {
2142                 if (pedantic)
2143                   pedwarn ("ANSI C forbids newline in string constant");
2144                 lineno++;
2145               }
2146             else
2147               {
2148 #ifdef MULTIBYTE_CHARS
2149                 wchar_t wc;
2150                 int i;
2151                 int char_len = -1;
2152                 for (i = 0; i < longest_char; ++i)
2153                   {
2154                     if (p + i >= token_buffer + maxtoken)
2155                       p = extend_token_buffer (p);
2156                     p[i] = c;
2157
2158                     char_len = local_mbtowc (& wc, p, i + 1);
2159                     if (char_len != -1)
2160                       break;
2161                     c = GETC ();
2162                   }
2163                 if (char_len == -1)
2164                   {
2165                     warning ("Ignoring invalid multibyte character");
2166                     /* Replace all except the first byte.  */
2167                     UNGETC (c);
2168                     for (--i; i > 0; --i)
2169                       UNGETC (p[i]);
2170                     char_len = 1;
2171                   }
2172                 /* mbtowc sometimes needs an extra char before accepting */
2173                 if (char_len <= i)
2174                   UNGETC (c);
2175                 if (! wide_flag)
2176                   {
2177                     p += (i + 1);
2178                     c = GETC ();
2179                     continue;
2180                   }
2181                 c = wc;
2182 #endif /* MULTIBYTE_CHARS */
2183               }
2184
2185             /* Add this single character into the buffer either as a wchar_t
2186                or as a single byte.  */
2187             if (wide_flag)
2188               {
2189                 unsigned width = TYPE_PRECISION (char_type_node);
2190                 unsigned bytemask = (1 << width) - 1;
2191                 int byte;
2192
2193                 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2194                   p = extend_token_buffer (p);
2195
2196                 for (byte = 0; byte < WCHAR_BYTES; ++byte)
2197                   {
2198                     int value;
2199                     if (byte >= (int) sizeof (c))
2200                       value = 0;
2201                     else
2202                       value = (c >> (byte * width)) & bytemask;
2203                     if (BYTES_BIG_ENDIAN)
2204                       p[WCHAR_BYTES - byte - 1] = value;
2205                     else
2206                       p[byte] = value;
2207                   }
2208                 p += WCHAR_BYTES;
2209               }
2210             else
2211               {
2212                 if (p >= token_buffer + maxtoken)
2213                   p = extend_token_buffer (p);
2214                 *p++ = c;
2215               }
2216
2217           skipnewline:
2218             c = GETC ();
2219           }
2220
2221         /* Terminate the string value, either with a single byte zero
2222            or with a wide zero.  */
2223         if (wide_flag)
2224           {
2225             if (p + WCHAR_BYTES > token_buffer + maxtoken)
2226               p = extend_token_buffer (p);
2227             bzero (p, WCHAR_BYTES);
2228             p += WCHAR_BYTES;
2229           }
2230         else
2231           {
2232             if (p >= token_buffer + maxtoken)
2233               p = extend_token_buffer (p);
2234             *p++ = 0;
2235           }
2236
2237         if (c < 0)
2238           error ("Unterminated string constant");
2239
2240         /* We have read the entire constant.
2241            Construct a STRING_CST for the result.  */
2242
2243         if (wide_flag)
2244           {
2245             yylval.ttype = build_string (p - (token_buffer + 1),
2246                                          token_buffer + 1);
2247             TREE_TYPE (yylval.ttype) = wchar_array_type_node;
2248             value = STRING;
2249           }
2250         else if (objc_flag)
2251           {
2252             /* Return an Objective-C @"..." constant string object.  */
2253             yylval.ttype = build_objc_string (p - (token_buffer + 1),
2254                                               token_buffer + 1);
2255             TREE_TYPE (yylval.ttype) = char_array_type_node;
2256             value = OBJC_STRING;
2257           }
2258         else
2259           {
2260             yylval.ttype = build_string (p - (token_buffer + 1),
2261                                          token_buffer + 1);
2262             TREE_TYPE (yylval.ttype) = char_array_type_node;
2263             value = STRING;
2264           }
2265
2266         break;
2267       }
2268
2269     case '+':
2270     case '-':
2271     case '&':
2272     case '|':
2273     case ':':
2274     case '<':
2275     case '>':
2276     case '*':
2277     case '/':
2278     case '%':
2279     case '^':
2280     case '!':
2281     case '=':
2282       {
2283         register int c1;
2284
2285       combine:
2286
2287         switch (c)
2288           {
2289           case '+':
2290             yylval.code = PLUS_EXPR; break;
2291           case '-':
2292             yylval.code = MINUS_EXPR; break;
2293           case '&':
2294             yylval.code = BIT_AND_EXPR; break;
2295           case '|':
2296             yylval.code = BIT_IOR_EXPR; break;
2297           case '*':
2298             yylval.code = MULT_EXPR; break;
2299           case '/':
2300             yylval.code = TRUNC_DIV_EXPR; break;
2301           case '%':
2302             yylval.code = TRUNC_MOD_EXPR; break;
2303           case '^':
2304             yylval.code = BIT_XOR_EXPR; break;
2305           case LSHIFT:
2306             yylval.code = LSHIFT_EXPR; break;
2307           case RSHIFT:
2308             yylval.code = RSHIFT_EXPR; break;
2309           case '<':
2310             yylval.code = LT_EXPR; break;
2311           case '>':
2312             yylval.code = GT_EXPR; break;
2313           }
2314
2315         token_buffer[1] = c1 = GETC();
2316         token_buffer[2] = 0;
2317
2318         if (c1 == '=')
2319           {
2320             switch (c)
2321               {
2322               case '<':
2323                 value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
2324               case '>':
2325                 value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
2326               case '!':
2327                 value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
2328               case '=':
2329                 value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
2330               }
2331             value = ASSIGN; goto done;
2332           }
2333         else if (c == c1)
2334           switch (c)
2335             {
2336             case '+':
2337               value = PLUSPLUS; goto done;
2338             case '-':
2339               value = MINUSMINUS; goto done;
2340             case '&':
2341               value = ANDAND; goto done;
2342             case '|':
2343               value = OROR; goto done;
2344             case '<':
2345               c = LSHIFT;
2346               goto combine;
2347             case '>':
2348               c = RSHIFT;
2349               goto combine;
2350             }
2351         else
2352           switch (c)
2353             {
2354             case '-':
2355               if (c1 == '>')
2356                 { value = POINTSAT; goto done; }
2357               break;
2358             case ':':
2359               if (c1 == '>')
2360                 { value = ']'; goto done; }
2361               break;
2362             case '<':
2363               if (c1 == '%')
2364                 { value = '{'; indent_level++; goto done; }
2365               if (c1 == ':')
2366                 { value = '['; goto done; }
2367               break;
2368             case '%':
2369               if (c1 == '>')
2370                 { value = '}'; indent_level--; goto done; }
2371               break;
2372             }
2373         UNGETC (c1);
2374         token_buffer[1] = 0;
2375
2376         if ((c == '<') || (c == '>'))
2377           value = ARITHCOMPARE;
2378         else value = c;
2379         goto done;
2380       }
2381
2382     case 0:
2383       /* Don't make yyparse think this is eof.  */
2384       value = 1;
2385       break;
2386
2387     case '{':
2388       indent_level++;
2389       value = c;
2390       break;
2391
2392     case '}':
2393       indent_level--;
2394       value = c;
2395       break;
2396
2397     default:
2398       value = c;
2399     }
2400
2401 done:
2402 /*  yylloc.last_line = lineno; */
2403
2404   return value;
2405 }
2406
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.  */
2410
2411 void
2412 set_yydebug (value)
2413      int value;
2414 {
2415 #if YYDEBUG != 0
2416   yydebug = value;
2417 #else
2418   warning ("YYDEBUG not defined.");
2419 #endif
2420 }