home *** CD-ROM | disk | FTP | other *** search
/ Dream 57 / Amiga_Dream_57.iso / Amiga / Programmation / c / Docs / cxref-1.4a.lha / cpp / cexp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-25  |  50.3 KB  |  1,902 lines

  1.  
  2. /*  A Bison parser, made from cexp.y with Bison version GNU Bison version 1.22
  3.   */
  4.  
  5. #define YYBISON 1  /* Identify Bison output.  */
  6.  
  7. #define    INT    258
  8. #define    CHAR    259
  9. #define    NAME    260
  10. #define    ERROR    261
  11. #define    OR    262
  12. #define    AND    263
  13. #define    EQUAL    264
  14. #define    NOTEQUAL    265
  15. #define    LEQ    266
  16. #define    GEQ    267
  17. #define    LSH    268
  18. #define    RSH    269
  19. #define    UNARY    270
  20.  
  21.  
  22. #include "config.h"
  23. #include <setjmp.h>
  24. /* #define YYDEBUG 1 */
  25.  
  26. #ifdef MULTIBYTE_CHARS
  27. #include <stdlib.h>
  28. #include <locale.h>
  29. #endif
  30.  
  31. #include <stdio.h>
  32.  
  33. typedef unsigned char U_CHAR;
  34.  
  35. /* This is used for communicating lists of keywords with cccp.c.  */
  36. struct arglist {
  37.   struct arglist *next;
  38.   U_CHAR *name;
  39.   int length;
  40.   int argno;
  41. };
  42.  
  43. /* Define a generic NULL if one hasn't already been defined.  */
  44.  
  45. #ifndef NULL
  46. #define NULL 0
  47. #endif
  48.  
  49. #ifndef GENERIC_PTR
  50. #if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
  51. #define GENERIC_PTR void *
  52. #else
  53. #define GENERIC_PTR char *
  54. #endif
  55. #endif
  56.  
  57. /* Find the largest host integer type and set its size and type.  */
  58.  
  59. #ifndef HOST_BITS_PER_WIDE_INT
  60.  
  61. #if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
  62. #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
  63. #define HOST_WIDE_INT long
  64. #else
  65. #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
  66. #define HOST_WIDE_INT int
  67. #endif
  68.  
  69. #endif
  70.  
  71. #ifndef NULL_PTR
  72. #define NULL_PTR ((GENERIC_PTR)0)
  73. #endif
  74.  
  75. int yylex ();
  76. void yyerror ();
  77. HOST_WIDE_INT expression_value;
  78.  
  79. static jmp_buf parse_return_error;
  80.  
  81. /* Nonzero means count most punctuation as part of a name.  */
  82. static int keyword_parsing = 0;
  83.  
  84. /* Nonzero means do not evaluate this expression.
  85.    This is a count, since unevaluated expressions can nest.  */
  86. static int skip_evaluation;
  87.  
  88. /* some external tables of character types */
  89. extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
  90.  
  91. extern char *xmalloc ();
  92.  
  93. /* Flag for -pedantic.  */
  94. extern int pedantic;
  95.  
  96. /* Flag for -traditional.  */
  97. extern int traditional;
  98.  
  99. #ifndef CHAR_TYPE_SIZE
  100. #define CHAR_TYPE_SIZE BITS_PER_UNIT
  101. #endif
  102.  
  103. #ifndef INT_TYPE_SIZE
  104. #define INT_TYPE_SIZE BITS_PER_WORD
  105. #endif
  106.  
  107. #ifndef LONG_TYPE_SIZE
  108. #define LONG_TYPE_SIZE BITS_PER_WORD
  109. #endif
  110.  
  111. #ifndef WCHAR_TYPE_SIZE
  112. #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
  113. #endif
  114.  
  115. #ifndef MAX_CHAR_TYPE_SIZE
  116. #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
  117. #endif
  118.  
  119. #ifndef MAX_INT_TYPE_SIZE
  120. #define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
  121. #endif
  122.  
  123. #ifndef MAX_LONG_TYPE_SIZE
  124. #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
  125. #endif
  126.  
  127. #ifndef MAX_WCHAR_TYPE_SIZE
  128. #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
  129. #endif
  130.  
  131. /* Yield nonzero if adding two numbers with A's and B's signs can yield a
  132.    number with SUM's sign, where A, B, and SUM are all C integers.  */
  133. #define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
  134.  
  135. static void integer_overflow ();
  136. static long left_shift ();
  137. static long right_shift ();
  138.  
  139. typedef union {
  140.   struct constant {long value; int unsignedp;} integer;
  141.   struct name {U_CHAR *address; int length;} name;
  142.   struct arglist *keywords;
  143. } YYSTYPE;
  144.  
  145. #ifndef YYLTYPE
  146. typedef
  147.   struct yyltype
  148.     {
  149.       int timestamp;
  150.       int first_line;
  151.       int first_column;
  152.       int last_line;
  153.       int last_column;
  154.       char *text;
  155.    }
  156.   yyltype;
  157.  
  158. #define YYLTYPE yyltype
  159. #endif
  160.  
  161. #include <stdio.h>
  162.  
  163. #ifndef __cplusplus
  164. #ifndef __STDC__
  165. #define const
  166. #endif
  167. #endif
  168.  
  169.  
  170.  
  171. #define    YYFINAL        77
  172. #define    YYFLAG        -32768
  173. #define    YYNTBASE    34
  174.  
  175. #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 43)
  176.  
  177. static const char yytranslate[] = {     0,
  178.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  179.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  180.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  181.      2,     2,    29,     2,    31,     2,    27,    14,     2,    32,
  182.     33,    25,    23,     9,    24,     2,    26,     2,     2,     2,
  183.      2,     2,     2,     2,     2,     2,     2,     8,     2,    17,
  184.      2,    18,     7,     2,     2,     2,     2,     2,     2,     2,
  185.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  186.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  187.      2,     2,     2,    13,     2,     2,     2,     2,     2,     2,
  188.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  189.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  190.      2,     2,     2,    12,     2,    30,     2,     2,     2,     2,
  191.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  192.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  193.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  194.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  195.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  196.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  197.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  198.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  199.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  200.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  201.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  202.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  203.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  204.      6,    10,    11,    15,    16,    19,    20,    21,    22,    28
  205. };
  206.  
  207. #if YYDEBUG != 0
  208. static const short yyprhs[] = {     0,
  209.      0,     2,     4,     8,    11,    14,    17,    20,    23,    24,
  210.     31,    35,    39,    43,    47,    51,    55,    59,    63,    67,
  211.     71,    75,    79,    83,    87,    91,    95,    99,   100,   105,
  212.    106,   111,   112,   113,   121,   123,   125,   127,   128,   133
  213. };
  214.  
  215. static const short yyrhs[] = {    35,
  216.      0,    36,     0,    35,     9,    36,     0,    24,    36,     0,
  217.     29,    36,     0,    23,    36,     0,    30,    36,     0,    31,
  218.      5,     0,     0,    31,     5,    37,    32,    42,    33,     0,
  219.     32,    35,    33,     0,    36,    25,    36,     0,    36,    26,
  220.     36,     0,    36,    27,    36,     0,    36,    23,    36,     0,
  221.     36,    24,    36,     0,    36,    21,    36,     0,    36,    22,
  222.     36,     0,    36,    15,    36,     0,    36,    16,    36,     0,
  223.     36,    19,    36,     0,    36,    20,    36,     0,    36,    17,
  224.     36,     0,    36,    18,    36,     0,    36,    14,    36,     0,
  225.     36,    13,    36,     0,    36,    12,    36,     0,     0,    36,
  226.     11,    38,    36,     0,     0,    36,    10,    39,    36,     0,
  227.      0,     0,    36,     7,    40,    36,     8,    41,    36,     0,
  228.      3,     0,     4,     0,     5,     0,     0,    32,    42,    33,
  229.     42,     0,     5,    42,     0
  230. };
  231.  
  232. #endif
  233.  
  234. #if YYDEBUG != 0
  235. static const short yyrline[] = { 0,
  236.    176,   181,   182,   189,   194,   197,   199,   202,   206,   208,
  237.    213,   218,   230,   246,   258,   265,   272,   278,   284,   287,
  238.    290,   296,   302,   308,   314,   317,   320,   323,   326,   329,
  239.    332,   335,   337,   340,   343,   345,   347,   352,   354,   367
  240. };
  241.  
  242. static const char * const yytname[] = {   "$","error","$illegal.","INT","CHAR",
  243. "NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
  244. "'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
  245. "'~'","'#'","'('","')'","start","exp1","exp","@1","@2","@3","@4","@5","keywords",
  246. ""
  247. };
  248. #endif
  249.  
  250. static const short yyr1[] = {     0,
  251.     34,    35,    35,    36,    36,    36,    36,    36,    37,    36,
  252.     36,    36,    36,    36,    36,    36,    36,    36,    36,    36,
  253.     36,    36,    36,    36,    36,    36,    36,    38,    36,    39,
  254.     36,    40,    41,    36,    36,    36,    36,    42,    42,    42
  255. };
  256.  
  257. static const short yyr2[] = {     0,
  258.      1,     1,     3,     2,     2,     2,     2,     2,     0,     6,
  259.      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
  260.      3,     3,     3,     3,     3,     3,     3,     0,     4,     0,
  261.      4,     0,     0,     7,     1,     1,     1,     0,     4,     2
  262. };
  263.  
  264. static const short yydefact[] = {     0,
  265.     35,    36,    37,     0,     0,     0,     0,     0,     0,     1,
  266.      2,     6,     4,     5,     7,     8,     0,     0,    32,    30,
  267.     28,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  268.      0,     0,     0,     0,     0,     0,     0,     0,    11,     3,
  269.      0,     0,     0,    27,    26,    25,    19,    20,    23,    24,
  270.     21,    22,    17,    18,    15,    16,    12,    13,    14,    38,
  271.      0,    31,    29,    38,    38,     0,    33,    40,     0,    10,
  272.      0,    38,    34,    39,     0,     0,     0
  273. };
  274.  
  275. static const short yydefgoto[] = {    75,
  276.     10,    11,    38,    43,    42,    41,    71,    66
  277. };
  278.  
  279. static const short yypact[] = {    12,
  280. -32768,-32768,-32768,    12,    12,    12,    12,     1,    12,     4,
  281.     79,-32768,-32768,-32768,-32768,   -21,    31,    12,-32768,-32768,
  282. -32768,    12,    12,    12,    12,    12,    12,    12,    12,    12,
  283.     12,    12,    12,    12,    12,    12,    12,    30,-32768,    79,
  284.     12,    12,    12,   110,   124,   137,   148,   148,   155,   155,
  285.    155,   155,   160,   160,   -17,   -17,-32768,-32768,-32768,     2,
  286.     58,    34,    95,     2,     2,    54,-32768,-32768,    55,-32768,
  287.     12,     2,    79,-32768,    63,   188,-32768
  288. };
  289.  
  290. static const short yypgoto[] = {-32768,
  291.    180,    -4,-32768,-32768,-32768,-32768,-32768,   -60
  292. };
  293.  
  294.  
  295. #define    YYLAST        189
  296.  
  297.  
  298. static const short yytable[] = {    12,
  299.     13,    14,    15,    68,    69,    16,    64,    35,    36,    37,
  300.     -9,    74,    18,    40,     1,     2,     3,    44,    45,    46,
  301.     47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
  302.     57,    58,    59,    65,     4,     5,    61,    62,    63,    18,
  303.      6,     7,     8,     9,    21,    22,    23,    24,    25,    26,
  304.     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
  305.     37,    60,    76,    39,    19,    67,    73,    20,    21,    22,
  306.     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  307.     33,    34,    35,    36,    37,    19,    70,    72,    20,    21,
  308.     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
  309.     32,    33,    34,    35,    36,    37,    22,    23,    24,    25,
  310.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  311.     36,    37,    23,    24,    25,    26,    27,    28,    29,    30,
  312.     31,    32,    33,    34,    35,    36,    37,    24,    25,    26,
  313.     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
  314.     37,    25,    26,    27,    28,    29,    30,    31,    32,    33,
  315.     34,    35,    36,    37,    27,    28,    29,    30,    31,    32,
  316.     33,    34,    35,    36,    37,    31,    32,    33,    34,    35,
  317.     36,    37,    33,    34,    35,    36,    37,    77,    17
  318. };
  319.  
  320. static const short yycheck[] = {     4,
  321.      5,     6,     7,    64,    65,     5,     5,    25,    26,    27,
  322.     32,    72,     9,    18,     3,     4,     5,    22,    23,    24,
  323.     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
  324.     35,    36,    37,    32,    23,    24,    41,    42,    43,     9,
  325.     29,    30,    31,    32,    11,    12,    13,    14,    15,    16,
  326.     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
  327.     27,    32,     0,    33,     7,     8,    71,    10,    11,    12,
  328.     13,    14,    15,    16,    17,    18,    19,    20,    21,    22,
  329.     23,    24,    25,    26,    27,     7,    33,    33,    10,    11,
  330.     12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
  331.     22,    23,    24,    25,    26,    27,    12,    13,    14,    15,
  332.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  333.     26,    27,    13,    14,    15,    16,    17,    18,    19,    20,
  334.     21,    22,    23,    24,    25,    26,    27,    14,    15,    16,
  335.     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
  336.     27,    15,    16,    17,    18,    19,    20,    21,    22,    23,
  337.     24,    25,    26,    27,    17,    18,    19,    20,    21,    22,
  338.     23,    24,    25,    26,    27,    21,    22,    23,    24,    25,
  339.     26,    27,    23,    24,    25,    26,    27,     0,     9
  340. };
  341. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  342.  
  343.  
  344. /* Skeleton output parser for bison,
  345.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  346.  
  347.    This program is free software; you can redistribute it and/or modify
  348.    it under the terms of the GNU General Public License as published by
  349.    the Free Software Foundation; either version 1, or (at your option)
  350.    any later version.
  351.  
  352.    This program is distributed in the hope that it will be useful,
  353.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  354.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  355.    GNU General Public License for more details.
  356.  
  357.    You should have received a copy of the GNU General Public License
  358.    along with this program; if not, write to the Free Software
  359.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  360.  
  361.  
  362. #ifndef alloca
  363. #ifdef __GNUC__
  364. #define alloca __builtin_alloca
  365. #else /* not GNU C.  */
  366. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  367. #include <alloca.h>
  368. #else /* not sparc */
  369. #if defined (MSDOS) && !defined (__TURBOC__)
  370. #include <malloc.h>
  371. #else /* not MSDOS, or __TURBOC__ */
  372. #if defined(_AIX)
  373. #include <malloc.h>
  374.  #pragma alloca
  375. #else /* not MSDOS, __TURBOC__, or _AIX */
  376. #ifdef __hpux
  377. #ifdef __cplusplus
  378. extern "C" {
  379. void *alloca (unsigned int);
  380. };
  381. #else /* not __cplusplus */
  382. void *alloca ();
  383. #endif /* not __cplusplus */
  384. #endif /* __hpux */
  385. #endif /* not _AIX */
  386. #endif /* not MSDOS, or __TURBOC__ */
  387. #endif /* not sparc.  */
  388. #endif /* not GNU C.  */
  389. #endif /* alloca not defined.  */
  390.  
  391. /* This is the parser code that is written into each bison parser
  392.   when the %semantic_parser declaration is not specified in the grammar.
  393.   It was written by Richard Stallman by simplifying the hairy parser
  394.   used when %semantic_parser is specified.  */
  395.  
  396. /* Note: there must be only one dollar sign in this file.
  397.    It is replaced by the list of actions, each action
  398.    as one case of the switch.  */
  399.  
  400. #define yyerrok        (yyerrstatus = 0)
  401. #define yyclearin    (yychar = YYEMPTY)
  402. #define YYEMPTY        -2
  403. #define YYEOF        0
  404. #define YYACCEPT    return(0)
  405. #define YYABORT     return(1)
  406. #define YYERROR        goto yyerrlab1
  407. /* Like YYERROR except do call yyerror.
  408.    This remains here temporarily to ease the
  409.    transition to the new meaning of YYERROR, for GCC.
  410.    Once GCC version 2 has supplanted version 1, this can go.  */
  411. #define YYFAIL        goto yyerrlab
  412. #define YYRECOVERING()  (!!yyerrstatus)
  413. #define YYBACKUP(token, value) \
  414. do                                \
  415.   if (yychar == YYEMPTY && yylen == 1)                \
  416.     { yychar = (token), yylval = (value);            \
  417.       yychar1 = YYTRANSLATE (yychar);                \
  418.       YYPOPSTACK;                        \
  419.       goto yybackup;                        \
  420.     }                                \
  421.   else                                \
  422.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  423. while (0)
  424.  
  425. #define YYTERROR    1
  426. #define YYERRCODE    256
  427.  
  428. #ifndef YYPURE
  429. #define YYLEX        yylex()
  430. #endif
  431.  
  432. #ifdef YYPURE
  433. #ifdef YYLSP_NEEDED
  434. #define YYLEX        yylex(&yylval, &yylloc)
  435. #else
  436. #define YYLEX        yylex(&yylval)
  437. #endif
  438. #endif
  439.  
  440. /* If nonreentrant, generate the variables here */
  441.  
  442. #ifndef YYPURE
  443.  
  444. int    yychar;            /*  the lookahead symbol        */
  445. YYSTYPE    yylval;            /*  the semantic value of the        */
  446.                 /*  lookahead symbol            */
  447.  
  448. #ifdef YYLSP_NEEDED
  449. YYLTYPE yylloc;            /*  location data for the lookahead    */
  450.                 /*  symbol                */
  451. #endif
  452.  
  453. int yynerrs;            /*  number of parse errors so far       */
  454. #endif  /* not YYPURE */
  455.  
  456. #if YYDEBUG != 0
  457. int yydebug;            /*  nonzero means print parse trace    */
  458. /* Since this is uninitialized, it does not stop multiple parsers
  459.    from coexisting.  */
  460. #endif
  461.  
  462. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  463.  
  464. #ifndef    YYINITDEPTH
  465. #define YYINITDEPTH 200
  466. #endif
  467.  
  468. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  469.     (effective only if the built-in stack extension method is used).  */
  470.  
  471. #if YYMAXDEPTH == 0
  472. #undef YYMAXDEPTH
  473. #endif
  474.  
  475. #ifndef YYMAXDEPTH
  476. #define YYMAXDEPTH 10000
  477. #endif
  478.  
  479. /* Prevent warning if -Wstrict-prototypes.  */
  480. #ifdef __GNUC__
  481. int yyparse (void);
  482. #endif
  483.  
  484. #if __GNUC__ > 1        /* GNU C and GNU C++ define this.  */
  485. #define __yy_bcopy(FROM,TO,COUNT)    __builtin_memcpy(TO,FROM,COUNT)
  486. #else                /* not GNU C or C++ */
  487. #ifndef __cplusplus
  488.  
  489. /* This is the most reliable way to avoid incompatibilities
  490.    in available built-in functions on various systems.  */
  491. static void
  492. __yy_bcopy (from, to, count)
  493.      char *from;
  494.      char *to;
  495.      int count;
  496. {
  497.   register char *f = from;
  498.   register char *t = to;
  499.   register int i = count;
  500.  
  501.   while (i-- > 0)
  502.     *t++ = *f++;
  503. }
  504.  
  505. #else /* __cplusplus */
  506.  
  507. /* This is the most reliable way to avoid incompatibilities
  508.    in available built-in functions on various systems.  */
  509. static void
  510. __yy_bcopy (char *from, char *to, int count)
  511. {
  512.   register char *f = from;
  513.   register char *t = to;
  514.   register int i = count;
  515.  
  516.   while (i-- > 0)
  517.     *t++ = *f++;
  518. }
  519.  
  520. #endif
  521. #endif
  522.  
  523.  
  524. int
  525. yyparse()
  526. {
  527.   register int yystate;
  528.   register int yyn;
  529.   register short *yyssp;
  530.   register YYSTYPE *yyvsp;
  531.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  532.   int yychar1 = 0;        /*  lookahead token as an internal (translated) token number */
  533.  
  534.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  535.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  536.  
  537.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  538.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  539.  
  540. #ifdef YYLSP_NEEDED
  541.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  542.   YYLTYPE *yyls = yylsa;
  543.   YYLTYPE *yylsp;
  544.  
  545. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  546. #else
  547. #define YYPOPSTACK   (yyvsp--, yyssp--)
  548. #endif
  549.  
  550.   int yystacksize = YYINITDEPTH;
  551.  
  552. #ifdef YYPURE
  553.   int yychar;
  554.   YYSTYPE yylval;
  555.   int yynerrs;
  556. #ifdef YYLSP_NEEDED
  557.   YYLTYPE yylloc;
  558. #endif
  559. #endif
  560.  
  561.   YYSTYPE yyval;        /*  the variable used to return        */
  562.                 /*  semantic values from the action    */
  563.                 /*  routines                */
  564.  
  565.   int yylen;
  566.  
  567. #if YYDEBUG != 0
  568.   if (yydebug)
  569.     fprintf(stderr, "Starting parse\n");
  570. #endif
  571.  
  572.   yystate = 0;
  573.   yyerrstatus = 0;
  574.   yynerrs = 0;
  575.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  576.  
  577.   /* Initialize stack pointers.
  578.      Waste one element of value and location stack
  579.      so that they stay on the same level as the state stack.
  580.      The wasted elements are never initialized.  */
  581.  
  582.   yyssp = yyss - 1;
  583.   yyvsp = yyvs;
  584. #ifdef YYLSP_NEEDED
  585.   yylsp = yyls;
  586. #endif
  587.  
  588. /* Push a new state, which is found in  yystate  .  */
  589. /* In all cases, when you get here, the value and location stacks
  590.    have just been pushed. so pushing a state here evens the stacks.  */
  591. yynewstate:
  592.  
  593.   *++yyssp = yystate;
  594.  
  595.   if (yyssp >= yyss + yystacksize - 1)
  596.     {
  597.       /* Give user a chance to reallocate the stack */
  598.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  599.       YYSTYPE *yyvs1 = yyvs;
  600.       short *yyss1 = yyss;
  601. #ifdef YYLSP_NEEDED
  602.       YYLTYPE *yyls1 = yyls;
  603. #endif
  604.  
  605.       /* Get the current used size of the three stacks, in elements.  */
  606.       int size = yyssp - yyss + 1;
  607.  
  608. #ifdef yyoverflow
  609.       /* Each stack pointer address is followed by the size of
  610.      the data in use in that stack, in bytes.  */
  611. #ifdef YYLSP_NEEDED
  612.       /* This used to be a conditional around just the two extra args,
  613.      but that might be undefined if yyoverflow is a macro.  */
  614.       yyoverflow("parser stack overflow",
  615.          &yyss1, size * sizeof (*yyssp),
  616.          &yyvs1, size * sizeof (*yyvsp),
  617.          &yyls1, size * sizeof (*yylsp),
  618.          &yystacksize);
  619. #else
  620.       yyoverflow("parser stack overflow",
  621.          &yyss1, size * sizeof (*yyssp),
  622.          &yyvs1, size * sizeof (*yyvsp),
  623.          &yystacksize);
  624. #endif
  625.  
  626.       yyss = yyss1; yyvs = yyvs1;
  627. #ifdef YYLSP_NEEDED
  628.       yyls = yyls1;
  629. #endif
  630. #else /* no yyoverflow */
  631.       /* Extend the stack our own way.  */
  632.       if (yystacksize >= YYMAXDEPTH)
  633.     {
  634.       yyerror("parser stack overflow");
  635.       return 2;
  636.     }
  637.       yystacksize *= 2;
  638.       if (yystacksize > YYMAXDEPTH)
  639.     yystacksize = YYMAXDEPTH;
  640.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  641.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  642.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  643.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  644. #ifdef YYLSP_NEEDED
  645.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  646.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  647. #endif
  648. #endif /* no yyoverflow */
  649.  
  650.       yyssp = yyss + size - 1;
  651.       yyvsp = yyvs + size - 1;
  652. #ifdef YYLSP_NEEDED
  653.       yylsp = yyls + size - 1;
  654. #endif
  655.  
  656. #if YYDEBUG != 0
  657.       if (yydebug)
  658.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  659. #endif
  660.  
  661.       if (yyssp >= yyss + yystacksize - 1)
  662.     YYABORT;
  663.     }
  664.  
  665. #if YYDEBUG != 0
  666.   if (yydebug)
  667.     fprintf(stderr, "Entering state %d\n", yystate);
  668. #endif
  669.  
  670.   goto yybackup;
  671.  yybackup:
  672.  
  673. /* Do appropriate processing given the current state.  */
  674. /* Read a lookahead token if we need one and don't already have one.  */
  675. /* yyresume: */
  676.  
  677.   /* First try to decide what to do without reference to lookahead token.  */
  678.  
  679.   yyn = yypact[yystate];
  680.   if (yyn == YYFLAG)
  681.     goto yydefault;
  682.  
  683.   /* Not known => get a lookahead token if don't already have one.  */
  684.  
  685.   /* yychar is either YYEMPTY or YYEOF
  686.      or a valid token in external form.  */
  687.  
  688.   if (yychar == YYEMPTY)
  689.     {
  690. #if YYDEBUG != 0
  691.       if (yydebug)
  692.     fprintf(stderr, "Reading a token: ");
  693. #endif
  694.       yychar = YYLEX;
  695.     }
  696.  
  697.   /* Convert token to internal form (in yychar1) for indexing tables with */
  698.  
  699.   if (yychar <= 0)        /* This means end of input. */
  700.     {
  701.       yychar1 = 0;
  702.       yychar = YYEOF;        /* Don't call YYLEX any more */
  703.  
  704. #if YYDEBUG != 0
  705.       if (yydebug)
  706.     fprintf(stderr, "Now at end of input.\n");
  707. #endif
  708.     }
  709.   else
  710.     {
  711.       yychar1 = YYTRANSLATE(yychar);
  712.  
  713. #if YYDEBUG != 0
  714.       if (yydebug)
  715.     {
  716.       fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
  717.       /* Give the individual parser a way to print the precise meaning
  718.          of a token, for further debugging info.  */
  719. #ifdef YYPRINT
  720.       YYPRINT (stderr, yychar, yylval);
  721. #endif
  722.       fprintf (stderr, ")\n");
  723.     }
  724. #endif
  725.     }
  726.  
  727.   yyn += yychar1;
  728.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  729.     goto yydefault;
  730.  
  731.   yyn = yytable[yyn];
  732.  
  733.   /* yyn is what to do for this token type in this state.
  734.      Negative => reduce, -yyn is rule number.
  735.      Positive => shift, yyn is new state.
  736.        New state is final state => don't bother to shift,
  737.        just return success.
  738.      0, or most negative number => error.  */
  739.  
  740.   if (yyn < 0)
  741.     {
  742.       if (yyn == YYFLAG)
  743.     goto yyerrlab;
  744.       yyn = -yyn;
  745.       goto yyreduce;
  746.     }
  747.   else if (yyn == 0)
  748.     goto yyerrlab;
  749.  
  750.   if (yyn == YYFINAL)
  751.     YYACCEPT;
  752.  
  753.   /* Shift the lookahead token.  */
  754.  
  755. #if YYDEBUG != 0
  756.   if (yydebug)
  757.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  758. #endif
  759.  
  760.   /* Discard the token being shifted unless it is eof.  */
  761.   if (yychar != YYEOF)
  762.     yychar = YYEMPTY;
  763.  
  764.   *++yyvsp = yylval;
  765. #ifdef YYLSP_NEEDED
  766.   *++yylsp = yylloc;
  767. #endif
  768.  
  769.   /* count tokens shifted since error; after three, turn off error status.  */
  770.   if (yyerrstatus) yyerrstatus--;
  771.  
  772.   yystate = yyn;
  773.   goto yynewstate;
  774.  
  775. /* Do the default action for the current state.  */
  776. yydefault:
  777.  
  778.   yyn = yydefact[yystate];
  779.   if (yyn == 0)
  780.     goto yyerrlab;
  781.  
  782. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  783. yyreduce:
  784.   yylen = yyr2[yyn];
  785.   if (yylen > 0)
  786.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  787.  
  788. #if YYDEBUG != 0
  789.   if (yydebug)
  790.     {
  791.       int i;
  792.  
  793.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  794.            yyn, yyrline[yyn]);
  795.  
  796.       /* Print the symbols being reduced, and their result.  */
  797.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  798.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  799.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  800.     }
  801. #endif
  802.  
  803.  
  804.   switch (yyn) {
  805.  
  806. case 1:
  807. { expression_value = yyvsp[0].integer.value; ;
  808.     break;}
  809. case 3:
  810. { if (pedantic)
  811.                 pedwarn ("comma operator in operand of `#if'");
  812.               yyval.integer = yyvsp[0].integer; ;
  813.     break;}
  814. case 4:
  815. { yyval.integer.value = - yyvsp[0].integer.value;
  816.               if ((yyval.integer.value & yyvsp[0].integer.value) < 0 && ! yyvsp[0].integer.unsignedp)
  817.                 integer_overflow ();
  818.               yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
  819.     break;}
  820. case 5:
  821. { yyval.integer.value = ! yyvsp[0].integer.value;
  822.               yyval.integer.unsignedp = 0; ;
  823.     break;}
  824. case 6:
  825. { yyval.integer = yyvsp[0].integer; ;
  826.     break;}
  827. case 7:
  828. { yyval.integer.value = ~ yyvsp[0].integer.value;
  829.               yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
  830.     break;}
  831. case 8:
  832. { yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length,
  833.                               0, NULL_PTR);
  834.               yyval.integer.unsignedp = 0; ;
  835.     break;}
  836. case 9:
  837. { keyword_parsing = 1; ;
  838.     break;}
  839. case 10:
  840. { yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length,
  841.                               1, yyvsp[-1].keywords);
  842.               keyword_parsing = 0;
  843.               yyval.integer.unsignedp = 0; ;
  844.     break;}
  845. case 11:
  846. { yyval.integer = yyvsp[-1].integer; ;
  847.     break;}
  848. case 12:
  849. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  850.               if (yyval.integer.unsignedp)
  851.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value * yyvsp[0].integer.value;
  852.               else
  853.                 {
  854.                   yyval.integer.value = yyvsp[-2].integer.value * yyvsp[0].integer.value;
  855.                   if (yyvsp[-2].integer.value
  856.                   && (yyval.integer.value / yyvsp[-2].integer.value != yyvsp[0].integer.value
  857.                       || (yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0))
  858.                 integer_overflow ();
  859.                 } ;
  860.     break;}
  861. case 13:
  862. { if (yyvsp[0].integer.value == 0)
  863.                 {
  864.                   if (!skip_evaluation)
  865.                 error ("division by zero in #if");
  866.                   yyvsp[0].integer.value = 1;
  867.                 }
  868.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  869.               if (yyval.integer.unsignedp)
  870.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value / yyvsp[0].integer.value;
  871.               else
  872.                 {
  873.                   yyval.integer.value = yyvsp[-2].integer.value / yyvsp[0].integer.value;
  874.                   if ((yyval.integer.value & yyvsp[-2].integer.value & yyvsp[0].integer.value) < 0)
  875.                 integer_overflow ();
  876.                 } ;
  877.     break;}
  878. case 14:
  879. { if (yyvsp[0].integer.value == 0)
  880.                 {
  881.                   if (!skip_evaluation)
  882.                 error ("division by zero in #if");
  883.                   yyvsp[0].integer.value = 1;
  884.                 }
  885.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  886.               if (yyval.integer.unsignedp)
  887.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value % yyvsp[0].integer.value;
  888.               else
  889.                 yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value; ;
  890.     break;}
  891. case 15:
  892. { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
  893.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  894.               if (! yyval.integer.unsignedp
  895.                   && ! possible_sum_sign (yyvsp[-2].integer.value, yyvsp[0].integer.value,
  896.                               yyval.integer.value))
  897.                 integer_overflow (); ;
  898.     break;}
  899. case 16:
  900. { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
  901.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
  902.               if (! yyval.integer.unsignedp
  903.                   && ! possible_sum_sign (yyval.integer.value, yyvsp[0].integer.value,
  904.                               yyvsp[-2].integer.value))
  905.                 integer_overflow (); ;
  906.     break;}
  907. case 17:
  908. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
  909.               if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
  910.                 yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
  911.               else
  912.                 yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
  913.     break;}
  914. case 18:
  915. { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
  916.               if (yyvsp[0].integer.value < 0 && ! yyvsp[0].integer.unsignedp)
  917.                 yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
  918.               else
  919.                 yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
  920.     break;}
  921. case 19:
  922. { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
  923.               yyval.integer.unsignedp = 0; ;
  924.     break;}
  925. case 20:
  926. { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
  927.               yyval.integer.unsignedp = 0; ;
  928.     break;}
  929. case 21:
  930. { yyval.integer.unsignedp = 0;
  931.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  932.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value <= yyvsp[0].integer.value;
  933.               else
  934.                 yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value; ;
  935.     break;}
  936. case 22:
  937. { yyval.integer.unsignedp = 0;
  938.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  939.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value >= yyvsp[0].integer.value;
  940.               else
  941.                 yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value; ;
  942.     break;}
  943. case 23:
  944. { yyval.integer.unsignedp = 0;
  945.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  946.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value < yyvsp[0].integer.value;
  947.               else
  948.                 yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value; ;
  949.     break;}
  950. case 24:
  951. { yyval.integer.unsignedp = 0;
  952.               if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
  953.                 yyval.integer.value = (unsigned long) yyvsp[-2].integer.value > yyvsp[0].integer.value;
  954.               else
  955.                 yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value; ;
  956.     break;}
  957. case 25:
  958. { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
  959.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  960.     break;}
  961. case 26:
  962. { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
  963.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  964.     break;}
  965. case 27:
  966. { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
  967.               yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  968.     break;}
  969. case 28:
  970. { skip_evaluation += !yyvsp[-1].integer.value; ;
  971.     break;}
  972. case 29:
  973. { skip_evaluation -= !yyvsp[-3].integer.value;
  974.               yyval.integer.value = (yyvsp[-3].integer.value && yyvsp[0].integer.value);
  975.               yyval.integer.unsignedp = 0; ;
  976.     break;}
  977. case 30:
  978. { skip_evaluation += !!yyvsp[-1].integer.value; ;
  979.     break;}
  980. case 31:
  981. { skip_evaluation -= !!yyvsp[-3].integer.value;
  982.               yyval.integer.value = (yyvsp[-3].integer.value || yyvsp[0].integer.value);
  983.               yyval.integer.unsignedp = 0; ;
  984.     break;}
  985. case 32:
  986. { skip_evaluation += !yyvsp[-1].integer.value; ;
  987.     break;}
  988. case 33:
  989. { skip_evaluation += !!yyvsp[-4].integer.value - !yyvsp[-4].integer.value; ;
  990.     break;}
  991. case 34:
  992. { skip_evaluation -= !!yyvsp[-6].integer.value;
  993.               yyval.integer.value = yyvsp[-6].integer.value ? yyvsp[-3].integer.value : yyvsp[0].integer.value;
  994.               yyval.integer.unsignedp = yyvsp[-3].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
  995.     break;}
  996. case 35:
  997. { yyval.integer = yylval.integer; ;
  998.     break;}
  999. case 36:
  1000. { yyval.integer = yylval.integer; ;
  1001.     break;}
  1002. case 37:
  1003. { yyval.integer.value = 0;
  1004.               yyval.integer.unsignedp = 0; ;
  1005.     break;}
  1006. case 38:
  1007. { yyval.keywords = 0; ;
  1008.     break;}
  1009. case 39:
  1010. { struct arglist *temp;
  1011.               yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
  1012.               yyval.keywords->next = yyvsp[-2].keywords;
  1013.               yyval.keywords->name = (U_CHAR *) "(";
  1014.               yyval.keywords->length = 1;
  1015.               temp = yyval.keywords;
  1016.               while (temp != 0 && temp->next != 0)
  1017.                 temp = temp->next;
  1018.               temp->next = (struct arglist *) xmalloc (sizeof (struct arglist));
  1019.               temp->next->next = yyvsp[0].keywords;
  1020.               temp->next->name = (U_CHAR *) ")";
  1021.               temp->next->length = 1; ;
  1022.     break;}
  1023. case 40:
  1024. { yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
  1025.               yyval.keywords->name = yyvsp[-1].name.address;
  1026.               yyval.keywords->length = yyvsp[-1].name.length;
  1027.               yyval.keywords->next = yyvsp[0].keywords; ;
  1028.     break;}
  1029. }
  1030.    /* the action file gets copied in in place of this dollarsign */
  1031.  
  1032.  
  1033.   yyvsp -= yylen;
  1034.   yyssp -= yylen;
  1035. #ifdef YYLSP_NEEDED
  1036.   yylsp -= yylen;
  1037. #endif
  1038.  
  1039. #if YYDEBUG != 0
  1040.   if (yydebug)
  1041.     {
  1042.       short *ssp1 = yyss - 1;
  1043.       fprintf (stderr, "state stack now");
  1044.       while (ssp1 != yyssp)
  1045.     fprintf (stderr, " %d", *++ssp1);
  1046.       fprintf (stderr, "\n");
  1047.     }
  1048. #endif
  1049.  
  1050.   *++yyvsp = yyval;
  1051.  
  1052. #ifdef YYLSP_NEEDED
  1053.   yylsp++;
  1054.   if (yylen == 0)
  1055.     {
  1056.       yylsp->first_line = yylloc.first_line;
  1057.       yylsp->first_column = yylloc.first_column;
  1058.       yylsp->last_line = (yylsp-1)->last_line;
  1059.       yylsp->last_column = (yylsp-1)->last_column;
  1060.       yylsp->text = 0;
  1061.     }
  1062.   else
  1063.     {
  1064.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1065.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1066.     }
  1067. #endif
  1068.  
  1069.   /* Now "shift" the result of the reduction.
  1070.      Determine what state that goes to,
  1071.      based on the state we popped back to
  1072.      and the rule number reduced by.  */
  1073.  
  1074.   yyn = yyr1[yyn];
  1075.  
  1076.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1077.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1078.     yystate = yytable[yystate];
  1079.   else
  1080.     yystate = yydefgoto[yyn - YYNTBASE];
  1081.  
  1082.   goto yynewstate;
  1083.  
  1084. yyerrlab:   /* here on detecting error */
  1085.  
  1086.   if (! yyerrstatus)
  1087.     /* If not already recovering from an error, report this error.  */
  1088.     {
  1089.       ++yynerrs;
  1090.  
  1091. #ifdef YYERROR_VERBOSE
  1092.       yyn = yypact[yystate];
  1093.  
  1094.       if (yyn > YYFLAG && yyn < YYLAST)
  1095.     {
  1096.       int size = 0;
  1097.       char *msg;
  1098.       int x, count;
  1099.  
  1100.       count = 0;
  1101.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1102.       for (x = (yyn < 0 ? -yyn : 0);
  1103.            x < (sizeof(yytname) / sizeof(char *)); x++)
  1104.         if (yycheck[x + yyn] == x)
  1105.           size += strlen(yytname[x]) + 15, count++;
  1106.       msg = (char *) malloc(size + 15);
  1107.       if (msg != 0)
  1108.         {
  1109.           strcpy(msg, "parse error");
  1110.  
  1111.           if (count < 5)
  1112.         {
  1113.           count = 0;
  1114.           for (x = (yyn < 0 ? -yyn : 0);
  1115.                x < (sizeof(yytname) / sizeof(char *)); x++)
  1116.             if (yycheck[x + yyn] == x)
  1117.               {
  1118.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1119.             strcat(msg, yytname[x]);
  1120.             strcat(msg, "'");
  1121.             count++;
  1122.               }
  1123.         }
  1124.           yyerror(msg);
  1125.           free(msg);
  1126.         }
  1127.       else
  1128.         yyerror ("parse error; also virtual memory exceeded");
  1129.     }
  1130.       else
  1131. #endif /* YYERROR_VERBOSE */
  1132.     yyerror("parse error");
  1133.     }
  1134.  
  1135.   goto yyerrlab1;
  1136. yyerrlab1:   /* here on error raised explicitly by an action */
  1137.  
  1138.   if (yyerrstatus == 3)
  1139.     {
  1140.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1141.  
  1142.       /* return failure if at end of input */
  1143.       if (yychar == YYEOF)
  1144.     YYABORT;
  1145.  
  1146. #if YYDEBUG != 0
  1147.       if (yydebug)
  1148.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1149. #endif
  1150.  
  1151.       yychar = YYEMPTY;
  1152.     }
  1153.  
  1154.   /* Else will try to reuse lookahead token
  1155.      after shifting the error token.  */
  1156.  
  1157.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1158.  
  1159.   goto yyerrhandle;
  1160.  
  1161. yyerrdefault:  /* current state does not do anything special for the error token. */
  1162.  
  1163. #if 0
  1164.   /* This is wrong; only states that explicitly want error tokens
  1165.      should shift them.  */
  1166.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1167.   if (yyn) goto yydefault;
  1168. #endif
  1169.  
  1170. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1171.  
  1172.   if (yyssp == yyss) YYABORT;
  1173.   yyvsp--;
  1174.   yystate = *--yyssp;
  1175. #ifdef YYLSP_NEEDED
  1176.   yylsp--;
  1177. #endif
  1178.  
  1179. #if YYDEBUG != 0
  1180.   if (yydebug)
  1181.     {
  1182.       short *ssp1 = yyss - 1;
  1183.       fprintf (stderr, "Error: state stack now");
  1184.       while (ssp1 != yyssp)
  1185.     fprintf (stderr, " %d", *++ssp1);
  1186.       fprintf (stderr, "\n");
  1187.     }
  1188. #endif
  1189.  
  1190. yyerrhandle:
  1191.  
  1192.   yyn = yypact[yystate];
  1193.   if (yyn == YYFLAG)
  1194.     goto yyerrdefault;
  1195.  
  1196.   yyn += YYTERROR;
  1197.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1198.     goto yyerrdefault;
  1199.  
  1200.   yyn = yytable[yyn];
  1201.   if (yyn < 0)
  1202.     {
  1203.       if (yyn == YYFLAG)
  1204.     goto yyerrpop;
  1205.       yyn = -yyn;
  1206.       goto yyreduce;
  1207.     }
  1208.   else if (yyn == 0)
  1209.     goto yyerrpop;
  1210.  
  1211.   if (yyn == YYFINAL)
  1212.     YYACCEPT;
  1213.  
  1214. #if YYDEBUG != 0
  1215.   if (yydebug)
  1216.     fprintf(stderr, "Shifting error token, ");
  1217. #endif
  1218.  
  1219.   *++yyvsp = yylval;
  1220. #ifdef YYLSP_NEEDED
  1221.   *++yylsp = yylloc;
  1222. #endif
  1223.  
  1224.   yystate = yyn;
  1225.   goto yynewstate;
  1226. }
  1227.  
  1228.  
  1229. /* During parsing of a C expression, the pointer to the next character
  1230.    is in this variable.  */
  1231.  
  1232. static char *lexptr;
  1233.  
  1234. /* Take care of parsing a number (anything that starts with a digit).
  1235.    Set yylval and return the token type; update lexptr.
  1236.    LEN is the number of characters in it.  */
  1237.  
  1238. /* maybe needs to actually deal with floating point numbers */
  1239.  
  1240. int
  1241. parse_number (olen)
  1242.      int olen;
  1243. {
  1244.   register char *p = lexptr;
  1245.   register int c;
  1246.   register unsigned long n = 0, nd, ULONG_MAX_over_base;
  1247.   register int base = 10;
  1248.   register int len = olen;
  1249.   register int overflow = 0;
  1250.   register int digit, largest_digit = 0;
  1251.   int spec_long = 0;
  1252.  
  1253.   for (c = 0; c < len; c++)
  1254.     if (p[c] == '.') {
  1255.       /* It's a float since it contains a point.  */
  1256.       yyerror ("floating point numbers not allowed in #if expressions");
  1257.       return ERROR;
  1258.     }
  1259.  
  1260.   yylval.integer.unsignedp = 0;
  1261.  
  1262.   if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
  1263.     p += 2;
  1264.     base = 16;
  1265.     len -= 2;
  1266.   }
  1267.   else if (*p == '0')
  1268.     base = 8;
  1269.  
  1270.   ULONG_MAX_over_base = (unsigned long) -1 / base;
  1271.  
  1272.   for (; len > 0; len--) {
  1273.     c = *p++;
  1274.  
  1275.     if (c >= '0' && c <= '9')
  1276.       digit = c - '0';
  1277.     else if (base == 16 && c >= 'a' && c <= 'f')
  1278.       digit = c - 'a' + 10;
  1279.     else if (base == 16 && c >= 'A' && c <= 'F')
  1280.       digit = c - 'A' + 10;
  1281.     else {
  1282.       /* `l' means long, and `u' means unsigned.  */
  1283.       while (1) {
  1284.     if (c == 'l' || c == 'L')
  1285.       {
  1286.         if (spec_long)
  1287.           yyerror ("two `l's in integer constant");
  1288.         spec_long = 1;
  1289.       }
  1290.     else if (c == 'u' || c == 'U')
  1291.       {
  1292.         if (yylval.integer.unsignedp)
  1293.           yyerror ("two `u's in integer constant");
  1294.         yylval.integer.unsignedp = 1;
  1295.       }
  1296.     else
  1297.       break;
  1298.  
  1299.     if (--len == 0)
  1300.       break;
  1301.     c = *p++;
  1302.       }
  1303.       /* Don't look for any more digits after the suffixes.  */
  1304.       break;
  1305.     }
  1306.     if (largest_digit < digit)
  1307.       largest_digit = digit;
  1308.     nd = n * base + digit;
  1309.     overflow |= ULONG_MAX_over_base < n | nd < n;
  1310.     n = nd;
  1311.   }
  1312.  
  1313.   if (len != 0) {
  1314.     yyerror ("Invalid number in #if expression");
  1315.     return ERROR;
  1316.   }
  1317.  
  1318.   if (base <= largest_digit)
  1319.     warning ("integer constant contains digits beyond the radix");
  1320.  
  1321.   if (overflow)
  1322.     warning ("integer constant out of range");
  1323.  
  1324.   /* If too big to be signed, consider it unsigned.  */
  1325.   if ((long) n < 0 && ! yylval.integer.unsignedp)
  1326.     {
  1327.       if (base == 10)
  1328.     warning ("integer constant is so large that it is unsigned");
  1329.       yylval.integer.unsignedp = 1;
  1330.     }
  1331.  
  1332.   lexptr = p;
  1333.   yylval.integer.value = n;
  1334.   return INT;
  1335. }
  1336.  
  1337. struct token {
  1338.   char *operator;
  1339.   int token;
  1340. };
  1341.  
  1342. static struct token tokentab2[] = {
  1343.   {"&&", AND},
  1344.   {"||", OR},
  1345.   {"<<", LSH},
  1346.   {">>", RSH},
  1347.   {"==", EQUAL},
  1348.   {"!=", NOTEQUAL},
  1349.   {"<=", LEQ},
  1350.   {">=", GEQ},
  1351.   {"++", ERROR},
  1352.   {"--", ERROR},
  1353.   {NULL, ERROR}
  1354. };
  1355.  
  1356. /* Read one token, getting characters through lexptr.  */
  1357.  
  1358. int
  1359. yylex ()
  1360. {
  1361.   register int c;
  1362.   register int namelen;
  1363.   register unsigned char *tokstart;
  1364.   register struct token *toktab;
  1365.   int wide_flag;
  1366.  
  1367.  retry:
  1368.  
  1369.   tokstart = (unsigned char *) lexptr;
  1370.   c = *tokstart;
  1371.   /* See if it is a special token of length 2.  */
  1372.   if (! keyword_parsing)
  1373.     for (toktab = tokentab2; toktab->operator != NULL; toktab++)
  1374.       if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
  1375.     lexptr += 2;
  1376.     if (toktab->token == ERROR)
  1377.       {
  1378.         char *buf = (char *) alloca (40);
  1379.         sprintf (buf, "`%s' not allowed in operand of `#if'", toktab->operator);
  1380.         yyerror (buf);
  1381.       }
  1382.     return toktab->token;
  1383.       }
  1384.  
  1385.   switch (c) {
  1386.   case 0:
  1387.     return 0;
  1388.     
  1389.   case ' ':
  1390.   case '\t':
  1391.   case '\r':
  1392.   case '\n':
  1393.     lexptr++;
  1394.     goto retry;
  1395.     
  1396.   case 'L':
  1397.     /* Capital L may start a wide-string or wide-character constant.  */
  1398.     if (lexptr[1] == '\'')
  1399.       {
  1400.     lexptr++;
  1401.     wide_flag = 1;
  1402.     goto char_constant;
  1403.       }
  1404.     if (lexptr[1] == '"')
  1405.       {
  1406.     lexptr++;
  1407.     wide_flag = 1;
  1408.     goto string_constant;
  1409.       }
  1410.     break;
  1411.  
  1412.   case '\'':
  1413.     wide_flag = 0;
  1414.   char_constant:
  1415.     lexptr++;
  1416.     if (keyword_parsing) {
  1417.       char *start_ptr = lexptr - 1;
  1418.       while (1) {
  1419.     c = *lexptr++;
  1420.     if (c == '\\')
  1421.       c = parse_escape (&lexptr);
  1422.     else if (c == '\'')
  1423.       break;
  1424.       }
  1425.       yylval.name.address = tokstart;
  1426.       yylval.name.length = lexptr - start_ptr;
  1427.       return NAME;
  1428.     }
  1429.  
  1430.     /* This code for reading a character constant
  1431.        handles multicharacter constants and wide characters.
  1432.        It is mostly copied from c-lex.c.  */
  1433.     {
  1434.       register int result = 0;
  1435.       register num_chars = 0;
  1436.       unsigned width = MAX_CHAR_TYPE_SIZE;
  1437.       int max_chars;
  1438.       char *token_buffer;
  1439.  
  1440.       if (wide_flag)
  1441.     {
  1442.       width = MAX_WCHAR_TYPE_SIZE;
  1443. #ifdef MULTIBYTE_CHARS
  1444.       max_chars = MB_CUR_MAX;
  1445. #else
  1446.       max_chars = 1;
  1447. #endif
  1448.     }
  1449.       else
  1450.     max_chars = MAX_LONG_TYPE_SIZE / width;
  1451.  
  1452.       token_buffer = (char *) alloca (max_chars + 1);
  1453.  
  1454.       while (1)
  1455.     {
  1456.       c = *lexptr++;
  1457.  
  1458.       if (c == '\'' || c == EOF)
  1459.         break;
  1460.  
  1461.       if (c == '\\')
  1462.         {
  1463.           c = parse_escape (&lexptr);
  1464.           if (width < HOST_BITS_PER_INT
  1465.           && (unsigned) c >= (1 << width))
  1466.         pedwarn ("escape sequence out of range for character");
  1467.         }
  1468.  
  1469.       num_chars++;
  1470.  
  1471.       /* Merge character into result; ignore excess chars.  */
  1472.       if (num_chars < max_chars + 1)
  1473.         {
  1474.           if (width < HOST_BITS_PER_INT)
  1475.         result = (result << width) | (c & ((1 << width) - 1));
  1476.           else
  1477.         result = c;
  1478.           token_buffer[num_chars - 1] = c;
  1479.         }
  1480.     }
  1481.  
  1482.       token_buffer[num_chars] = 0;
  1483.  
  1484.       if (c != '\'')
  1485.     error ("malformatted character constant");
  1486.       else if (num_chars == 0)
  1487.     error ("empty character constant");
  1488.       else if (num_chars > max_chars)
  1489.     {
  1490.       num_chars = max_chars;
  1491.       error ("character constant too long");
  1492.     }
  1493.       else if (num_chars != 1 && ! traditional)
  1494.     warning ("multi-character character constant");
  1495.  
  1496.       /* If char type is signed, sign-extend the constant.  */
  1497.       if (! wide_flag)
  1498.     {
  1499.       int num_bits = num_chars * width;
  1500.  
  1501.       if (lookup ("__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__")-1, -1)
  1502.           || ((result >> (num_bits - 1)) & 1) == 0)
  1503.         yylval.integer.value
  1504.           = result & ((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
  1505.       else
  1506.         yylval.integer.value
  1507.           = result | ~((unsigned long) ~0 >> (HOST_BITS_PER_LONG - num_bits));
  1508.     }
  1509.       else
  1510.     {
  1511. #ifdef MULTIBYTE_CHARS
  1512.       /* Set the initial shift state and convert the next sequence.  */
  1513.       result = 0;
  1514.       /* In all locales L'\0' is zero and mbtowc will return zero,
  1515.          so don't use it.  */
  1516.       if (num_chars > 1
  1517.           || (num_chars == 1 && token_buffer[0] != '\0'))
  1518.         {
  1519.           wchar_t wc;
  1520.           (void) mbtowc (NULL_PTR, NULL_PTR, 0);
  1521.           if (mbtowc (& wc, token_buffer, num_chars) == num_chars)
  1522.         result = wc;
  1523.           else
  1524.         warning ("Ignoring invalid multibyte character");
  1525.         }
  1526. #endif
  1527.       yylval.integer.value = result;
  1528.     }
  1529.     }
  1530.  
  1531.     /* This is always a signed type.  */
  1532.     yylval.integer.unsignedp = 0;
  1533.     
  1534.     return CHAR;
  1535.  
  1536.     /* some of these chars are invalid in constant expressions;
  1537.        maybe do something about them later */
  1538.   case '/':
  1539.   case '+':
  1540.   case '-':
  1541.   case '*':
  1542.   case '%':
  1543.   case '|':
  1544.   case '&':
  1545.   case '^':
  1546.   case '~':
  1547.   case '!':
  1548.   case '@':
  1549.   case '<':
  1550.   case '>':
  1551.   case '[':
  1552.   case ']':
  1553.   case '.':
  1554.   case '?':
  1555.   case ':':
  1556.   case '=':
  1557.   case '{':
  1558.   case '}':
  1559.   case ',':
  1560.   case '#':
  1561.     if (keyword_parsing)
  1562.       break;
  1563.   case '(':
  1564.   case ')':
  1565.     lexptr++;
  1566.     return c;
  1567.  
  1568.   case '"':
  1569.   string_constant:
  1570.     if (keyword_parsing) {
  1571.       char *start_ptr = lexptr;
  1572.       lexptr++;
  1573.       while (1) {
  1574.     c = *lexptr++;
  1575.     if (c == '\\')
  1576.       c = parse_escape (&lexptr);
  1577.     else if (c == '"')
  1578.       break;
  1579.       }
  1580.       yylval.name.address = tokstart;
  1581.       yylval.name.length = lexptr - start_ptr;
  1582.       return NAME;
  1583.     }
  1584.     yyerror ("string constants not allowed in #if expressions");
  1585.     return ERROR;
  1586.   }
  1587.  
  1588.   if (c >= '0' && c <= '9' && !keyword_parsing) {
  1589.     /* It's a number */
  1590.     for (namelen = 0;
  1591.      c = tokstart[namelen], is_idchar[c] || c == '.'; 
  1592.      namelen++)
  1593.       ;
  1594.     return parse_number (namelen);
  1595.   }
  1596.  
  1597.   /* It is a name.  See how long it is.  */
  1598.  
  1599.   if (keyword_parsing) {
  1600.     for (namelen = 0;; namelen++) {
  1601.       if (is_hor_space[tokstart[namelen]])
  1602.     break;
  1603.       if (tokstart[namelen] == '(' || tokstart[namelen] == ')')
  1604.     break;
  1605.       if (tokstart[namelen] == '"' || tokstart[namelen] == '\'')
  1606.     break;
  1607.     }
  1608.   } else {
  1609.     if (!is_idstart[c]) {
  1610.       yyerror ("Invalid token in expression");
  1611.       return ERROR;
  1612.     }
  1613.  
  1614.     for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
  1615.       ;
  1616.   }
  1617.   
  1618.   lexptr += namelen;
  1619.   yylval.name.address = tokstart;
  1620.   yylval.name.length = namelen;
  1621.   return NAME;
  1622. }
  1623.  
  1624.  
  1625. /* Parse a C escape sequence.  STRING_PTR points to a variable
  1626.    containing a pointer to the string to parse.  That pointer
  1627.    is updated past the characters we use.  The value of the
  1628.    escape sequence is returned.
  1629.  
  1630.    A negative value means the sequence \ newline was seen,
  1631.    which is supposed to be equivalent to nothing at all.
  1632.  
  1633.    If \ is followed by a null character, we return a negative
  1634.    value and leave the string pointer pointing at the null character.
  1635.  
  1636.    If \ is followed by 000, we return 0 and leave the string pointer
  1637.    after the zeros.  A value of 0 does not mean end of string.  */
  1638.  
  1639. int
  1640. parse_escape (string_ptr)
  1641.      char **string_ptr;
  1642. {
  1643.   register int c = *(*string_ptr)++;
  1644.   switch (c)
  1645.     {
  1646.     case 'a':
  1647.       return TARGET_BELL;
  1648.     case 'b':
  1649.       return TARGET_BS;
  1650.     case 'e':
  1651.     case 'E':
  1652.       if (pedantic)
  1653.     pedwarn ("non-ANSI-standard escape sequence, `\\%c'", c);
  1654.       return 033;
  1655.     case 'f':
  1656.       return TARGET_FF;
  1657.     case 'n':
  1658.       return TARGET_NEWLINE;
  1659.     case 'r':
  1660.       return TARGET_CR;
  1661.     case 't':
  1662.       return TARGET_TAB;
  1663.     case 'v':
  1664.       return TARGET_VT;
  1665.     case '\n':
  1666.       return -2;
  1667.     case 0:
  1668.       (*string_ptr)--;
  1669.       return 0;
  1670.       
  1671.     case '0':
  1672.     case '1':
  1673.     case '2':
  1674.     case '3':
  1675.     case '4':
  1676.     case '5':
  1677.     case '6':
  1678.     case '7':
  1679.       {
  1680.     register int i = c - '0';
  1681.     register int count = 0;
  1682.     while (++count < 3)
  1683.       {
  1684.         c = *(*string_ptr)++;
  1685.         if (c >= '0' && c <= '7')
  1686.           i = (i << 3) + c - '0';
  1687.         else
  1688.           {
  1689.         (*string_ptr)--;
  1690.         break;
  1691.           }
  1692.       }
  1693.     if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0)
  1694.       {
  1695.         i &= (1 << MAX_CHAR_TYPE_SIZE) - 1;
  1696.         warning ("octal character constant does not fit in a byte");
  1697.       }
  1698.     return i;
  1699.       }
  1700.     case 'x':
  1701.       {
  1702.     register unsigned i = 0, overflow = 0, digits_found = 0, digit;
  1703.     for (;;)
  1704.       {
  1705.         c = *(*string_ptr)++;
  1706.         if (c >= '0' && c <= '9')
  1707.           digit = c - '0';
  1708.         else if (c >= 'a' && c <= 'f')
  1709.           digit = c - 'a' + 10;
  1710.         else if (c >= 'A' && c <= 'F')
  1711.           digit = c - 'A' + 10;
  1712.         else
  1713.           {
  1714.         (*string_ptr)--;
  1715.         break;
  1716.           }
  1717.         overflow |= i ^ (i << 4 >> 4);
  1718.         i = (i << 4) + digit;
  1719.         digits_found = 1;
  1720.       }
  1721.     if (!digits_found)
  1722.       yyerror ("\\x used with no following hex digits");
  1723.     if (overflow | (i & ~((1 << BITS_PER_UNIT) - 1)))
  1724.       {
  1725.         i &= (1 << BITS_PER_UNIT) - 1;
  1726.         warning ("hex character constant does not fit in a byte");
  1727.       }
  1728.     return i;
  1729.       }
  1730.     default:
  1731.       return c;
  1732.     }
  1733. }
  1734.  
  1735. void
  1736. yyerror (s)
  1737.      char *s;
  1738. {
  1739.   error (s);
  1740.   skip_evaluation = 0;
  1741.   longjmp (parse_return_error, 1);
  1742. }
  1743.  
  1744. static void
  1745. integer_overflow ()
  1746. {
  1747.   if (!skip_evaluation && pedantic)
  1748.     pedwarn ("integer overflow in preprocessor expression");
  1749. }
  1750.  
  1751. static long
  1752. left_shift (a, b)
  1753.      struct constant *a;
  1754.      unsigned long b;
  1755. {
  1756.    /* It's unclear from the C standard whether shifts can overflow.
  1757.       The following code ignores overflow; perhaps a C standard
  1758.       interpretation ruling is needed.  */
  1759.   if (b >= HOST_BITS_PER_LONG)
  1760.     return 0;
  1761.   else if (a->unsignedp)
  1762.     return (unsigned long) a->value << b;
  1763.   else
  1764.     return a->value << b;
  1765. }
  1766.  
  1767. static long
  1768. right_shift (a, b)
  1769.      struct constant *a;
  1770.      unsigned long b;
  1771. {
  1772.   if (b >= HOST_BITS_PER_LONG)
  1773.     return a->unsignedp ? 0 : a->value >> (HOST_BITS_PER_LONG - 1);
  1774.   else if (a->unsignedp)
  1775.     return (unsigned long) a->value >> b;
  1776.   else
  1777.     return a->value >> b;
  1778. }
  1779.  
  1780. /* This page contains the entry point to this file.  */
  1781.  
  1782. /* Parse STRING as an expression, and complain if this fails
  1783.    to use up all of the contents of STRING.  */
  1784. /* We do not support C comments.  They should be removed before
  1785.    this function is called.  */
  1786.  
  1787. HOST_WIDE_INT
  1788. parse_c_expression (string)
  1789.      char *string;
  1790. {
  1791.   lexptr = string;
  1792.   
  1793.   if (lexptr == 0 || *lexptr == 0) {
  1794.     error ("empty #if expression");
  1795.     return 0;            /* don't include the #if group */
  1796.   }
  1797.  
  1798.   /* if there is some sort of scanning error, just return 0 and assume
  1799.      the parsing routine has printed an error message somewhere.
  1800.      there is surely a better thing to do than this.     */
  1801.   if (setjmp (parse_return_error))
  1802.     return 0;
  1803.  
  1804.   if (yyparse ())
  1805.     return 0;            /* actually this is never reached
  1806.                    the way things stand. */
  1807.   if (*lexptr)
  1808.     error ("Junk after end of expression.");
  1809.  
  1810.   return expression_value;    /* set by yyparse () */
  1811. }
  1812.  
  1813. #ifdef TEST_EXP_READER
  1814. extern int yydebug;
  1815.  
  1816. /* Main program for testing purposes.  */
  1817. int
  1818. main ()
  1819. {
  1820.   int n, c;
  1821.   char buf[1024];
  1822.  
  1823. /*
  1824.   yydebug = 1;
  1825. */
  1826.   initialize_random_junk ();
  1827.  
  1828.   for (;;) {
  1829.     printf ("enter expression: ");
  1830.     n = 0;
  1831.     while ((buf[n] = getchar ()) != '\n' && buf[n] != EOF)
  1832.       n++;
  1833.     if (buf[n] == EOF)
  1834.       break;
  1835.     buf[n] = '\0';
  1836.     printf ("parser returned %ld\n", parse_c_expression (buf));
  1837.   }
  1838.  
  1839.   return 0;
  1840. }
  1841.  
  1842. /* table to tell if char can be part of a C identifier. */
  1843. unsigned char is_idchar[256];
  1844. /* table to tell if char can be first char of a c identifier. */
  1845. unsigned char is_idstart[256];
  1846. /* table to tell if c is horizontal space.  isspace () thinks that
  1847.    newline is space; this is not a good idea for this program. */
  1848. char is_hor_space[256];
  1849.  
  1850. /*
  1851.  * initialize random junk in the hash table and maybe other places
  1852.  */
  1853. initialize_random_junk ()
  1854. {
  1855.   register int i;
  1856.  
  1857.   /*
  1858.    * Set up is_idchar and is_idstart tables.  These should be
  1859.    * faster than saying (is_alpha (c) || c == '_'), etc.
  1860.    * Must do set up these things before calling any routines tthat
  1861.    * refer to them.
  1862.    */
  1863.   for (i = 'a'; i <= 'z'; i++) {
  1864.     ++is_idchar[i - 'a' + 'A'];
  1865.     ++is_idchar[i];
  1866.     ++is_idstart[i - 'a' + 'A'];
  1867.     ++is_idstart[i];
  1868.   }
  1869.   for (i = '0'; i <= '9'; i++)
  1870.     ++is_idchar[i];
  1871.   ++is_idchar['_'];
  1872.   ++is_idstart['_'];
  1873. #if DOLLARS_IN_IDENTIFIERS
  1874.   ++is_idchar['$'];
  1875.   ++is_idstart['$'];
  1876. #endif
  1877.  
  1878.   /* horizontal space table */
  1879.   ++is_hor_space[' '];
  1880.   ++is_hor_space['\t'];
  1881. }
  1882.  
  1883. error (msg)
  1884. {
  1885.   printf ("error: %s\n", msg);
  1886. }
  1887.  
  1888. warning (msg)
  1889. {
  1890.   printf ("warning: %s\n", msg);
  1891. }
  1892.  
  1893. struct hashnode *
  1894. lookup (name, len, hash)
  1895.      char *name;
  1896.      int len;
  1897.      int hash;
  1898. {
  1899.   return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
  1900. }
  1901. #endif
  1902.