1*7c478bd9Sstevel@tonic-gate/* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate/* 23*7c478bd9Sstevel@tonic-gate * Copyright 1993 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate/* Copyright (c) 1988 AT&T */ 28*7c478bd9Sstevel@tonic-gate/* All Rights Reserved */ 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate#pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate/* 33*7c478bd9Sstevel@tonic-gate** Skeleton parser driver for yacc output 34*7c478bd9Sstevel@tonic-gate*/ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate/* 37*7c478bd9Sstevel@tonic-gate** yacc user known macros and defines 38*7c478bd9Sstevel@tonic-gate*/ 39*7c478bd9Sstevel@tonic-gate#define YYERROR goto yyerrlab 40*7c478bd9Sstevel@tonic-gate#define YYACCEPT return(0) 41*7c478bd9Sstevel@tonic-gate#define YYABORT return(1) 42*7c478bd9Sstevel@tonic-gate#define YYBACKUP( newtoken, newvalue )\ 43*7c478bd9Sstevel@tonic-gate{\ 44*7c478bd9Sstevel@tonic-gate if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ 45*7c478bd9Sstevel@tonic-gate {\ 46*7c478bd9Sstevel@tonic-gate yyerror( "syntax error - cannot backup" );\ 47*7c478bd9Sstevel@tonic-gate goto yyerrlab;\ 48*7c478bd9Sstevel@tonic-gate }\ 49*7c478bd9Sstevel@tonic-gate yychar = newtoken;\ 50*7c478bd9Sstevel@tonic-gate yystate = *yyps;\ 51*7c478bd9Sstevel@tonic-gate yylval = newvalue;\ 52*7c478bd9Sstevel@tonic-gate goto yynewstate;\ 53*7c478bd9Sstevel@tonic-gate} 54*7c478bd9Sstevel@tonic-gate#define YYRECOVERING() (!!yyerrflag) 55*7c478bd9Sstevel@tonic-gate#define YYNEW(type) malloc(sizeof(type) * yynewmax) 56*7c478bd9Sstevel@tonic-gate#define YYCOPY(to, from, type) \ 57*7c478bd9Sstevel@tonic-gate (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) 58*7c478bd9Sstevel@tonic-gate#define YYENLARGE( from, type) \ 59*7c478bd9Sstevel@tonic-gate (type *) realloc((char *) from, yynewmax * sizeof(type)) 60*7c478bd9Sstevel@tonic-gate#ifndef YYDEBUG 61*7c478bd9Sstevel@tonic-gate# define YYDEBUG 1 /* make debugging available */ 62*7c478bd9Sstevel@tonic-gate#endif 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate/* 65*7c478bd9Sstevel@tonic-gate** user known globals 66*7c478bd9Sstevel@tonic-gate*/ 67*7c478bd9Sstevel@tonic-gateint yydebug; /* set to 1 to get debugging */ 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate/* 70*7c478bd9Sstevel@tonic-gate** driver internal defines 71*7c478bd9Sstevel@tonic-gate*/ 72*7c478bd9Sstevel@tonic-gate#define YYFLAG (-10000000) 73*7c478bd9Sstevel@tonic-gate 74*7c478bd9Sstevel@tonic-gate/* 75*7c478bd9Sstevel@tonic-gate** global variables used by the parser 76*7c478bd9Sstevel@tonic-gate*/ 77*7c478bd9Sstevel@tonic-gateYYSTYPE *yypv; /* top of value stack */ 78*7c478bd9Sstevel@tonic-gateint *yyps; /* top of state stack */ 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gateint yystate; /* current state */ 81*7c478bd9Sstevel@tonic-gateint yytmp; /* extra var (lasts between blocks) */ 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gateint yynerrs; /* number of errors */ 84*7c478bd9Sstevel@tonic-gateint yyerrflag; /* error recovery flag */ 85*7c478bd9Sstevel@tonic-gateint yychar; /* current input token number */ 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate#ifdef YYNMBCHARS 90*7c478bd9Sstevel@tonic-gate#define YYLEX() yycvtok(yylex()) 91*7c478bd9Sstevel@tonic-gate/* 92*7c478bd9Sstevel@tonic-gate** yycvtok - return a token if i is a wchar_t value that exceeds 255. 93*7c478bd9Sstevel@tonic-gate** If i<255, i itself is the token. If i>255 but the neither 94*7c478bd9Sstevel@tonic-gate** of the 30th or 31st bit is on, i is already a token. 95*7c478bd9Sstevel@tonic-gate*/ 96*7c478bd9Sstevel@tonic-gate#if defined(__STDC__) || defined(__cplusplus) 97*7c478bd9Sstevel@tonic-gateint yycvtok(int i) 98*7c478bd9Sstevel@tonic-gate#else 99*7c478bd9Sstevel@tonic-gateint yycvtok(i) int i; 100*7c478bd9Sstevel@tonic-gate#endif 101*7c478bd9Sstevel@tonic-gate{ 102*7c478bd9Sstevel@tonic-gate int first = 0; 103*7c478bd9Sstevel@tonic-gate int last = YYNMBCHARS - 1; 104*7c478bd9Sstevel@tonic-gate int mid; 105*7c478bd9Sstevel@tonic-gate wchar_t j; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate if(i&0x60000000){/*Must convert to a token. */ 108*7c478bd9Sstevel@tonic-gate if( yymbchars[last].character < i ){ 109*7c478bd9Sstevel@tonic-gate return i;/*Giving up*/ 110*7c478bd9Sstevel@tonic-gate } 111*7c478bd9Sstevel@tonic-gate while ((last>=first)&&(first>=0)) {/*Binary search loop*/ 112*7c478bd9Sstevel@tonic-gate mid = (first+last)/2; 113*7c478bd9Sstevel@tonic-gate j = yymbchars[mid].character; 114*7c478bd9Sstevel@tonic-gate if( j==i ){/*Found*/ 115*7c478bd9Sstevel@tonic-gate return yymbchars[mid].tvalue; 116*7c478bd9Sstevel@tonic-gate }else if( j<i ){ 117*7c478bd9Sstevel@tonic-gate first = mid + 1; 118*7c478bd9Sstevel@tonic-gate }else{ 119*7c478bd9Sstevel@tonic-gate last = mid -1; 120*7c478bd9Sstevel@tonic-gate } 121*7c478bd9Sstevel@tonic-gate } 122*7c478bd9Sstevel@tonic-gate /*No entry in the table.*/ 123*7c478bd9Sstevel@tonic-gate return i;/* Giving up.*/ 124*7c478bd9Sstevel@tonic-gate }else{/* i is already a token. */ 125*7c478bd9Sstevel@tonic-gate return i; 126*7c478bd9Sstevel@tonic-gate } 127*7c478bd9Sstevel@tonic-gate} 128*7c478bd9Sstevel@tonic-gate#else/*!YYNMBCHARS*/ 129*7c478bd9Sstevel@tonic-gate#define YYLEX() yylex() 130*7c478bd9Sstevel@tonic-gate#endif/*!YYNMBCHARS*/ 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate/* 133*7c478bd9Sstevel@tonic-gate** yyparse - return 0 if worked, 1 if syntax error not recovered from 134*7c478bd9Sstevel@tonic-gate*/ 135*7c478bd9Sstevel@tonic-gate#if defined(__STDC__) || defined(__cplusplus) 136*7c478bd9Sstevel@tonic-gateint yyparse(void) 137*7c478bd9Sstevel@tonic-gate#else 138*7c478bd9Sstevel@tonic-gateint yyparse() 139*7c478bd9Sstevel@tonic-gate#endif 140*7c478bd9Sstevel@tonic-gate{ 141*7c478bd9Sstevel@tonic-gate register YYSTYPE *yypvt = 0; /* top of value stack for $vars */ 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate#if defined(__cplusplus) || defined(lint) 144*7c478bd9Sstevel@tonic-gate/* 145*7c478bd9Sstevel@tonic-gate hacks to please C++ and lint - goto's inside 146*7c478bd9Sstevel@tonic-gate switch should never be executed 147*7c478bd9Sstevel@tonic-gate*/ 148*7c478bd9Sstevel@tonic-gate static int __yaccpar_lint_hack__ = 0; 149*7c478bd9Sstevel@tonic-gate switch (__yaccpar_lint_hack__) 150*7c478bd9Sstevel@tonic-gate { 151*7c478bd9Sstevel@tonic-gate case 1: goto yyerrlab; 152*7c478bd9Sstevel@tonic-gate case 2: goto yynewstate; 153*7c478bd9Sstevel@tonic-gate } 154*7c478bd9Sstevel@tonic-gate#endif 155*7c478bd9Sstevel@tonic-gate 156*7c478bd9Sstevel@tonic-gate /* 157*7c478bd9Sstevel@tonic-gate ** Initialize externals - yyparse may be called more than once 158*7c478bd9Sstevel@tonic-gate */ 159*7c478bd9Sstevel@tonic-gate yypv = &yyv[-1]; 160*7c478bd9Sstevel@tonic-gate yyps = &yys[-1]; 161*7c478bd9Sstevel@tonic-gate yystate = 0; 162*7c478bd9Sstevel@tonic-gate yytmp = 0; 163*7c478bd9Sstevel@tonic-gate yynerrs = 0; 164*7c478bd9Sstevel@tonic-gate yyerrflag = 0; 165*7c478bd9Sstevel@tonic-gate yychar = -1; 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate#if YYMAXDEPTH <= 0 168*7c478bd9Sstevel@tonic-gate if (yymaxdepth <= 0) 169*7c478bd9Sstevel@tonic-gate { 170*7c478bd9Sstevel@tonic-gate if ((yymaxdepth = YYEXPAND(0)) <= 0) 171*7c478bd9Sstevel@tonic-gate { 172*7c478bd9Sstevel@tonic-gate yyerror("yacc initialization error"); 173*7c478bd9Sstevel@tonic-gate YYABORT; 174*7c478bd9Sstevel@tonic-gate } 175*7c478bd9Sstevel@tonic-gate } 176*7c478bd9Sstevel@tonic-gate#endif 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate { 179*7c478bd9Sstevel@tonic-gate register YYSTYPE *yy_pv; /* top of value stack */ 180*7c478bd9Sstevel@tonic-gate register int *yy_ps; /* top of state stack */ 181*7c478bd9Sstevel@tonic-gate register int yy_state; /* current state */ 182*7c478bd9Sstevel@tonic-gate register int yy_n; /* internal state number info */ 183*7c478bd9Sstevel@tonic-gate goto yystack; /* moved from 6 lines above to here to please C++ */ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate /* 186*7c478bd9Sstevel@tonic-gate ** get globals into registers. 187*7c478bd9Sstevel@tonic-gate ** branch to here only if YYBACKUP was called. 188*7c478bd9Sstevel@tonic-gate */ 189*7c478bd9Sstevel@tonic-gate yynewstate: 190*7c478bd9Sstevel@tonic-gate yy_pv = yypv; 191*7c478bd9Sstevel@tonic-gate yy_ps = yyps; 192*7c478bd9Sstevel@tonic-gate yy_state = yystate; 193*7c478bd9Sstevel@tonic-gate goto yy_newstate; 194*7c478bd9Sstevel@tonic-gate 195*7c478bd9Sstevel@tonic-gate /* 196*7c478bd9Sstevel@tonic-gate ** get globals into registers. 197*7c478bd9Sstevel@tonic-gate ** either we just started, or we just finished a reduction 198*7c478bd9Sstevel@tonic-gate */ 199*7c478bd9Sstevel@tonic-gate yystack: 200*7c478bd9Sstevel@tonic-gate yy_pv = yypv; 201*7c478bd9Sstevel@tonic-gate yy_ps = yyps; 202*7c478bd9Sstevel@tonic-gate yy_state = yystate; 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate /* 205*7c478bd9Sstevel@tonic-gate ** top of for (;;) loop while no reductions done 206*7c478bd9Sstevel@tonic-gate */ 207*7c478bd9Sstevel@tonic-gate yy_stack: 208*7c478bd9Sstevel@tonic-gate /* 209*7c478bd9Sstevel@tonic-gate ** put a state and value onto the stacks 210*7c478bd9Sstevel@tonic-gate */ 211*7c478bd9Sstevel@tonic-gate#if YYDEBUG 212*7c478bd9Sstevel@tonic-gate /* 213*7c478bd9Sstevel@tonic-gate ** if debugging, look up token value in list of value vs. 214*7c478bd9Sstevel@tonic-gate ** name pairs. 0 and negative (-1) are special values. 215*7c478bd9Sstevel@tonic-gate ** Note: linear search is used since time is not a real 216*7c478bd9Sstevel@tonic-gate ** consideration while debugging. 217*7c478bd9Sstevel@tonic-gate */ 218*7c478bd9Sstevel@tonic-gate if ( yydebug ) 219*7c478bd9Sstevel@tonic-gate { 220*7c478bd9Sstevel@tonic-gate register int yy_i; 221*7c478bd9Sstevel@tonic-gate 222*7c478bd9Sstevel@tonic-gate printf( "State %d, token ", yy_state ); 223*7c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 224*7c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 225*7c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 226*7c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 227*7c478bd9Sstevel@tonic-gate else 228*7c478bd9Sstevel@tonic-gate { 229*7c478bd9Sstevel@tonic-gate for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 230*7c478bd9Sstevel@tonic-gate yy_i++ ) 231*7c478bd9Sstevel@tonic-gate { 232*7c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val == yychar ) 233*7c478bd9Sstevel@tonic-gate break; 234*7c478bd9Sstevel@tonic-gate } 235*7c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 236*7c478bd9Sstevel@tonic-gate } 237*7c478bd9Sstevel@tonic-gate } 238*7c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 239*7c478bd9Sstevel@tonic-gate if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ 240*7c478bd9Sstevel@tonic-gate { 241*7c478bd9Sstevel@tonic-gate /* 242*7c478bd9Sstevel@tonic-gate ** reallocate and recover. Note that pointers 243*7c478bd9Sstevel@tonic-gate ** have to be reset, or bad things will happen 244*7c478bd9Sstevel@tonic-gate */ 245*7c478bd9Sstevel@tonic-gate long yyps_index = (yy_ps - yys); 246*7c478bd9Sstevel@tonic-gate long yypv_index = (yy_pv - yyv); 247*7c478bd9Sstevel@tonic-gate long yypvt_index = (yypvt - yyv); 248*7c478bd9Sstevel@tonic-gate int yynewmax; 249*7c478bd9Sstevel@tonic-gate#ifdef YYEXPAND 250*7c478bd9Sstevel@tonic-gate yynewmax = YYEXPAND(yymaxdepth); 251*7c478bd9Sstevel@tonic-gate#else 252*7c478bd9Sstevel@tonic-gate yynewmax = 2 * yymaxdepth; /* double table size */ 253*7c478bd9Sstevel@tonic-gate if (yymaxdepth == YYMAXDEPTH) /* first time growth */ 254*7c478bd9Sstevel@tonic-gate { 255*7c478bd9Sstevel@tonic-gate char *newyys = (char *)YYNEW(int); 256*7c478bd9Sstevel@tonic-gate char *newyyv = (char *)YYNEW(YYSTYPE); 257*7c478bd9Sstevel@tonic-gate if (newyys != 0 && newyyv != 0) 258*7c478bd9Sstevel@tonic-gate { 259*7c478bd9Sstevel@tonic-gate yys = YYCOPY(newyys, yys, int); 260*7c478bd9Sstevel@tonic-gate yyv = YYCOPY(newyyv, yyv, YYSTYPE); 261*7c478bd9Sstevel@tonic-gate } 262*7c478bd9Sstevel@tonic-gate else 263*7c478bd9Sstevel@tonic-gate yynewmax = 0; /* failed */ 264*7c478bd9Sstevel@tonic-gate } 265*7c478bd9Sstevel@tonic-gate else /* not first time */ 266*7c478bd9Sstevel@tonic-gate { 267*7c478bd9Sstevel@tonic-gate yys = YYENLARGE(yys, int); 268*7c478bd9Sstevel@tonic-gate yyv = YYENLARGE(yyv, YYSTYPE); 269*7c478bd9Sstevel@tonic-gate if (yys == 0 || yyv == 0) 270*7c478bd9Sstevel@tonic-gate yynewmax = 0; /* failed */ 271*7c478bd9Sstevel@tonic-gate } 272*7c478bd9Sstevel@tonic-gate#endif 273*7c478bd9Sstevel@tonic-gate if (yynewmax <= yymaxdepth) /* tables not expanded */ 274*7c478bd9Sstevel@tonic-gate { 275*7c478bd9Sstevel@tonic-gate yyerror( "yacc stack overflow" ); 276*7c478bd9Sstevel@tonic-gate YYABORT; 277*7c478bd9Sstevel@tonic-gate } 278*7c478bd9Sstevel@tonic-gate yymaxdepth = yynewmax; 279*7c478bd9Sstevel@tonic-gate 280*7c478bd9Sstevel@tonic-gate yy_ps = yys + yyps_index; 281*7c478bd9Sstevel@tonic-gate yy_pv = yyv + yypv_index; 282*7c478bd9Sstevel@tonic-gate yypvt = yyv + yypvt_index; 283*7c478bd9Sstevel@tonic-gate } 284*7c478bd9Sstevel@tonic-gate *yy_ps = yy_state; 285*7c478bd9Sstevel@tonic-gate *++yy_pv = yyval; 286*7c478bd9Sstevel@tonic-gate 287*7c478bd9Sstevel@tonic-gate /* 288*7c478bd9Sstevel@tonic-gate ** we have a new state - find out what to do 289*7c478bd9Sstevel@tonic-gate */ 290*7c478bd9Sstevel@tonic-gate yy_newstate: 291*7c478bd9Sstevel@tonic-gate if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) 292*7c478bd9Sstevel@tonic-gate goto yydefault; /* simple state */ 293*7c478bd9Sstevel@tonic-gate#if YYDEBUG 294*7c478bd9Sstevel@tonic-gate /* 295*7c478bd9Sstevel@tonic-gate ** if debugging, need to mark whether new token grabbed 296*7c478bd9Sstevel@tonic-gate */ 297*7c478bd9Sstevel@tonic-gate yytmp = yychar < 0; 298*7c478bd9Sstevel@tonic-gate#endif 299*7c478bd9Sstevel@tonic-gate if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 300*7c478bd9Sstevel@tonic-gate yychar = 0; /* reached EOF */ 301*7c478bd9Sstevel@tonic-gate#if YYDEBUG 302*7c478bd9Sstevel@tonic-gate if ( yydebug && yytmp ) 303*7c478bd9Sstevel@tonic-gate { 304*7c478bd9Sstevel@tonic-gate register int yy_i; 305*7c478bd9Sstevel@tonic-gate 306*7c478bd9Sstevel@tonic-gate printf( "Received token " ); 307*7c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 308*7c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 309*7c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 310*7c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 311*7c478bd9Sstevel@tonic-gate else 312*7c478bd9Sstevel@tonic-gate { 313*7c478bd9Sstevel@tonic-gate for ( yy_i = 0; yytoks[yy_i].t_val >= 0; 314*7c478bd9Sstevel@tonic-gate yy_i++ ) 315*7c478bd9Sstevel@tonic-gate { 316*7c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val == yychar ) 317*7c478bd9Sstevel@tonic-gate break; 318*7c478bd9Sstevel@tonic-gate } 319*7c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 320*7c478bd9Sstevel@tonic-gate } 321*7c478bd9Sstevel@tonic-gate } 322*7c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 323*7c478bd9Sstevel@tonic-gate if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) 324*7c478bd9Sstevel@tonic-gate goto yydefault; 325*7c478bd9Sstevel@tonic-gate if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ 326*7c478bd9Sstevel@tonic-gate { 327*7c478bd9Sstevel@tonic-gate yychar = -1; 328*7c478bd9Sstevel@tonic-gate yyval = yylval; 329*7c478bd9Sstevel@tonic-gate yy_state = yy_n; 330*7c478bd9Sstevel@tonic-gate if ( yyerrflag > 0 ) 331*7c478bd9Sstevel@tonic-gate yyerrflag--; 332*7c478bd9Sstevel@tonic-gate goto yy_stack; 333*7c478bd9Sstevel@tonic-gate } 334*7c478bd9Sstevel@tonic-gate 335*7c478bd9Sstevel@tonic-gate yydefault: 336*7c478bd9Sstevel@tonic-gate if ( ( yy_n = yydef[ yy_state ] ) == -2 ) 337*7c478bd9Sstevel@tonic-gate { 338*7c478bd9Sstevel@tonic-gate#if YYDEBUG 339*7c478bd9Sstevel@tonic-gate yytmp = yychar < 0; 340*7c478bd9Sstevel@tonic-gate#endif 341*7c478bd9Sstevel@tonic-gate if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) 342*7c478bd9Sstevel@tonic-gate yychar = 0; /* reached EOF */ 343*7c478bd9Sstevel@tonic-gate#if YYDEBUG 344*7c478bd9Sstevel@tonic-gate if ( yydebug && yytmp ) 345*7c478bd9Sstevel@tonic-gate { 346*7c478bd9Sstevel@tonic-gate register int yy_i; 347*7c478bd9Sstevel@tonic-gate 348*7c478bd9Sstevel@tonic-gate printf( "Received token " ); 349*7c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 350*7c478bd9Sstevel@tonic-gate printf( "end-of-file\n" ); 351*7c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 352*7c478bd9Sstevel@tonic-gate printf( "-none-\n" ); 353*7c478bd9Sstevel@tonic-gate else 354*7c478bd9Sstevel@tonic-gate { 355*7c478bd9Sstevel@tonic-gate for ( yy_i = 0; 356*7c478bd9Sstevel@tonic-gate yytoks[yy_i].t_val >= 0; 357*7c478bd9Sstevel@tonic-gate yy_i++ ) 358*7c478bd9Sstevel@tonic-gate { 359*7c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val 360*7c478bd9Sstevel@tonic-gate == yychar ) 361*7c478bd9Sstevel@tonic-gate { 362*7c478bd9Sstevel@tonic-gate break; 363*7c478bd9Sstevel@tonic-gate } 364*7c478bd9Sstevel@tonic-gate } 365*7c478bd9Sstevel@tonic-gate printf( "%s\n", yytoks[yy_i].t_name ); 366*7c478bd9Sstevel@tonic-gate } 367*7c478bd9Sstevel@tonic-gate } 368*7c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 369*7c478bd9Sstevel@tonic-gate /* 370*7c478bd9Sstevel@tonic-gate ** look through exception table 371*7c478bd9Sstevel@tonic-gate */ 372*7c478bd9Sstevel@tonic-gate { 373*7c478bd9Sstevel@tonic-gate register YYCONST int *yyxi = yyexca; 374*7c478bd9Sstevel@tonic-gate 375*7c478bd9Sstevel@tonic-gate while ( ( *yyxi != -1 ) || 376*7c478bd9Sstevel@tonic-gate ( yyxi[1] != yy_state ) ) 377*7c478bd9Sstevel@tonic-gate { 378*7c478bd9Sstevel@tonic-gate yyxi += 2; 379*7c478bd9Sstevel@tonic-gate } 380*7c478bd9Sstevel@tonic-gate while ( ( *(yyxi += 2) >= 0 ) && 381*7c478bd9Sstevel@tonic-gate ( *yyxi != yychar ) ) 382*7c478bd9Sstevel@tonic-gate ; 383*7c478bd9Sstevel@tonic-gate if ( ( yy_n = yyxi[1] ) < 0 ) 384*7c478bd9Sstevel@tonic-gate YYACCEPT; 385*7c478bd9Sstevel@tonic-gate } 386*7c478bd9Sstevel@tonic-gate } 387*7c478bd9Sstevel@tonic-gate 388*7c478bd9Sstevel@tonic-gate /* 389*7c478bd9Sstevel@tonic-gate ** check for syntax error 390*7c478bd9Sstevel@tonic-gate */ 391*7c478bd9Sstevel@tonic-gate if ( yy_n == 0 ) /* have an error */ 392*7c478bd9Sstevel@tonic-gate { 393*7c478bd9Sstevel@tonic-gate /* no worry about speed here! */ 394*7c478bd9Sstevel@tonic-gate switch ( yyerrflag ) 395*7c478bd9Sstevel@tonic-gate { 396*7c478bd9Sstevel@tonic-gate case 0: /* new error */ 397*7c478bd9Sstevel@tonic-gate yyerror( "syntax error" ); 398*7c478bd9Sstevel@tonic-gate goto skip_init; 399*7c478bd9Sstevel@tonic-gate yyerrlab: 400*7c478bd9Sstevel@tonic-gate /* 401*7c478bd9Sstevel@tonic-gate ** get globals into registers. 402*7c478bd9Sstevel@tonic-gate ** we have a user generated syntax type error 403*7c478bd9Sstevel@tonic-gate */ 404*7c478bd9Sstevel@tonic-gate yy_pv = yypv; 405*7c478bd9Sstevel@tonic-gate yy_ps = yyps; 406*7c478bd9Sstevel@tonic-gate yy_state = yystate; 407*7c478bd9Sstevel@tonic-gate skip_init: 408*7c478bd9Sstevel@tonic-gate yynerrs++; 409*7c478bd9Sstevel@tonic-gate /* FALLTHRU */ 410*7c478bd9Sstevel@tonic-gate case 1: 411*7c478bd9Sstevel@tonic-gate case 2: /* incompletely recovered error */ 412*7c478bd9Sstevel@tonic-gate /* try again... */ 413*7c478bd9Sstevel@tonic-gate yyerrflag = 3; 414*7c478bd9Sstevel@tonic-gate /* 415*7c478bd9Sstevel@tonic-gate ** find state where "error" is a legal 416*7c478bd9Sstevel@tonic-gate ** shift action 417*7c478bd9Sstevel@tonic-gate */ 418*7c478bd9Sstevel@tonic-gate while ( yy_ps >= yys ) 419*7c478bd9Sstevel@tonic-gate { 420*7c478bd9Sstevel@tonic-gate yy_n = yypact[ *yy_ps ] + YYERRCODE; 421*7c478bd9Sstevel@tonic-gate if ( yy_n >= 0 && yy_n < YYLAST && 422*7c478bd9Sstevel@tonic-gate yychk[yyact[yy_n]] == YYERRCODE) { 423*7c478bd9Sstevel@tonic-gate /* 424*7c478bd9Sstevel@tonic-gate ** simulate shift of "error" 425*7c478bd9Sstevel@tonic-gate */ 426*7c478bd9Sstevel@tonic-gate yy_state = yyact[ yy_n ]; 427*7c478bd9Sstevel@tonic-gate goto yy_stack; 428*7c478bd9Sstevel@tonic-gate } 429*7c478bd9Sstevel@tonic-gate /* 430*7c478bd9Sstevel@tonic-gate ** current state has no shift on 431*7c478bd9Sstevel@tonic-gate ** "error", pop stack 432*7c478bd9Sstevel@tonic-gate */ 433*7c478bd9Sstevel@tonic-gate#if YYDEBUG 434*7c478bd9Sstevel@tonic-gate# define _POP_ "Error recovery pops state %d, uncovers state %d\n" 435*7c478bd9Sstevel@tonic-gate if ( yydebug ) 436*7c478bd9Sstevel@tonic-gate printf( _POP_, *yy_ps, 437*7c478bd9Sstevel@tonic-gate yy_ps[-1] ); 438*7c478bd9Sstevel@tonic-gate# undef _POP_ 439*7c478bd9Sstevel@tonic-gate#endif 440*7c478bd9Sstevel@tonic-gate yy_ps--; 441*7c478bd9Sstevel@tonic-gate yy_pv--; 442*7c478bd9Sstevel@tonic-gate } 443*7c478bd9Sstevel@tonic-gate /* 444*7c478bd9Sstevel@tonic-gate ** there is no state on stack with "error" as 445*7c478bd9Sstevel@tonic-gate ** a valid shift. give up. 446*7c478bd9Sstevel@tonic-gate */ 447*7c478bd9Sstevel@tonic-gate YYABORT; 448*7c478bd9Sstevel@tonic-gate case 3: /* no shift yet; eat a token */ 449*7c478bd9Sstevel@tonic-gate#if YYDEBUG 450*7c478bd9Sstevel@tonic-gate /* 451*7c478bd9Sstevel@tonic-gate ** if debugging, look up token in list of 452*7c478bd9Sstevel@tonic-gate ** pairs. 0 and negative shouldn't occur, 453*7c478bd9Sstevel@tonic-gate ** but since timing doesn't matter when 454*7c478bd9Sstevel@tonic-gate ** debugging, it doesn't hurt to leave the 455*7c478bd9Sstevel@tonic-gate ** tests here. 456*7c478bd9Sstevel@tonic-gate */ 457*7c478bd9Sstevel@tonic-gate if ( yydebug ) 458*7c478bd9Sstevel@tonic-gate { 459*7c478bd9Sstevel@tonic-gate register int yy_i; 460*7c478bd9Sstevel@tonic-gate 461*7c478bd9Sstevel@tonic-gate printf( "Error recovery discards " ); 462*7c478bd9Sstevel@tonic-gate if ( yychar == 0 ) 463*7c478bd9Sstevel@tonic-gate printf( "token end-of-file\n" ); 464*7c478bd9Sstevel@tonic-gate else if ( yychar < 0 ) 465*7c478bd9Sstevel@tonic-gate printf( "token -none-\n" ); 466*7c478bd9Sstevel@tonic-gate else 467*7c478bd9Sstevel@tonic-gate { 468*7c478bd9Sstevel@tonic-gate for ( yy_i = 0; 469*7c478bd9Sstevel@tonic-gate yytoks[yy_i].t_val >= 0; 470*7c478bd9Sstevel@tonic-gate yy_i++ ) 471*7c478bd9Sstevel@tonic-gate { 472*7c478bd9Sstevel@tonic-gate if ( yytoks[yy_i].t_val 473*7c478bd9Sstevel@tonic-gate == yychar ) 474*7c478bd9Sstevel@tonic-gate { 475*7c478bd9Sstevel@tonic-gate break; 476*7c478bd9Sstevel@tonic-gate } 477*7c478bd9Sstevel@tonic-gate } 478*7c478bd9Sstevel@tonic-gate printf( "token %s\n", 479*7c478bd9Sstevel@tonic-gate yytoks[yy_i].t_name ); 480*7c478bd9Sstevel@tonic-gate } 481*7c478bd9Sstevel@tonic-gate } 482*7c478bd9Sstevel@tonic-gate#endif /* YYDEBUG */ 483*7c478bd9Sstevel@tonic-gate if ( yychar == 0 ) /* reached EOF. quit */ 484*7c478bd9Sstevel@tonic-gate YYABORT; 485*7c478bd9Sstevel@tonic-gate yychar = -1; 486*7c478bd9Sstevel@tonic-gate goto yy_newstate; 487*7c478bd9Sstevel@tonic-gate } 488*7c478bd9Sstevel@tonic-gate }/* end if ( yy_n == 0 ) */ 489*7c478bd9Sstevel@tonic-gate /* 490*7c478bd9Sstevel@tonic-gate ** reduction by production yy_n 491*7c478bd9Sstevel@tonic-gate ** put stack tops, etc. so things right after switch 492*7c478bd9Sstevel@tonic-gate */ 493*7c478bd9Sstevel@tonic-gate#if YYDEBUG 494*7c478bd9Sstevel@tonic-gate /* 495*7c478bd9Sstevel@tonic-gate ** if debugging, print the string that is the user's 496*7c478bd9Sstevel@tonic-gate ** specification of the reduction which is just about 497*7c478bd9Sstevel@tonic-gate ** to be done. 498*7c478bd9Sstevel@tonic-gate */ 499*7c478bd9Sstevel@tonic-gate if ( yydebug ) 500*7c478bd9Sstevel@tonic-gate printf( "Reduce by (%d) \"%s\"\n", 501*7c478bd9Sstevel@tonic-gate yy_n, yyreds[ yy_n ] ); 502*7c478bd9Sstevel@tonic-gate#endif 503*7c478bd9Sstevel@tonic-gate yytmp = yy_n; /* value to switch over */ 504*7c478bd9Sstevel@tonic-gate yypvt = yy_pv; /* $vars top of value stack */ 505*7c478bd9Sstevel@tonic-gate /* 506*7c478bd9Sstevel@tonic-gate ** Look in goto table for next state 507*7c478bd9Sstevel@tonic-gate ** Sorry about using yy_state here as temporary 508*7c478bd9Sstevel@tonic-gate ** register variable, but why not, if it works... 509*7c478bd9Sstevel@tonic-gate ** If yyr2[ yy_n ] doesn't have the low order bit 510*7c478bd9Sstevel@tonic-gate ** set, then there is no action to be done for 511*7c478bd9Sstevel@tonic-gate ** this reduction. So, no saving & unsaving of 512*7c478bd9Sstevel@tonic-gate ** registers done. The only difference between the 513*7c478bd9Sstevel@tonic-gate ** code just after the if and the body of the if is 514*7c478bd9Sstevel@tonic-gate ** the goto yy_stack in the body. This way the test 515*7c478bd9Sstevel@tonic-gate ** can be made before the choice of what to do is needed. 516*7c478bd9Sstevel@tonic-gate */ 517*7c478bd9Sstevel@tonic-gate { 518*7c478bd9Sstevel@tonic-gate /* length of production doubled with extra bit */ 519*7c478bd9Sstevel@tonic-gate register int yy_len = yyr2[ yy_n ]; 520*7c478bd9Sstevel@tonic-gate 521*7c478bd9Sstevel@tonic-gate if ( !( yy_len & 01 ) ) 522*7c478bd9Sstevel@tonic-gate { 523*7c478bd9Sstevel@tonic-gate yy_len >>= 1; 524*7c478bd9Sstevel@tonic-gate yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 525*7c478bd9Sstevel@tonic-gate yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 526*7c478bd9Sstevel@tonic-gate *( yy_ps -= yy_len ) + 1; 527*7c478bd9Sstevel@tonic-gate if ( yy_state >= YYLAST || 528*7c478bd9Sstevel@tonic-gate yychk[ yy_state = 529*7c478bd9Sstevel@tonic-gate yyact[ yy_state ] ] != -yy_n ) 530*7c478bd9Sstevel@tonic-gate { 531*7c478bd9Sstevel@tonic-gate yy_state = yyact[ yypgo[ yy_n ] ]; 532*7c478bd9Sstevel@tonic-gate } 533*7c478bd9Sstevel@tonic-gate goto yy_stack; 534*7c478bd9Sstevel@tonic-gate } 535*7c478bd9Sstevel@tonic-gate yy_len >>= 1; 536*7c478bd9Sstevel@tonic-gate yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ 537*7c478bd9Sstevel@tonic-gate yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + 538*7c478bd9Sstevel@tonic-gate *( yy_ps -= yy_len ) + 1; 539*7c478bd9Sstevel@tonic-gate if ( yy_state >= YYLAST || 540*7c478bd9Sstevel@tonic-gate yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) 541*7c478bd9Sstevel@tonic-gate { 542*7c478bd9Sstevel@tonic-gate yy_state = yyact[ yypgo[ yy_n ] ]; 543*7c478bd9Sstevel@tonic-gate } 544*7c478bd9Sstevel@tonic-gate } 545*7c478bd9Sstevel@tonic-gate /* save until reenter driver code */ 546*7c478bd9Sstevel@tonic-gate yystate = yy_state; 547*7c478bd9Sstevel@tonic-gate yyps = yy_ps; 548*7c478bd9Sstevel@tonic-gate yypv = yy_pv; 549*7c478bd9Sstevel@tonic-gate } 550*7c478bd9Sstevel@tonic-gate /* 551*7c478bd9Sstevel@tonic-gate ** code supplied by user is placed in this switch 552*7c478bd9Sstevel@tonic-gate */ 553*7c478bd9Sstevel@tonic-gate switch( yytmp ) 554*7c478bd9Sstevel@tonic-gate { 555*7c478bd9Sstevel@tonic-gate $A 556*7c478bd9Sstevel@tonic-gate } 557*7c478bd9Sstevel@tonic-gate goto yystack; /* reset registers in driver code */ 558*7c478bd9Sstevel@tonic-gate} 559*7c478bd9Sstevel@tonic-gate 560