OSDN Git Service

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