OSDN Git Service

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