OSDN Git Service

Tue Jul 6 13:06:01 1999 Dave Brolley <brolley@cygnus.com>
[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         /* for multi-precision arithmetic,
1481            we actually store only HOST_BITS_PER_CHAR bits in each part.
1482            The number of parts is chosen so as to be sufficient to hold
1483            the enough bits to fit into the two HOST_WIDE_INTs that contain
1484            the integer value (this is always at least as many bits as are
1485            in a target `long long' value, but may be wider).  */
1486 #define TOTAL_PARTS ((HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR) * 2 + 2)
1487         int parts[TOTAL_PARTS];
1488         int overflow = 0;
1489
1490         enum anon1 { NOT_FLOAT, AFTER_POINT, TOO_MANY_POINTS, AFTER_EXPON}
1491           floatflag = NOT_FLOAT;
1492
1493         for (count = 0; count < TOTAL_PARTS; count++)
1494           parts[count] = 0;
1495
1496         p = token_buffer;
1497         *p++ = c;
1498
1499         if (c == '0')
1500           {
1501             *p++ = (c = GETC());
1502             if ((c == 'x') || (c == 'X'))
1503               {
1504                 base = 16;
1505                 *p++ = (c = GETC());
1506               }
1507             /* Leading 0 forces octal unless the 0 is the only digit.  */
1508             else if (c >= '0' && c <= '9')
1509               {
1510                 base = 8;
1511                 numdigits++;
1512               }
1513             else
1514               numdigits++;
1515           }
1516
1517         /* Read all the digits-and-decimal-points.  */
1518
1519         while (c == '.'
1520                || (ISALNUM (c) && c != 'l' && c != 'L'
1521                    && c != 'u' && c != 'U'
1522                    && c != 'i' && c != 'I' && c != 'j' && c != 'J'
1523                    && (floatflag == NOT_FLOAT || ((c != 'f') && (c != 'F')))))
1524           {
1525             if (c == '.')
1526               {
1527                 if (base == 16 && pedantic)
1528                   error ("floating constant may not be in radix 16");
1529                 if (floatflag == TOO_MANY_POINTS)
1530                   /* We have already emitted an error.  Don't need another.  */
1531                   ;
1532                 else if (floatflag == AFTER_POINT || floatflag == AFTER_EXPON)
1533                   {
1534                     error ("malformed floating constant");
1535                     floatflag = TOO_MANY_POINTS;
1536                     /* Avoid another error from atof by forcing all characters
1537                        from here on to be ignored.  */
1538                     p[-1] = '\0';
1539                   }
1540                 else
1541                   floatflag = AFTER_POINT;
1542
1543                 if (base == 8)
1544                   base = 10;
1545                 *p++ = c = GETC();
1546                 /* Accept '.' as the start of a floating-point number
1547                    only when it is followed by a digit.
1548                    Otherwise, unread the following non-digit
1549                    and use the '.' as a structural token.  */
1550                 if (p == token_buffer + 2 && !ISDIGIT (c))
1551                   {
1552                     if (c == '.')
1553                       {
1554                         c = GETC();
1555                         if (c == '.')
1556                           {
1557                             *p++ = c;
1558                             *p = 0;
1559                             return ELLIPSIS;
1560                           }
1561                         error ("parse error at `..'");
1562                       }
1563                     UNGETC (c);
1564                     token_buffer[1] = 0;
1565                     value = '.';
1566                     goto done;
1567                   }
1568               }
1569             else
1570               {
1571                 /* It is not a decimal point.
1572                    It should be a digit (perhaps a hex digit).  */
1573
1574                 if (ISDIGIT (c))
1575                   {
1576                     c = c - '0';
1577                   }
1578                 else if (base <= 10)
1579                   {
1580                     if (c == 'e' || c == 'E')
1581                       {
1582                         base = 10;
1583                         floatflag = AFTER_EXPON;
1584                         break;   /* start of exponent */
1585                       }
1586                     error ("nondigits in number and not hexadecimal");
1587                     c = 0;
1588                   }
1589                 else if (base == 16 && (c == 'p' || c == 'P'))
1590                   {
1591                     floatflag = AFTER_EXPON;
1592                     break;   /* start of exponent */
1593                   }
1594                 else if (c >= 'a')
1595                   {
1596                     c = c - 'a' + 10;
1597                   }
1598                 else
1599                   {
1600                     c = c - 'A' + 10;
1601                   }
1602                 if (c >= largest_digit)
1603                   largest_digit = c;
1604                 numdigits++;
1605
1606                 for (count = 0; count < TOTAL_PARTS; count++)
1607                   {
1608                     parts[count] *= base;
1609                     if (count)
1610                       {
1611                         parts[count]
1612                           += (parts[count-1] >> HOST_BITS_PER_CHAR);
1613                         parts[count-1]
1614                           &= (1 << HOST_BITS_PER_CHAR) - 1;
1615                       }
1616                     else
1617                       parts[0] += c;
1618                   }
1619
1620                 /* If the extra highest-order part ever gets anything in it,
1621                    the number is certainly too big.  */
1622                 if (parts[TOTAL_PARTS - 1] != 0)
1623                   overflow = 1;
1624
1625                 if (p >= token_buffer + maxtoken - 3)
1626                   p = extend_token_buffer (p);
1627                 *p++ = (c = GETC());
1628               }
1629           }
1630
1631         if (numdigits == 0)
1632           error ("numeric constant with no digits");
1633
1634         if (largest_digit >= base)
1635           error ("numeric constant contains digits beyond the radix");
1636
1637         /* Remove terminating char from the token buffer and delimit the string */
1638         *--p = 0;
1639
1640         if (floatflag != NOT_FLOAT)
1641           {
1642             tree type = double_type_node;
1643             int imag = 0;
1644             int conversion_errno = 0;
1645             REAL_VALUE_TYPE value;
1646             struct pf_args args;
1647
1648             /* Read explicit exponent if any, and put it in tokenbuf.  */
1649
1650             if ((base == 10 && ((c == 'e') || (c == 'E')))
1651                 || (base == 16 && (c == 'p' || c == 'P')))
1652               {
1653                 if (p >= token_buffer + maxtoken - 3)
1654                   p = extend_token_buffer (p);
1655                 *p++ = c;
1656                 c = GETC();
1657                 if ((c == '+') || (c == '-'))
1658                   {
1659                     *p++ = c;
1660                     c = GETC();
1661                   }
1662                 /* Exponent is decimal, even if string is a hex float.  */
1663                 if (! ISDIGIT (c))
1664                   error ("floating constant exponent has no digits");
1665                 while (ISDIGIT (c))
1666                   {
1667                     if (p >= token_buffer + maxtoken - 3)
1668                       p = extend_token_buffer (p);
1669                     *p++ = c;
1670                     c = GETC();
1671                   }
1672               }
1673             if (base == 16 && floatflag != AFTER_EXPON)
1674               error ("hexadecimal floating constant has no exponent");
1675
1676             *p = 0;
1677
1678             /* Setup input for parse_float() */
1679             args.base = base;
1680             args.p = p;
1681             args.c = c;
1682             args.imag = imag;
1683             args.type = type;
1684             args.conversion_errno = conversion_errno;
1685
1686             /* Convert string to a double, checking for overflow.  */
1687             if (do_float_handler (parse_float, (PTR) &args))
1688               {
1689                 /* Receive output from parse_float() */
1690                 value = args.value;
1691               }
1692             else
1693               {
1694                 /* We got an exception from parse_float() */
1695                 error ("floating constant out of range");
1696                 value = dconst0;
1697               }
1698
1699             /* Receive output from parse_float() */
1700             c = args.c;
1701             imag = args.imag;
1702             type = args.type;
1703             conversion_errno = args.conversion_errno;
1704             
1705 #ifdef ERANGE
1706             /* ERANGE is also reported for underflow,
1707                so test the value to distinguish overflow from that.  */
1708             if (conversion_errno == ERANGE && !flag_traditional && pedantic
1709                 && (REAL_VALUES_LESS (dconst1, value)
1710                     || REAL_VALUES_LESS (value, dconstm1)))
1711               warning ("floating point number exceeds range of `double'");
1712 #endif
1713
1714             /* If the result is not a number, assume it must have been
1715                due to some error message above, so silently convert
1716                it to a zero.  */
1717             if (REAL_VALUE_ISNAN (value))
1718               value = dconst0;
1719
1720             /* Create a node with determined type and value.  */
1721             if (imag)
1722               yylval.ttype = build_complex (NULL_TREE,
1723                                             convert (type, integer_zero_node),
1724                                             build_real (type, value));
1725             else
1726               yylval.ttype = build_real (type, value);
1727           }
1728         else
1729           {
1730             tree traditional_type, ansi_type, type;
1731             HOST_WIDE_INT high, low;
1732             int spec_unsigned = 0;
1733             int spec_long = 0;
1734             int spec_long_long = 0;
1735             int spec_imag = 0;
1736             int warn, i;
1737
1738             traditional_type = ansi_type = type = NULL_TREE;
1739             while (1)
1740               {
1741                 if (c == 'u' || c == 'U')
1742                   {
1743                     if (spec_unsigned)
1744                       error ("two `u's in integer constant");
1745                     spec_unsigned = 1;
1746                   }
1747                 else if (c == 'l' || c == 'L')
1748                   {
1749                     if (spec_long)
1750                       {
1751                         if (spec_long_long)
1752                           error ("three `l's in integer constant");
1753                         else if (pedantic && ! in_system_header && warn_long_long)
1754                           pedwarn ("ANSI C forbids long long integer constants");
1755                         spec_long_long = 1;
1756                       }
1757                     spec_long = 1;
1758                   }
1759                 else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
1760                   {
1761                     if (spec_imag)
1762                       error ("more than one `i' or `j' in numeric constant");
1763                     else if (pedantic)
1764                       pedwarn ("ANSI C forbids imaginary numeric constants");
1765                     spec_imag = 1;
1766                   }
1767                 else
1768                   break;
1769                 if (p >= token_buffer + maxtoken - 3)
1770                   p = extend_token_buffer (p);
1771                 *p++ = c;
1772                 c = GETC();
1773               }
1774
1775             /* If it won't fit in the host's representation for integers,
1776                then pedwarn. */
1777
1778             warn = overflow;
1779             if (warn)
1780               pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);
1781
1782             /* This is simplified by the fact that our constant
1783                is always positive.  */
1784
1785             high = low = 0;
1786
1787             for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
1788               {
1789                 high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
1790                                                     / HOST_BITS_PER_CHAR)]
1791                          << (i * HOST_BITS_PER_CHAR));
1792                 low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
1793               }
1794
1795             yylval.ttype = build_int_2 (low, high);
1796             TREE_TYPE (yylval.ttype) = long_long_unsigned_type_node;
1797
1798             /* If warn_traditional, calculate both the ANSI type and the
1799                traditional type, then see if they disagree.
1800                Otherwise, calculate only the type for the dialect in use.  */
1801             if (warn_traditional || flag_traditional)
1802               {
1803                 /* Calculate the traditional type.  */
1804                 /* Traditionally, any constant is signed;
1805                    but if unsigned is specified explicitly, obey that.
1806                    Use the smallest size with the right number of bits,
1807                    except for one special case with decimal constants.  */
1808                 if (! spec_long && base != 10
1809                     && int_fits_type_p (yylval.ttype, unsigned_type_node))
1810                   traditional_type = (spec_unsigned ? unsigned_type_node
1811                                       : integer_type_node);
1812                 /* A decimal constant must be long
1813                    if it does not fit in type int.
1814                    I think this is independent of whether
1815                    the constant is signed.  */
1816                 else if (! spec_long && base == 10
1817                          && int_fits_type_p (yylval.ttype, integer_type_node))
1818                   traditional_type = (spec_unsigned ? unsigned_type_node
1819                                       : integer_type_node);
1820                 else if (! spec_long_long)
1821                   traditional_type = (spec_unsigned ? long_unsigned_type_node
1822                                       : long_integer_type_node);
1823                 else if (int_fits_type_p (yylval.ttype,
1824                                           spec_unsigned 
1825                                           ? long_long_unsigned_type_node
1826                                           : long_long_integer_type_node)) 
1827                   traditional_type = (spec_unsigned
1828                                       ? long_long_unsigned_type_node
1829                                       : long_long_integer_type_node);
1830                 else
1831                   traditional_type = (spec_unsigned
1832                                       ? widest_unsigned_literal_type_node
1833                                       : widest_integer_literal_type_node);
1834               }
1835             if (warn_traditional || ! flag_traditional)
1836               {
1837                 /* Calculate the ANSI type.  */
1838                 if (! spec_long && ! spec_unsigned
1839                     && int_fits_type_p (yylval.ttype, integer_type_node))
1840                   ansi_type = integer_type_node;
1841                 else if (! spec_long && (base != 10 || spec_unsigned)
1842                          && int_fits_type_p (yylval.ttype, unsigned_type_node))
1843                   ansi_type = unsigned_type_node;
1844                 else if (! spec_unsigned && !spec_long_long
1845                          && int_fits_type_p (yylval.ttype, long_integer_type_node))
1846                   ansi_type = long_integer_type_node;
1847                 else if (! spec_long_long
1848                          && int_fits_type_p (yylval.ttype,
1849                                              long_unsigned_type_node))
1850                   ansi_type = long_unsigned_type_node;
1851                 else if (! spec_unsigned
1852                          && int_fits_type_p (yylval.ttype,
1853                                              long_long_integer_type_node))
1854                   ansi_type = long_long_integer_type_node;
1855                 else if (int_fits_type_p (yylval.ttype,
1856                                           long_long_unsigned_type_node))
1857                   ansi_type = long_long_unsigned_type_node;
1858                 else if (! spec_unsigned
1859                          && int_fits_type_p (yylval.ttype,
1860                                              widest_integer_literal_type_node))
1861                   ansi_type = widest_integer_literal_type_node;
1862                 else
1863                   ansi_type = widest_unsigned_literal_type_node;
1864               }
1865
1866             type = flag_traditional ? traditional_type : ansi_type;
1867
1868             if (warn_traditional && traditional_type != ansi_type)
1869               {
1870                 if (TYPE_PRECISION (traditional_type)
1871                     != TYPE_PRECISION (ansi_type))
1872                   warning ("width of integer constant changes with -traditional");
1873                 else if (TREE_UNSIGNED (traditional_type)
1874                          != TREE_UNSIGNED (ansi_type))
1875                   warning ("integer constant is unsigned in ANSI C, signed with -traditional");
1876                 else
1877                   warning ("width of integer constant may change on other systems with -traditional");
1878               }
1879
1880             if (pedantic && !flag_traditional && !spec_long_long && !warn
1881                 && (TYPE_PRECISION (long_integer_type_node)
1882                     < TYPE_PRECISION (type)))
1883               {
1884                 warn = 1;
1885                 pedwarn ("integer constant larger than the maximum value of an unsigned long int");
1886               }
1887
1888             if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))
1889               warning ("decimal constant is so large that it is unsigned");
1890
1891             if (spec_imag)
1892               {
1893                 if (TYPE_PRECISION (type)
1894                     <= TYPE_PRECISION (integer_type_node))
1895                   yylval.ttype
1896                     = build_complex (NULL_TREE, integer_zero_node,
1897                                      convert (integer_type_node,
1898                                               yylval.ttype));
1899                 else
1900                   error ("complex integer constant is too wide for `complex int'");
1901               }
1902             else if (flag_traditional && !int_fits_type_p (yylval.ttype, type))
1903               /* The traditional constant 0x80000000 is signed
1904                  but doesn't fit in the range of int.
1905                  This will change it to -0x80000000, which does fit.  */
1906               {
1907                 TREE_TYPE (yylval.ttype) = unsigned_type (type);
1908                 yylval.ttype = convert (type, yylval.ttype);
1909                 TREE_OVERFLOW (yylval.ttype)
1910                   = TREE_CONSTANT_OVERFLOW (yylval.ttype) = 0;
1911               }
1912             else
1913               TREE_TYPE (yylval.ttype) = type;
1914
1915
1916             /* If it's still an integer (not a complex), and it doesn't
1917                fit in the type we choose for it, then pedwarn. */
1918
1919             if (! warn
1920                 && TREE_CODE (TREE_TYPE (yylval.ttype)) == INTEGER_TYPE
1921                 && ! int_fits_type_p (yylval.ttype, TREE_TYPE (yylval.ttype)))
1922               pedwarn ("integer constant is larger than the maximum value for its type");
1923           }
1924
1925         UNGETC (c);
1926         *p = 0;
1927
1928         if (ISALNUM (c) || c == '.' || c == '_' || c == '$'
1929             || (!flag_traditional && (c == '-' || c == '+')
1930                 && (p[-1] == 'e' || p[-1] == 'E')))
1931           error ("missing white space after number `%s'", token_buffer);
1932
1933         value = CONSTANT; break;
1934       }
1935
1936     case '\'':
1937     char_constant:
1938       {
1939         register int result = 0;
1940         register int num_chars = 0;
1941         int chars_seen = 0;
1942         unsigned width = TYPE_PRECISION (char_type_node);
1943         int max_chars;
1944 #ifdef MULTIBYTE_CHARS
1945         int longest_char = local_mb_cur_max ();
1946         (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
1947 #endif
1948
1949         max_chars = TYPE_PRECISION (integer_type_node) / width;
1950         if (wide_flag)
1951           width = WCHAR_TYPE_SIZE;
1952
1953         while (1)
1954           {
1955           tryagain:
1956             c = GETC();
1957
1958             if (c == '\'' || c == EOF)
1959               break;
1960
1961             ++chars_seen;
1962             if (c == '\\')
1963               {
1964                 int ignore = 0;
1965                 c = readescape (&ignore);
1966                 if (ignore)
1967                   goto tryagain;
1968                 if (width < HOST_BITS_PER_INT
1969                     && (unsigned) c >= ((unsigned)1 << width))
1970                   pedwarn ("escape sequence out of range for character");
1971 #ifdef MAP_CHARACTER
1972                 if (ISPRINT (c))
1973                   c = MAP_CHARACTER (c);
1974 #endif
1975               }
1976             else if (c == '\n')
1977               {
1978                 if (pedantic)
1979                   pedwarn ("ANSI C forbids newline in character constant");
1980                 lineno++;
1981               }
1982             else
1983               {
1984 #ifdef MULTIBYTE_CHARS
1985                 wchar_t wc;
1986                 int i;
1987                 int char_len = -1;
1988                 for (i = 1; i <= longest_char; ++i)
1989                   {
1990                     if (i > maxtoken - 4)
1991                       extend_token_buffer (token_buffer);
1992
1993                     token_buffer[i] = c;
1994                     char_len = local_mbtowc (& wc,
1995                                              token_buffer + 1,
1996                                              i);
1997                     if (char_len != -1)
1998                       break;
1999                     c = GETC ();
2000                   }
2001                 if (char_len > 1)
2002                   {
2003                     /* mbtowc sometimes needs an extra char before accepting */
2004                     if (char_len < i)
2005                       UNGETC (c);
2006                     if (! wide_flag)
2007                       {
2008                         /* Merge character into result; ignore excess chars.  */
2009                         for (i = 1; i <= char_len; ++i)
2010                           {
2011                             if (i > max_chars)
2012                               break;
2013                             if (width < HOST_BITS_PER_INT)
2014                               result = (result << width)
2015                                 | (token_buffer[i]
2016                                    & ((1 << width) - 1));
2017                             else
2018                               result = token_buffer[i];
2019                           }
2020                         num_chars += char_len;
2021                         goto tryagain;
2022                       }
2023                     c = wc;
2024                   }
2025                 else
2026                   {
2027                     if (char_len == -1)
2028                       {
2029                         warning ("Ignoring invalid multibyte character");
2030                         /* Replace all but the first byte.  */
2031                         for (--i; i > 1; --i)
2032                           UNGETC (token_buffer[i]);
2033                         wc = token_buffer[1];
2034                       }
2035 #ifdef MAP_CHARACTER
2036                       c = MAP_CHARACTER (wc);
2037 #else
2038                       c = wc;
2039 #endif
2040                   }
2041 #else /* ! MULTIBYTE_CHARS */
2042 #ifdef MAP_CHARACTER
2043                 c = MAP_CHARACTER (c);
2044 #endif
2045 #endif /* ! MULTIBYTE_CHARS */
2046               }
2047
2048             if (wide_flag)
2049               {
2050                 if (chars_seen == 1) /* only keep the first one */
2051                   result = c;
2052                 goto tryagain;
2053               }
2054
2055             /* Merge character into result; ignore excess chars.  */
2056             num_chars += (width / TYPE_PRECISION (char_type_node));
2057             if (num_chars < max_chars + 1)
2058               {
2059                 if (width < HOST_BITS_PER_INT)
2060                   result = (result << width) | (c & ((1 << width) - 1));
2061                 else
2062                   result = c;
2063               }
2064           }
2065
2066         if (c != '\'')
2067           error ("malformatted character constant");
2068         else if (chars_seen == 0)
2069           error ("empty character constant");
2070         else if (num_chars > max_chars)
2071           {
2072             num_chars = max_chars;
2073             error ("character constant too long");
2074           }
2075         else if (chars_seen != 1 && ! flag_traditional && warn_multichar)
2076           warning ("multi-character character constant");
2077
2078         /* If char type is signed, sign-extend the constant.  */
2079         if (! wide_flag)
2080           {
2081             int num_bits = num_chars * width;
2082             if (num_bits == 0)
2083               /* We already got an error; avoid invalid shift.  */
2084               yylval.ttype = build_int_2 (0, 0);
2085             else if (TREE_UNSIGNED (char_type_node)
2086                      || ((result >> (num_bits - 1)) & 1) == 0)
2087               yylval.ttype
2088                 = build_int_2 (result & (~(unsigned HOST_WIDE_INT) 0
2089                                          >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2090                                0);
2091             else
2092               yylval.ttype
2093                 = build_int_2 (result | ~(~(unsigned HOST_WIDE_INT) 0
2094                                           >> (HOST_BITS_PER_WIDE_INT - num_bits)),
2095                                -1);
2096             TREE_TYPE (yylval.ttype) = integer_type_node;
2097           }
2098         else
2099           {
2100             yylval.ttype = build_int_2 (result, 0);
2101             TREE_TYPE (yylval.ttype) = wchar_type_node;
2102           }
2103
2104         value = CONSTANT;
2105         break;
2106       }
2107
2108     case '"':
2109     string_constant:
2110       {
2111         unsigned width = wide_flag ? WCHAR_TYPE_SIZE
2112                                    : TYPE_PRECISION (char_type_node);
2113 #ifdef MULTIBYTE_CHARS
2114         int longest_char = local_mb_cur_max ();
2115         (void) local_mbtowc (NULL_PTR, NULL_PTR, 0);
2116 #endif
2117         c = GETC ();
2118         p = token_buffer + 1;
2119
2120         while (c != '"' && c >= 0)
2121           {
2122             if (c == '\\')
2123               {
2124                 int ignore = 0;
2125                 c = readescape (&ignore);
2126                 if (ignore)
2127                   goto skipnewline;
2128                 if (width < HOST_BITS_PER_INT
2129                     && (unsigned) c >= ((unsigned)1 << width))
2130                   pedwarn ("escape sequence out of range for character");
2131               }
2132             else if (c == '\n')
2133               {
2134                 if (pedantic)
2135                   pedwarn ("ANSI C forbids newline in string constant");
2136                 lineno++;
2137               }
2138             else
2139               {
2140 #ifdef MULTIBYTE_CHARS
2141                 wchar_t wc;
2142                 int i;
2143                 int char_len = -1;
2144                 for (i = 0; i < longest_char; ++i)
2145                   {
2146                     if (p + i >= token_buffer + maxtoken)
2147                       p = extend_token_buffer (p);
2148                     p[i] = c;
2149
2150                     char_len = local_mbtowc (& wc, p, i + 1);
2151                     if (char_len != -1)
2152                       break;
2153                     c = GETC ();
2154                   }
2155                 if (char_len == -1)
2156                   {
2157                     warning ("Ignoring invalid multibyte character");
2158                     /* Replace all except the first byte.  */
2159                     UNGETC (c);
2160                     for (--i; i > 0; --i)
2161                       UNGETC (p[i]);
2162                     char_len = 1;
2163                   }
2164                 /* mbtowc sometimes needs an extra char before accepting */
2165                 if (char_len <= i)
2166                   UNGETC (c);
2167                 if (! wide_flag)
2168                   {
2169                     p += (i + 1);
2170                     c = GETC ();
2171                     continue;
2172                   }
2173                 c = wc;
2174 #endif /* MULTIBYTE_CHARS */
2175               }
2176
2177             /* Add this single character into the buffer either as a wchar_t
2178                or as a single byte.  */
2179             if (wide_flag)
2180               {
2181                 unsigned width = TYPE_PRECISION (char_type_node);
2182                 unsigned bytemask = (1 << width) - 1;
2183                 int byte;
2184
2185                 if (p + WCHAR_BYTES > token_buffer + maxtoken)
2186                   p = extend_token_buffer (p);
2187
2188                 for (byte = 0; byte < WCHAR_BYTES; ++byte)
2189                   {
2190                     int value;
2191                     if (byte >= (int) sizeof (c))
2192                       value = 0;
2193                     else
2194                       value = (c >> (byte * width)) & bytemask;
2195                     if (BYTES_BIG_ENDIAN)
2196                       p[WCHAR_BYTES - byte - 1] = value;
2197                     else
2198                       p[byte] = value;
2199                   }
2200                 p += WCHAR_BYTES;
2201               }
2202             else
2203               {
2204                 if (p >= token_buffer + maxtoken)
2205                   p = extend_token_buffer (p);
2206                 *p++ = c;
2207               }
2208
2209           skipnewline:
2210             c = GETC ();
2211           }
2212
2213         /* Terminate the string value, either with a single byte zero
2214            or with a wide zero.  */
2215         if (wide_flag)
2216           {
2217             if (p + WCHAR_BYTES > token_buffer + maxtoken)
2218               p = extend_token_buffer (p);
2219             bzero (p, WCHAR_BYTES);
2220             p += WCHAR_BYTES;
2221           }
2222         else
2223           {
2224             if (p >= token_buffer + maxtoken)
2225               p = extend_token_buffer (p);
2226             *p++ = 0;
2227           }
2228
2229         if (c < 0)
2230           error ("Unterminated string constant");
2231
2232         /* We have read the entire constant.
2233            Construct a STRING_CST for the result.  */
2234
2235         if (wide_flag)
2236           {
2237             yylval.ttype = build_string (p - (token_buffer + 1),
2238                                          token_buffer + 1);
2239             TREE_TYPE (yylval.ttype) = wchar_array_type_node;
2240             value = STRING;
2241           }
2242         else if (objc_flag)
2243           {
2244             /* Return an Objective-C @"..." constant string object.  */
2245             yylval.ttype = build_objc_string (p - (token_buffer + 1),
2246                                               token_buffer + 1);
2247             TREE_TYPE (yylval.ttype) = char_array_type_node;
2248             value = OBJC_STRING;
2249           }
2250         else
2251           {
2252             yylval.ttype = build_string (p - (token_buffer + 1),
2253                                          token_buffer + 1);
2254             TREE_TYPE (yylval.ttype) = char_array_type_node;
2255             value = STRING;
2256           }
2257
2258         break;
2259       }
2260
2261     case '+':
2262     case '-':
2263     case '&':
2264     case '|':
2265     case ':':
2266     case '<':
2267     case '>':
2268     case '*':
2269     case '/':
2270     case '%':
2271     case '^':
2272     case '!':
2273     case '=':
2274       {
2275         register int c1;
2276
2277       combine:
2278
2279         switch (c)
2280           {
2281           case '+':
2282             yylval.code = PLUS_EXPR; break;
2283           case '-':
2284             yylval.code = MINUS_EXPR; break;
2285           case '&':
2286             yylval.code = BIT_AND_EXPR; break;
2287           case '|':
2288             yylval.code = BIT_IOR_EXPR; break;
2289           case '*':
2290             yylval.code = MULT_EXPR; break;
2291           case '/':
2292             yylval.code = TRUNC_DIV_EXPR; break;
2293           case '%':
2294             yylval.code = TRUNC_MOD_EXPR; break;
2295           case '^':
2296             yylval.code = BIT_XOR_EXPR; break;
2297           case LSHIFT:
2298             yylval.code = LSHIFT_EXPR; break;
2299           case RSHIFT:
2300             yylval.code = RSHIFT_EXPR; break;
2301           case '<':
2302             yylval.code = LT_EXPR; break;
2303           case '>':
2304             yylval.code = GT_EXPR; break;
2305           }
2306
2307         token_buffer[1] = c1 = GETC();
2308         token_buffer[2] = 0;
2309
2310         if (c1 == '=')
2311           {
2312             switch (c)
2313               {
2314               case '<':
2315                 value = ARITHCOMPARE; yylval.code = LE_EXPR; goto done;
2316               case '>':
2317                 value = ARITHCOMPARE; yylval.code = GE_EXPR; goto done;
2318               case '!':
2319                 value = EQCOMPARE; yylval.code = NE_EXPR; goto done;
2320               case '=':
2321                 value = EQCOMPARE; yylval.code = EQ_EXPR; goto done;
2322               }
2323             value = ASSIGN; goto done;
2324           }
2325         else if (c == c1)
2326           switch (c)
2327             {
2328             case '+':
2329               value = PLUSPLUS; goto done;
2330             case '-':
2331               value = MINUSMINUS; goto done;
2332             case '&':
2333               value = ANDAND; goto done;
2334             case '|':
2335               value = OROR; goto done;
2336             case '<':
2337               c = LSHIFT;
2338               goto combine;
2339             case '>':
2340               c = RSHIFT;
2341               goto combine;
2342             }
2343         else
2344           switch (c)
2345             {
2346             case '-':
2347               if (c1 == '>')
2348                 { value = POINTSAT; goto done; }
2349               break;
2350             case ':':
2351               if (c1 == '>')
2352                 { value = ']'; goto done; }
2353               break;
2354             case '<':
2355               if (c1 == '%')
2356                 { value = '{'; indent_level++; goto done; }
2357               if (c1 == ':')
2358                 { value = '['; goto done; }
2359               break;
2360             case '%':
2361               if (c1 == '>')
2362                 { value = '}'; indent_level--; goto done; }
2363               break;
2364             }
2365         UNGETC (c1);
2366         token_buffer[1] = 0;
2367
2368         if ((c == '<') || (c == '>'))
2369           value = ARITHCOMPARE;
2370         else value = c;
2371         goto done;
2372       }
2373
2374     case 0:
2375       /* Don't make yyparse think this is eof.  */
2376       value = 1;
2377       break;
2378
2379     case '{':
2380       indent_level++;
2381       value = c;
2382       break;
2383
2384     case '}':
2385       indent_level--;
2386       value = c;
2387       break;
2388
2389     default:
2390       value = c;
2391     }
2392
2393 done:
2394 /*  yylloc.last_line = lineno; */
2395
2396   return value;
2397 }
2398
2399 /* Sets the value of the 'yydebug' variable to VALUE.
2400    This is a function so we don't have to have YYDEBUG defined
2401    in order to build the compiler.  */
2402
2403 void
2404 set_yydebug (value)
2405      int value;
2406 {
2407 #if YYDEBUG != 0
2408   yydebug = value;
2409 #else
2410   warning ("YYDEBUG not defined.");
2411 #endif
2412 }