Annotation of gcc/cexp.c, revision 1.1.1.9

1.1       root        1: 
1.1.1.9 ! root        2: /*  A Bison parser, made from ./cexp.y  */
1.1       root        3: 
                      4: #define        INT     258
                      5: #define        CHAR    259
                      6: #define        NAME    260
                      7: #define        ERROR   261
                      8: #define        OR      262
                      9: #define        AND     263
                     10: #define        EQUAL   264
                     11: #define        NOTEQUAL        265
                     12: #define        LEQ     266
                     13: #define        GEQ     267
                     14: #define        LSH     268
                     15: #define        RSH     269
                     16: #define        UNARY   270
                     17: 
1.1.1.9 ! root       18: #line 26 "./cexp.y"
1.1       root       19: 
1.1.1.2   root       20: #include "config.h"
1.1       root       21: #include <setjmp.h>
                     22: /* #define YYDEBUG 1 */
                     23: 
1.1.1.3   root       24:   int yylex ();
                     25:   void yyerror ();
1.1       root       26:   int expression_value;
                     27: 
                     28:   static jmp_buf parse_return_error;
                     29: 
                     30:   /* some external tables of character types */
                     31:   extern unsigned char is_idstart[], is_idchar[];
                     32: 
1.1.1.7   root       33: #ifndef CHAR_TYPE_SIZE
                     34: #define CHAR_TYPE_SIZE BITS_PER_UNIT
                     35: #endif
1.1       root       36: 
1.1.1.9 ! root       37: #line 45 "./cexp.y"
1.1       root       38: typedef union {
1.1.1.7   root       39:   struct constant {long value; int unsignedp;} integer;
1.1       root       40:   int voidval;
                     41:   char *sval;
                     42: } YYSTYPE;
                     43: 
                     44: #ifndef YYLTYPE
                     45: typedef
                     46:   struct yyltype
1.1.1.9 ! root       47:  {
1.1       root       48:       int timestamp;
                     49:       int first_line;
                     50:       int first_column;
                     51:       int last_line;
                     52:       int last_column;
                     53:       char *text;
                     54:    }
1.1.1.9 ! root       55:  yyltype;
1.1       root       56: 
                     57: #define YYLTYPE yyltype
                     58: #endif
                     59: 
                     60: #include <stdio.h>
                     61: 
1.1.1.2   root       62: #ifndef __STDC__
                     63: #define const
                     64: #endif
                     65: 
1.1       root       66: 
                     67: 
1.1.1.7   root       68: #define        YYFINAL         61
1.1       root       69: #define        YYFLAG          -32768
                     70: #define        YYNTBASE        33
                     71: 
1.1.1.2   root       72: #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 36)
1.1       root       73: 
1.1.1.2   root       74: static const char yytranslate[] = {     0,
1.1       root       75:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     76:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     77:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     78:      2,     2,    29,     2,     2,     2,    27,    14,     2,    31,
                     79:     32,    25,    23,     9,    24,     2,    26,     2,     2,     2,
                     80:      2,     2,     2,     2,     2,     2,     2,     8,     2,    17,
                     81:      2,    18,     7,     2,     2,     2,     2,     2,     2,     2,
                     82:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     83:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     84:      2,     2,     2,    13,     2,     2,     2,     2,     2,     2,
                     85:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     86:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     87:      2,     2,     2,    12,     2,    30,     2,     2,     2,     2,
                     88:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     89:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     90:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     91:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     92:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     93:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     94:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     95:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     96:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     97:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     98:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                     99:      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
                    100:      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
                    101:      6,    10,    11,    15,    16,    19,    20,    21,    22,    28
                    102: };
                    103: 
1.1.1.9 ! root      104: static const short yyprhs[] = {     0,
        !           105:      0,     2,     4,     8,    11,    14,    17,    20,    24,    28,
        !           106:     32,    36,    40,    44,    48,    52,    56,    60,    64,    68,
        !           107:     72,    76,    80,    84,    88,    92,    96,   102,   104,   106
        !           108: };
        !           109: 
        !           110: static const short yyrhs[] = {    34,
        !           111:      0,    35,     0,    34,     9,    35,     0,    24,    35,     0,
        !           112:     29,    35,     0,    23,    35,     0,    30,    35,     0,    31,
        !           113:     34,    32,     0,    35,    25,    35,     0,    35,    26,    35,
        !           114:      0,    35,    27,    35,     0,    35,    23,    35,     0,    35,
        !           115:     24,    35,     0,    35,    21,    35,     0,    35,    22,    35,
        !           116:      0,    35,    15,    35,     0,    35,    16,    35,     0,    35,
        !           117:     19,    35,     0,    35,    20,    35,     0,    35,    17,    35,
        !           118:      0,    35,    18,    35,     0,    35,    14,    35,     0,    35,
        !           119:     13,    35,     0,    35,    12,    35,     0,    35,    11,    35,
        !           120:      0,    35,    10,    35,     0,    35,     7,    35,     8,    35,
        !           121:      0,     3,     0,     4,     0,     5,     0
        !           122: };
        !           123: 
1.1.1.8   root      124: #if YYDEBUG != 0
                    125: static const short yyrline[] = { 0,
1.1.1.7   root      126:     74,    79,    80,    85,    88,    91,    93,    96,   101,   107,
                    127:    118,   129,   132,   135,   141,   147,   150,   153,   159,   165,
                    128:    171,   177,   180,   183,   186,   189,   192,   195,   197,   199
1.1       root      129: };
                    130: 
1.1.1.9 ! root      131: static const char * const yytname[] = {   "$",
1.1       root      132: "error","$illegal.","INT","CHAR","NAME","ERROR","'?'","':'","','","OR",
                    133: "AND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'","'>'","LEQ","GEQ",
                    134: "LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'","'~'",
1.1.1.9 ! root      135: "'('","')'","start","exp1","exp",""
1.1       root      136: };
1.1.1.8   root      137: #endif
1.1       root      138: 
1.1.1.2   root      139: static const short yyr1[] = {     0,
1.1       root      140:     33,    34,    34,    35,    35,    35,    35,    35,    35,    35,
                    141:     35,    35,    35,    35,    35,    35,    35,    35,    35,    35,
1.1.1.7   root      142:     35,    35,    35,    35,    35,    35,    35,    35,    35,    35
1.1       root      143: };
                    144: 
1.1.1.2   root      145: static const short yyr2[] = {     0,
1.1.1.7   root      146:      1,     1,     3,     2,     2,     2,     2,     3,     3,     3,
1.1       root      147:      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
1.1.1.7   root      148:      3,     3,     3,     3,     3,     3,     5,     1,     1,     1
1.1       root      149: };
                    150: 
1.1.1.2   root      151: static const short yydefact[] = {     0,
1.1.1.7   root      152:     28,    29,    30,     0,     0,     0,     0,     0,     1,     2,
                    153:      6,     4,     5,     7,     0,     0,     0,     0,     0,     0,
1.1       root      154:      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1.1.1.7   root      155:      0,     0,     0,     0,     0,     8,     3,     0,    26,    25,
                    156:     24,    23,    22,    16,    17,    20,    21,    18,    19,    14,
                    157:     15,    12,    13,     9,    10,    11,     0,    27,     0,     0,
                    158:      0
1.1       root      159: };
                    160: 
1.1.1.7   root      161: static const short yydefgoto[] = {    59,
                    162:      9,    10
1.1       root      163: };
                    164: 
1.1.1.7   root      165: static const short yypact[] = {    31,
                    166: -32768,-32768,-32768,    31,    31,    31,    31,    31,     1,    77,
                    167: -32768,-32768,-32768,-32768,     0,    31,    31,    31,    31,    31,
                    168:     31,    31,    31,    31,    31,    31,    31,    31,    31,    31,
                    169:     31,    31,    31,    31,    31,-32768,    77,    56,    94,    25,
                    170:    109,   123,   136,   147,   147,   154,   154,   154,   154,   -19,
                    171:    -19,    32,    32,-32768,-32768,-32768,    31,    77,    11,    33,
                    172: -32768
1.1       root      173: };
                    174: 
1.1.1.2   root      175: static const short yypgoto[] = {-32768,
1.1.1.7   root      176:     48,    -4
1.1       root      177: };
                    178: 
                    179: 
1.1.1.7   root      180: #define        YYLAST          181
1.1       root      181: 
                    182: 
1.1.1.7   root      183: static const short yytable[] = {    11,
                    184:     12,    13,    14,    31,    32,    33,    34,    35,    16,    16,
                    185:     60,    37,    38,    39,    40,    41,    42,    43,    44,    45,
                    186:     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
                    187:     56,    36,    61,     1,     2,     3,    20,    21,    22,    23,
1.1       root      188:     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
1.1.1.7   root      189:     34,    35,    58,     4,     5,    15,    33,    34,    35,     6,
                    190:      7,     8,    17,    57,     0,    18,    19,    20,    21,    22,
1.1       root      191:     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
1.1.1.7   root      192:     33,    34,    35,    17,     0,     0,    18,    19,    20,    21,
1.1       root      193:     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1.1.1.7   root      194:     32,    33,    34,    35,    19,    20,    21,    22,    23,    24,
                    195:     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
                    196:     35,    21,    22,    23,    24,    25,    26,    27,    28,    29,
                    197:     30,    31,    32,    33,    34,    35,    22,    23,    24,    25,
                    198:     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
                    199:     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
                    200:     33,    34,    35,    25,    26,    27,    28,    29,    30,    31,
                    201:     32,    33,    34,    35,    29,    30,    31,    32,    33,    34,
                    202:     35
1.1       root      203: };
                    204: 
1.1.1.2   root      205: static const short yycheck[] = {     4,
1.1.1.7   root      206:      5,     6,     7,    23,    24,    25,    26,    27,     9,     9,
                    207:      0,    16,    17,    18,    19,    20,    21,    22,    23,    24,
                    208:     25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
                    209:     35,    32,     0,     3,     4,     5,    12,    13,    14,    15,
                    210:     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
                    211:     26,    27,    57,    23,    24,     8,    25,    26,    27,    29,
                    212:     30,    31,     7,     8,    -1,    10,    11,    12,    13,    14,
1.1       root      213:     15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
1.1.1.7   root      214:     25,    26,    27,     7,    -1,    -1,    10,    11,    12,    13,
                    215:     14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
                    216:     24,    25,    26,    27,    11,    12,    13,    14,    15,    16,
1.1       root      217:     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
1.1.1.7   root      218:     27,    13,    14,    15,    16,    17,    18,    19,    20,    21,
                    219:     22,    23,    24,    25,    26,    27,    14,    15,    16,    17,
1.1       root      220:     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
1.1.1.7   root      221:     15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
                    222:     25,    26,    27,    17,    18,    19,    20,    21,    22,    23,
                    223:     24,    25,    26,    27,    21,    22,    23,    24,    25,    26,
                    224:     27
1.1       root      225: };
1.1.1.6   root      226: /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
                    227: #line 3 "bison.simple"
1.1       root      228: 
                    229: /* Skeleton output parser for bison,
1.1.1.9 ! root      230:    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
1.1       root      231: 
1.1.1.7   root      232:    This program is free software; you can redistribute it and/or modify
                    233:    it under the terms of the GNU General Public License as published by
                    234:    the Free Software Foundation; either version 1, or (at your option)
                    235:    any later version.
                    236: 
                    237:    This program is distributed in the hope that it will be useful,
                    238:    but WITHOUT ANY WARRANTY; without even the implied warranty of
                    239:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                    240:    GNU General Public License for more details.
                    241: 
                    242:    You should have received a copy of the GNU General Public License
                    243:    along with this program; if not, write to the Free Software
                    244:    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
1.1.1.2   root      245: 
1.1       root      246: 
1.1.1.9 ! root      247: #ifndef alloca
1.1.1.8   root      248: #ifdef __GNUC__
                    249: #define alloca __builtin_alloca
                    250: #else /* Not GNU C.  */
1.1.1.6   root      251: #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
                    252: #include <alloca.h>
1.1.1.9 ! root      253: #else /* Not sparc */
        !           254: #ifdef MSDOS
        !           255: #include <malloc.h>
        !           256: #endif /* MSDOS */
        !           257: #endif /* Not sparc.  */
1.1.1.8   root      258: #endif /* Not GNU C.  */
1.1.1.9 ! root      259: #endif /* alloca not defined.  */
1.1.1.6   root      260: 
1.1       root      261: /* This is the parser code that is written into each bison parser
                    262:   when the %semantic_parser declaration is not specified in the grammar.
                    263:   It was written by Richard Stallman by simplifying the hairy parser
                    264:   used when %semantic_parser is specified.  */
                    265: 
                    266: /* Note: there must be only one dollar sign in this file.
                    267:    It is replaced by the list of actions, each action
                    268:    as one case of the switch.  */
                    269: 
                    270: #define yyerrok                (yyerrstatus = 0)
                    271: #define yyclearin      (yychar = YYEMPTY)
                    272: #define YYEMPTY                -2
                    273: #define YYEOF          0
1.1.1.6   root      274: #define YYACCEPT       return(0)
                    275: #define YYABORT        return(1)
1.1.1.9 ! root      276: #define YYERROR                goto yyerrlab1
        !           277: /* Like YYERROR except do call yyerror.
        !           278:    This remains here temporarily to ease the
        !           279:    transition to the new meaning of YYERROR, for GCC.
        !           280:    Once GCC version 2 has supplanted version 1, this can go.  */
        !           281: #define YYFAIL         goto yyerrlab
        !           282: #define YYRECOVERING()  (!!yyerrstatus)
        !           283: #define YYBACKUP(token, value) \
        !           284: do                                                             \
        !           285:   if (yychar == YYEMPTY && yylen == 1)                         \
        !           286:     { yychar = (token), yylval = (value);                      \
        !           287:       yychar1 = YYTRANSLATE (yychar);                          \
        !           288:       YYPOPSTACK;                                              \
        !           289:       goto yybackup;                                           \
        !           290:     }                                                          \
        !           291:   else                                                         \
        !           292:     { yyerror ("syntax error: cannot back up"); YYERROR; }     \
        !           293: while (0)
1.1       root      294: 
                    295: #define YYTERROR       1
1.1.1.7   root      296: #define YYERRCODE      256
1.1       root      297: 
1.1.1.9 ! root      298: #ifndef YYPURE
1.1       root      299: #define YYLEX          yylex()
                    300: #endif
                    301: 
1.1.1.9 ! root      302: #ifdef YYPURE
        !           303: #ifdef YYLSP_NEEDED
1.1       root      304: #define YYLEX          yylex(&yylval, &yylloc)
1.1.1.9 ! root      305: #else
        !           306: #define YYLEX          yylex(&yylval)
        !           307: #endif
1.1       root      308: #endif
                    309: 
                    310: /* If nonreentrant, generate the variables here */
                    311: 
1.1.1.9 ! root      312: #ifndef YYPURE
1.1       root      313: 
                    314: int    yychar;                 /*  the lookahead symbol                */
                    315: YYSTYPE        yylval;                 /*  the semantic value of the           */
                    316:                                /*  lookahead symbol                    */
                    317: 
1.1.1.8   root      318: #ifdef YYLSP_NEEDED
1.1       root      319: YYLTYPE yylloc;                        /*  location data for the lookahead     */
                    320:                                /*  symbol                              */
1.1.1.8   root      321: #endif
1.1       root      322: 
1.1.1.6   root      323: int yynerrs;                   /*  number of parse errors so far       */
1.1.1.9 ! root      324: #endif  /* not YYPURE */
1.1       root      325: 
1.1.1.6   root      326: #if YYDEBUG != 0
                    327: int yydebug;                   /*  nonzero means print parse trace     */
                    328: /* Since this is uninitialized, it does not stop multiple parsers
                    329:    from coexisting.  */
                    330: #endif
1.1       root      331: 
1.1.1.9 ! root      332: /*  YYINITDEPTH indicates the initial size of the parser's stacks      */
1.1       root      333: 
1.1.1.9 ! root      334: #ifndef        YYINITDEPTH
        !           335: #define YYINITDEPTH 200
1.1       root      336: #endif
                    337: 
1.1.1.9 ! root      338: /*  YYMAXDEPTH is the maximum size the stacks can grow to
1.1       root      339:     (effective only if the built-in stack extension method is used).  */
                    340: 
1.1.1.9 ! root      341: #if YYMAXDEPTH == 0
        !           342: #undef YYMAXDEPTH
1.1       root      343: #endif
                    344: 
1.1.1.9 ! root      345: #ifndef YYMAXDEPTH
        !           346: #define YYMAXDEPTH 10000
        !           347: #endif
        !           348: 
        !           349: #ifndef __cplusplus
        !           350: 
1.1.1.8   root      351: /* This is the most reliable way to avoid incompatibilities
                    352:    in available built-in functions on various systems.  */
                    353: static void
                    354: __yy_bcopy (from, to, count)
                    355:      char *from;
                    356:      char *to;
                    357:      int count;
                    358: {
                    359:   register char *f = from;
                    360:   register char *t = to;
                    361:   register int i = count;
                    362: 
                    363:   while (i-- > 0)
                    364:     *t++ = *f++;
                    365: }
1.1       root      366: 
1.1.1.9 ! root      367: #else /* __cplusplus */
        !           368: 
        !           369: /* This is the most reliable way to avoid incompatibilities
        !           370:    in available built-in functions on various systems.  */
        !           371: static void
        !           372: __yy_bcopy (char *from, char *to, int count)
        !           373: {
        !           374:   register char *f = from;
        !           375:   register char *t = to;
        !           376:   register int i = count;
        !           377: 
        !           378:   while (i-- > 0)
        !           379:     *t++ = *f++;
        !           380: }
        !           381: 
        !           382: #endif
        !           383: 
        !           384: #line 160 "bison.simple"
1.1       root      385: int
                    386: yyparse()
                    387: {
                    388:   register int yystate;
                    389:   register int yyn;
                    390:   register short *yyssp;
                    391:   register YYSTYPE *yyvsp;
                    392:   int yyerrstatus;     /*  number of tokens to shift before error messages enabled */
                    393:   int yychar1;         /*  lookahead token as an internal (translated) token number */
                    394: 
1.1.1.9 ! root      395:   short        yyssa[YYINITDEPTH];     /*  the state stack                     */
        !           396:   YYSTYPE yyvsa[YYINITDEPTH];  /*  the semantic value stack            */
1.1       root      397: 
                    398:   short *yyss = yyssa;         /*  refer to the stacks thru separate pointers */
                    399:   YYSTYPE *yyvs = yyvsa;       /*  to allow yyoverflow to reallocate them elsewhere */
1.1.1.8   root      400: 
                    401: #ifdef YYLSP_NEEDED
1.1       root      402:   YYLTYPE *yyls = yylsa;
1.1.1.8   root      403:   YYLTYPE *yylsp;
1.1.1.9 ! root      404:   YYLTYPE yylsa[YYINITDEPTH];  /*  the location stack                  */
        !           405: 
        !           406: #define YYPOPSTACK   (yyvsp--, yysp--, yylsp--)
        !           407: #else
        !           408: #define YYPOPSTACK   (yyvsp--, yysp--)
1.1.1.8   root      409: #endif
1.1       root      410: 
1.1.1.9 ! root      411:   int yystacksize = YYINITDEPTH;
1.1       root      412: 
1.1.1.9 ! root      413: #ifdef YYPURE
1.1       root      414:   int yychar;
                    415:   YYSTYPE yylval;
1.1.1.6   root      416:   int yynerrs;
1.1.1.8   root      417: #ifdef YYLSP_NEEDED
                    418:   YYLTYPE yylloc;
                    419: #endif
1.1.1.2   root      420: #endif
1.1       root      421: 
                    422:   YYSTYPE yyval;               /*  the variable used to return         */
                    423:                                /*  semantic values from the action     */
                    424:                                /*  routines                            */
                    425: 
                    426:   int yylen;
                    427: 
1.1.1.6   root      428: #if YYDEBUG != 0
1.1       root      429:   if (yydebug)
                    430:     fprintf(stderr, "Starting parse\n");
1.1.1.2   root      431: #endif
1.1       root      432: 
                    433:   yystate = 0;
                    434:   yyerrstatus = 0;
1.1.1.6   root      435:   yynerrs = 0;
1.1       root      436:   yychar = YYEMPTY;            /* Cause a token to be read.  */
                    437: 
                    438:   /* Initialize stack pointers.
                    439:      Waste one element of value and location stack
                    440:      so that they stay on the same level as the state stack.  */
                    441: 
                    442:   yyssp = yyss - 1;
                    443:   yyvsp = yyvs;
1.1.1.8   root      444: #ifdef YYLSP_NEEDED
1.1       root      445:   yylsp = yyls;
1.1.1.8   root      446: #endif
1.1       root      447: 
                    448: /* Push a new state, which is found in  yystate  .  */
                    449: /* In all cases, when you get here, the value and location stacks
                    450:    have just been pushed. so pushing a state here evens the stacks.  */
                    451: yynewstate:
                    452: 
                    453:   *++yyssp = yystate;
                    454: 
1.1.1.9 ! root      455:   if (yyssp >= yyss + yystacksize - 1)
1.1       root      456:     {
                    457:       /* Give user a chance to reallocate the stack */
                    458:       /* Use copies of these so that the &'s don't force the real ones into memory. */
                    459:       YYSTYPE *yyvs1 = yyvs;
                    460:       short *yyss1 = yyss;
1.1.1.8   root      461: #ifdef YYLSP_NEEDED
                    462:       YYLTYPE *yyls1 = yyls;
                    463: #endif
1.1       root      464: 
                    465:       /* Get the current used size of the three stacks, in elements.  */
                    466:       int size = yyssp - yyss + 1;
                    467: 
                    468: #ifdef yyoverflow
                    469:       /* Each stack pointer address is followed by the size of
                    470:         the data in use in that stack, in bytes.  */
                    471:       yyoverflow("parser stack overflow",
                    472:                 &yyss1, size * sizeof (*yyssp),
                    473:                 &yyvs1, size * sizeof (*yyvsp),
1.1.1.8   root      474: #ifdef YYLSP_NEEDED
1.1       root      475:                 &yyls1, size * sizeof (*yylsp),
1.1.1.8   root      476: #endif
1.1.1.9 ! root      477:                 &yystacksize);
1.1       root      478: 
1.1.1.8   root      479:       yyss = yyss1; yyvs = yyvs1;
                    480: #ifdef YYLSP_NEEDED
                    481:       yyls = yyls1;
                    482: #endif
1.1       root      483: #else /* no yyoverflow */
                    484:       /* Extend the stack our own way.  */
1.1.1.9 ! root      485:       if (yystacksize >= YYMAXDEPTH)
        !           486:        {
        !           487:          yyerror("parser stack overflow");
        !           488:          return 2;
        !           489:        }
        !           490:       yystacksize *= 2;
        !           491:       if (yystacksize > YYMAXDEPTH)
        !           492:        yystacksize = YYMAXDEPTH;
        !           493:       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
1.1.1.8   root      494:       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
1.1.1.9 ! root      495:       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
1.1.1.8   root      496:       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
1.1.1.3   root      497: #ifdef YYLSP_NEEDED
1.1.1.9 ! root      498:       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
1.1.1.8   root      499:       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
1.1.1.2   root      500: #endif
1.1       root      501: #endif /* no yyoverflow */
                    502: 
                    503:       yyssp = yyss + size - 1;
                    504:       yyvsp = yyvs + size - 1;
1.1.1.3   root      505: #ifdef YYLSP_NEEDED
1.1.1.2   root      506:       yylsp = yyls + size - 1;
                    507: #endif
1.1       root      508: 
1.1.1.6   root      509: #if YYDEBUG != 0
1.1       root      510:       if (yydebug)
1.1.1.9 ! root      511:        fprintf(stderr, "Stack size increased to %d\n", yystacksize);
1.1.1.2   root      512: #endif
1.1       root      513: 
1.1.1.9 ! root      514:       if (yyssp >= yyss + yystacksize - 1)
1.1.1.6   root      515:        YYABORT;
1.1       root      516:     }
                    517: 
1.1.1.6   root      518: #if YYDEBUG != 0
1.1       root      519:   if (yydebug)
                    520:     fprintf(stderr, "Entering state %d\n", yystate);
1.1.1.2   root      521: #endif
1.1       root      522: 
1.1.1.9 ! root      523:  yybackup:
        !           524: 
1.1       root      525: /* Do appropriate processing given the current state.  */
                    526: /* Read a lookahead token if we need one and don't already have one.  */
1.1.1.8   root      527: /* yyresume: */
1.1       root      528: 
                    529:   /* First try to decide what to do without reference to lookahead token.  */
                    530: 
                    531:   yyn = yypact[yystate];
                    532:   if (yyn == YYFLAG)
                    533:     goto yydefault;
                    534: 
                    535:   /* Not known => get a lookahead token if don't already have one.  */
                    536: 
                    537:   /* yychar is either YYEMPTY or YYEOF
                    538:      or a valid token in external form.  */
                    539: 
                    540:   if (yychar == YYEMPTY)
                    541:     {
1.1.1.6   root      542: #if YYDEBUG != 0
1.1.1.2   root      543:       if (yydebug)
                    544:        fprintf(stderr, "Reading a token: ");
                    545: #endif
1.1       root      546:       yychar = YYLEX;
                    547:     }
                    548: 
                    549:   /* Convert token to internal form (in yychar1) for indexing tables with */
                    550: 
                    551:   if (yychar <= 0)             /* This means end of input. */
                    552:     {
                    553:       yychar1 = 0;
                    554:       yychar = YYEOF;          /* Don't call YYLEX any more */
                    555: 
1.1.1.6   root      556: #if YYDEBUG != 0
1.1       root      557:       if (yydebug)
                    558:        fprintf(stderr, "Now at end of input.\n");
1.1.1.2   root      559: #endif
1.1       root      560:     }
                    561:   else
                    562:     {
                    563:       yychar1 = YYTRANSLATE(yychar);
                    564: 
1.1.1.6   root      565: #if YYDEBUG != 0
1.1       root      566:       if (yydebug)
1.1.1.2   root      567:        fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
                    568: #endif
1.1       root      569:     }
                    570: 
                    571:   yyn += yychar1;
                    572:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
                    573:     goto yydefault;
                    574: 
                    575:   yyn = yytable[yyn];
                    576: 
                    577:   /* yyn is what to do for this token type in this state.
                    578:      Negative => reduce, -yyn is rule number.
                    579:      Positive => shift, yyn is new state.
                    580:        New state is final state => don't bother to shift,
                    581:        just return success.
                    582:      0, or most negative number => error.  */
                    583: 
                    584:   if (yyn < 0)
                    585:     {
                    586:       if (yyn == YYFLAG)
                    587:        goto yyerrlab;
                    588:       yyn = -yyn;
                    589:       goto yyreduce;
                    590:     }
                    591:   else if (yyn == 0)
                    592:     goto yyerrlab;
                    593: 
                    594:   if (yyn == YYFINAL)
                    595:     YYACCEPT;
                    596: 
                    597:   /* Shift the lookahead token.  */
                    598: 
1.1.1.6   root      599: #if YYDEBUG != 0
1.1       root      600:   if (yydebug)
                    601:     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
1.1.1.2   root      602: #endif
1.1       root      603: 
                    604:   /* Discard the token being shifted unless it is eof.  */
                    605:   if (yychar != YYEOF)
                    606:     yychar = YYEMPTY;
                    607: 
                    608:   *++yyvsp = yylval;
1.1.1.3   root      609: #ifdef YYLSP_NEEDED
1.1       root      610:   *++yylsp = yylloc;
1.1.1.2   root      611: #endif
1.1       root      612: 
                    613:   /* count tokens shifted since error; after three, turn off error status.  */
                    614:   if (yyerrstatus) yyerrstatus--;
                    615: 
                    616:   yystate = yyn;
                    617:   goto yynewstate;
                    618: 
                    619: /* Do the default action for the current state.  */
                    620: yydefault:
                    621: 
                    622:   yyn = yydefact[yystate];
                    623:   if (yyn == 0)
                    624:     goto yyerrlab;
                    625: 
                    626: /* Do a reduction.  yyn is the number of a rule to reduce with.  */
                    627: yyreduce:
                    628:   yylen = yyr2[yyn];
                    629:   yyval = yyvsp[1-yylen]; /* implement default value of the action */
                    630: 
1.1.1.6   root      631: #if YYDEBUG != 0
1.1       root      632:   if (yydebug)
                    633:     {
1.1.1.9 ! root      634:       int i;
        !           635: 
        !           636:       fprintf (stderr, "Reducing via rule %d (line %d), ",
        !           637:               yyn, yyrline[yyn]);
        !           638: 
        !           639:       /* Print the symboles being reduced, and their result.  */
        !           640:       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
        !           641:        fprintf (stderr, "%s ", yytname[yyrhs[i]]);
        !           642:       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
1.1       root      643:     }
1.1.1.2   root      644: #endif
1.1       root      645: 
                    646: 
                    647:   switch (yyn) {
                    648: 
                    649: case 1:
1.1.1.9 ! root      650: #line 75 "./cexp.y"
1.1.1.7   root      651: { expression_value = yyvsp[0].integer.value; ;
1.1       root      652:     break;}
                    653: case 3:
1.1.1.9 ! root      654: #line 81 "./cexp.y"
1.1.1.7   root      655: { yyval.integer = yyvsp[0].integer; ;
1.1       root      656:     break;}
                    657: case 4:
1.1.1.9 ! root      658: #line 86 "./cexp.y"
1.1.1.7   root      659: { yyval.integer.value = - yyvsp[0].integer.value;
                    660:                          yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
1.1       root      661:     break;}
                    662: case 5:
1.1.1.9 ! root      663: #line 89 "./cexp.y"
1.1.1.7   root      664: { yyval.integer.value = ! yyvsp[0].integer.value;
                    665:                          yyval.integer.unsignedp = 0; ;
1.1       root      666:     break;}
                    667: case 6:
1.1.1.9 ! root      668: #line 92 "./cexp.y"
1.1.1.7   root      669: { yyval.integer = yyvsp[0].integer; ;
1.1       root      670:     break;}
                    671: case 7:
1.1.1.9 ! root      672: #line 94 "./cexp.y"
1.1.1.7   root      673: { yyval.integer.value = ~ yyvsp[0].integer.value;
                    674:                          yyval.integer.unsignedp = yyvsp[0].integer.unsignedp; ;
1.1       root      675:     break;}
                    676: case 8:
1.1.1.9 ! root      677: #line 97 "./cexp.y"
1.1.1.7   root      678: { yyval.integer = yyvsp[-1].integer; ;
1.1       root      679:     break;}
                    680: case 9:
1.1.1.9 ! root      681: #line 102 "./cexp.y"
1.1.1.7   root      682: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    683:                          if (yyval.integer.unsignedp)
                    684:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value * yyvsp[0].integer.value;
                    685:                          else
                    686:                            yyval.integer.value = yyvsp[-2].integer.value * yyvsp[0].integer.value; ;
1.1       root      687:     break;}
                    688: case 10:
1.1.1.9 ! root      689: #line 108 "./cexp.y"
1.1.1.7   root      690: { if (yyvsp[0].integer.value == 0)
1.1.1.6   root      691:                            {
                    692:                              error ("division by zero in #if");
1.1.1.7   root      693:                              yyvsp[0].integer.value = 1;
1.1.1.6   root      694:                            }
1.1.1.7   root      695:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    696:                          if (yyval.integer.unsignedp)
                    697:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value / yyvsp[0].integer.value;
                    698:                          else
                    699:                            yyval.integer.value = yyvsp[-2].integer.value / yyvsp[0].integer.value; ;
1.1       root      700:     break;}
                    701: case 11:
1.1.1.9 ! root      702: #line 119 "./cexp.y"
1.1.1.7   root      703: { if (yyvsp[0].integer.value == 0)
                    704:                            {
                    705:                              error ("division by zero in #if");
                    706:                              yyvsp[0].integer.value = 1;
                    707:                            }
                    708:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp;
                    709:                          if (yyval.integer.unsignedp)
                    710:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value % yyvsp[0].integer.value;
                    711:                          else
                    712:                            yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value; ;
1.1       root      713:     break;}
                    714: case 12:
1.1.1.9 ! root      715: #line 130 "./cexp.y"
1.1.1.7   root      716: { yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
                    717:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      718:     break;}
                    719: case 13:
1.1.1.9 ! root      720: #line 133 "./cexp.y"
1.1.1.7   root      721: { yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
                    722:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      723:     break;}
                    724: case 14:
1.1.1.9 ! root      725: #line 136 "./cexp.y"
1.1.1.7   root      726: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
                    727:                          if (yyval.integer.unsignedp)
                    728:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value << yyvsp[0].integer.value;
                    729:                          else
                    730:                            yyval.integer.value = yyvsp[-2].integer.value << yyvsp[0].integer.value; ;
1.1       root      731:     break;}
                    732: case 15:
1.1.1.9 ! root      733: #line 142 "./cexp.y"
1.1.1.7   root      734: { yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp;
                    735:                          if (yyval.integer.unsignedp)
                    736:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value >> yyvsp[0].integer.value;
                    737:                          else
                    738:                            yyval.integer.value = yyvsp[-2].integer.value >> yyvsp[0].integer.value; ;
1.1       root      739:     break;}
                    740: case 16:
1.1.1.9 ! root      741: #line 148 "./cexp.y"
1.1.1.7   root      742: { yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
                    743:                          yyval.integer.unsignedp = 0; ;
1.1       root      744:     break;}
                    745: case 17:
1.1.1.9 ! root      746: #line 151 "./cexp.y"
1.1.1.7   root      747: { yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
                    748:                          yyval.integer.unsignedp = 0; ;
1.1       root      749:     break;}
                    750: case 18:
1.1.1.9 ! root      751: #line 154 "./cexp.y"
1.1.1.7   root      752: { yyval.integer.unsignedp = 0;
                    753:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    754:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value <= yyvsp[0].integer.value;
                    755:                          else
                    756:                            yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value; ;
1.1       root      757:     break;}
                    758: case 19:
1.1.1.9 ! root      759: #line 160 "./cexp.y"
1.1.1.7   root      760: { yyval.integer.unsignedp = 0;
                    761:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    762:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value >= yyvsp[0].integer.value;
                    763:                          else
                    764:                            yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value; ;
1.1       root      765:     break;}
                    766: case 20:
1.1.1.9 ! root      767: #line 166 "./cexp.y"
1.1.1.7   root      768: { yyval.integer.unsignedp = 0;
                    769:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    770:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value < yyvsp[0].integer.value;
                    771:                          else
                    772:                            yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value; ;
1.1       root      773:     break;}
                    774: case 21:
1.1.1.9 ! root      775: #line 172 "./cexp.y"
1.1.1.7   root      776: { yyval.integer.unsignedp = 0;
                    777:                          if (yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp)
                    778:                            yyval.integer.value = (unsigned) yyvsp[-2].integer.value > yyvsp[0].integer.value;
                    779:                          else
                    780:                            yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value; ;
1.1       root      781:     break;}
                    782: case 22:
1.1.1.9 ! root      783: #line 178 "./cexp.y"
1.1.1.7   root      784: { yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
                    785:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      786:     break;}
                    787: case 23:
1.1.1.9 ! root      788: #line 181 "./cexp.y"
1.1.1.7   root      789: { yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
                    790:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      791:     break;}
                    792: case 24:
1.1.1.9 ! root      793: #line 184 "./cexp.y"
1.1.1.7   root      794: { yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
                    795:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      796:     break;}
                    797: case 25:
1.1.1.9 ! root      798: #line 187 "./cexp.y"
1.1.1.7   root      799: { yyval.integer.value = (yyvsp[-2].integer.value && yyvsp[0].integer.value);
                    800:                          yyval.integer.unsignedp = 0; ;
1.1       root      801:     break;}
                    802: case 26:
1.1.1.9 ! root      803: #line 190 "./cexp.y"
1.1.1.7   root      804: { yyval.integer.value = (yyvsp[-2].integer.value || yyvsp[0].integer.value);
                    805:                          yyval.integer.unsignedp = 0; ;
1.1       root      806:     break;}
                    807: case 27:
1.1.1.9 ! root      808: #line 193 "./cexp.y"
1.1.1.7   root      809: { yyval.integer.value = yyvsp[-4].integer.value ? yyvsp[-2].integer.value : yyvsp[0].integer.value;
                    810:                          yyval.integer.unsignedp = yyvsp[-2].integer.unsignedp || yyvsp[0].integer.unsignedp; ;
1.1       root      811:     break;}
                    812: case 28:
1.1.1.9 ! root      813: #line 196 "./cexp.y"
1.1.1.7   root      814: { yyval.integer = yylval.integer; ;
1.1       root      815:     break;}
                    816: case 29:
1.1.1.9 ! root      817: #line 198 "./cexp.y"
1.1.1.7   root      818: { yyval.integer = yylval.integer; ;
                    819:     break;}
                    820: case 30:
1.1.1.9 ! root      821: #line 200 "./cexp.y"
1.1.1.7   root      822: { yyval.integer.value = 0;
                    823:                          yyval.integer.unsignedp = 0; ;
1.1       root      824:     break;}
                    825: }
                    826:    /* the action file gets copied in in place of this dollarsign */
1.1.1.9 ! root      827: #line 423 "bison.simple"
1.1       root      828: 
                    829:   yyvsp -= yylen;
                    830:   yyssp -= yylen;
1.1.1.3   root      831: #ifdef YYLSP_NEEDED
1.1.1.2   root      832:   yylsp -= yylen;
                    833: #endif
1.1       root      834: 
1.1.1.6   root      835: #if YYDEBUG != 0
1.1       root      836:   if (yydebug)
                    837:     {
                    838:       short *ssp1 = yyss - 1;
1.1.1.6   root      839:       fprintf (stderr, "state stack now");
1.1       root      840:       while (ssp1 != yyssp)
                    841:        fprintf (stderr, " %d", *++ssp1);
                    842:       fprintf (stderr, "\n");
                    843:     }
1.1.1.2   root      844: #endif
1.1       root      845: 
                    846:   *++yyvsp = yyval;
                    847: 
1.1.1.3   root      848: #ifdef YYLSP_NEEDED
1.1       root      849:   yylsp++;
                    850:   if (yylen == 0)
                    851:     {
                    852:       yylsp->first_line = yylloc.first_line;
                    853:       yylsp->first_column = yylloc.first_column;
                    854:       yylsp->last_line = (yylsp-1)->last_line;
                    855:       yylsp->last_column = (yylsp-1)->last_column;
                    856:       yylsp->text = 0;
                    857:     }
                    858:   else
                    859:     {
                    860:       yylsp->last_line = (yylsp+yylen-1)->last_line;
                    861:       yylsp->last_column = (yylsp+yylen-1)->last_column;
                    862:     }
1.1.1.2   root      863: #endif
1.1       root      864: 
                    865:   /* Now "shift" the result of the reduction.
                    866:      Determine what state that goes to,
                    867:      based on the state we popped back to
                    868:      and the rule number reduced by.  */
                    869: 
                    870:   yyn = yyr1[yyn];
                    871: 
                    872:   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
                    873:   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
                    874:     yystate = yytable[yystate];
                    875:   else
                    876:     yystate = yydefgoto[yyn - YYNTBASE];
                    877: 
                    878:   goto yynewstate;
                    879: 
                    880: yyerrlab:   /* here on detecting error */
                    881: 
                    882:   if (! yyerrstatus)
                    883:     /* If not already recovering from an error, report this error.  */
                    884:     {
1.1.1.6   root      885:       ++yynerrs;
1.1.1.8   root      886: 
                    887: #ifdef YYERROR_VERBOSE
                    888:       yyn = yypact[yystate];
                    889: 
                    890:       if (yyn > YYFLAG && yyn < YYLAST)
                    891:        {
                    892:          int size = 0;
                    893:          char *msg;
                    894:          int x, count;
                    895: 
                    896:          count = 0;
                    897:          for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
                    898:            if (yycheck[x + yyn] == x)
                    899:              size += strlen(yytname[x]) + 15, count++;
                    900:          msg = (char *) xmalloc(size + 15);
                    901:          strcpy(msg, "parse error");
                    902: 
                    903:          if (count < 5)
                    904:            {
                    905:              count = 0;
                    906:              for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
                    907:                if (yycheck[x + yyn] == x)
                    908:                  {
                    909:                    strcat(msg, count == 0 ? ", expecting `" : " or `");
                    910:                    strcat(msg, yytname[x]);
                    911:                    strcat(msg, "'");
                    912:                    count++;
                    913:                  }
                    914:            }
                    915:          yyerror(msg);
                    916:          free(msg);
                    917:        }
                    918:       else
                    919: #endif /* YYERROR_VERBOSE */
                    920:        yyerror("parse error");
1.1       root      921:     }
                    922: 
1.1.1.9 ! root      923: yyerrlab1:   /* here on error raised explicitly by an action */
        !           924: 
1.1       root      925:   if (yyerrstatus == 3)
                    926:     {
                    927:       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
                    928: 
                    929:       /* return failure if at end of input */
                    930:       if (yychar == YYEOF)
1.1.1.6   root      931:        YYABORT;
1.1       root      932: 
1.1.1.6   root      933: #if YYDEBUG != 0
1.1       root      934:       if (yydebug)
                    935:        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1.1.1.2   root      936: #endif
1.1       root      937: 
                    938:       yychar = YYEMPTY;
                    939:     }
                    940: 
                    941:   /* Else will try to reuse lookahead token
                    942:      after shifting the error token.  */
                    943: 
                    944:   yyerrstatus = 3;             /* Each real token shifted decrements this */
                    945: 
                    946:   goto yyerrhandle;
                    947: 
                    948: yyerrdefault:  /* current state does not do anything special for the error token. */
                    949: 
                    950: #if 0
                    951:   /* This is wrong; only states that explicitly want error tokens
                    952:      should shift them.  */
                    953:   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
                    954:   if (yyn) goto yydefault;
                    955: #endif
                    956: 
                    957: yyerrpop:   /* pop the current state because it cannot handle the error token */
                    958: 
1.1.1.6   root      959:   if (yyssp == yyss) YYABORT;
1.1       root      960:   yyvsp--;
                    961:   yystate = *--yyssp;
1.1.1.3   root      962: #ifdef YYLSP_NEEDED
1.1.1.2   root      963:   yylsp--;
                    964: #endif
1.1       root      965: 
1.1.1.6   root      966: #if YYDEBUG != 0
1.1       root      967:   if (yydebug)
                    968:     {
                    969:       short *ssp1 = yyss - 1;
1.1.1.6   root      970:       fprintf (stderr, "Error: state stack now");
1.1       root      971:       while (ssp1 != yyssp)
                    972:        fprintf (stderr, " %d", *++ssp1);
                    973:       fprintf (stderr, "\n");
                    974:     }
1.1.1.2   root      975: #endif
1.1       root      976: 
                    977: yyerrhandle:
                    978: 
                    979:   yyn = yypact[yystate];
                    980:   if (yyn == YYFLAG)
                    981:     goto yyerrdefault;
                    982: 
                    983:   yyn += YYTERROR;
                    984:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
                    985:     goto yyerrdefault;
                    986: 
                    987:   yyn = yytable[yyn];
                    988:   if (yyn < 0)
                    989:     {
                    990:       if (yyn == YYFLAG)
                    991:        goto yyerrpop;
                    992:       yyn = -yyn;
                    993:       goto yyreduce;
                    994:     }
                    995:   else if (yyn == 0)
                    996:     goto yyerrpop;
                    997: 
                    998:   if (yyn == YYFINAL)
                    999:     YYACCEPT;
                   1000: 
1.1.1.6   root     1001: #if YYDEBUG != 0
1.1       root     1002:   if (yydebug)
                   1003:     fprintf(stderr, "Shifting error token, ");
1.1.1.2   root     1004: #endif
1.1       root     1005: 
                   1006:   *++yyvsp = yylval;
1.1.1.3   root     1007: #ifdef YYLSP_NEEDED
1.1       root     1008:   *++yylsp = yylloc;
1.1.1.2   root     1009: #endif
1.1       root     1010: 
                   1011:   yystate = yyn;
                   1012:   goto yynewstate;
                   1013: }
1.1.1.9 ! root     1014: #line 203 "./cexp.y"
1.1       root     1015: 
                   1016: 
                   1017: /* During parsing of a C expression, the pointer to the next character
                   1018:    is in this variable.  */
                   1019: 
                   1020: static char *lexptr;
                   1021: 
                   1022: /* Take care of parsing a number (anything that starts with a digit).
                   1023:    Set yylval and return the token type; update lexptr.
                   1024:    LEN is the number of characters in it.  */
                   1025: 
                   1026: /* maybe needs to actually deal with floating point numbers */
                   1027: 
1.1.1.3   root     1028: int
1.1       root     1029: parse_number (olen)
                   1030:      int olen;
                   1031: {
                   1032:   register char *p = lexptr;
                   1033:   register long n = 0;
                   1034:   register int c;
                   1035:   register int base = 10;
1.1.1.7   root     1036:   register int len = olen;
1.1       root     1037: 
                   1038:   for (c = 0; c < len; c++)
                   1039:     if (p[c] == '.') {
                   1040:       /* It's a float since it contains a point.  */
                   1041:       yyerror ("floating point numbers not allowed in #if expressions");
                   1042:       return ERROR;
                   1043:     }
1.1.1.7   root     1044: 
                   1045:   yylval.integer.unsignedp = 0;
                   1046: 
1.1       root     1047:   if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
                   1048:     p += 2;
                   1049:     base = 16;
                   1050:     len -= 2;
                   1051:   }
                   1052:   else if (*p == '0')
                   1053:     base = 8;
1.1.1.7   root     1054: 
                   1055:   while (len > 0) {
1.1       root     1056:     c = *p++;
1.1.1.7   root     1057:     len--;
                   1058:     if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
                   1059: 
                   1060:     if (c >= '0' && c <= '9') {
                   1061:       n *= base;
1.1       root     1062:       n += c - '0';
1.1.1.7   root     1063:     } else if (base == 16 && c >= 'a' && c <= 'f') {
                   1064:       n *= base;
                   1065:       n += c - 'a' + 10;
                   1066:     } else {
                   1067:       /* `l' means long, and `u' means unsigned.  */
                   1068:       while (1) {
                   1069:        if (c == 'l' || c == 'L')
                   1070:          ;
                   1071:        else if (c == 'u' || c == 'U')
                   1072:          yylval.integer.unsignedp = 1;
                   1073:        else
                   1074:          break;
                   1075: 
                   1076:        if (len == 0)
                   1077:          break;
                   1078:        c = *p++;
                   1079:        len--;
1.1       root     1080:       }
1.1.1.7   root     1081:       /* Don't look for any more digits after the suffixes.  */
                   1082:       break;
1.1       root     1083:     }
                   1084:   }
                   1085: 
1.1.1.7   root     1086:   if (len != 0) {
                   1087:     yyerror ("Invalid number in #if expression");
                   1088:     return ERROR;
                   1089:   }
                   1090: 
                   1091:   /* If too big to be signed, consider it unsigned.  */
                   1092:   if (n < 0)
                   1093:     yylval.integer.unsignedp = 1;
                   1094: 
1.1       root     1095:   lexptr = p;
1.1.1.7   root     1096:   yylval.integer.value = n;
1.1       root     1097:   return INT;
                   1098: }
                   1099: 
                   1100: struct token {
                   1101:   char *operator;
                   1102:   int token;
                   1103: };
                   1104: 
1.1.1.7   root     1105: #ifndef NULL
1.1       root     1106: #define NULL 0
1.1.1.7   root     1107: #endif
1.1       root     1108: 
                   1109: static struct token tokentab2[] = {
                   1110:   {"&&", AND},
                   1111:   {"||", OR},
                   1112:   {"<<", LSH},
                   1113:   {">>", RSH},
                   1114:   {"==", EQUAL},
                   1115:   {"!=", NOTEQUAL},
                   1116:   {"<=", LEQ},
                   1117:   {">=", GEQ},
                   1118:   {NULL, ERROR}
                   1119: };
                   1120: 
                   1121: /* Read one token, getting characters through lexptr.  */
                   1122: 
1.1.1.3   root     1123: int
1.1       root     1124: yylex ()
                   1125: {
                   1126:   register int c;
                   1127:   register int namelen;
                   1128:   register char *tokstart;
                   1129:   register struct token *toktab;
                   1130: 
                   1131:  retry:
                   1132: 
                   1133:   tokstart = lexptr;
                   1134:   c = *tokstart;
                   1135:   /* See if it is a special token of length 2.  */
                   1136:   for (toktab = tokentab2; toktab->operator != NULL; toktab++)
                   1137:     if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
                   1138:       lexptr += 2;
                   1139:       return toktab->token;
                   1140:     }
                   1141: 
                   1142:   switch (c) {
                   1143:   case 0:
                   1144:     return 0;
                   1145:     
                   1146:   case ' ':
                   1147:   case '\t':
1.1.1.8   root     1148:   case '\r':
1.1       root     1149:   case '\n':
                   1150:     lexptr++;
                   1151:     goto retry;
                   1152:     
                   1153:   case '\'':
                   1154:     lexptr++;
                   1155:     c = *lexptr++;
                   1156:     if (c == '\\')
                   1157:       c = parse_escape (&lexptr);
1.1.1.7   root     1158: 
                   1159:     /* Sign-extend the constant if chars are signed on target machine.  */
                   1160:     {
                   1161:       if (lookup ("__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__")-1, -1)
                   1162:          || ((c >> (CHAR_TYPE_SIZE - 1)) & 1) == 0)
                   1163:        yylval.integer.value = c & ((1 << CHAR_TYPE_SIZE) - 1);
                   1164:       else
                   1165:        yylval.integer.value = c | ~((1 << CHAR_TYPE_SIZE) - 1);
                   1166:     }
                   1167: 
                   1168:     yylval.integer.unsignedp = 0;
1.1       root     1169:     c = *lexptr++;
                   1170:     if (c != '\'') {
                   1171:       yyerror ("Invalid character constant in #if");
                   1172:       return ERROR;
                   1173:     }
                   1174:     
                   1175:     return CHAR;
                   1176: 
                   1177:     /* some of these chars are invalid in constant expressions;
                   1178:        maybe do something about them later */
                   1179:   case '/':
                   1180:   case '+':
                   1181:   case '-':
                   1182:   case '*':
                   1183:   case '%':
                   1184:   case '|':
                   1185:   case '&':
                   1186:   case '^':
                   1187:   case '~':
                   1188:   case '!':
                   1189:   case '@':
                   1190:   case '<':
                   1191:   case '>':
                   1192:   case '(':
                   1193:   case ')':
                   1194:   case '[':
                   1195:   case ']':
                   1196:   case '.':
                   1197:   case '?':
                   1198:   case ':':
                   1199:   case '=':
                   1200:   case '{':
                   1201:   case '}':
                   1202:   case ',':
                   1203:     lexptr++;
                   1204:     return c;
                   1205:     
                   1206:   case '"':
                   1207:     yyerror ("double quoted strings not allowed in #if expressions");
                   1208:     return ERROR;
                   1209:   }
                   1210:   if (c >= '0' && c <= '9') {
                   1211:     /* It's a number */
                   1212:     for (namelen = 0;
                   1213:         c = tokstart[namelen], is_idchar[c] || c == '.'; 
                   1214:         namelen++)
                   1215:       ;
                   1216:     return parse_number (namelen);
                   1217:   }
                   1218:   
                   1219:   if (!is_idstart[c]) {
                   1220:     yyerror ("Invalid token in expression");
                   1221:     return ERROR;
                   1222:   }
                   1223:   
                   1224:   /* It is a name.  See how long it is.  */
                   1225:   
                   1226:   for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
                   1227:     ;
                   1228:   
                   1229:   lexptr += namelen;
                   1230:   return NAME;
                   1231: }
                   1232: 
                   1233: 
                   1234: /* Parse a C escape sequence.  STRING_PTR points to a variable
                   1235:    containing a pointer to the string to parse.  That pointer
                   1236:    is updated past the characters we use.  The value of the
                   1237:    escape sequence is returned.
                   1238: 
                   1239:    A negative value means the sequence \ newline was seen,
                   1240:    which is supposed to be equivalent to nothing at all.
                   1241: 
                   1242:    If \ is followed by a null character, we return a negative
                   1243:    value and leave the string pointer pointing at the null character.
                   1244: 
                   1245:    If \ is followed by 000, we return 0 and leave the string pointer
                   1246:    after the zeros.  A value of 0 does not mean end of string.  */
                   1247: 
1.1.1.3   root     1248: int
1.1       root     1249: parse_escape (string_ptr)
                   1250:      char **string_ptr;
                   1251: {
                   1252:   register int c = *(*string_ptr)++;
                   1253:   switch (c)
                   1254:     {
                   1255:     case 'a':
1.1.1.7   root     1256:       return TARGET_BELL;
1.1       root     1257:     case 'b':
1.1.1.7   root     1258:       return TARGET_BS;
1.1       root     1259:     case 'e':
                   1260:       return 033;
                   1261:     case 'f':
1.1.1.7   root     1262:       return TARGET_FF;
1.1       root     1263:     case 'n':
1.1.1.7   root     1264:       return TARGET_NEWLINE;
1.1       root     1265:     case 'r':
1.1.1.7   root     1266:       return TARGET_CR;
1.1       root     1267:     case 't':
1.1.1.7   root     1268:       return TARGET_TAB;
1.1       root     1269:     case 'v':
1.1.1.7   root     1270:       return TARGET_VT;
1.1       root     1271:     case '\n':
                   1272:       return -2;
                   1273:     case 0:
                   1274:       (*string_ptr)--;
                   1275:       return 0;
                   1276:     case '^':
                   1277:       c = *(*string_ptr)++;
                   1278:       if (c == '\\')
                   1279:        c = parse_escape (string_ptr);
                   1280:       if (c == '?')
                   1281:        return 0177;
                   1282:       return (c & 0200) | (c & 037);
                   1283:       
                   1284:     case '0':
                   1285:     case '1':
                   1286:     case '2':
                   1287:     case '3':
                   1288:     case '4':
                   1289:     case '5':
                   1290:     case '6':
                   1291:     case '7':
                   1292:       {
                   1293:        register int i = c - '0';
                   1294:        register int count = 0;
                   1295:        while (++count < 3)
                   1296:          {
1.1.1.7   root     1297:            c = *(*string_ptr)++;
                   1298:            if (c >= '0' && c <= '7')
                   1299:              i = (i << 3) + c - '0';
                   1300:            else
1.1       root     1301:              {
1.1.1.7   root     1302:                (*string_ptr)--;
                   1303:                break;
1.1       root     1304:              }
1.1.1.7   root     1305:          }
                   1306:        if ((i & ~((1 << CHAR_TYPE_SIZE) - 1)) != 0)
                   1307:          {
                   1308:            i &= (1 << CHAR_TYPE_SIZE) - 1;
                   1309:            warning ("octal character constant does not fit in a byte");
                   1310:          }
                   1311:        return i;
                   1312:       }
                   1313:     case 'x':
                   1314:       {
                   1315:        register int i = 0;
                   1316:        register int count = 0;
                   1317:        for (;;)
                   1318:          {
                   1319:            c = *(*string_ptr)++;
                   1320:            if (c >= '0' && c <= '9')
                   1321:              i = (i << 4) + c - '0';
                   1322:            else if (c >= 'a' && c <= 'f')
                   1323:              i = (i << 4) + c - 'a' + 10;
                   1324:            else if (c >= 'A' && c <= 'F')
                   1325:              i = (i << 4) + c - 'A' + 10;
1.1       root     1326:            else
                   1327:              {
                   1328:                (*string_ptr)--;
                   1329:                break;
                   1330:              }
                   1331:          }
1.1.1.7   root     1332:        if ((i & ~((1 << BITS_PER_UNIT) - 1)) != 0)
                   1333:          {
                   1334:            i &= (1 << BITS_PER_UNIT) - 1;
                   1335:            warning ("hex character constant does not fit in a byte");
                   1336:          }
1.1       root     1337:        return i;
                   1338:       }
                   1339:     default:
                   1340:       return c;
                   1341:     }
                   1342: }
                   1343: 
1.1.1.3   root     1344: void
1.1       root     1345: yyerror (s)
                   1346:      char *s;
                   1347: {
                   1348:   error (s);
                   1349:   longjmp (parse_return_error, 1);
                   1350: }
                   1351: 
                   1352: /* This page contains the entry point to this file.  */
                   1353: 
                   1354: /* Parse STRING as an expression, and complain if this fails
                   1355:    to use up all of the contents of STRING.  */
                   1356: /* We do not support C comments.  They should be removed before
                   1357:    this function is called.  */
                   1358: 
                   1359: int
                   1360: parse_c_expression (string)
                   1361:      char *string;
                   1362: {
                   1363:   lexptr = string;
                   1364:   
                   1365:   if (lexptr == 0 || *lexptr == 0) {
                   1366:     error ("empty #if expression");
                   1367:     return 0;                  /* don't include the #if group */
                   1368:   }
                   1369: 
                   1370:   /* if there is some sort of scanning error, just return 0 and assume
                   1371:      the parsing routine has printed an error message somewhere.
                   1372:      there is surely a better thing to do than this.     */
1.1.1.7   root     1373:   if (setjmp (parse_return_error))
1.1       root     1374:     return 0;
                   1375: 
                   1376:   if (yyparse ())
                   1377:     return 0;                  /* actually this is never reached
                   1378:                                   the way things stand. */
                   1379:   if (*lexptr)
                   1380:     error ("Junk after end of expression.");
                   1381: 
1.1.1.7   root     1382:   return expression_value;     /* set by yyparse () */
1.1       root     1383: }
                   1384: 
                   1385: #ifdef TEST_EXP_READER
                   1386: /* main program, for testing purposes. */
1.1.1.7   root     1387: main ()
1.1       root     1388: {
1.1.1.7   root     1389:   int n, c;
1.1       root     1390:   char buf[1024];
                   1391:   extern int yydebug;
                   1392: /*
                   1393:   yydebug = 1;
                   1394: */
                   1395:   initialize_random_junk ();
                   1396: 
                   1397:   for (;;) {
1.1.1.7   root     1398:     printf ("enter expression: ");
1.1       root     1399:     n = 0;
1.1.1.7   root     1400:     while ((buf[n] = getchar ()) != '\n' && buf[n] != EOF)
1.1       root     1401:       n++;
1.1.1.7   root     1402:     if (buf[n] == EOF)
                   1403:       break;
1.1       root     1404:     buf[n] = '\0';
1.1.1.7   root     1405:     printf ("parser returned %d\n", parse_c_expression (buf));
1.1       root     1406:   }
                   1407: }
                   1408: 
                   1409: /* table to tell if char can be part of a C identifier. */
1.1.1.7   root     1410: unsigned char is_idchar[256];
1.1       root     1411: /* table to tell if char can be first char of a c identifier. */
1.1.1.7   root     1412: unsigned char is_idstart[256];
                   1413: /* table to tell if c is horizontal space.  isspace () thinks that
1.1       root     1414:    newline is space; this is not a good idea for this program. */
                   1415: char is_hor_space[256];
                   1416: 
                   1417: /*
                   1418:  * initialize random junk in the hash table and maybe other places
                   1419:  */
1.1.1.7   root     1420: initialize_random_junk ()
1.1       root     1421: {
                   1422:   register int i;
                   1423: 
                   1424:   /*
                   1425:    * Set up is_idchar and is_idstart tables.  These should be
1.1.1.7   root     1426:    * faster than saying (is_alpha (c) || c == '_'), etc.
1.1       root     1427:    * Must do set up these things before calling any routines tthat
                   1428:    * refer to them.
                   1429:    */
                   1430:   for (i = 'a'; i <= 'z'; i++) {
                   1431:     ++is_idchar[i - 'a' + 'A'];
                   1432:     ++is_idchar[i];
                   1433:     ++is_idstart[i - 'a' + 'A'];
                   1434:     ++is_idstart[i];
                   1435:   }
                   1436:   for (i = '0'; i <= '9'; i++)
                   1437:     ++is_idchar[i];
                   1438:   ++is_idchar['_'];
                   1439:   ++is_idstart['_'];
1.1.1.7   root     1440: #if DOLLARS_IN_IDENTIFIERS
1.1       root     1441:   ++is_idchar['$'];
                   1442:   ++is_idstart['$'];
                   1443: #endif
                   1444: 
                   1445:   /* horizontal space table */
                   1446:   ++is_hor_space[' '];
                   1447:   ++is_hor_space['\t'];
                   1448: }
                   1449: 
                   1450: error (msg)
                   1451: {
1.1.1.7   root     1452:   printf ("error: %s\n", msg);
                   1453: }
                   1454: 
                   1455: warning (msg)
                   1456: {
                   1457:   printf ("warning: %s\n", msg);
                   1458: }
                   1459: 
                   1460: struct hashnode *
                   1461: lookup (name, len, hash)
                   1462:      char *name;
                   1463:      int len;
                   1464:      int hash;
                   1465: {
                   1466:   return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
1.1       root     1467: }
                   1468: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.