home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / c-lex.c < prev    next >
C/C++ Source or Header  |  1996-07-16  |  52KB  |  2,068 lines

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