#include #ifndef lint #if 0 static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #else __IDSTRING(yyrcsid, "$NetBSD: skeleton.c,v 1.14 1997/10/20 03:41:16 lukem Exp $"); #endif #endif #include #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define YYLEX yylex() #define YYEMPTY -1 #define yyclearin (yychar=(YYEMPTY)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" #line 2 "cdgram.y" /* Yacc grammar for ANSI and C++ cdecl. */ /* The output of this file is included */ /* into the C file cdecl.c. */ char cdgramsccsid[] = "@(#)cdgram.y 2.2 3/30/88"; #line 8 "cdgram.y" typedef union { char *dynstr; struct { char *left; char *right; char *type; } halves; } YYSTYPE; #line 34 "y.tab.c" #define ARRAY 257 #define AS 258 #define CAST 259 #define COMMA 260 #define DECLARE 261 #define DOUBLECOLON 262 #define EXPLAIN 263 #define FUNCTION 264 #define HELP 265 #define INTO 266 #define OF 267 #define MEMBER 268 #define POINTER 269 #define REFERENCE 270 #define RETURNING 271 #define SET 272 #define TO 273 #define CHAR 274 #define CLASS 275 #define CONSTVOLATILE 276 #define DOUBLE 277 #define ENUM 278 #define FLOAT 279 #define INT 280 #define LONG 281 #define NAME 282 #define NUMBER 283 #define SHORT 284 #define SIGNED 285 #define STRUCT 286 #define UNION 287 #define UNSIGNED 288 #define VOID 289 #define AUTO 290 #define EXTERN 291 #define REGISTER 292 #define STATIC 293 #define YYERRCODE 256 short yylhs[] = { -1, 0, 0, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 15, 15, 6, 6, 6, 6, 7, 7, 7, 7, 7, 5, 5, 5, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 21, 21, 21, 21, 21, 21, 21, 2, 2, 20, 24, 3, 3, 3, 3, 18, 18, 18, 10, 10, 19, 19, 19, 19, 19, 11, 11, 12, 12, 13, 13, 13, 13, 14, 14, 9, 17, 17, 17, 17, 16, 16, }; short yylen[] = { 2, 0, 2, 2, 6, 4, 5, 3, 6, 5, 5, 8, 3, 1, 2, 1, 1, 1, 0, 1, 3, 4, 3, 3, 4, 2, 3, 1, 3, 3, 1, 0, 3, 1, 1, 3, 0, 2, 5, 6, 3, 4, 2, 2, 2, 2, 3, 3, 6, 4, 4, 8, 4, 2, 0, 1, 2, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 0, 2, 1, 1, 1, 1, 1, 0, }; short yydefred[] = { 1, 0, 0, 0, 0, 0, 0, 0, 15, 16, 2, 13, 14, 0, 0, 0, 0, 0, 0, 0, 83, 84, 85, 86, 0, 87, 0, 0, 0, 3, 17, 0, 55, 0, 0, 0, 80, 0, 0, 0, 53, 0, 7, 0, 0, 57, 0, 0, 57, 0, 12, 0, 47, 0, 0, 34, 0, 0, 0, 68, 66, 70, 63, 69, 67, 78, 79, 77, 65, 64, 76, 71, 56, 62, 0, 0, 0, 59, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 6, 0, 50, 52, 60, 75, 74, 72, 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 25, 0, 9, 35, 0, 0, 0, 4, 0, 37, 0, 0, 0, 0, 44, 0, 26, 20, 22, 30, 23, 0, 57, 0, 45, 8, 48, 0, 0, 0, 0, 21, 0, 24, 0, 46, 0, 0, 0, 11, 0, 0, 51, 38, 0, 39, }; short yydgoto[] = { 1, 54, 33, 72, 108, 137, 86, 87, 130, 47, 73, 74, 101, 75, 17, 31, 24, 25, 76, 77, 40, 55, 10, 11, 41, }; short yysindex[] = { 0, -7, 30, -145, -70, -31, 30, -266, 0, 0, 0, 0, 0, -254, -30, -235, -223, -160, 30, -201, 0, 0, 0, 0, -121, 0, -235, -215, -235, 0, 0, 30, 0, -199, -121, -137, 0, -121, -202, -200, 0, 117, 0, -123, 30, 0, -235, -25, 0, -25, 0, -121, 0, -176, -29, 0, 30, -122, -121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -116, -132, -179, 0, -121, 0, -19, 0, -156, -25, -235, -235, 30, -22, -25, 30, 0, -121, -137, -147, 0, -152, 0, 0, 0, 0, 0, 0, 0, 30, -128, -34, -19, -19, -3, 88, 97, -25, -25, 0, -40, -82, 0, 30, 0, 0, -120, -121, -228, 0, 105, 0, 4, 59, 59, -266, 0, -25, 0, 0, 0, 0, 0, -27, 0, 58, 0, 0, 0, -125, -19, 134, 30, 0, -210, 0, -19, 0, -121, 59, -39, 0, -85, 59, 0, 0, 14, 0, }; short yyrindex[] = { 0, 0, 0, -71, -92, 99, 0, 46, 0, 0, 0, 0, 0, -88, 0, 6, 0, 133, 0, 0, 0, 0, 0, 0, -71, 0, 156, 156, 22, 0, 0, 0, 0, 0, -71, 77, 0, -71, 0, 0, 0, 0, 0, -92, 0, 0, 38, 0, 0, 0, 0, -71, 0, 18, 0, 0, 0, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -5, -10, 0, 0, -71, 0, 9, 54, 57, 0, -16, -16, 0, 24, 0, 0, 0, -71, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 89, -21, -21, 0, 0, 0, 0, 0, 0, 156, 0, 0, 0, 0, 0, 140, -71, 0, 0, 0, 0, 0, 61, 70, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -21, -14, 0, 0, 156, 0, -21, 0, -71, 84, 156, 0, 150, 85, 0, 0, 0, 0, }; short yygindex[] = { 0, 108, 0, 0, 16, -55, 2, 0, 118, 0, 102, 136, 0, 0, 344, 96, 20, 221, 0, 153, -6, 50, 0, 73, 0, }; #define YYTABLESIZE 498 short yytable[] = { 73, 136, 159, 8, 107, 58, 105, 125, 106, 26, 35, 140, 93, 85, 149, 83, 30, 84, 114, 107, 36, 105, 81, 106, 81, 27, 81, 40, 73, 32, 73, 73, 73, 58, 19, 58, 58, 58, 129, 80, 8, 15, 88, 37, 81, 145, 81, 60, 81, 73, 36, 89, 9, 18, 58, 161, 18, 43, 68, 33, 81, 46, 81, 78, 81, 19, 15, 27, 51, 115, 36, 57, 135, 58, 44, 12, 81, 40, 81, 29, 81, 73, 91, 19, 52, 110, 58, 56, 115, 9, 117, 42, 82, 156, 82, 115, 82, 27, 27, 160, 36, 90, 42, 102, 50, 18, 109, 96, 97, 38, 39, 43, 13, 133, 134, 122, 27, 79, 31, 14, 13, 126, 127, 128, 121, 41, 29, 14, 103, 94, 131, 15, 150, 147, 124, 13, 13, 16, 132, 15, 92, 119, 14, 14, 99, 53, 95, 144, 27, 65, 115, 151, 66, 67, 15, 15, 70, 152, 59, 113, 153, 61, 118, 63, 64, 88, 157, 20, 21, 22, 23, 142, 88, 71, 154, 148, 123, 88, 88, 54, 36, 32, 88, 88, 88, 88, 88, 88, 88, 88, 141, 28, 88, 88, 88, 88, 88, 88, 81, 81, 120, 139, 158, 81, 81, 116, 81, 81, 81, 81, 81, 100, 19, 81, 81, 81, 81, 81, 81, 155, 20, 21, 22, 23, 143, 146, 28, 98, 0, 0, 0, 92, 0, 148, 0, 0, 15, 15, 0, 36, 0, 34, 135, 135, 0, 0, 40, 0, 104, 2, 73, 0, 3, 0, 4, 58, 5, 82, 6, 20, 21, 22, 23, 104, 73, 7, 81, 73, 0, 73, 73, 0, 73, 0, 148, 81, 81, 58, 33, 73, 81, 81, 0, 81, 81, 81, 81, 81, 81, 0, 81, 81, 81, 81, 81, 81, 87, 87, 0, 87, 87, 87, 87, 87, 81, 0, 87, 87, 87, 87, 87, 87, 81, 81, 0, 81, 81, 81, 81, 81, 81, 42, 81, 81, 81, 81, 81, 81, 80, 80, 43, 80, 80, 80, 80, 80, 82, 31, 80, 80, 80, 80, 80, 80, 41, 29, 81, 81, 0, 0, 0, 81, 81, 0, 81, 81, 81, 81, 81, 36, 0, 81, 81, 81, 81, 81, 81, 0, 0, 0, 45, 48, 49, 88, 88, 88, 88, 88, 88, 88, 88, 0, 0, 88, 88, 88, 88, 88, 88, 0, 81, 59, 60, 0, 61, 62, 63, 64, 65, 0, 0, 66, 67, 68, 69, 70, 71, 57, 57, 0, 57, 57, 57, 57, 57, 0, 0, 57, 57, 57, 57, 57, 57, 0, 0, 0, 0, 0, 111, 112, 81, 81, 0, 81, 81, 81, 81, 81, 0, 0, 81, 81, 81, 81, 81, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 138, }; short yycheck[] = { 10, 41, 41, 10, 38, 10, 40, 41, 42, 40, 40, 93, 41, 38, 41, 40, 282, 42, 40, 38, 41, 40, 38, 42, 40, 5, 42, 41, 38, 283, 40, 41, 42, 38, 10, 40, 41, 42, 41, 45, 10, 276, 48, 266, 38, 41, 40, 275, 42, 59, 41, 49, 59, 3, 59, 41, 10, 258, 286, 41, 38, 276, 40, 43, 42, 41, 276, 10, 267, 91, 91, 273, 282, 273, 24, 2, 38, 91, 40, 6, 42, 91, 258, 59, 34, 83, 91, 37, 91, 59, 88, 18, 38, 148, 40, 91, 42, 40, 41, 154, 91, 51, 41, 282, 31, 59, 262, 57, 58, 269, 270, 41, 257, 111, 112, 267, 59, 44, 41, 264, 257, 105, 106, 107, 271, 41, 41, 264, 78, 56, 42, 276, 138, 131, 262, 257, 257, 282, 41, 276, 260, 91, 264, 264, 276, 282, 268, 42, 91, 281, 91, 93, 284, 285, 276, 276, 288, 282, 274, 86, 144, 277, 89, 279, 280, 257, 150, 290, 291, 292, 293, 121, 264, 289, 40, 260, 103, 269, 270, 267, 91, 41, 274, 275, 276, 277, 278, 279, 280, 281, 117, 41, 284, 285, 286, 287, 288, 289, 269, 270, 92, 283, 152, 274, 275, 87, 277, 278, 279, 280, 281, 75, 282, 284, 285, 286, 287, 288, 289, 146, 290, 291, 292, 293, 122, 129, 5, 74, -1, -1, -1, 260, -1, 260, -1, -1, 276, 276, -1, 260, -1, 271, 282, 282, -1, -1, 260, -1, 282, 256, 260, -1, 259, -1, 261, 260, 263, 282, 265, 290, 291, 292, 293, 282, 274, 272, 282, 277, -1, 279, 280, -1, 282, -1, 260, 269, 270, 282, 260, 289, 274, 275, -1, 277, 278, 279, 280, 281, 282, -1, 284, 285, 286, 287, 288, 289, 274, 275, -1, 277, 278, 279, 280, 281, 282, -1, 284, 285, 286, 287, 288, 289, 274, 275, -1, 277, 278, 279, 280, 281, 282, 260, 284, 285, 286, 287, 288, 289, 274, 275, 260, 277, 278, 279, 280, 281, 282, 260, 284, 285, 286, 287, 288, 289, 260, 260, 269, 270, -1, -1, -1, 274, 275, -1, 277, 278, 279, 280, 281, 15, -1, 284, 285, 286, 287, 288, 289, -1, -1, -1, 26, 27, 28, 274, 275, 276, 277, 278, 279, 280, 281, -1, -1, 284, 285, 286, 287, 288, 289, -1, 46, 274, 275, -1, 277, 278, 279, 280, 281, -1, -1, 284, 285, 286, 287, 288, 289, 274, 275, -1, 277, 278, 279, 280, 281, -1, -1, 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, -1, 84, 85, 274, 275, -1, 277, 278, 279, 280, 281, -1, -1, 284, 285, 286, 287, 288, 289, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, 154, }; #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 293 #if YYDEBUG char *yyname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,"'&'",0,"'('","')'","'*'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, "ARRAY","AS","CAST","COMMA","DECLARE","DOUBLECOLON","EXPLAIN","FUNCTION","HELP", "INTO","OF","MEMBER","POINTER","REFERENCE","RETURNING","SET","TO","CHAR", "CLASS","CONSTVOLATILE","DOUBLE","ENUM","FLOAT","INT","LONG","NAME","NUMBER", "SHORT","SIGNED","STRUCT","UNION","UNSIGNED","VOID","AUTO","EXTERN","REGISTER", "STATIC", }; char *yyrule[] = { "$accept : prog", "prog :", "prog : prog stmt", "stmt : HELP NL", "stmt : DECLARE NAME AS opt_storage adecl NL", "stmt : DECLARE opt_storage adecl NL", "stmt : CAST NAME INTO adecl NL", "stmt : CAST adecl NL", "stmt : EXPLAIN opt_storage opt_constvol_list type cdecl NL", "stmt : EXPLAIN storage opt_constvol_list cdecl NL", "stmt : EXPLAIN opt_storage constvol_list cdecl NL", "stmt : EXPLAIN '(' opt_constvol_list type cast ')' optNAME NL", "stmt : SET optNAME NL", "stmt : NL", "stmt : error NL", "NL : '\\n'", "NL : ';'", "optNAME : NAME", "optNAME :", "cdecl : cdecl1", "cdecl : '*' opt_constvol_list cdecl", "cdecl : NAME DOUBLECOLON '*' cdecl", "cdecl : '&' opt_constvol_list cdecl", "cdecl1 : cdecl1 '(' ')'", "cdecl1 : cdecl1 '(' castlist ')'", "cdecl1 : cdecl1 cdims", "cdecl1 : '(' cdecl ')'", "cdecl1 : NAME", "castlist : castlist COMMA castlist", "castlist : opt_constvol_list type cast", "castlist : NAME", "adecllist :", "adecllist : adecllist COMMA adecllist", "adecllist : NAME", "adecllist : adecl", "adecllist : NAME AS adecl", "cast :", "cast : '(' ')'", "cast : '(' cast ')' '(' ')'", "cast : '(' cast ')' '(' castlist ')'", "cast : '(' cast ')'", "cast : NAME DOUBLECOLON '*' cast", "cast : '*' cast", "cast : '&' cast", "cast : cast cdims", "cdims : '[' ']'", "cdims : '[' NUMBER ']'", "adecl : FUNCTION RETURNING adecl", "adecl : FUNCTION '(' adecllist ')' RETURNING adecl", "adecl : ARRAY adims OF adecl", "adecl : opt_constvol_list POINTER TO adecl", "adecl : opt_constvol_list POINTER TO MEMBER OF ClassStruct NAME adecl", "adecl : opt_constvol_list REFERENCE TO adecl", "adecl : opt_constvol_list type", "adims :", "adims : NUMBER", "type : tinit c_type", "tinit :", "c_type : mod_list", "c_type : tname", "c_type : mod_list tname", "c_type : StrClaUniEnum NAME", "StrClaUniEnum : ClassStruct", "StrClaUniEnum : ENUM", "StrClaUniEnum : UNION", "ClassStruct : STRUCT", "ClassStruct : CLASS", "tname : INT", "tname : CHAR", "tname : FLOAT", "tname : DOUBLE", "tname : VOID", "mod_list : modifier mod_list1", "mod_list : modifier", "mod_list1 : mod_list", "mod_list1 : CONSTVOLATILE", "modifier : UNSIGNED", "modifier : SIGNED", "modifier : LONG", "modifier : SHORT", "opt_constvol_list : CONSTVOLATILE opt_constvol_list", "opt_constvol_list :", "constvol_list : CONSTVOLATILE opt_constvol_list", "storage : AUTO", "storage : EXTERN", "storage : REGISTER", "storage : STATIC", "opt_storage : storage", "opt_storage :", }; #endif #ifdef YYSTACKSIZE #undef YYMAXDEPTH #define YYMAXDEPTH YYSTACKSIZE #else #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else #define YYSTACKSIZE 10000 #define YYMAXDEPTH 10000 #endif #endif #define YYINITSTACKSIZE 200 int yydebug; int yynerrs; int yyerrflag; int yychar; short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; short *yyss; short *yysslim; YYSTYPE *yyvs; int yystacksize; /* allocate initial stack or double stack size, up to YYMAXDEPTH */ int yyparse __P((void)); static int yygrowstack __P((void)); static int yygrowstack() { int newsize, i; short *newss; YYSTYPE *newvs; if ((newsize = yystacksize) == 0) newsize = YYINITSTACKSIZE; else if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL) return -1; yyss = newss; yyssp = newss + i; if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL) return -1; yyvs = newvs; yyvsp = newvs + i; yystacksize = newsize; yysslim = yyss + newsize - 1; return 0; } #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int yyparse() { int yym, yyn, yystate; #if YYDEBUG char *yys; if ((yys = getenv("YYDEBUG")) != NULL) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; } #endif yynerrs = 0; yyerrflag = 0; yychar = (-1); if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0; yyloop: if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; yychar = (-1); if (yyerrflag > 0) --yyerrflag; goto yyloop; } if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery; goto yynewerror; yynewerror: yyerror("syntax error"); goto yyerrlab; yyerrlab: ++yynerrs; yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else { #if YYDEBUG if (yydebug) printf("%sdebug: error recovery discarding state %d\n", YYPREFIX, *yyssp); #endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif yychar = (-1); goto yyloop; } yyreduce: #if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) { case 2: #line 33 "cdgram.y" { prompt(); prev = 0; } break; case 3: #line 40 "cdgram.y" { Debug((stderr, "stmt: help\n")); dohelp(); } break; case 4: #line 46 "cdgram.y" { Debug((stderr, "stmt: DECLARE NAME AS opt_storage adecl\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[-4].dynstr)); Debug((stderr, "\topt_storage='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tacdecl.left='%s'\n", yyvsp[-1].halves.left)); Debug((stderr, "\tacdecl.right='%s'\n", yyvsp[-1].halves.right)); Debug((stderr, "\tacdecl.type='%s'\n", yyvsp[-1].halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); dodeclare(yyvsp[-4].dynstr, yyvsp[-2].dynstr, yyvsp[-1].halves.left, yyvsp[-1].halves.right, yyvsp[-1].halves.type); } break; case 5: #line 58 "cdgram.y" { Debug((stderr, "stmt: DECLARE opt_storage adecl\n")); Debug((stderr, "\topt_storage='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tacdecl.left='%s'\n", yyvsp[-1].halves.left)); Debug((stderr, "\tacdecl.right='%s'\n", yyvsp[-1].halves.right)); Debug((stderr, "\tacdecl.type='%s'\n", yyvsp[-1].halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); dodeclare(NullCP, yyvsp[-2].dynstr, yyvsp[-1].halves.left, yyvsp[-1].halves.right, yyvsp[-1].halves.type); } break; case 6: #line 69 "cdgram.y" { Debug((stderr, "stmt: CAST NAME AS adecl\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tacdecl.left='%s'\n", yyvsp[-1].halves.left)); Debug((stderr, "\tacdecl.right='%s'\n", yyvsp[-1].halves.right)); Debug((stderr, "\tacdecl.type='%s'\n", yyvsp[-1].halves.type)); docast(yyvsp[-3].dynstr, yyvsp[-1].halves.left, yyvsp[-1].halves.right, yyvsp[-1].halves.type); } break; case 7: #line 79 "cdgram.y" { Debug((stderr, "stmt: CAST adecl\n")); Debug((stderr, "\tacdecl.left='%s'\n", yyvsp[-1].halves.left)); Debug((stderr, "\tacdecl.right='%s'\n", yyvsp[-1].halves.right)); Debug((stderr, "\tacdecl.type='%s'\n", yyvsp[-1].halves.type)); docast(NullCP, yyvsp[-1].halves.left, yyvsp[-1].halves.right, yyvsp[-1].halves.type); } break; case 8: #line 88 "cdgram.y" { Debug((stderr, "stmt: EXPLAIN opt_storage opt_constvol_list type cdecl\n")); Debug((stderr, "\topt_storage='%s'\n", yyvsp[-4].dynstr)); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\ttype='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); dodexplain(yyvsp[-4].dynstr, yyvsp[-3].dynstr, yyvsp[-2].dynstr, yyvsp[-1].dynstr); } break; case 9: #line 99 "cdgram.y" { Debug((stderr, "stmt: EXPLAIN storage opt_constvol_list cdecl\n")); Debug((stderr, "\tstorage='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); dodexplain(yyvsp[-3].dynstr, yyvsp[-2].dynstr, NullCP, yyvsp[-1].dynstr); } break; case 10: #line 109 "cdgram.y" { Debug((stderr, "stmt: EXPLAIN opt_storage constvol_list cdecl\n")); Debug((stderr, "\topt_storage='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tconstvol_list='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); dodexplain(yyvsp[-3].dynstr, yyvsp[-2].dynstr, NullCP, yyvsp[-1].dynstr); } break; case 11: #line 119 "cdgram.y" { Debug((stderr, "stmt: EXPLAIN ( opt_constvol_list type cast ) optNAME\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-5].dynstr)); Debug((stderr, "\ttype='%s'\n", yyvsp[-4].dynstr)); Debug((stderr, "\tcast='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tNAME='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); docexplain(yyvsp[-5].dynstr, yyvsp[-4].dynstr, yyvsp[-3].dynstr, yyvsp[-1].dynstr); } break; case 12: #line 130 "cdgram.y" { Debug((stderr, "stmt: SET optNAME\n")); Debug((stderr, "\toptNAME='%s'\n", yyvsp[-1].dynstr)); doset(yyvsp[-1].dynstr); } break; case 14: #line 138 "cdgram.y" { yyerrok; } break; case 15: #line 144 "cdgram.y" { doprompt(); } break; case 16: #line 148 "cdgram.y" { noprompt(); } break; case 17: #line 154 "cdgram.y" { Debug((stderr, "optNAME: NAME\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 18: #line 161 "cdgram.y" { Debug((stderr, "optNAME: EMPTY\n")); yyval.dynstr = ds(unknown_name); } break; case 20: #line 169 "cdgram.y" { Debug((stderr, "cdecl: * opt_constvol_list cdecl\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[0].dynstr,yyvsp[-1].dynstr,ds(strlen(yyvsp[-1].dynstr)?" pointer to ":"pointer to "),NullCP); prev = 'p'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 21: #line 179 "cdgram.y" { Debug((stderr, "cdecl: NAME DOUBLECOLON '*' cdecl\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[0].dynstr)); if (!CplusplusFlag) unsupp("pointer to member of class", NullCP); yyval.dynstr = cat(yyvsp[0].dynstr,ds("pointer to member of class "),yyvsp[-3].dynstr,ds(" "),NullCP); prev = 'p'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 22: #line 191 "cdgram.y" { Debug((stderr, "cdecl: & opt_constvol_list cdecl\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tcdecl='%s'\n", yyvsp[0].dynstr)); if (!CplusplusFlag) unsupp("reference", NullCP); yyval.dynstr = cat(yyvsp[0].dynstr,yyvsp[-1].dynstr,ds(strlen(yyvsp[-1].dynstr)?" reference to ":"reference to "),NullCP); prev = 'r'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 23: #line 204 "cdgram.y" { Debug((stderr, "cdecl1: cdecl1()\n")); Debug((stderr, "\tcdecl1='%s'\n", yyvsp[-2].dynstr)); yyval.dynstr = cat(yyvsp[-2].dynstr,ds("function returning "),NullCP); prev = 'f'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 24: #line 213 "cdgram.y" { Debug((stderr, "cdecl1: cdecl1(castlist)\n")); Debug((stderr, "\tcdecl1='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tcastlist='%s'\n", yyvsp[-1].dynstr)); yyval.dynstr = cat(yyvsp[-3].dynstr, ds("function ("), yyvsp[-1].dynstr, ds(") returning "), NullCP); prev = 'f'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 25: #line 224 "cdgram.y" { Debug((stderr, "cdecl1: cdecl1 cdims\n")); Debug((stderr, "\tcdecl1='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tcdims='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds("array "),yyvsp[0].dynstr,NullCP); prev = 'a'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 26: #line 234 "cdgram.y" { Debug((stderr, "cdecl1: (cdecl)\n")); Debug((stderr, "\tcdecl='%s'\n", yyvsp[-1].dynstr)); yyval.dynstr = yyvsp[-1].dynstr; /* prev = prev; */ Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 27: #line 243 "cdgram.y" { Debug((stderr, "cdecl1: NAME\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[0].dynstr)); savedname = yyvsp[0].dynstr; yyval.dynstr = ds(""); prev = 'n'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 28: #line 254 "cdgram.y" { Debug((stderr, "castlist: castlist1, castlist2\n")); Debug((stderr, "\tcastlist1='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tcastlist2='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-2].dynstr, ds(", "), yyvsp[0].dynstr, NullCP); } break; case 29: #line 262 "cdgram.y" { Debug((stderr, "castlist: opt_constvol_list type cast\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\ttype='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tcast='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[0].dynstr, yyvsp[-2].dynstr, ds(strlen(yyvsp[-2].dynstr) ? " " : ""), yyvsp[-1].dynstr, NullCP); } break; case 30: #line 271 "cdgram.y" { yyval.dynstr = yyvsp[0].dynstr; } break; case 31: #line 277 "cdgram.y" { Debug((stderr, "adecllist: EMPTY\n")); yyval.dynstr = ds(""); } break; case 32: #line 283 "cdgram.y" { Debug((stderr, "adecllist: adecllist1, adecllist2\n")); Debug((stderr, "\tadecllist1='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tadecllist2='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-2].dynstr, ds(", "), yyvsp[0].dynstr, NullCP); } break; case 33: #line 291 "cdgram.y" { Debug((stderr, "adecllist: NAME\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 34: #line 298 "cdgram.y" { Debug((stderr, "adecllist: adecl\n")); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); yyval.dynstr = cat(yyvsp[0].halves.type, ds(" "), yyvsp[0].halves.left, yyvsp[0].halves.right, NullCP); } break; case 35: #line 307 "cdgram.y" { Debug((stderr, "adecllist: NAME AS adecl\n")); Debug((stderr, "\tNAME='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); yyval.dynstr = cat(yyvsp[0].halves.type, ds(" "), yyvsp[0].halves.left, yyvsp[-2].dynstr, yyvsp[0].halves.right, NullCP); } break; case 36: #line 318 "cdgram.y" { Debug((stderr, "cast: EMPTY\n")); yyval.dynstr = ds(""); /* prev = prev; */ Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 37: #line 326 "cdgram.y" { Debug((stderr, "cast: ()\n")); yyval.dynstr = ds("function returning "); prev = 'f'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 38: #line 334 "cdgram.y" { Debug((stderr, "cast: (cast)()\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[-3].dynstr)); yyval.dynstr = cat(yyvsp[-3].dynstr,ds("function returning "),NullCP); prev = 'f'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 39: #line 343 "cdgram.y" { Debug((stderr, "cast: (cast)(castlist)\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[-4].dynstr)); Debug((stderr, "\tcastlist='%s'\n", yyvsp[-1].dynstr)); yyval.dynstr = cat(yyvsp[-4].dynstr,ds("function ("),yyvsp[-1].dynstr,ds(") returning "),NullCP); prev = 'f'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 40: #line 353 "cdgram.y" { Debug((stderr, "cast: (cast)\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[-1].dynstr)); yyval.dynstr = yyvsp[-1].dynstr; /* prev = prev; */ Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 41: #line 362 "cdgram.y" { Debug((stderr, "cast: NAME::*cast\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[0].dynstr)); if (!CplusplusFlag) unsupp("pointer to member of class", NullCP); yyval.dynstr = cat(yyvsp[0].dynstr,ds("pointer to member of class "),yyvsp[-3].dynstr,ds(" "),NullCP); prev = 'p'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 42: #line 373 "cdgram.y" { Debug((stderr, "cast: *cast\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[0].dynstr,ds("pointer to "),NullCP); prev = 'p'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 43: #line 382 "cdgram.y" { Debug((stderr, "cast: &cast\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[0].dynstr)); if (!CplusplusFlag) unsupp("reference", NullCP); yyval.dynstr = cat(yyvsp[0].dynstr,ds("reference to "),NullCP); prev = 'r'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 44: #line 393 "cdgram.y" { Debug((stderr, "cast: cast cdims\n")); Debug((stderr, "\tcast='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tcdims='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds("array "),yyvsp[0].dynstr,NullCP); prev = 'a'; Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 45: #line 404 "cdgram.y" { Debug((stderr, "cdims: []\n")); yyval.dynstr = ds("of "); } break; case 46: #line 410 "cdgram.y" { Debug((stderr, "cdims: [NUMBER]\n")); Debug((stderr, "\tNUMBER='%s'\n", yyvsp[-1].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(" of "),NullCP); } break; case 47: #line 418 "cdgram.y" { Debug((stderr, "adecl: FUNCTION RETURNING adecl\n")); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (prev == 'f') unsupp("Function returning function", "function returning pointer to function"); else if (prev=='A' || prev=='a') unsupp("Function returning array", "function returning pointer"); yyval.halves.left = yyvsp[0].halves.left; yyval.halves.right = cat(ds("()"),yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; prev = 'f'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 48: #line 441 "cdgram.y" { Debug((stderr, "adecl: FUNCTION (adecllist) RETURNING adecl\n")); Debug((stderr, "\tadecllist='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (prev == 'f') unsupp("Function returning function", "function returning pointer to function"); else if (prev=='A' || prev=='a') unsupp("Function returning array", "function returning pointer"); yyval.halves.left = yyvsp[0].halves.left; yyval.halves.right = cat(ds("("),yyvsp[-3].dynstr,ds(")"),yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; prev = 'f'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 49: #line 465 "cdgram.y" { Debug((stderr, "adecl: ARRAY adims OF adecl\n")); Debug((stderr, "\tadims='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (prev == 'f') unsupp("Array of function", "array of pointer to function"); else if (prev == 'a') unsupp("Inner array of unspecified size", "array of pointer"); else if (prev == 'v') unsupp("Array of void", "pointer to void"); if (arbdims) prev = 'a'; else prev = 'A'; yyval.halves.left = yyvsp[0].halves.left; yyval.halves.right = cat(yyvsp[-2].dynstr,yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 50: #line 495 "cdgram.y" { char *op = "", *cp = "", *sp = ""; Debug((stderr, "adecl: opt_constvol_list POINTER TO adecl\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (prev == 'a') unsupp("Pointer to array of unspecified dimension", "pointer to object"); if (prev=='a' || prev=='A' || prev=='f') { op = "("; cp = ")"; } if (strlen(yyvsp[-3].dynstr) != 0) sp = " "; yyval.halves.left = cat(yyvsp[0].halves.left,ds(op),ds("*"), ds(sp),yyvsp[-3].dynstr,ds(sp),NullCP); yyval.halves.right = cat(ds(cp),yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; prev = 'p'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 51: #line 525 "cdgram.y" { char *op = "", *cp = "", *sp = ""; Debug((stderr, "adecl: opt_constvol_list POINTER TO MEMBER OF ClassStruct NAME adecl\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-7].dynstr)); Debug((stderr, "\tClassStruct='%s'\n", yyvsp[-2].dynstr)); Debug((stderr, "\tNAME='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (!CplusplusFlag) unsupp("pointer to member of class", NullCP); if (prev == 'a') unsupp("Pointer to array of unspecified dimension", "pointer to object"); if (prev=='a' || prev=='A' || prev=='f') { op = "("; cp = ")"; } if (strlen(yyvsp[-7].dynstr) != 0) sp = " "; yyval.halves.left = cat(yyvsp[0].halves.left,ds(op),yyvsp[-1].dynstr,ds("::*"), ds(sp),yyvsp[-7].dynstr,ds(sp),NullCP); yyval.halves.right = cat(ds(cp),yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; prev = 'p'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 52: #line 559 "cdgram.y" { char *op = "", *cp = "", *sp = ""; Debug((stderr, "adecl: opt_constvol_list REFERENCE TO adecl\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-3].dynstr)); Debug((stderr, "\tadecl.left='%s'\n", yyvsp[0].halves.left)); Debug((stderr, "\tadecl.right='%s'\n", yyvsp[0].halves.right)); Debug((stderr, "\tadecl.type='%s'\n", yyvsp[0].halves.type)); if (!CplusplusFlag) unsupp("reference", NullCP); if (prev == 'v') unsupp("Reference to void", "pointer to void"); else if (prev == 'a') unsupp("Reference to array of unspecified dimension", "reference to object"); if (prev=='a' || prev=='A' || prev=='f') { op = "("; cp = ")"; } if (strlen(yyvsp[-3].dynstr) != 0) sp = " "; yyval.halves.left = cat(yyvsp[0].halves.left,ds(op),ds("&"), ds(sp),yyvsp[-3].dynstr,ds(sp),NullCP); yyval.halves.right = cat(ds(cp),yyvsp[0].halves.right,NullCP); yyval.halves.type = yyvsp[0].halves.type; prev = 'r'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 53: #line 594 "cdgram.y" { Debug((stderr, "adecl: opt_constvol_list type\n")); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\ttype='%s'\n", yyvsp[0].dynstr)); yyval.halves.left = ds(""); yyval.halves.right = ds(""); yyval.halves.type = cat(yyvsp[-1].dynstr,ds(strlen(yyvsp[-1].dynstr)?" ":""),yyvsp[0].dynstr,NullCP); if (strcmp(yyvsp[0].dynstr, "void") == 0) prev = 'v'; else if ((strncmp(yyvsp[0].dynstr, "struct", 6) == 0) || (strncmp(yyvsp[0].dynstr, "class", 5) == 0)) prev = 's'; else prev = 't'; Debug((stderr, "\n\tadecl now =\n")); Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left)); Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right)); Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type)); Debug((stderr, "\tprev = '%s'\n", visible(prev))); } break; case 54: #line 617 "cdgram.y" { Debug((stderr, "adims: EMPTY\n")); arbdims = 1; yyval.dynstr = ds("[]"); } break; case 55: #line 624 "cdgram.y" { Debug((stderr, "adims: NUMBER\n")); Debug((stderr, "\tNUMBER='%s'\n", yyvsp[0].dynstr)); arbdims = 0; yyval.dynstr = cat(ds("["),yyvsp[0].dynstr,ds("]"),NullCP); } break; case 56: #line 633 "cdgram.y" { Debug((stderr, "type: tinit c_type\n")); Debug((stderr, "\ttinit=''\n")); Debug((stderr, "\tc_type='%s'\n", yyvsp[0].dynstr)); mbcheck(); yyval.dynstr = yyvsp[0].dynstr; } break; case 57: #line 643 "cdgram.y" { Debug((stderr, "tinit: EMPTY\n")); modbits = 0; } break; case 58: #line 650 "cdgram.y" { Debug((stderr, "c_type: mod_list\n")); Debug((stderr, "\tmod_list='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 59: #line 657 "cdgram.y" { Debug((stderr, "c_type: tname\n")); Debug((stderr, "\ttname='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 60: #line 664 "cdgram.y" { Debug((stderr, "c_type: mod_list tname\n")); Debug((stderr, "\tmod_list='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\ttname='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(" "),yyvsp[0].dynstr,NullCP); } break; case 61: #line 672 "cdgram.y" { Debug((stderr, "c_type: StrClaUniEnum NAME\n")); Debug((stderr, "\tStrClaUniEnum='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tNAME='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(" "),yyvsp[0].dynstr,NullCP); } break; case 64: #line 683 "cdgram.y" { yyval.dynstr = yyvsp[0].dynstr; } break; case 66: #line 690 "cdgram.y" { yyval.dynstr = yyvsp[0].dynstr; } break; case 67: #line 696 "cdgram.y" { Debug((stderr, "tname: INT\n")); Debug((stderr, "\tINT='%s'\n", yyvsp[0].dynstr)); modbits |= MB_INT; yyval.dynstr = yyvsp[0].dynstr; } break; case 68: #line 703 "cdgram.y" { Debug((stderr, "tname: CHAR\n")); Debug((stderr, "\tCHAR='%s'\n", yyvsp[0].dynstr)); modbits |= MB_CHAR; yyval.dynstr = yyvsp[0].dynstr; } break; case 69: #line 710 "cdgram.y" { Debug((stderr, "tname: FLOAT\n")); Debug((stderr, "\tFLOAT='%s'\n", yyvsp[0].dynstr)); modbits |= MB_FLOAT; yyval.dynstr = yyvsp[0].dynstr; } break; case 70: #line 717 "cdgram.y" { Debug((stderr, "tname: DOUBLE\n")); Debug((stderr, "\tDOUBLE='%s'\n", yyvsp[0].dynstr)); modbits |= MB_DOUBLE; yyval.dynstr = yyvsp[0].dynstr; } break; case 71: #line 724 "cdgram.y" { Debug((stderr, "tname: VOID\n")); Debug((stderr, "\tVOID='%s'\n", yyvsp[0].dynstr)); modbits |= MB_VOID; yyval.dynstr = yyvsp[0].dynstr; } break; case 72: #line 732 "cdgram.y" { Debug((stderr, "mod_list: modifier mod_list1\n")); Debug((stderr, "\tmodifier='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\tmod_list1='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(" "),yyvsp[0].dynstr,NullCP); } break; case 73: #line 740 "cdgram.y" { Debug((stderr, "mod_list: modifier\n")); Debug((stderr, "\tmodifier='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 74: #line 748 "cdgram.y" { Debug((stderr, "mod_list1: mod_list\n")); Debug((stderr, "\tmod_list='%s'\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 75: #line 755 "cdgram.y" { Debug((stderr, "mod_list1: CONSTVOLATILE\n")); Debug((stderr, "\tCONSTVOLATILE='%s'\n", yyvsp[0].dynstr)); if (PreANSIFlag) notsupported(" (Pre-ANSI Compiler)", yyvsp[0].dynstr, NullCP); else if (RitchieFlag) notsupported(" (Ritchie Compiler)", yyvsp[0].dynstr, NullCP); else if ((strcmp(yyvsp[0].dynstr, "noalias") == 0) && CplusplusFlag) unsupp(yyvsp[0].dynstr, NullCP); yyval.dynstr = yyvsp[0].dynstr; } break; case 76: #line 769 "cdgram.y" { Debug((stderr, "modifier: UNSIGNED\n")); Debug((stderr, "\tUNSIGNED='%s'\n", yyvsp[0].dynstr)); modbits |= MB_UNSIGNED; yyval.dynstr = yyvsp[0].dynstr; } break; case 77: #line 776 "cdgram.y" { Debug((stderr, "modifier: SIGNED\n")); Debug((stderr, "\tSIGNED='%s'\n", yyvsp[0].dynstr)); modbits |= MB_SIGNED; yyval.dynstr = yyvsp[0].dynstr; } break; case 78: #line 783 "cdgram.y" { Debug((stderr, "modifier: LONG\n")); Debug((stderr, "\tLONG='%s'\n", yyvsp[0].dynstr)); modbits |= MB_LONG; yyval.dynstr = yyvsp[0].dynstr; } break; case 79: #line 790 "cdgram.y" { Debug((stderr, "modifier: SHORT\n")); Debug((stderr, "\tSHORT='%s'\n", yyvsp[0].dynstr)); modbits |= MB_SHORT; yyval.dynstr = yyvsp[0].dynstr; } break; case 80: #line 798 "cdgram.y" { Debug((stderr, "opt_constvol_list: CONSTVOLATILE opt_constvol_list\n")); Debug((stderr, "\tCONSTVOLATILE='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[0].dynstr)); if (PreANSIFlag) notsupported(" (Pre-ANSI Compiler)", yyvsp[-1].dynstr, NullCP); else if (RitchieFlag) notsupported(" (Ritchie Compiler)", yyvsp[-1].dynstr, NullCP); else if ((strcmp(yyvsp[-1].dynstr, "noalias") == 0) && CplusplusFlag) unsupp(yyvsp[-1].dynstr, NullCP); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(strlen(yyvsp[0].dynstr) ? " " : ""),yyvsp[0].dynstr,NullCP); } break; case 81: #line 812 "cdgram.y" { Debug((stderr, "opt_constvol_list: EMPTY\n")); yyval.dynstr = ds(""); } break; case 82: #line 819 "cdgram.y" { Debug((stderr, "constvol_list: CONSTVOLATILE opt_constvol_list\n")); Debug((stderr, "\tCONSTVOLATILE='%s'\n", yyvsp[-1].dynstr)); Debug((stderr, "\topt_constvol_list='%s'\n", yyvsp[0].dynstr)); if (PreANSIFlag) notsupported(" (Pre-ANSI Compiler)", yyvsp[-1].dynstr, NullCP); else if (RitchieFlag) notsupported(" (Ritchie Compiler)", yyvsp[-1].dynstr, NullCP); else if ((strcmp(yyvsp[-1].dynstr, "noalias") == 0) && CplusplusFlag) unsupp(yyvsp[-1].dynstr, NullCP); yyval.dynstr = cat(yyvsp[-1].dynstr,ds(strlen(yyvsp[0].dynstr) ? " " : ""),yyvsp[0].dynstr,NullCP); } break; case 86: #line 837 "cdgram.y" { Debug((stderr, "storage: AUTO,EXTERN,STATIC,REGISTER (%s)\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 87: #line 844 "cdgram.y" { Debug((stderr, "opt_storage: storage=%s\n", yyvsp[0].dynstr)); yyval.dynstr = yyvsp[0].dynstr; } break; case 88: #line 850 "cdgram.y" { Debug((stderr, "opt_storage: EMPTY\n")); yyval.dynstr = ds(""); } break; #line 1439 "y.tab.c" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; #if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } #endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: return (1); yyaccept: return (0); }