From accceecf589434b1c1636171d6c40deab36f8beb Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 5 Oct 2004 06:14:58 +0000 Subject: [PATCH] prebuild-bison --- pandatool/src/xfile/xLexer.cxx.prebuilt | 8 +- pandatool/src/xfile/xParser.cxx.prebuilt | 285 ++++++++++++++--------- 2 files changed, 184 insertions(+), 109 deletions(-) diff --git a/pandatool/src/xfile/xLexer.cxx.prebuilt b/pandatool/src/xfile/xLexer.cxx.prebuilt index 0933902729..32a2652028 100644 --- a/pandatool/src/xfile/xLexer.cxx.prebuilt +++ b/pandatool/src/xfile/xLexer.cxx.prebuilt @@ -1342,7 +1342,7 @@ YY_RULE_SETUP // An integer as part of a semicolon-delimited list. accept(); xyylval.int_list = parse_int_list(xyytext, ";"); - xyylval.u.separator_token = TOKEN_SEMICOLON; + xyylval.u.separator = ';'; return TOKEN_INTEGER_LIST; } @@ -1354,7 +1354,7 @@ YY_RULE_SETUP // A floating-point number as part of a semicolon-delimited list. accept(); xyylval.double_list = parse_double_list(xyytext, ";"); - xyylval.u.separator_token = TOKEN_SEMICOLON; + xyylval.u.separator = ';'; return TOKEN_REALNUM_LIST; } @@ -1366,7 +1366,7 @@ YY_RULE_SETUP // An integer as part of a semicolon-delimited list. accept(); xyylval.int_list = parse_int_list(xyytext, ","); - xyylval.u.separator_token = TOKEN_COMMA; + xyylval.u.separator = ','; return TOKEN_INTEGER_LIST; } @@ -1378,7 +1378,7 @@ YY_RULE_SETUP // A floating-point number as part of a semicolon-delimited list. accept(); xyylval.double_list = parse_double_list(xyytext, ","); - xyylval.u.separator_token = TOKEN_COMMA; + xyylval.u.separator = ','; return TOKEN_REALNUM_LIST; } diff --git a/pandatool/src/xfile/xParser.cxx.prebuilt b/pandatool/src/xfile/xParser.cxx.prebuilt index 9872c840d6..c99bea4679 100644 --- a/pandatool/src/xfile/xParser.cxx.prebuilt +++ b/pandatool/src/xfile/xParser.cxx.prebuilt @@ -135,8 +135,8 @@ static const short yyprhs[] = 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 81, 84, 86, 89, 93, 95, 97, 99, 102, 104, 107, 109, 111, 113, 115, 117, 119, 123, - 124, 132, 134, 137, 139, 141, 143, 145, 148, 150, - 152, 154, 156, 158, 160, 165 + 124, 132, 134, 137, 141, 143, 145, 147, 150, 152, + 154, 156, 158, 160, 162, 164, 167 }; static const short yyrhs[] = { @@ -150,13 +150,13 @@ static const short yyrhs[] = 28, 0, 30, 0, 31, 0, 32, 0, 45, 52, 0, 52, 52, 0, 48, 0, 47, 48, 0, 13, 49, 14, 0, 5, 0, 52, 0, 51, 0, 50, - 51, 0, 52, 0, 52, 6, 0, 3, 0, 66, + 51, 0, 52, 0, 52, 54, 0, 3, 0, 66, 0, 52, 0, 6, 0, 66, 0, 54, 0, 17, 17, 17, 0, 0, 52, 53, 9, 58, 55, 59, - 10, 0, 60, 0, 59, 60, 0, 65, 0, 57, - 0, 61, 0, 62, 0, 63, 64, 0, 64, 0, - 7, 0, 8, 0, 4, 0, 19, 0, 18, 0, - 9, 52, 55, 10, 0, 0 + 10, 0, 60, 0, 59, 60, 0, 9, 65, 10, + 0, 57, 0, 61, 0, 62, 0, 63, 64, 0, + 64, 0, 7, 0, 8, 0, 4, 0, 19, 0, + 18, 0, 52, 0, 52, 54, 0, 0 }; #endif @@ -165,13 +165,13 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 104, 106, 107, 110, 110, 125, 127, 130, 132, - 135, 140, 143, 145, 148, 150, 151, 154, 162, 166, - 179, 184, 188, 192, 196, 200, 204, 208, 212, 216, - 220, 226, 232, 244, 246, 249, 253, 258, 269, 273, - 278, 288, 303, 307, 312, 315, 319, 324, 327, 331, - 331, 353, 355, 358, 362, 365, 368, 371, 374, 379, - 383, 387, 391, 393, 396, 400 + 0, 106, 108, 109, 112, 112, 127, 129, 132, 134, + 137, 142, 145, 147, 150, 152, 153, 156, 164, 168, + 181, 186, 190, 194, 198, 202, 206, 210, 214, 218, + 222, 228, 234, 246, 248, 251, 255, 260, 271, 275, + 280, 290, 305, 309, 314, 317, 321, 326, 329, 333, + 333, 361, 363, 366, 383, 391, 397, 403, 409, 417, + 421, 425, 429, 434, 440, 450, 466 }; #endif @@ -210,7 +210,7 @@ static const short yyr1[] = 45, 46, 46, 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, 53, 53, 54, 55, 55, 56, 58, 57, 59, 59, 60, 60, 60, 60, 60, 60, 61, - 62, 63, 64, 64, 65, 66 + 62, 63, 64, 64, 65, 65, 66 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -221,8 +221,8 @@ static const short yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 3, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 3, 0, - 7, 1, 2, 1, 1, 1, 1, 2, 1, 1, - 1, 1, 1, 1, 4, 0 + 7, 1, 2, 3, 1, 1, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 2, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -230,82 +230,82 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 65, 0, 1, 42, 0, 2, 65, 3, 0, 44, - 0, 43, 0, 49, 45, 4, 65, 65, 47, 0, + 66, 0, 1, 42, 0, 2, 66, 3, 0, 44, + 0, 43, 0, 49, 45, 4, 66, 66, 47, 0, 46, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 0, 0, 0, 7, 12, 14, 15, 16, - 65, 65, 8, 61, 59, 60, 0, 63, 62, 54, - 0, 51, 55, 56, 0, 58, 53, 0, 0, 0, - 5, 0, 13, 0, 0, 65, 50, 52, 57, 31, + 66, 66, 8, 61, 59, 60, 0, 63, 62, 54, + 0, 51, 55, 56, 0, 58, 0, 0, 0, 5, + 0, 13, 0, 0, 64, 0, 50, 52, 57, 31, 0, 0, 33, 32, 0, 0, 11, 38, 40, 10, - 17, 19, 0, 36, 0, 37, 18, 34, 0, 6, - 39, 41, 64, 35, 48, 0, 0 + 17, 19, 65, 53, 36, 0, 37, 18, 34, 0, + 6, 39, 41, 35, 48, 0, 0 }; static const short yydefgoto[] = { 1, 5, 17, 33, 34, 75, 35, 36, 37, 38, - 39, 40, 58, 71, 72, 84, 76, 77, 6, 10, - 18, 19, 79, 49, 16, 50, 51, 52, 53, 54, - 55, 56, 11 + 39, 40, 57, 71, 72, 85, 76, 77, 6, 10, + 15, 19, 79, 49, 16, 50, 51, 52, 53, 54, + 55, 65, 11 }; static const short yypact[] = { - -32768, 1,-32768,-32768, 6,-32768, 6,-32768, 9,-32768, - 18,-32768, 34,-32768,-32768,-32768, 34, 70,-32768, 26, + -32768, 3,-32768,-32768, 6,-32768, 6,-32768, 18,-32768, + 23,-32768, 34,-32768,-32768,-32768, 34, 65,-32768, 26, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 87, 22, 28, 56,-32768,-32768,-32768,-32768, + -32768,-32768, 78, 31, 30, 52,-32768,-32768,-32768,-32768, 6, 6,-32768,-32768,-32768,-32768, 6,-32768,-32768,-32768, - 7,-32768,-32768,-32768, 20,-32768,-32768, 6, 30, 6, - -32768, 5,-32768, 27, 29, 34,-32768,-32768,-32768,-32768, - 2, -7,-32768,-32768, 32, 33, 6,-32768, 44,-32768, - -32768,-32768, 41,-32768, 38,-32768,-32768,-32768, 37,-32768, - -32768,-32768,-32768,-32768,-32768, 58,-32768 + 7,-32768,-32768,-32768, -11,-32768, 6, 33, 6,-32768, + 2,-32768, 28, 29, 34, 40,-32768,-32768,-32768,-32768, + 19, -1,-32768,-32768, 36, 37, 6,-32768, 34,-32768, + -32768,-32768,-32768,-32768,-32768, 43,-32768,-32768,-32768, 41, + -32768,-32768,-32768,-32768,-32768, 59,-32768 }; static const short yypgoto[] = { - -32768,-32768,-32768,-32768,-32768,-32768,-32768, 21,-32768,-32768, - -32768, 31,-32768,-32768, -11,-32768,-32768, -15, -4, -17, - 50, -1,-32768, 64,-32768,-32768, 17,-32768,-32768,-32768, - 16,-32768, 3 + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 25,-32768,-32768, + -32768, 32,-32768,-32768, -10,-32768,-32768, -14, -4, -2, + -15,-32768,-32768, 66,-32768,-32768, 20,-32768,-32768,-32768, + 15,-32768, 4 }; -#define YYLAST 119 +#define YYLAST 110 static const short yytable[] = { - 8, 95, 9, 2, 3, 3, 70, 83, 3, 3, - 3, 43, 86, 41, 44, 45, 46, 66, 12, 20, - 42, 4, 74, 63, 64, 47, 48, 13, 59, 3, - 43, 41, 60, 44, 45, 46, 9, 9, 47, 48, - 14, 61, 65, 70, 47, 48, 80, 89, 81, 88, - 91, 92, 93, 69, 94, 73, 62, 78, 96, 3, - 87, 90, 15, 57, 82, 7, 85, 67, 20, -9, - 68, 0, 78, 3, 0, 0, 0, 21, 22, 23, - 24, 25, 26, 27, 28, 0, 29, 30, 31, 32, - 3, 21, 22, 23, 24, 25, 26, 27, 28, 0, - 29, 30, 31, 32, 0, 0, 0, 0, 21, 22, - 23, 24, 25, 26, 27, 28, 0, 29, 30, 31 + 8, 18, 9, 95, 2, 3, 3, 47, 48, 3, + 3, 43, 70, 41, 44, 45, 46, 66, 87, 74, + 20, 42, 3, 4, 84, 47, 48, 12, 58, 3, + 43, 41, 13, 44, 45, 46, 9, 9, 62, 63, + 14, 59, 64, 60, 47, 48, 70, 80, 81, 82, + 83, 90, 69, 89, 73, 3, 78, 93, 94, 96, + 61, 88, 91, 92, 56, -9, 86, 7, 3, 68, + 67, 0, 78, 21, 22, 23, 24, 25, 26, 27, + 28, 3, 29, 30, 31, 32, 21, 22, 23, 24, + 25, 26, 27, 28, 0, 29, 30, 31, 32, 21, + 22, 23, 24, 25, 26, 27, 28, 0, 29, 30, + 31 }; static const short yycheck[] = { - 4, 0, 6, 0, 3, 3, 13, 5, 3, 3, - 3, 4, 19, 17, 7, 8, 9, 10, 9, 16, - 17, 20, 17, 40, 41, 18, 19, 9, 32, 3, - 4, 35, 10, 7, 8, 9, 40, 41, 18, 19, - 6, 13, 46, 13, 18, 19, 19, 14, 19, 17, - 6, 10, 14, 57, 17, 59, 35, 61, 0, 3, - 71, 76, 12, 32, 65, 1, 70, 50, 65, 13, - 54, -1, 76, 3, -1, -1, -1, 21, 22, 23, - 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, - 3, 21, 22, 23, 24, 25, 26, 27, 28, -1, - 30, 31, 32, 33, -1, -1, -1, -1, 21, 22, - 23, 24, 25, 26, 27, 28, -1, 30, 31, 32 + 4, 16, 6, 0, 0, 3, 3, 18, 19, 3, + 3, 4, 13, 17, 7, 8, 9, 10, 19, 17, + 16, 17, 3, 20, 5, 18, 19, 9, 32, 3, + 4, 35, 9, 7, 8, 9, 40, 41, 40, 41, + 6, 10, 46, 13, 18, 19, 13, 19, 19, 64, + 10, 14, 56, 17, 58, 3, 60, 14, 17, 0, + 35, 71, 76, 78, 32, 13, 70, 1, 3, 54, + 50, -1, 76, 21, 22, 23, 24, 25, 26, 27, + 28, 3, 30, 31, 32, 33, 21, 22, 23, 24, + 25, 26, 27, 28, -1, 30, 31, 32, 33, 21, + 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, + 32 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" @@ -1015,139 +1015,139 @@ yyreduce: switch (yyn) { case 4: -#line 112 "xParser.yxx" +#line 114 "xParser.yxx" { yyval.u.node = current_node; - XFileTemplate *templ = new XFileTemplate(yyvsp[-2].str, yyvsp[0].guid); + XFileTemplate *templ = new XFileTemplate(x_file, yyvsp[-2].str, yyvsp[0].guid); current_node->add_child(templ); current_node = templ; } break; case 5: -#line 119 "xParser.yxx" +#line 121 "xParser.yxx" { yyval.u.node = current_node; current_node = yyvsp[-2].u.node; } break; case 10: -#line 137 "xParser.yxx" +#line 139 "xParser.yxx" { DCAST(XFileTemplate, current_node)->set_open(true); } break; case 17: -#line 156 "xParser.yxx" +#line 158 "xParser.yxx" { - current_data_def = new XFileDataDef(yyvsp[-2].u.primitive_type, yyvsp[-1].str); + current_data_def = new XFileDataDef(x_file, yyvsp[-1].str, yyvsp[-2].u.primitive_type); current_node->add_child(current_data_def); } break; case 19: -#line 168 "xParser.yxx" +#line 170 "xParser.yxx" { XFileTemplate *xtemplate = x_file->find_template(yyvsp[-2].str); if (xtemplate == (XFileTemplate *)NULL) { yyerror("Unknown template: " + yyvsp[-2].str); } else { - current_data_def = new XFileDataDef(XFileDataDef::T_template, yyvsp[-1].str, xtemplate); + current_data_def = new XFileDataDef(x_file, yyvsp[-1].str, XFileDataDef::T_template, xtemplate); current_node->add_child(current_data_def); } } break; case 20: -#line 181 "xParser.yxx" +#line 183 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_word; } break; case 21: -#line 185 "xParser.yxx" +#line 187 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_dword; } break; case 22: -#line 189 "xParser.yxx" +#line 191 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_float; } break; case 23: -#line 193 "xParser.yxx" +#line 195 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_double; } break; case 24: -#line 197 "xParser.yxx" +#line 199 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_char; } break; case 25: -#line 201 "xParser.yxx" +#line 203 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_uchar; } break; case 26: -#line 205 "xParser.yxx" +#line 207 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_sword; } break; case 27: -#line 209 "xParser.yxx" +#line 211 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_sdword; } break; case 28: -#line 213 "xParser.yxx" +#line 215 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_string; } break; case 29: -#line 217 "xParser.yxx" +#line 219 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_unicode; } break; case 30: -#line 221 "xParser.yxx" +#line 223 "xParser.yxx" { yyval.u.primitive_type = XFileDataDef::T_cstring; } break; case 31: -#line 228 "xParser.yxx" +#line 230 "xParser.yxx" { - current_data_def = new XFileDataDef(yyvsp[-1].u.primitive_type, yyvsp[0].str); + current_data_def = new XFileDataDef(x_file, yyvsp[0].str, yyvsp[-1].u.primitive_type); current_node->add_child(current_data_def); } break; case 32: -#line 233 "xParser.yxx" +#line 235 "xParser.yxx" { XFileTemplate *xtemplate = x_file->find_template(yyvsp[-1].str); if (xtemplate == (XFileTemplate *)NULL) { yyerror("Unknown template: " + yyvsp[-1].str); } else { - current_data_def = new XFileDataDef(XFileDataDef::T_template, yyvsp[0].str, xtemplate); + current_data_def = new XFileDataDef(x_file, yyvsp[0].str, XFileDataDef::T_template, xtemplate); current_node->add_child(current_data_def); } } break; case 36: -#line 255 "xParser.yxx" +#line 257 "xParser.yxx" { current_data_def->add_array_def(XFileArrayDef(yyvsp[0].u.number)); } break; case 37: -#line 259 "xParser.yxx" +#line 261 "xParser.yxx" { XFileNode *data_def = current_node->find_child(yyvsp[0].str); if (data_def == (XFileNode *)NULL) { @@ -1158,17 +1158,17 @@ case 37: } break; case 38: -#line 271 "xParser.yxx" +#line 273 "xParser.yxx" { } break; case 39: -#line 274 "xParser.yxx" +#line 276 "xParser.yxx" { } break; case 40: -#line 280 "xParser.yxx" +#line 282 "xParser.yxx" { XFileTemplate *xtemplate = x_file->find_template(yyvsp[0].str); if (xtemplate == (XFileTemplate *)NULL) { @@ -1179,7 +1179,7 @@ case 40: } break; case 41: -#line 289 "xParser.yxx" +#line 291 "xParser.yxx" { XFileTemplate *xtemplate = x_file->find_template(yyvsp[0].guid); if (xtemplate == (XFileTemplate *)NULL) { @@ -1194,19 +1194,19 @@ case 41: } break; case 43: -#line 309 "xParser.yxx" +#line 311 "xParser.yxx" { yyval.str = string(); } break; case 46: -#line 321 "xParser.yxx" +#line 323 "xParser.yxx" { yyval.guid = WindowsGuid(); } break; case 49: -#line 333 "xParser.yxx" +#line 335 "xParser.yxx" { XFileTemplate *xtemplate = x_file->find_template(yyvsp[-2].str); yyval.u.node = current_node; @@ -1215,47 +1215,122 @@ case 49: yyerror("Unknown template: " + yyvsp[-2].str); } else { XFileDataObjectTemplate *templ = - new XFileDataObjectTemplate(xtemplate, yyvsp[-1].str); + new XFileDataObjectTemplate(x_file, yyvsp[-1].str, xtemplate); current_node->add_child(templ); current_node = templ; } } break; case 50: -#line 347 "xParser.yxx" +#line 349 "xParser.yxx" { + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + if (!current_template->finalize_parse_data()) { + yyerror("Invalid data for object."); + } + yyval.u.node = current_node; current_node = yyvsp[-3].u.node; } break; case 53: -#line 360 "xParser.yxx" +#line 368 "xParser.yxx" { + if (yyvsp[-1].u.node != (XFileNode *)NULL) { + if (!yyvsp[-1].u.node->is_of_type(XFileDataObjectTemplate::get_class_type())) { + // Actually, maybe you can--the docs aren't clear about this. + // But I don't think there's any real reason to. + yyerror("Can't reference primitive data type."); + } else { + XFileDataObjectTemplate *object = + DCAST(XFileDataObjectTemplate, yyvsp[-1].u.node); + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_object(object, true); + } + } } break; case 54: -#line 363 "xParser.yxx" +#line 384 "xParser.yxx" { + XFileDataObjectTemplate *object = + DCAST(XFileDataObjectTemplate, yyvsp[0].u.node); + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_object(object, false); } break; case 55: -#line 366 "xParser.yxx" +#line 392 "xParser.yxx" { + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_int(yyvsp[0].int_list, yyvsp[0].u.separator); } break; case 56: -#line 369 "xParser.yxx" +#line 398 "xParser.yxx" { + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_double(yyvsp[0].double_list, yyvsp[0].u.separator); } break; case 57: -#line 372 "xParser.yxx" +#line 404 "xParser.yxx" { + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_string(yyvsp[-1].str, yyvsp[0].u.separator); } break; case 58: -#line 375 "xParser.yxx" +#line 410 "xParser.yxx" { + XFileDataObjectTemplate *current_template = + DCAST(XFileDataObjectTemplate, current_node); + current_template->add_parse_separator(yyvsp[0].u.separator); +} + break; +case 62: +#line 431 "xParser.yxx" +{ + yyval.u.separator = ';'; +} + break; +case 63: +#line 435 "xParser.yxx" +{ + yyval.u.separator = ','; +} + break; +case 64: +#line 442 "xParser.yxx" +{ + XFileDataObject *data_object = x_file->find_data_object(yyvsp[0].str); + if (data_object == (XFileDataObject *)NULL) { + yyerror("Unknown data_object: " + yyvsp[0].str); + } + + yyval.u.node = data_object; +} + break; +case 65: +#line 451 "xParser.yxx" +{ + XFileDataObject *data_object = x_file->find_data_object(yyvsp[0].guid); + if (data_object == (XFileDataObject *)NULL) { + yyerror("Unknown data_object: " + yyvsp[-1].str); + } else { + if (data_object->get_name() != yyvsp[-1].str) { + xyywarning("GUID identifies data_object " + data_object->get_name() + + ", not " + yyvsp[-1].str); + } + } + + yyval.u.node = data_object; } break; } @@ -1491,4 +1566,4 @@ yyreturn: #endif return yyresult; } -#line 402 "xParser.yxx" +#line 468 "xParser.yxx"