Annotation of researchv10dc/cmd/gcc/cexp.c, revision 1.1

1.1     ! root        1: 
        !             2: /*  A Bison parser, made from cexp.y  */
        !             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: 
        !            18: #line 109 "cexp.y"
        !            19: 
        !            20: #include "config.h"
        !            21: #include <setjmp.h>
        !            22: /* #define YYDEBUG 1 */
        !            23: 
        !            24:   static int yylex ();
        !            25:   static yyerror ();
        !            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: 
        !            33: 
        !            34: #line 125 "cexp.y"
        !            35: typedef union {
        !            36:   long lval;
        !            37:   int voidval;
        !            38:   char *sval;
        !            39: } YYSTYPE;
        !            40: 
        !            41: #ifndef YYLTYPE
        !            42: typedef
        !            43:   struct yyltype
        !            44:     {
        !            45:       int timestamp;
        !            46:       int first_line;
        !            47:       int first_column;
        !            48:       int last_line;
        !            49:       int last_column;
        !            50:       char *text;
        !            51:    }
        !            52:   yyltype;
        !            53: 
        !            54: #define YYLTYPE yyltype
        !            55: #endif
        !            56: 
        !            57: #define        YYACCEPT        return(0)
        !            58: #define        YYABORT return(1)
        !            59: #define        YYERROR return(1)
        !            60: #include <stdio.h>
        !            61: 
        !            62: #ifndef __STDC__
        !            63: #define const
        !            64: #endif
        !            65: 
        !            66: 
        !            67: 
        !            68: #define        YYFINAL         59
        !            69: #define        YYFLAG          -32768
        !            70: #define        YYNTBASE        33
        !            71: 
        !            72: #define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 36)
        !            73: 
        !            74: static const char yytranslate[] = {     0,
        !            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: 
        !           104: static const short yyrline[] = {     0,
        !           105:    154,   159,   160,   165,   167,   169,   171,   176,   178,   180,
        !           106:    182,   184,   186,   188,   190,   192,   194,   196,   198,   200,
        !           107:    202,   204,   206,   208,   210,   212,   214,   216,   218
        !           108: };
        !           109: 
        !           110: static const char * const yytname[] = {     0,
        !           111: "error","$illegal.","INT","CHAR","NAME","ERROR","'?'","':'","','","OR",
        !           112: "AND","'|'","'^'","'&'","EQUAL","NOTEQUAL","'<'","'>'","LEQ","GEQ",
        !           113: "LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'","'~'",
        !           114: "'('","')'","start"
        !           115: };
        !           116: 
        !           117: static const short yyr1[] = {     0,
        !           118:     33,    34,    34,    35,    35,    35,    35,    35,    35,    35,
        !           119:     35,    35,    35,    35,    35,    35,    35,    35,    35,    35,
        !           120:     35,    35,    35,    35,    35,    35,    35,    35,    35
        !           121: };
        !           122: 
        !           123: static const short yyr2[] = {     0,
        !           124:      1,     1,     3,     2,     2,     2,     3,     3,     3,     3,
        !           125:      3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
        !           126:      3,     3,     3,     3,     3,     5,     1,     1,     1
        !           127: };
        !           128: 
        !           129: static const short yydefact[] = {     0,
        !           130:     27,    28,    29,     0,     0,     0,     0,     1,     2,     4,
        !           131:      5,     6,     0,     0,     0,     0,     0,     0,     0,     0,
        !           132:      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        !           133:      0,     0,     0,     7,     3,     0,    25,    24,    23,    22,
        !           134:     21,    15,    16,    19,    20,    17,    18,    13,    14,    11,
        !           135:     12,     8,     9,    10,     0,    26,     0,     0,     0
        !           136: };
        !           137: 
        !           138: static const short yydefgoto[] = {    57,
        !           139:      8,     9
        !           140: };
        !           141: 
        !           142: static const short yypact[] = {    28,
        !           143: -32768,-32768,-32768,    28,    28,    28,    28,    -3,    74,-32768,
        !           144: -32768,-32768,    -2,    28,    28,    28,    28,    28,    28,    28,
        !           145:     28,    28,    28,    28,    28,    28,    28,    28,    28,    28,
        !           146:     28,    28,    28,-32768,    74,    53,    23,    90,   105,   119,
        !           147:    132,   143,   143,   150,   150,   150,   150,   155,   155,   -22,
        !           148:    -22,-32768,-32768,-32768,    28,    74,     8,     9,-32768
        !           149: };
        !           150: 
        !           151: static const short yypgoto[] = {-32768,
        !           152:     46,    -4
        !           153: };
        !           154: 
        !           155: 
        !           156: #define        YYLAST          182
        !           157: 
        !           158: 
        !           159: static const short yytable[] = {    10,
        !           160:     11,    12,    31,    32,    33,    14,    14,    58,    59,    35,
        !           161:     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
        !           162:     46,    47,    48,    49,    50,    51,    52,    53,    54,    34,
        !           163:      1,     2,     3,    17,    18,    19,    20,    21,    22,    23,
        !           164:     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
        !           165:     56,     4,    13,     0,     0,     0,     5,     6,     7,    15,
        !           166:     55,     0,    16,    17,    18,    19,    20,    21,    22,    23,
        !           167:     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
        !           168:     15,     0,     0,    16,    17,    18,    19,    20,    21,    22,
        !           169:     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
        !           170:     33,    18,    19,    20,    21,    22,    23,    24,    25,    26,
        !           171:     27,    28,    29,    30,    31,    32,    33,    19,    20,    21,
        !           172:     22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
        !           173:     32,    33,    20,    21,    22,    23,    24,    25,    26,    27,
        !           174:     28,    29,    30,    31,    32,    33,    21,    22,    23,    24,
        !           175:     25,    26,    27,    28,    29,    30,    31,    32,    33,    23,
        !           176:     24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
        !           177:     27,    28,    29,    30,    31,    32,    33,    29,    30,    31,
        !           178:     32,    33
        !           179: };
        !           180: 
        !           181: static const short yycheck[] = {     4,
        !           182:      5,     6,    25,    26,    27,     9,     9,     0,     0,    14,
        !           183:     15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
        !           184:     25,    26,    27,    28,    29,    30,    31,    32,    33,    32,
        !           185:      3,     4,     5,    11,    12,    13,    14,    15,    16,    17,
        !           186:     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
        !           187:     55,    24,     7,    -1,    -1,    -1,    29,    30,    31,     7,
        !           188:      8,    -1,    10,    11,    12,    13,    14,    15,    16,    17,
        !           189:     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
        !           190:      7,    -1,    -1,    10,    11,    12,    13,    14,    15,    16,
        !           191:     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
        !           192:     27,    12,    13,    14,    15,    16,    17,    18,    19,    20,
        !           193:     21,    22,    23,    24,    25,    26,    27,    13,    14,    15,
        !           194:     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
        !           195:     26,    27,    14,    15,    16,    17,    18,    19,    20,    21,
        !           196:     22,    23,    24,    25,    26,    27,    15,    16,    17,    18,
        !           197:     19,    20,    21,    22,    23,    24,    25,    26,    27,    17,
        !           198:     18,    19,    20,    21,    22,    23,    24,    25,    26,    27,
        !           199:     21,    22,    23,    24,    25,    26,    27,    23,    24,    25,
        !           200:     26,    27
        !           201: };
        !           202: #define YYPURE 1
        !           203: 
        !           204: #line 2 "bison.simple"
        !           205: 
        !           206: /* Skeleton output parser for bison,
        !           207:    copyright (C) 1984 Bob Corbett and Richard Stallman
        !           208: 
        !           209:                       NO WARRANTY
        !           210: 
        !           211:   BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
        !           212: NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
        !           213: WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
        !           214: RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
        !           215: WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
        !           216: BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
        !           217: FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
        !           218: AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
        !           219: DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
        !           220: CORRECTION.
        !           221: 
        !           222:  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
        !           223: STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
        !           224: WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
        !           225: LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
        !           226: OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
        !           227: USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
        !           228: DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
        !           229: A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
        !           230: PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
        !           231: DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
        !           232: 
        !           233:                GENERAL PUBLIC LICENSE TO COPY
        !           234: 
        !           235:   1. You may copy and distribute verbatim copies of this source file
        !           236: as you receive it, in any medium, provided that you conspicuously and
        !           237: appropriately publish on each copy a valid copyright notice "Copyright
        !           238: (C) 1985 Free Software Foundation, Inc."; and include following the
        !           239: copyright notice a verbatim copy of the above disclaimer of warranty
        !           240: and of this License.  You may charge a distribution fee for the
        !           241: physical act of transferring a copy.
        !           242: 
        !           243:   2. You may modify your copy or copies of this source file or
        !           244: any portion of it, and copy and distribute such modifications under
        !           245: the terms of Paragraph 1 above, provided that you also do the following:
        !           246: 
        !           247:     a) cause the modified files to carry prominent notices stating
        !           248:     that you changed the files and the date of any change; and
        !           249: 
        !           250:     b) cause the whole of any work that you distribute or publish,
        !           251:     that in whole or in part contains or is a derivative of this
        !           252:     program or any part thereof, to be licensed at no charge to all
        !           253:     third parties on terms identical to those contained in this
        !           254:     License Agreement (except that you may choose to grant more extensive
        !           255:     warranty protection to some or all third parties, at your option).
        !           256: 
        !           257:     c) You may charge a distribution fee for the physical act of
        !           258:     transferring a copy, and you may at your option offer warranty
        !           259:     protection in exchange for a fee.
        !           260: 
        !           261: Mere aggregation of another unrelated program with this program (or its
        !           262: derivative) on a volume of a storage or distribution medium does not bring
        !           263: the other program under the scope of these terms.
        !           264: 
        !           265:   3. You may copy and distribute this program (or a portion or derivative
        !           266: of it, under Paragraph 2) in object code or executable form under the terms
        !           267: of Paragraphs 1 and 2 above provided that you also do one of the following:
        !           268: 
        !           269:     a) accompany it with the complete corresponding machine-readable
        !           270:     source code, which must be distributed under the terms of
        !           271:     Paragraphs 1 and 2 above; or,
        !           272: 
        !           273:     b) accompany it with a written offer, valid for at least three
        !           274:     years, to give any third party free (except for a nominal
        !           275:     shipping charge) a complete machine-readable copy of the
        !           276:     corresponding source code, to be distributed under the terms of
        !           277:     Paragraphs 1 and 2 above; or,
        !           278: 
        !           279:     c) accompany it with the information you received as to where the
        !           280:     corresponding source code may be obtained.  (This alternative is
        !           281:     allowed only for noncommercial distribution and only if you
        !           282:     received the program in object code or executable form alone.)
        !           283: 
        !           284: For an executable file, complete source code means all the source code for
        !           285: all modules it contains; but, as a special exception, it need not include
        !           286: source code for modules which are standard libraries that accompany the
        !           287: operating system on which the executable file runs.
        !           288: 
        !           289:   4. You may not copy, sublicense, distribute or transfer this program
        !           290: except as expressly provided under this License Agreement.  Any attempt
        !           291: otherwise to copy, sublicense, distribute or transfer this program is void and
        !           292: your rights to use the program under this License agreement shall be
        !           293: automatically terminated.  However, parties who have received computer
        !           294: software programs from you with this License Agreement will not have
        !           295: their licenses terminated so long as such parties remain in full compliance.
        !           296: 
        !           297:   5. If you wish to incorporate parts of this program into other free
        !           298: programs whose distribution conditions are different, write to the Free
        !           299: Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
        !           300: worked out a simple rule that can be stated here, but we will often permit
        !           301: this.  We will be guided by the two goals of preserving the free status of
        !           302: all derivatives of our free software and of promoting the sharing and reuse of
        !           303: software.
        !           304: 
        !           305: 
        !           306: In other words, you are welcome to use, share and improve this program.
        !           307: You are forbidden to forbid anyone else to use, share and improve
        !           308: what you give them.   Help stamp out software-hoarding!  */
        !           309: 
        !           310: /* This is the parser code that is written into each bison parser
        !           311:   when the %semantic_parser declaration is not specified in the grammar.
        !           312:   It was written by Richard Stallman by simplifying the hairy parser
        !           313:   used when %semantic_parser is specified.  */
        !           314: 
        !           315: /* Note: there must be only one dollar sign in this file.
        !           316:    It is replaced by the list of actions, each action
        !           317:    as one case of the switch.  */
        !           318: 
        !           319: #define yyerrok                (yyerrstatus = 0)
        !           320: #define yyclearin      (yychar = YYEMPTY)
        !           321: #define YYEMPTY                -2
        !           322: #define YYEOF          0
        !           323: #define YYFAIL         goto yyerrlab;
        !           324: 
        !           325: #define YYTERROR       1
        !           326: 
        !           327: #ifndef YYIMPURE
        !           328: #define YYLEX          yylex()
        !           329: #endif
        !           330: 
        !           331: #ifndef YYPURE
        !           332: #define YYLEX          yylex(&yylval, &yylloc)
        !           333: #endif
        !           334: 
        !           335: /* If nonreentrant, generate the variables here */
        !           336: 
        !           337: #ifndef YYIMPURE
        !           338: 
        !           339: int    yychar;                 /*  the lookahead symbol                */
        !           340: YYSTYPE        yylval;                 /*  the semantic value of the           */
        !           341:                                /*  lookahead symbol                    */
        !           342: 
        !           343: YYLTYPE yylloc;                        /*  location data for the lookahead     */
        !           344:                                /*  symbol                              */
        !           345: 
        !           346: int yynerr;                    /*  number of parse errors so far       */
        !           347: 
        !           348: #ifdef YYDEBUG
        !           349: int yydebug = 0;               /*  nonzero means print parse trace     */
        !           350: #endif
        !           351: 
        !           352: #endif  /* YYIMPURE */
        !           353: 
        !           354: 
        !           355: /*  YYMAXDEPTH indicates the initial size of the parser's stacks       */
        !           356: 
        !           357: #ifndef        YYMAXDEPTH
        !           358: #define YYMAXDEPTH 200
        !           359: #endif
        !           360: 
        !           361: /*  YYMAXLIMIT is the maximum size the stacks can grow to
        !           362:     (effective only if the built-in stack extension method is used).  */
        !           363: 
        !           364: #ifndef YYMAXLIMIT
        !           365: #define YYMAXLIMIT 10000
        !           366: #endif
        !           367: 
        !           368: 
        !           369: #line 165 "bison.simple"
        !           370: int
        !           371: yyparse()
        !           372: {
        !           373:   register int yystate;
        !           374:   register int yyn;
        !           375:   register short *yyssp;
        !           376:   register YYSTYPE *yyvsp;
        !           377:   YYLTYPE *yylsp;
        !           378:   int yyerrstatus;     /*  number of tokens to shift before error messages enabled */
        !           379:   int yychar1;         /*  lookahead token as an internal (translated) token number */
        !           380: 
        !           381:   short        yyssa[YYMAXDEPTH];      /*  the state stack                     */
        !           382:   YYSTYPE yyvsa[YYMAXDEPTH];   /*  the semantic value stack            */
        !           383:   YYLTYPE yylsa[YYMAXDEPTH];   /*  the location stack                  */
        !           384: 
        !           385:   short *yyss = yyssa;         /*  refer to the stacks thru separate pointers */
        !           386:   YYSTYPE *yyvs = yyvsa;       /*  to allow yyoverflow to reallocate them elsewhere */
        !           387:   YYLTYPE *yyls = yylsa;
        !           388: 
        !           389:   int yymaxdepth = YYMAXDEPTH;
        !           390: 
        !           391: #ifndef YYPURE
        !           392:   int yychar;
        !           393:   YYSTYPE yylval;
        !           394:   YYLTYPE yylloc;
        !           395: #endif
        !           396: 
        !           397: #ifdef YYDEBUG
        !           398:   extern int yydebug;
        !           399: #endif
        !           400: 
        !           401: 
        !           402:   YYSTYPE yyval;               /*  the variable used to return         */
        !           403:                                /*  semantic values from the action     */
        !           404:                                /*  routines                            */
        !           405: 
        !           406:   int yylen;
        !           407: 
        !           408: #ifdef YYDEBUG
        !           409:   if (yydebug)
        !           410:     fprintf(stderr, "Starting parse\n");
        !           411: #endif
        !           412: 
        !           413:   yystate = 0;
        !           414:   yyerrstatus = 0;
        !           415:   yynerr = 0;
        !           416:   yychar = YYEMPTY;            /* Cause a token to be read.  */
        !           417: 
        !           418:   /* Initialize stack pointers.
        !           419:      Waste one element of value and location stack
        !           420:      so that they stay on the same level as the state stack.  */
        !           421: 
        !           422:   yyssp = yyss - 1;
        !           423:   yyvsp = yyvs;
        !           424:   yylsp = yyls;
        !           425: 
        !           426: /* Push a new state, which is found in  yystate  .  */
        !           427: /* In all cases, when you get here, the value and location stacks
        !           428:    have just been pushed. so pushing a state here evens the stacks.  */
        !           429: yynewstate:
        !           430: 
        !           431:   *++yyssp = yystate;
        !           432: 
        !           433:   if (yyssp >= yyss + yymaxdepth - 1)
        !           434:     {
        !           435:       /* Give user a chance to reallocate the stack */
        !           436:       /* Use copies of these so that the &'s don't force the real ones into memory. */
        !           437:       YYSTYPE *yyvs1 = yyvs;
        !           438:       YYLTYPE *yyls1 = yyls;
        !           439:       short *yyss1 = yyss;
        !           440: 
        !           441:       /* Get the current used size of the three stacks, in elements.  */
        !           442:       int size = yyssp - yyss + 1;
        !           443: 
        !           444: #ifdef yyoverflow
        !           445:       /* Each stack pointer address is followed by the size of
        !           446:         the data in use in that stack, in bytes.  */
        !           447:       yyoverflow("parser stack overflow",
        !           448:                 &yyss1, size * sizeof (*yyssp),
        !           449:                 &yyvs1, size * sizeof (*yyvsp),
        !           450:                 &yyls1, size * sizeof (*yylsp),
        !           451:                 &yymaxdepth);
        !           452: 
        !           453:       yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
        !           454: #else /* no yyoverflow */
        !           455:       /* Extend the stack our own way.  */
        !           456:       if (yymaxdepth >= YYMAXLIMIT)
        !           457:        yyerror("parser stack overflow");
        !           458:       yymaxdepth *= 2;
        !           459:       if (yymaxdepth > YYMAXLIMIT)
        !           460:        yymaxdepth = YYMAXLIMIT;
        !           461:       yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
        !           462:       bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
        !           463:       yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
        !           464:       bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
        !           465: #ifdef YYLSP_NEEDED
        !           466:       yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
        !           467:       bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
        !           468: #endif
        !           469: #endif /* no yyoverflow */
        !           470: 
        !           471:       yyssp = yyss + size - 1;
        !           472:       yyvsp = yyvs + size - 1;
        !           473: #ifdef YYLSP_NEEDED
        !           474:       yylsp = yyls + size - 1;
        !           475: #endif
        !           476: 
        !           477: #ifdef YYDEBUG
        !           478:       if (yydebug)
        !           479:        fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
        !           480: #endif
        !           481: 
        !           482:       if (yyssp >= yyss + yymaxdepth - 1)
        !           483:        YYERROR;
        !           484:     }
        !           485: 
        !           486: #ifdef YYDEBUG
        !           487:   if (yydebug)
        !           488:     fprintf(stderr, "Entering state %d\n", yystate);
        !           489: #endif
        !           490: 
        !           491: /* Do appropriate processing given the current state.  */
        !           492: /* Read a lookahead token if we need one and don't already have one.  */
        !           493: yyresume:
        !           494: 
        !           495:   /* First try to decide what to do without reference to lookahead token.  */
        !           496: 
        !           497:   yyn = yypact[yystate];
        !           498:   if (yyn == YYFLAG)
        !           499:     goto yydefault;
        !           500: 
        !           501:   /* Not known => get a lookahead token if don't already have one.  */
        !           502: 
        !           503:   /* yychar is either YYEMPTY or YYEOF
        !           504:      or a valid token in external form.  */
        !           505: 
        !           506:   if (yychar == YYEMPTY)
        !           507:     {
        !           508: #ifdef YYDEBUG
        !           509:       if (yydebug)
        !           510:        fprintf(stderr, "Reading a token: ");
        !           511: #endif
        !           512:       yychar = YYLEX;
        !           513:     }
        !           514: 
        !           515:   /* Convert token to internal form (in yychar1) for indexing tables with */
        !           516: 
        !           517:   if (yychar <= 0)             /* This means end of input. */
        !           518:     {
        !           519:       yychar1 = 0;
        !           520:       yychar = YYEOF;          /* Don't call YYLEX any more */
        !           521: 
        !           522: #ifdef YYDEBUG
        !           523:       if (yydebug)
        !           524:        fprintf(stderr, "Now at end of input.\n");
        !           525: #endif
        !           526:     }
        !           527:   else
        !           528:     {
        !           529:       yychar1 = YYTRANSLATE(yychar);
        !           530: 
        !           531: #ifdef YYDEBUG
        !           532:       if (yydebug)
        !           533:        fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
        !           534: #endif
        !           535:     }
        !           536: 
        !           537:   yyn += yychar1;
        !           538:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
        !           539:     goto yydefault;
        !           540: 
        !           541:   yyn = yytable[yyn];
        !           542: 
        !           543:   /* yyn is what to do for this token type in this state.
        !           544:      Negative => reduce, -yyn is rule number.
        !           545:      Positive => shift, yyn is new state.
        !           546:        New state is final state => don't bother to shift,
        !           547:        just return success.
        !           548:      0, or most negative number => error.  */
        !           549: 
        !           550:   if (yyn < 0)
        !           551:     {
        !           552:       if (yyn == YYFLAG)
        !           553:        goto yyerrlab;
        !           554:       yyn = -yyn;
        !           555:       goto yyreduce;
        !           556:     }
        !           557:   else if (yyn == 0)
        !           558:     goto yyerrlab;
        !           559: 
        !           560:   if (yyn == YYFINAL)
        !           561:     YYACCEPT;
        !           562: 
        !           563:   /* Shift the lookahead token.  */
        !           564: 
        !           565: #ifdef YYDEBUG
        !           566:   if (yydebug)
        !           567:     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
        !           568: #endif
        !           569: 
        !           570:   /* Discard the token being shifted unless it is eof.  */
        !           571:   if (yychar != YYEOF)
        !           572:     yychar = YYEMPTY;
        !           573: 
        !           574:   *++yyvsp = yylval;
        !           575: #ifdef YYLSP_NEEDED
        !           576:   *++yylsp = yylloc;
        !           577: #endif
        !           578: 
        !           579:   /* count tokens shifted since error; after three, turn off error status.  */
        !           580:   if (yyerrstatus) yyerrstatus--;
        !           581: 
        !           582:   yystate = yyn;
        !           583:   goto yynewstate;
        !           584: 
        !           585: /* Do the default action for the current state.  */
        !           586: yydefault:
        !           587: 
        !           588:   yyn = yydefact[yystate];
        !           589:   if (yyn == 0)
        !           590:     goto yyerrlab;
        !           591: 
        !           592: /* Do a reduction.  yyn is the number of a rule to reduce with.  */
        !           593: yyreduce:
        !           594:   yylen = yyr2[yyn];
        !           595:   yyval = yyvsp[1-yylen]; /* implement default value of the action */
        !           596: 
        !           597: #ifdef YYDEBUG
        !           598:   if (yydebug)
        !           599:     {
        !           600:       if (yylen == 1)
        !           601:        fprintf (stderr, "Reducing 1 value via line %d, ",
        !           602:                 yyrline[yyn]);
        !           603:       else
        !           604:        fprintf (stderr, "Reducing %d values via line %d, ",
        !           605:                 yylen, yyrline[yyn]);
        !           606:     }
        !           607: #endif
        !           608: 
        !           609: 
        !           610:   switch (yyn) {
        !           611: 
        !           612: case 1:
        !           613: #line 155 "cexp.y"
        !           614: { expression_value = yyvsp[0].lval; ;
        !           615:     break;}
        !           616: case 3:
        !           617: #line 161 "cexp.y"
        !           618: { yyval.lval = yyvsp[0].lval; ;
        !           619:     break;}
        !           620: case 4:
        !           621: #line 166 "cexp.y"
        !           622: { yyval.lval = - yyvsp[0].lval; ;
        !           623:     break;}
        !           624: case 5:
        !           625: #line 168 "cexp.y"
        !           626: { yyval.lval = ! yyvsp[0].lval; ;
        !           627:     break;}
        !           628: case 6:
        !           629: #line 170 "cexp.y"
        !           630: { yyval.lval = ~ yyvsp[0].lval; ;
        !           631:     break;}
        !           632: case 7:
        !           633: #line 172 "cexp.y"
        !           634: { yyval.lval = yyvsp[-1].lval; ;
        !           635:     break;}
        !           636: case 8:
        !           637: #line 177 "cexp.y"
        !           638: { yyval.lval = yyvsp[-2].lval * yyvsp[0].lval; ;
        !           639:     break;}
        !           640: case 9:
        !           641: #line 179 "cexp.y"
        !           642: { yyval.lval = yyvsp[-2].lval / yyvsp[0].lval; ;
        !           643:     break;}
        !           644: case 10:
        !           645: #line 181 "cexp.y"
        !           646: { yyval.lval = yyvsp[-2].lval % yyvsp[0].lval; ;
        !           647:     break;}
        !           648: case 11:
        !           649: #line 183 "cexp.y"
        !           650: { yyval.lval = yyvsp[-2].lval + yyvsp[0].lval; ;
        !           651:     break;}
        !           652: case 12:
        !           653: #line 185 "cexp.y"
        !           654: { yyval.lval = yyvsp[-2].lval - yyvsp[0].lval; ;
        !           655:     break;}
        !           656: case 13:
        !           657: #line 187 "cexp.y"
        !           658: { yyval.lval = yyvsp[-2].lval << yyvsp[0].lval; ;
        !           659:     break;}
        !           660: case 14:
        !           661: #line 189 "cexp.y"
        !           662: { yyval.lval = yyvsp[-2].lval >> yyvsp[0].lval; ;
        !           663:     break;}
        !           664: case 15:
        !           665: #line 191 "cexp.y"
        !           666: { yyval.lval = (yyvsp[-2].lval == yyvsp[0].lval); ;
        !           667:     break;}
        !           668: case 16:
        !           669: #line 193 "cexp.y"
        !           670: { yyval.lval = (yyvsp[-2].lval != yyvsp[0].lval); ;
        !           671:     break;}
        !           672: case 17:
        !           673: #line 195 "cexp.y"
        !           674: { yyval.lval = (yyvsp[-2].lval <= yyvsp[0].lval); ;
        !           675:     break;}
        !           676: case 18:
        !           677: #line 197 "cexp.y"
        !           678: { yyval.lval = (yyvsp[-2].lval >= yyvsp[0].lval); ;
        !           679:     break;}
        !           680: case 19:
        !           681: #line 199 "cexp.y"
        !           682: { yyval.lval = (yyvsp[-2].lval < yyvsp[0].lval); ;
        !           683:     break;}
        !           684: case 20:
        !           685: #line 201 "cexp.y"
        !           686: { yyval.lval = (yyvsp[-2].lval > yyvsp[0].lval); ;
        !           687:     break;}
        !           688: case 21:
        !           689: #line 203 "cexp.y"
        !           690: { yyval.lval = (yyvsp[-2].lval & yyvsp[0].lval); ;
        !           691:     break;}
        !           692: case 22:
        !           693: #line 205 "cexp.y"
        !           694: { yyval.lval = (yyvsp[-2].lval ^ yyvsp[0].lval); ;
        !           695:     break;}
        !           696: case 23:
        !           697: #line 207 "cexp.y"
        !           698: { yyval.lval = (yyvsp[-2].lval | yyvsp[0].lval); ;
        !           699:     break;}
        !           700: case 24:
        !           701: #line 209 "cexp.y"
        !           702: { yyval.lval = (yyvsp[-2].lval && yyvsp[0].lval); ;
        !           703:     break;}
        !           704: case 25:
        !           705: #line 211 "cexp.y"
        !           706: { yyval.lval = (yyvsp[-2].lval || yyvsp[0].lval); ;
        !           707:     break;}
        !           708: case 26:
        !           709: #line 213 "cexp.y"
        !           710: { yyval.lval = yyvsp[-4].lval ? yyvsp[-2].lval : yyvsp[0].lval; ;
        !           711:     break;}
        !           712: case 27:
        !           713: #line 215 "cexp.y"
        !           714: { yyval.lval = yylval.lval; ;
        !           715:     break;}
        !           716: case 28:
        !           717: #line 217 "cexp.y"
        !           718: { yyval.lval = yylval.lval; ;
        !           719:     break;}
        !           720: case 29:
        !           721: #line 219 "cexp.y"
        !           722: { yyval.lval = 0; ;
        !           723:     break;}
        !           724: }
        !           725:    /* the action file gets copied in in place of this dollarsign */
        !           726: #line 303 "bison.simple"
        !           727: 
        !           728:   yyvsp -= yylen;
        !           729:   yyssp -= yylen;
        !           730: #ifdef YYLSP_NEEDED
        !           731:   yylsp -= yylen;
        !           732: #endif
        !           733: 
        !           734: #ifdef YYDEBUG
        !           735:   if (yydebug)
        !           736:     {
        !           737:       short *ssp1 = yyss - 1;
        !           738:       fprintf (stderr, "state stack now", yyssp-yyss);
        !           739:       while (ssp1 != yyssp)
        !           740:        fprintf (stderr, " %d", *++ssp1);
        !           741:       fprintf (stderr, "\n");
        !           742:     }
        !           743: #endif
        !           744: 
        !           745:   *++yyvsp = yyval;
        !           746: 
        !           747: #ifdef YYLSP_NEEDED
        !           748:   yylsp++;
        !           749:   if (yylen == 0)
        !           750:     {
        !           751:       yylsp->first_line = yylloc.first_line;
        !           752:       yylsp->first_column = yylloc.first_column;
        !           753:       yylsp->last_line = (yylsp-1)->last_line;
        !           754:       yylsp->last_column = (yylsp-1)->last_column;
        !           755:       yylsp->text = 0;
        !           756:     }
        !           757:   else
        !           758:     {
        !           759:       yylsp->last_line = (yylsp+yylen-1)->last_line;
        !           760:       yylsp->last_column = (yylsp+yylen-1)->last_column;
        !           761:     }
        !           762: #endif
        !           763: 
        !           764:   /* Now "shift" the result of the reduction.
        !           765:      Determine what state that goes to,
        !           766:      based on the state we popped back to
        !           767:      and the rule number reduced by.  */
        !           768: 
        !           769:   yyn = yyr1[yyn];
        !           770: 
        !           771:   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
        !           772:   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
        !           773:     yystate = yytable[yystate];
        !           774:   else
        !           775:     yystate = yydefgoto[yyn - YYNTBASE];
        !           776: 
        !           777:   goto yynewstate;
        !           778: 
        !           779: yyerrlab:   /* here on detecting error */
        !           780: 
        !           781:   if (! yyerrstatus)
        !           782:     /* If not already recovering from an error, report this error.  */
        !           783:     {
        !           784:       ++yynerr;
        !           785:       yyerror("parse error");
        !           786:     }
        !           787: 
        !           788:   if (yyerrstatus == 3)
        !           789:     {
        !           790:       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
        !           791: 
        !           792:       /* return failure if at end of input */
        !           793:       if (yychar == YYEOF)
        !           794:        YYERROR;
        !           795: 
        !           796: #ifdef YYDEBUG
        !           797:       if (yydebug)
        !           798:        fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
        !           799: #endif
        !           800: 
        !           801:       yychar = YYEMPTY;
        !           802:     }
        !           803: 
        !           804:   /* Else will try to reuse lookahead token
        !           805:      after shifting the error token.  */
        !           806: 
        !           807:   yyerrstatus = 3;             /* Each real token shifted decrements this */
        !           808: 
        !           809:   goto yyerrhandle;
        !           810: 
        !           811: yyerrdefault:  /* current state does not do anything special for the error token. */
        !           812: 
        !           813: #if 0
        !           814:   /* This is wrong; only states that explicitly want error tokens
        !           815:      should shift them.  */
        !           816:   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
        !           817:   if (yyn) goto yydefault;
        !           818: #endif
        !           819: 
        !           820: yyerrpop:   /* pop the current state because it cannot handle the error token */
        !           821: 
        !           822:   if (yyssp == yyss) YYERROR;
        !           823:   yyvsp--;
        !           824:   yystate = *--yyssp;
        !           825: #ifdef YYLSP_NEEDED
        !           826:   yylsp--;
        !           827: #endif
        !           828: 
        !           829: #ifdef YYDEBUG
        !           830:   if (yydebug)
        !           831:     {
        !           832:       short *ssp1 = yyss - 1;
        !           833:       fprintf (stderr, "Error: state stack now", yyssp-yyss);
        !           834:       while (ssp1 != yyssp)
        !           835:        fprintf (stderr, " %d", *++ssp1);
        !           836:       fprintf (stderr, "\n");
        !           837:     }
        !           838: #endif
        !           839: 
        !           840: yyerrhandle:
        !           841: 
        !           842:   yyn = yypact[yystate];
        !           843:   if (yyn == YYFLAG)
        !           844:     goto yyerrdefault;
        !           845: 
        !           846:   yyn += YYTERROR;
        !           847:   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
        !           848:     goto yyerrdefault;
        !           849: 
        !           850:   yyn = yytable[yyn];
        !           851:   if (yyn < 0)
        !           852:     {
        !           853:       if (yyn == YYFLAG)
        !           854:        goto yyerrpop;
        !           855:       yyn = -yyn;
        !           856:       goto yyreduce;
        !           857:     }
        !           858:   else if (yyn == 0)
        !           859:     goto yyerrpop;
        !           860: 
        !           861:   if (yyn == YYFINAL)
        !           862:     YYACCEPT;
        !           863: 
        !           864: #ifdef YYDEBUG
        !           865:   if (yydebug)
        !           866:     fprintf(stderr, "Shifting error token, ");
        !           867: #endif
        !           868: 
        !           869:   *++yyvsp = yylval;
        !           870: #ifdef YYLSP_NEEDED
        !           871:   *++yylsp = yylloc;
        !           872: #endif
        !           873: 
        !           874:   yystate = yyn;
        !           875:   goto yynewstate;
        !           876: }
        !           877: #line 221 "cexp.y"
        !           878: 
        !           879: 
        !           880: /* During parsing of a C expression, the pointer to the next character
        !           881:    is in this variable.  */
        !           882: 
        !           883: static char *lexptr;
        !           884: 
        !           885: /* Take care of parsing a number (anything that starts with a digit).
        !           886:    Set yylval and return the token type; update lexptr.
        !           887:    LEN is the number of characters in it.  */
        !           888: 
        !           889: /* maybe needs to actually deal with floating point numbers */
        !           890: 
        !           891: static int
        !           892: parse_number (olen)
        !           893:      int olen;
        !           894: {
        !           895:   register char *p = lexptr;
        !           896:   register long n = 0;
        !           897:   register int c;
        !           898:   register int base = 10;
        !           899:   register len = olen;
        !           900:   char *err_copy;
        !           901: 
        !           902:   extern double atof ();
        !           903: 
        !           904:   for (c = 0; c < len; c++)
        !           905:     if (p[c] == '.') {
        !           906:       /* It's a float since it contains a point.  */
        !           907:       yyerror ("floating point numbers not allowed in #if expressions");
        !           908:       return ERROR;
        !           909:       
        !           910: /* ****************
        !           911:         yylval.dval = atof (p);
        !           912:         lexptr += len;
        !           913:         return FLOAT;
        !           914:                 ****************  */
        !           915:     }
        !           916:   
        !           917:   if (len >= 3 && (!strncmp (p, "0x", 2) || !strncmp (p, "0X", 2))) {
        !           918:     p += 2;
        !           919:     base = 16;
        !           920:     len -= 2;
        !           921:   }
        !           922:   else if (*p == '0')
        !           923:     base = 8;
        !           924:   
        !           925:   while (len-- > 0) {
        !           926:     c = *p++;
        !           927:     n *= base;
        !           928:     if (c >= '0' && c <= '9')
        !           929:       n += c - '0';
        !           930:     else {
        !           931:       if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
        !           932:       if (base == 16 && c >= 'a' && c <= 'f')
        !           933:        n += c - 'a' + 10;
        !           934:       else if (len == 0 && c == 'l')
        !           935:        ;
        !           936:       else {
        !           937:        yyerror ("Invalid number in #if expression");
        !           938:        return ERROR;
        !           939:       }
        !           940:     }
        !           941:   }
        !           942: 
        !           943:   lexptr = p;
        !           944:   yylval.lval = n;
        !           945:   return INT;
        !           946: }
        !           947: 
        !           948: struct token {
        !           949:   char *operator;
        !           950:   int token;
        !           951: };
        !           952: 
        !           953: #define NULL 0
        !           954: 
        !           955: static struct token tokentab2[] = {
        !           956:   {"&&", AND},
        !           957:   {"||", OR},
        !           958:   {"<<", LSH},
        !           959:   {">>", RSH},
        !           960:   {"==", EQUAL},
        !           961:   {"!=", NOTEQUAL},
        !           962:   {"<=", LEQ},
        !           963:   {">=", GEQ},
        !           964:   {NULL, ERROR}
        !           965: };
        !           966: 
        !           967: /* Read one token, getting characters through lexptr.  */
        !           968: 
        !           969: static int
        !           970: yylex ()
        !           971: {
        !           972:   register int c;
        !           973:   register int namelen;
        !           974:   register char *tokstart;
        !           975:   register struct token *toktab;
        !           976: 
        !           977:  retry:
        !           978: 
        !           979:   tokstart = lexptr;
        !           980:   c = *tokstart;
        !           981:   /* See if it is a special token of length 2.  */
        !           982:   for (toktab = tokentab2; toktab->operator != NULL; toktab++)
        !           983:     if (c == *toktab->operator && tokstart[1] == toktab->operator[1]) {
        !           984:       lexptr += 2;
        !           985:       return toktab->token;
        !           986:     }
        !           987: 
        !           988:   switch (c) {
        !           989:   case 0:
        !           990:     return 0;
        !           991:     
        !           992:   case ' ':
        !           993:   case '\t':
        !           994:   case '\n':
        !           995:     lexptr++;
        !           996:     goto retry;
        !           997:     
        !           998:   case '\'':
        !           999:     lexptr++;
        !          1000:     c = *lexptr++;
        !          1001:     if (c == '\\')
        !          1002:       c = parse_escape (&lexptr);
        !          1003:     yylval.lval = c;
        !          1004:     c = *lexptr++;
        !          1005:     if (c != '\'') {
        !          1006:       yyerror ("Invalid character constant in #if");
        !          1007:       return ERROR;
        !          1008:     }
        !          1009:     
        !          1010:     return CHAR;
        !          1011: 
        !          1012:     /* some of these chars are invalid in constant expressions;
        !          1013:        maybe do something about them later */
        !          1014:   case '/':
        !          1015:   case '+':
        !          1016:   case '-':
        !          1017:   case '*':
        !          1018:   case '%':
        !          1019:   case '|':
        !          1020:   case '&':
        !          1021:   case '^':
        !          1022:   case '~':
        !          1023:   case '!':
        !          1024:   case '@':
        !          1025:   case '<':
        !          1026:   case '>':
        !          1027:   case '(':
        !          1028:   case ')':
        !          1029:   case '[':
        !          1030:   case ']':
        !          1031:   case '.':
        !          1032:   case '?':
        !          1033:   case ':':
        !          1034:   case '=':
        !          1035:   case '{':
        !          1036:   case '}':
        !          1037:   case ',':
        !          1038:     lexptr++;
        !          1039:     return c;
        !          1040:     
        !          1041:   case '"':
        !          1042:     yyerror ("double quoted strings not allowed in #if expressions");
        !          1043:     return ERROR;
        !          1044:   }
        !          1045:   if (c >= '0' && c <= '9') {
        !          1046:     /* It's a number */
        !          1047:     for (namelen = 0;
        !          1048:         c = tokstart[namelen], is_idchar[c] || c == '.'; 
        !          1049:         namelen++)
        !          1050:       ;
        !          1051:     return parse_number (namelen);
        !          1052:   }
        !          1053:   
        !          1054:   if (!is_idstart[c]) {
        !          1055:     yyerror ("Invalid token in expression");
        !          1056:     return ERROR;
        !          1057:   }
        !          1058:   
        !          1059:   /* It is a name.  See how long it is.  */
        !          1060:   
        !          1061:   for (namelen = 0; is_idchar[tokstart[namelen]]; namelen++)
        !          1062:     ;
        !          1063:   
        !          1064:   lexptr += namelen;
        !          1065:   return NAME;
        !          1066: }
        !          1067: 
        !          1068: 
        !          1069: /* Parse a C escape sequence.  STRING_PTR points to a variable
        !          1070:    containing a pointer to the string to parse.  That pointer
        !          1071:    is updated past the characters we use.  The value of the
        !          1072:    escape sequence is returned.
        !          1073: 
        !          1074:    A negative value means the sequence \ newline was seen,
        !          1075:    which is supposed to be equivalent to nothing at all.
        !          1076: 
        !          1077:    If \ is followed by a null character, we return a negative
        !          1078:    value and leave the string pointer pointing at the null character.
        !          1079: 
        !          1080:    If \ is followed by 000, we return 0 and leave the string pointer
        !          1081:    after the zeros.  A value of 0 does not mean end of string.  */
        !          1082: 
        !          1083: static int
        !          1084: parse_escape (string_ptr)
        !          1085:      char **string_ptr;
        !          1086: {
        !          1087:   register int c = *(*string_ptr)++;
        !          1088:   switch (c)
        !          1089:     {
        !          1090:     case 'a':
        !          1091:       return '\a';
        !          1092:     case 'b':
        !          1093:       return '\b';
        !          1094:     case 'e':
        !          1095:       return 033;
        !          1096:     case 'f':
        !          1097:       return '\f';
        !          1098:     case 'n':
        !          1099:       return '\n';
        !          1100:     case 'r':
        !          1101:       return '\r';
        !          1102:     case 't':
        !          1103:       return '\t';
        !          1104:     case 'v':
        !          1105:       return '\v';
        !          1106:     case '\n':
        !          1107:       return -2;
        !          1108:     case 0:
        !          1109:       (*string_ptr)--;
        !          1110:       return 0;
        !          1111:     case '^':
        !          1112:       c = *(*string_ptr)++;
        !          1113:       if (c == '\\')
        !          1114:        c = parse_escape (string_ptr);
        !          1115:       if (c == '?')
        !          1116:        return 0177;
        !          1117:       return (c & 0200) | (c & 037);
        !          1118:       
        !          1119:     case '0':
        !          1120:     case '1':
        !          1121:     case '2':
        !          1122:     case '3':
        !          1123:     case '4':
        !          1124:     case '5':
        !          1125:     case '6':
        !          1126:     case '7':
        !          1127:       {
        !          1128:        register int i = c - '0';
        !          1129:        register int count = 0;
        !          1130:        while (++count < 3)
        !          1131:          {
        !          1132:            if ((c = *(*string_ptr)++) >= '0' && c <= '7')
        !          1133:              {
        !          1134:                i *= 8;
        !          1135:                i += c - '0';
        !          1136:              }
        !          1137:            else
        !          1138:              {
        !          1139:                (*string_ptr)--;
        !          1140:                break;
        !          1141:              }
        !          1142:          }
        !          1143:        return i;
        !          1144:       }
        !          1145:     default:
        !          1146:       return c;
        !          1147:     }
        !          1148: }
        !          1149: 
        !          1150: static
        !          1151: yyerror (s)
        !          1152:      char *s;
        !          1153: {
        !          1154:   error (s);
        !          1155:   longjmp (parse_return_error, 1);
        !          1156: }
        !          1157: 
        !          1158: /* This page contains the entry point to this file.  */
        !          1159: 
        !          1160: /* Parse STRING as an expression, and complain if this fails
        !          1161:    to use up all of the contents of STRING.  */
        !          1162: /* We do not support C comments.  They should be removed before
        !          1163:    this function is called.  */
        !          1164: 
        !          1165: int
        !          1166: parse_c_expression (string)
        !          1167:      char *string;
        !          1168: {
        !          1169:   lexptr = string;
        !          1170:   
        !          1171:   if (lexptr == 0 || *lexptr == 0) {
        !          1172:     error ("empty #if expression");
        !          1173:     return 0;                  /* don't include the #if group */
        !          1174:   }
        !          1175: 
        !          1176:   /* if there is some sort of scanning error, just return 0 and assume
        !          1177:      the parsing routine has printed an error message somewhere.
        !          1178:      there is surely a better thing to do than this.     */
        !          1179:   if (setjmp(parse_return_error))
        !          1180:     return 0;
        !          1181: 
        !          1182:   if (yyparse ())
        !          1183:     return 0;                  /* actually this is never reached
        !          1184:                                   the way things stand. */
        !          1185:   if (*lexptr)
        !          1186:     error ("Junk after end of expression.");
        !          1187: 
        !          1188:   return expression_value;     /* set by yyparse() */
        !          1189: }
        !          1190: 
        !          1191: #ifdef TEST_EXP_READER
        !          1192: /* main program, for testing purposes. */
        !          1193: main()
        !          1194: {
        !          1195:   int n;
        !          1196:   char buf[1024];
        !          1197:   extern int yydebug;
        !          1198: /*
        !          1199:   yydebug = 1;
        !          1200: */
        !          1201:   initialize_random_junk ();
        !          1202: 
        !          1203:   for (;;) {
        !          1204:     printf("enter expression: ");
        !          1205:     n = 0;
        !          1206:     while ((buf[n] = getchar()) != '\n')
        !          1207:       n++;
        !          1208:     buf[n] = '\0';
        !          1209:     printf("parser returned %d\n", parse_c_expression(buf));
        !          1210:   }
        !          1211: }
        !          1212: 
        !          1213: /* table to tell if char can be part of a C identifier. */
        !          1214: char is_idchar[256];
        !          1215: /* table to tell if char can be first char of a c identifier. */
        !          1216: char is_idstart[256];
        !          1217: /* table to tell if c is horizontal space.  isspace() thinks that
        !          1218:    newline is space; this is not a good idea for this program. */
        !          1219: char is_hor_space[256];
        !          1220: 
        !          1221: /*
        !          1222:  * initialize random junk in the hash table and maybe other places
        !          1223:  */
        !          1224: initialize_random_junk()
        !          1225: {
        !          1226:   register int i;
        !          1227: 
        !          1228:   /*
        !          1229:    * Set up is_idchar and is_idstart tables.  These should be
        !          1230:    * faster than saying (is_alpha(c) || c == '_'), etc.
        !          1231:    * Must do set up these things before calling any routines tthat
        !          1232:    * refer to them.
        !          1233:    */
        !          1234:   for (i = 'a'; i <= 'z'; i++) {
        !          1235:     ++is_idchar[i - 'a' + 'A'];
        !          1236:     ++is_idchar[i];
        !          1237:     ++is_idstart[i - 'a' + 'A'];
        !          1238:     ++is_idstart[i];
        !          1239:   }
        !          1240:   for (i = '0'; i <= '9'; i++)
        !          1241:     ++is_idchar[i];
        !          1242:   ++is_idchar['_'];
        !          1243:   ++is_idstart['_'];
        !          1244: #ifdef DOLLARS_IN_IDENTIFIERS
        !          1245:   ++is_idchar['$'];
        !          1246:   ++is_idstart['$'];
        !          1247: #endif
        !          1248: 
        !          1249:   /* horizontal space table */
        !          1250:   ++is_hor_space[' '];
        !          1251:   ++is_hor_space['\t'];
        !          1252: }
        !          1253: 
        !          1254: error (msg)
        !          1255: {
        !          1256:   printf("error: %s\n", msg);
        !          1257: }
        !          1258: #endif

unix.superglobalmegacorp.com

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