OSDN Git Service

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