# line 2 "srdl.y" /* * Describe me. * * Mike Markowski * mm@udel.edu */ #include #include #include # line 21 "srdl.y" typedef union #ifdef __cplusplus YYSTYPE #endif { char *string; double number; } YYSTYPE; # define UMINUS 257 # define ANCHOR 258 # define AT 259 # define ATTRIBUTES 260 # define BACK 261 # define BOTTOM 262 # define CENTER 263 # define CIRCULAR 264 # define CM 265 # define COLOR 266 # define CURSOR 267 # define E 268 # define ENG 269 # define EQUATION 270 # define FALSE 271 # define FILENAME 272 # define FN 273 # define FOLD 274 # define FONT 275 # define FORMAT 276 # define FP 277 # define FRONT 278 # define GAP 279 # define INCH 280 # define INCHES 281 # define LABEL 282 # define LEFT 283 # define LENGTH 284 # define LINE 285 # define MATERIAL 286 # define MIN 287 # define MM 288 # define MORE 289 # define NOTATION 290 # define NUMBER 291 # define NUMBERLINE 292 # define ON 293 # define ONLY 294 # define PI 295 # define POSITION 296 # define RANGE 297 # define REDUCER 298 # define RIGHT 299 # define SCALE 300 # define SCIENTIFIC 301 # define SEGMENT 302 # define SLIDE 303 # define SLIDERULE 304 # define STATOR 305 # define STEP 306 # define STRAIGHT 307 # define STRING 308 # define SYMBOL 309 # define TEXT 310 # define THICKNESS 311 # define TICKS 312 # define TO 313 # define TOP 314 # define TRUE 315 # define WIDTH 316 # define ZOOM 317 #include #ifdef __STDC__ #include #include #define YYCONST const #else #include #include #define YYCONST #endif #include #if defined(__cplusplus) || defined(__STDC__) #if defined(__cplusplus) && defined(__EXTERN_C__) extern "C" { #endif #ifndef yyerror #if defined(__cplusplus) void yyerror(YYCONST char *); #endif #endif #ifndef yylex int yylex(void); #endif int yyparse(void); #if defined(__cplusplus) && defined(__EXTERN_C__) } #endif #endif #define yyclearin yychar = -1 #define yyerrok yyerrflag = 0 extern int yychar; extern int yyerrflag; YYSTYPE yylval; YYSTYPE yyval; typedef int yytabelem; #ifndef YYMAXDEPTH #define YYMAXDEPTH 150 #endif #if YYMAXDEPTH > 0 int yy_yys[YYMAXDEPTH], *yys = yy_yys; YYSTYPE yy_yyv[YYMAXDEPTH], *yyv = yy_yyv; #else /* user does initial allocation */ int *yys; YYSTYPE *yyv; #endif static int yymaxdepth = YYMAXDEPTH; # define YYERRCODE 256 # line 234 "srdl.y" static YYCONST yytabelem yyexca[] ={ -1, 1, 0, -1, -2, 0, -1, 216, 40, 111, 268, 111, 273, 111, 291, 111, 295, 111, 44, 111, -2, 106, }; # define YYNPROD 118 # define YYLAST 528 static YYCONST yytabelem yyact[]={ 225, 185, 156, 155, 213, 179, 224, 174, 175, 223, 190, 109, 210, 13, 150, 149, 107, 110, 153, 111, 12, 108, 177, 127, 180, 88, 158, 86, 85, 181, 45, 41, 182, 183, 109, 40, 157, 39, 35, 107, 110, 154, 111, 104, 108, 17, 184, 4, 212, 25, 117, 24, 186, 2, 32, 14, 159, 93, 71, 176, 75, 27, 15, 16, 109, 79, 63, 75, 112, 107, 110, 229, 195, 54, 108, 140, 70, 109, 92, 20, 75, 34, 107, 110, 217, 195, 91, 108, 28, 109, 67, 112, 75, 69, 107, 110, 58, 195, 22, 108, 124, 29, 50, 169, 75, 55, 56, 234, 122, 79, 90, 198, 30, 143, 148, 197, 31, 60, 21, 61, 59, 112, 48, 199, 62, 178, 57, 112, 141, 142, 201, 94, 51, 242, 112, 237, 144, 236, 49, 200, 53, 185, 171, 156, 155, 227, 112, 219, 185, 66, 156, 155, 215, 202, 192, 150, 165, 147, 139, 153, 126, 119, 150, 105, 180, 100, 153, 158, 99, 181, 82, 180, 182, 183, 158, 73, 181, 157, 109, 182, 183, 65, 154, 107, 157, 42, 184, 36, 108, 154, 172, 58, 186, 184, 98, 84, 115, 159, 47, 186, 55, 56, 52, 109, 159, 28, 136, 22, 107, 110, 28, 111, 60, 108, 61, 59, 58, 102, 29, 62, 46, 57, 22, 29, 118, 55, 56, 21, 70, 30, 96, 95, 220, 31, 30, 112, 70, 60, 31, 61, 59, 199, 21, 211, 62, 69, 57, 199, 201, 161, 203, 125, 162, 69, 201, 26, 87, 200, 173, 6, 112, 152, 109, 200, 167, 18, 240, 107, 110, 109, 111, 151, 108, 239, 107, 110, 166, 111, 103, 108, 68, 191, 101, 44, 109, 230, 23, 123, 77, 107, 110, 214, 111, 80, 108, 77, 19, 97, 43, 72, 80, 89, 83, 164, 37, 204, 11, 10, 77, 241, 9, 76, 8, 80, 221, 78, 243, 38, 76, 112, 77, 7, 78, 205, 206, 80, 112, 33, 5, 226, 3, 76, 77, 1, 64, 78, 235, 80, 0, 0, 0, 112, 222, 76, 74, 0, 109, 78, 0, 0, 81, 107, 110, 160, 111, 76, 108, 0, 109, 78, 0, 0, 233, 107, 110, 0, 111, 0, 108, 0, 109, 0, 0, 113, 163, 107, 110, 114, 111, 109, 108, 0, 0, 135, 107, 110, 0, 111, 0, 108, 0, 120, 109, 0, 121, 0, 0, 107, 110, 116, 111, 0, 108, 112, 128, 129, 130, 131, 132, 133, 134, 0, 0, 137, 138, 112, 0, 0, 109, 0, 145, 146, 0, 107, 110, 106, 111, 112, 108, 109, 0, 143, 0, 0, 107, 110, 112, 111, 0, 108, 0, 0, 0, 0, 0, 0, 141, 142, 168, 112, 0, 0, 170, 0, 144, 0, 0, 0, 187, 0, 188, 0, 189, 0, 0, 0, 0, 193, 194, 0, 196, 0, 0, 0, 0, 112, 0, 0, 0, 0, 207, 208, 209, 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, 216, 218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 228, 0, 0, 0, 0, 0, 0, 231, 0, 0, 232, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 238 }; static YYCONST yytabelem yypact[]={ -251,-10000000, -261, -247, -263, -247,-10000000,-10000000,-10000000,-10000000, -10000000,-10000000,-10000000, -44, -254, -62, -237, -226,-10000000, 128, -168, -271, -273, -277,-10000000,-10000000, 126, -184, -278, 180, -161, 162, -50,-10000000,-10000000,-10000000,-10000000, -59, 122,-10000000, -10000000, -33,-10000000, -67, 116,-10000000, 20,-10000000,-10000000,-10000000, -10000000,-10000000, 20, 111, -170, -280, -281, -161, -283, -191, -222, 20, 20,-10000000, 109,-10000000, 106, -185, -257,-10000000, -10000000,-10000000, 104,-10000000, 381, 20,-10000000,-10000000,-10000000, 20, 156, 355,-10000000, -75, 102,-10000000,-10000000,-10000000,-10000000,-10000000, -10000000,-10000000,-10000000, 20,-10000000,-10000000, 64, -26,-10000000,-10000000, -10000000, -25, 101,-10000000, -285,-10000000, 20, 20, 20, 20, 20, 20, 20, 342, 33, 20, 20,-10000000, 99,-10000000, 166, 392, 20, 20,-10000000, 98,-10000000, -108, 309, 33, 33, 33, 141, 141,-10000000,-10000000, 208, 392, 333,-10000000, -10000000,-10000000,-10000000,-10000000,-10000000, 392, -3,-10000000, 97, -256, 20,-10000000,-10000000, -156, 20, 150, -255,-10000000, -286, -118, 20,-10000000, 20,-10000000, 20,-10000000, -115, 95, 392, 20, 52,-10000000, 20,-10000000,-10000000,-10000000,-10000000, -12, 94, -265, 150, 150, 20, 20, 20, -296, -267, 247, 392, 392, -10000000, 93,-10000000, 392, 392, 20, 40, 88, -136, 150, -299, -302,-10000000, -125, 86,-10000000,-10000000, 27, 392, 166, -10000000,-10000000,-10000000,-10000000, 20,-10000000, 33, 20, 321,-10000000, -18, 78,-10000000,-10000000,-10000000,-10000000, 76,-10000000, 392, 20, -10000000, 232, 225, -152,-10000000, 74,-10000000,-10000000, 392,-10000000, -152,-10000000,-10000000,-10000000 }; static YYCONST yytabelem yypgo[]={ 0, 333, 330, 328, 327, 259, 321, 312, 310, 307, 306, 296, 304, 140, 302, 198, 301, 297, 75, 131, 255, 298, 286, 149, 282, 280, 278, 114, 276, 271, 261, 142, 258, 125, 250, 243, 115, 232, 231, 230, 206 }; static YYCONST yytabelem yyr1[]={ 0, 1, 2, 4, 4, 3, 3, 5, 5, 5, 5, 5, 7, 7, 12, 12, 11, 11, 10, 10, 14, 14, 13, 13, 13, 13, 13, 13, 13, 13, 15, 15, 15, 15, 16, 16, 16, 9, 9, 21, 21, 20, 20, 20, 20, 8, 8, 24, 24, 22, 22, 23, 25, 25, 26, 26, 18, 18, 18, 18, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 32, 32, 32, 30, 30, 34, 34, 33, 33, 33, 33, 33, 33, 33, 33, 35, 35, 29, 29, 37, 37, 36, 36, 36, 31, 31, 19, 19, 38, 39, 39, 39, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 40, 40, 40, 6 }; static YYCONST yytabelem yyr2[]={ 0, 6, 6, 2, 2, 4, 2, 2, 2, 2, 2, 2, 6, 8, 6, 4, 4, 4, 8, 10, 6, 4, 4, 4, 4, 4, 4, 8, 4, 4, 2, 2, 2, 2, 2, 2, 2, 6, 8, 6, 4, 4, 20, 4, 12, 10, 12, 6, 4, 2, 2, 4, 2, 2, 8, 10, 2, 2, 2, 2, 6, 4, 4, 2, 2, 6, 6, 4, 4, 2, 2, 2, 2, 6, 8, 6, 4, 4, 4, 6, 8, 4, 6, 4, 4, 2, 2, 8, 10, 6, 4, 4, 4, 4, 12, 10, 2, 2, 10, 4, 6, 2, 6, 2, 2, 2, 4, 6, 6, 6, 6, 6, 6, 8, 0, 6, 2, 2 }; static YYCONST yytabelem yychk[]={ -10000000, -1, 304, -2, 308, -3, -5, -6, -7, -8, -9, -10, 267, 260, 302, 309, 310, 308, -5, -11, 123, 286, 266, -22, 305, 303, -20, 123, 272, 285, 296, 300, 291, -4, 307, 264, 59, -12, -11, 308, 308, 308, 59, -21, -20, 308, 40, -15, 283, 299, 263, 293, 40, -13, 123, 275, 276, 296, 266, 290, 287, 289, 294, 125, -11, 59, -23, 123, -25, 278, 261, 125, -20, 59, -17, 40, 291, 268, 295, 45, 273, -17, 59, -14, -13, 308, 308, -15, 308, -16, 301, 277, 269, 279, -19, -38, -39, -17, -19, 59, 59, -24, -23, -26, 300, 59, 44, 42, 47, 37, 43, 45, 94, -17, -17, 40, 44, 125, -13, 59, -17, -17, 44, 313, 125, -23, 59, 308, -17, -17, -17, -17, -17, -17, -17, 41, -40, -17, -17, 59, -18, 280, 281, 265, 288, -17, -17, 59, -27, 123, 270, -29, -30, 274, 297, 259, 258, 292, 282, 312, 44, 41, 44, 41, 306, 59, -28, -27, -17, 259, -17, -31, 40, -32, 262, 263, 314, 308, -33, 123, 289, 294, 297, 298, 311, 266, 317, -17, -17, -17, 125, -27, 59, -17, -17, 45, -17, -36, 123, 259, 275, 266, 59, -34, -33, -31, -31, -17, -17, -17, 308, -35, 315, 271, 44, 59, -17, 44, -17, 59, -37, -36, -31, 308, 308, 125, -33, 59, -17, 44, -18, -17, -17, 41, 125, -36, 59, 59, -17, 41, 41, -18, 59, -18 }; static YYCONST yytabelem yydef[]={ 0, -2, 0, 0, 0, 1, 6, 7, 8, 9, 10, 11, 117, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 12, 0, 0, 16, 17, 0, 37, 0, 0, 41, 0, 43, 30, 31, 32, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, 15, 0, 0, 0, 52, 53, 38, 0, 40, 0, 0, 103, 104, 105, 0, 0, 0, 18, 0, 0, 22, 23, 24, 25, 26, 34, 35, 36, 0, 28, 96, 97, 101, 29, 14, 45, 0, 0, 51, 0, 39, 0, 0, 0, 0, 0, 0, 0, 0, 106, 114, 0, 19, 0, 21, 0, 99, 0, 0, 46, 0, 48, 0, 0, 107, 108, 109, 110, 111, 112, 102, 0, 116, 0, 20, 27, 56, 57, 58, 59, 100, 0, 47, 0, 0, 0, 63, 64, 0, 0, 0, 0, 69, 0, 0, 0, 113, 0, 44, 0, 54, 0, 0, 62, 0, 0, 67, 0, 68, 70, 71, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, 98, 55, 0, 61, 65, 66, 0, 0, 0, 0, 0, 0, 0, 73, 0, 0, 77, 78, 0, 81, 0, 83, 84, 85, 86, 0, 60, -2, 0, 0, 87, 0, 0, 91, 92, 93, 74, 0, 76, 79, 0, 82, 0, 0, 0, 88, 0, 90, 75, 80, 42, 0, 95, 89, 94 }; typedef struct #ifdef __cplusplus yytoktype #endif { char *t_name; int t_val; } yytoktype; #ifndef YYDEBUG # define YYDEBUG 0 /* don't allow debugging */ #endif #if YYDEBUG yytoktype yytoks[] = { "+", 43, "-", 45, "*", 42, "/", 47, "%", 37, "UMINUS", 257, "^", 94, "(", 40, ")", 41, "ANCHOR", 258, "AT", 259, "ATTRIBUTES", 260, "BACK", 261, "BOTTOM", 262, "CENTER", 263, "CIRCULAR", 264, "CM", 265, "COLOR", 266, "CURSOR", 267, "E", 268, "ENG", 269, "EQUATION", 270, "FALSE", 271, "FILENAME", 272, "FN", 273, "FOLD", 274, "FONT", 275, "FORMAT", 276, "FP", 277, "FRONT", 278, "GAP", 279, "INCH", 280, "INCHES", 281, "LABEL", 282, "LEFT", 283, "LENGTH", 284, "LINE", 285, "MATERIAL", 286, "MIN", 287, "MM", 288, "MORE", 289, "NOTATION", 290, "NUMBER", 291, "NUMBERLINE", 292, "ON", 293, "ONLY", 294, "PI", 295, "POSITION", 296, "RANGE", 297, "REDUCER", 298, "RIGHT", 299, "SCALE", 300, "SCIENTIFIC", 301, "SEGMENT", 302, "SLIDE", 303, "SLIDERULE", 304, "STATOR", 305, "STEP", 306, "STRAIGHT", 307, "STRING", 308, "SYMBOL", 309, "TEXT", 310, "THICKNESS", 311, "TICKS", 312, "TO", 313, "TOP", 314, "TRUE", 315, "WIDTH", 316, "ZOOM", 317, "-unknown-", -1 /* ends search */ }; char * yyreds[] = { "-no such reduction-", "sliderule : SLIDERULE name attrs", "name : STRING STRING sruleType", "sruleType : STRAIGHT", "sruleType : CIRCULAR", "attrs : attrs attr", "attrs : attr", "attr : cursorBlock", "attr : ruleAttrBlock", "attr : segmentBlock", "attr : symAttrBlock", "attr : textAttrBlock", "ruleAttrBlock : ATTRIBUTES ruleAttr ';'", "ruleAttrBlock : ATTRIBUTES '{' ruleAttrs '}'", "ruleAttrs : ruleAttrs ruleAttr ';'", "ruleAttrs : ruleAttr ';'", "ruleAttr : MATERIAL STRING", "ruleAttr : COLOR STRING", "textAttrBlock : TEXT NUMBER textAttr ';'", "textAttrBlock : TEXT NUMBER '{' textAttrs '}'", "textAttrs : textAttrs textAttr ';'", "textAttrs : textAttr ';'", "textAttr : FONT STRING", "textAttr : FORMAT STRING", "textAttr : POSITION position", "textAttr : COLOR STRING", "textAttr : NOTATION notStyle", "textAttr : MIN GAP expr units", "textAttr : MORE numbers", "textAttr : ONLY numbers", "position : LEFT", "position : RIGHT", "position : CENTER", "position : ON", "notStyle : SCIENTIFIC", "notStyle : FP", "notStyle : ENG", "symAttrBlock : SYMBOL symAttr ';'", "symAttrBlock : SYMBOL '{' symAttrs '}'", "symAttrs : symAttrs symAttr ';'", "symAttrs : symAttr ';'", "symAttr : FILENAME STRING", "symAttr : LINE '(' expr ',' expr ',' expr ',' expr ')'", "symAttr : POSITION position", "symAttr : SCALE '(' expr ',' expr ')'", "segmentBlock : SEGMENT segType STRING segment ';'", "segmentBlock : SEGMENT segType STRING '{' segments '}'", "segments : segments segment ';'", "segments : segment ';'", "segType : STATOR", "segType : SLIDE", "segment : side scaleBlock", "side : FRONT", "side : BACK", "scaleBlock : SCALE STRING scaleAttr ';'", "scaleBlock : SCALE STRING '{' scaleAttrs '}'", "units : INCH", "units : INCHES", "units : CM", "units : MM", "scaleAttrs : scaleAttrs scaleAttr ';'", "scaleAttrs : scaleAttr ';'", "scaleAttr : EQUATION expr", "scaleAttr : labelBlock", "scaleAttr : tickBlock", "scaleAttr : FOLD AT expr", "scaleAttr : RANGE expr expr", "scaleAttr : AT location", "scaleAttr : ANCHOR direction", "scaleAttr : NUMBERLINE", "direction : BOTTOM", "direction : CENTER", "direction : TOP", "tickBlock : TICKS tickAttr ';'", "tickBlock : TICKS '{' tickAttrs '}'", "tickAttrs : tickAttrs tickAttr ';'", "tickAttrs : tickAttr ';'", "tickAttr : MORE location", "tickAttr : ONLY location", "tickAttr : RANGE expr expr", "tickAttr : RANGE expr ',' expr", "tickAttr : REDUCER expr", "tickAttr : THICKNESS expr units", "tickAttr : COLOR STRING", "tickAttr : ZOOM boolean", "boolean : TRUE", "boolean : FALSE", "labelBlock : LABEL STRING labelAttr ';'", "labelBlock : LABEL STRING '{' labelAttrs '}'", "labelAttrs : labelAttrs labelAttr ';'", "labelAttrs : labelAttr ';'", "labelAttr : AT location", "labelAttr : FONT STRING", "labelAttr : COLOR STRING", "location : '(' expr ',' expr ')' units", "location : '(' expr expr ')' units", "numbers : numberRange", "numbers : numberList", "numberRange : expr TO expr STEP expr", "numberList : numberList expr", "numberList : numberList ',' expr", "numberList : expr", "expr : '(' expr ')'", "expr : NUMBER", "expr : E", "expr : PI", "expr : '-' expr", "expr : expr '*' expr", "expr : expr '/' expr", "expr : expr '%' expr", "expr : expr '+' expr", "expr : expr '-' expr", "expr : expr '^' expr", "expr : FN '(' args ')'", "args : /* empty */", "args : args ',' expr", "args : expr", "cursorBlock : CURSOR", }; #endif /* YYDEBUG */ # line 1 "/usr/ccs/bin/yaccpar" /* * Copyright (c) 1993 by Sun Microsystems, Inc. */ #pragma ident "@(#)yaccpar 6.16 99/01/20 SMI" /* ** Skeleton parser driver for yacc output */ /* ** yacc user known macros and defines */ #define YYERROR goto yyerrlab #define YYACCEPT return(0) #define YYABORT return(1) #define YYBACKUP( newtoken, newvalue )\ {\ if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\ {\ yyerror( "syntax error - cannot backup" );\ goto yyerrlab;\ }\ yychar = newtoken;\ yystate = *yyps;\ yylval = newvalue;\ goto yynewstate;\ } #define YYRECOVERING() (!!yyerrflag) #define YYNEW(type) malloc(sizeof(type) * yynewmax) #define YYCOPY(to, from, type) \ (type *) memcpy(to, (char *) from, yymaxdepth * sizeof (type)) #define YYENLARGE( from, type) \ (type *) realloc((char *) from, yynewmax * sizeof(type)) #ifndef YYDEBUG # define YYDEBUG 1 /* make debugging available */ #endif /* ** user known globals */ int yydebug; /* set to 1 to get debugging */ /* ** driver internal defines */ #define YYFLAG (-10000000) /* ** global variables used by the parser */ YYSTYPE *yypv; /* top of value stack */ int *yyps; /* top of state stack */ int yystate; /* current state */ int yytmp; /* extra var (lasts between blocks) */ int yynerrs; /* number of errors */ int yyerrflag; /* error recovery flag */ int yychar; /* current input token number */ #ifdef YYNMBCHARS #define YYLEX() yycvtok(yylex()) /* ** yycvtok - return a token if i is a wchar_t value that exceeds 255. ** If i<255, i itself is the token. If i>255 but the neither ** of the 30th or 31st bit is on, i is already a token. */ #if defined(__STDC__) || defined(__cplusplus) int yycvtok(int i) #else int yycvtok(i) int i; #endif { int first = 0; int last = YYNMBCHARS - 1; int mid; wchar_t j; if(i&0x60000000){/*Must convert to a token. */ if( yymbchars[last].character < i ){ return i;/*Giving up*/ } while ((last>=first)&&(first>=0)) {/*Binary search loop*/ mid = (first+last)/2; j = yymbchars[mid].character; if( j==i ){/*Found*/ return yymbchars[mid].tvalue; }else if( j= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) break; } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */ { /* ** reallocate and recover. Note that pointers ** have to be reset, or bad things will happen */ long yyps_index = (yy_ps - yys); long yypv_index = (yy_pv - yyv); long yypvt_index = (yypvt - yyv); int yynewmax; #ifdef YYEXPAND yynewmax = YYEXPAND(yymaxdepth); #else yynewmax = 2 * yymaxdepth; /* double table size */ if (yymaxdepth == YYMAXDEPTH) /* first time growth */ { char *newyys = (char *)YYNEW(int); char *newyyv = (char *)YYNEW(YYSTYPE); if (newyys != 0 && newyyv != 0) { yys = YYCOPY(newyys, yys, int); yyv = YYCOPY(newyyv, yyv, YYSTYPE); } else yynewmax = 0; /* failed */ } else /* not first time */ { yys = YYENLARGE(yys, int); yyv = YYENLARGE(yyv, YYSTYPE); if (yys == 0 || yyv == 0) yynewmax = 0; /* failed */ } #endif if (yynewmax <= yymaxdepth) /* tables not expanded */ { yyerror( "yacc stack overflow" ); YYABORT; } yymaxdepth = yynewmax; yy_ps = yys + yyps_index; yy_pv = yyv + yypv_index; yypvt = yyv + yypvt_index; } *yy_ps = yy_state; *++yy_pv = yyval; /* ** we have a new state - find out what to do */ yy_newstate: if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG ) goto yydefault; /* simple state */ #if YYDEBUG /* ** if debugging, need to mark whether new token grabbed */ yytmp = yychar < 0; #endif if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) yychar = 0; /* reached EOF */ #if YYDEBUG if ( yydebug && yytmp ) { register int yy_i; printf( "Received token " ); if ( yychar == 0 ) printf( "end-of-file\n" ); else if ( yychar < 0 ) printf( "-none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) break; } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) ) goto yydefault; if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/ { yychar = -1; yyval = yylval; yy_state = yy_n; if ( yyerrflag > 0 ) yyerrflag--; goto yy_stack; } yydefault: if ( ( yy_n = yydef[ yy_state ] ) == -2 ) { #if YYDEBUG yytmp = yychar < 0; #endif if ( ( yychar < 0 ) && ( ( yychar = YYLEX() ) < 0 ) ) yychar = 0; /* reached EOF */ #if YYDEBUG if ( yydebug && yytmp ) { register int yy_i; printf( "Received token " ); if ( yychar == 0 ) printf( "end-of-file\n" ); else if ( yychar < 0 ) printf( "-none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) { break; } } printf( "%s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ /* ** look through exception table */ { register YYCONST int *yyxi = yyexca; while ( ( *yyxi != -1 ) || ( yyxi[1] != yy_state ) ) { yyxi += 2; } while ( ( *(yyxi += 2) >= 0 ) && ( *yyxi != yychar ) ) ; if ( ( yy_n = yyxi[1] ) < 0 ) YYACCEPT; } } /* ** check for syntax error */ if ( yy_n == 0 ) /* have an error */ { /* no worry about speed here! */ switch ( yyerrflag ) { case 0: /* new error */ yyerror( "syntax error" ); goto skip_init; yyerrlab: /* ** get globals into registers. ** we have a user generated syntax type error */ yy_pv = yypv; yy_ps = yyps; yy_state = yystate; skip_init: yynerrs++; /* FALLTHRU */ case 1: case 2: /* incompletely recovered error */ /* try again... */ yyerrflag = 3; /* ** find state where "error" is a legal ** shift action */ while ( yy_ps >= yys ) { yy_n = yypact[ *yy_ps ] + YYERRCODE; if ( yy_n >= 0 && yy_n < YYLAST && yychk[yyact[yy_n]] == YYERRCODE) { /* ** simulate shift of "error" */ yy_state = yyact[ yy_n ]; goto yy_stack; } /* ** current state has no shift on ** "error", pop stack */ #if YYDEBUG # define _POP_ "Error recovery pops state %d, uncovers state %d\n" if ( yydebug ) printf( _POP_, *yy_ps, yy_ps[-1] ); # undef _POP_ #endif yy_ps--; yy_pv--; } /* ** there is no state on stack with "error" as ** a valid shift. give up. */ YYABORT; case 3: /* no shift yet; eat a token */ #if YYDEBUG /* ** if debugging, look up token in list of ** pairs. 0 and negative shouldn't occur, ** but since timing doesn't matter when ** debugging, it doesn't hurt to leave the ** tests here. */ if ( yydebug ) { register int yy_i; printf( "Error recovery discards " ); if ( yychar == 0 ) printf( "token end-of-file\n" ); else if ( yychar < 0 ) printf( "token -none-\n" ); else { for ( yy_i = 0; yytoks[yy_i].t_val >= 0; yy_i++ ) { if ( yytoks[yy_i].t_val == yychar ) { break; } } printf( "token %s\n", yytoks[yy_i].t_name ); } } #endif /* YYDEBUG */ if ( yychar == 0 ) /* reached EOF. quit */ YYABORT; yychar = -1; goto yy_newstate; } }/* end if ( yy_n == 0 ) */ /* ** reduction by production yy_n ** put stack tops, etc. so things right after switch */ #if YYDEBUG /* ** if debugging, print the string that is the user's ** specification of the reduction which is just about ** to be done. */ if ( yydebug ) printf( "Reduce by (%d) \"%s\"\n", yy_n, yyreds[ yy_n ] ); #endif yytmp = yy_n; /* value to switch over */ yypvt = yy_pv; /* $vars top of value stack */ /* ** Look in goto table for next state ** Sorry about using yy_state here as temporary ** register variable, but why not, if it works... ** If yyr2[ yy_n ] doesn't have the low order bit ** set, then there is no action to be done for ** this reduction. So, no saving & unsaving of ** registers done. The only difference between the ** code just after the if and the body of the if is ** the goto yy_stack in the body. This way the test ** can be made before the choice of what to do is needed. */ { /* length of production doubled with extra bit */ register int yy_len = yyr2[ yy_n ]; if ( !( yy_len & 01 ) ) { yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } goto yy_stack; } yy_len >>= 1; yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */ yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] + *( yy_ps -= yy_len ) + 1; if ( yy_state >= YYLAST || yychk[ yy_state = yyact[ yy_state ] ] != -yy_n ) { yy_state = yyact[ yypgo[ yy_n ] ]; } } /* save until reenter driver code */ yystate = yy_state; yyps = yy_ps; yypv = yy_pv; } /* ** code supplied by user is placed in this switch */ switch( yytmp ) { # line 531 "/usr/ccs/bin/yaccpar" } goto yystack; /* reset registers in driver code */ }