/* A Bison parser, made from ucparse.yy by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ # define IF 257 # define ELSE 258 # define RETURN 259 # define WHILE 260 # define FOR 261 # define UCC_IN 262 # define WITH 263 # define TO 264 # define EXTERN 265 # define BREAK 266 # define GOTO 267 # define CASE 268 # define VAR 269 # define UCC_INT 270 # define UCC_CONST 271 # define STRING 272 # define ENUM 273 # define CONVERSE 274 # define SAY 275 # define MESSAGE 276 # define RESPONSE 277 # define EVENT 278 # define FLAG 279 # define ITEM 280 # define UCTRUE 281 # define UCFALSE 282 # define REMOVE 283 # define ADD 284 # define HIDE 285 # define SCRIPT 286 # define AFTER 287 # define TICKS 288 # define STATIC_ 289 # define ORIGINAL 290 # define CONTINUE 291 # define REPEAT 292 # define NOP 293 # define NOHALT 294 # define WAIT 295 # define RISE 296 # define DESCEND 297 # define FRAME 298 # define HATCH 299 # define NEXT 300 # define PREVIOUS 301 # define CYCLE 302 # define STEP 303 # define MUSIC 304 # define CALL 305 # define SPEECH 306 # define SFX 307 # define FACE 308 # define HIT 309 # define HOURS 310 # define ACTOR 311 # define NORTH 312 # define SOUTH 313 # define EAST 314 # define WEST 315 # define NE 316 # define NW 317 # define SE 318 # define SW 319 # define STRING_LITERAL 320 # define STRING_PREFIX 321 # define IDENTIFIER 322 # define INT_LITERAL 323 # define AND 324 # define OR 325 # define EQUALS 326 # define NEQUALS 327 # define LTEQUALS 328 # define GTEQUALS 329 # define NOT 330 # define UCC_POINTS 331 #line 1 "ucparse.yy" /** ** Ucparse.y - Usecode parser. ** ** Written: 12/30/2000 - JSF **/ /* Copyright (C) 2000 The Exult Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include #include "ucfun.h" #include "ucexpr.h" #include "ucstmt.h" #include "opcodes.h" #include "ucscriptop.h" using std::strcpy; using std::strcat; using std::strlen; void yyerror(char *); extern int yylex(); static Uc_array_expression *Create_array(int, Uc_expression *); static Uc_array_expression *Create_array(int, Uc_expression *, Uc_expression *); #define YYERROR_VERBOSE 1 std::vector functions; // THIS is what we produce. static Uc_function *function = 0; // Current function being parsed. static int enum_val = -1; // Keeps track of enum elements. #line 61 "ucparse.yy" #ifndef YYSTYPE typedef union { class Uc_symbol *sym; class Uc_var_symbol *var; class Uc_expression *expr; class Uc_call_expression *funcall; class Uc_function_symbol *funsym; class Uc_statement *stmt; class std::vector *strvec; class Uc_block_statement *block; class Uc_arrayloop_statement *arrayloop; class Uc_array_expression *exprlist; int intval; char *strval; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 0 #endif #define YYFINAL 374 #define YYFLAG -32768 #define YYNTBASE 97 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 331 ? yytranslate[x] : 167) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 83, 80, 2, 86, 87, 81, 79, 91, 78, 96, 82, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 93, 90, 76, 92, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 94, 2, 95, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 88, 2, 89, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 84, 85 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 16, 20, 27, 29, 30, 31, 36, 39, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 76, 82, 84, 86, 90, 94, 96, 98, 100, 102, 106, 108, 109, 117, 121, 123, 125, 127, 132, 136, 138, 142, 144, 148, 153, 155, 159, 161, 165, 167, 171, 175, 180, 186, 194, 200, 204, 205, 212, 213, 214, 224, 229, 232, 235, 243, 250, 254, 257, 260, 268, 271, 272, 278, 282, 283, 288, 290, 293, 295, 298, 303, 306, 309, 313, 318, 321, 324, 327, 331, 336, 339, 343, 348, 352, 357, 361, 365, 369, 373, 377, 383, 387, 391, 395, 399, 403, 405, 407, 409, 411, 413, 415, 417, 419, 421, 425, 426, 429, 432, 435, 441, 447, 449, 453, 457, 461, 465, 469, 473, 477, 481, 485, 489, 493, 497, 501, 505, 509, 513, 516, 519, 523, 525, 527, 529, 530, 534, 536, 538, 540, 545, 550, 552, 554, 556, 558, 560, 564, 566, 568, 572, 574, 576, 582, 584, 585, 587, 588, 593, 596, 598, 600, 602, 603, 605, 607 }; static const short yyrhs[] = { 97, 98, 0, 98, 0, 99, 0, 122, 0, 113, 0, 109, 0, 117, 0, 0, 101, 100, 103, 0, 163, 68, 102, 86, 160, 87, 0, 162, 0, 0, 0, 88, 104, 105, 89, 0, 105, 106, 0, 0, 107, 0, 123, 0, 124, 0, 125, 0, 126, 0, 132, 0, 133, 0, 134, 0, 103, 0, 135, 0, 136, 0, 140, 0, 147, 0, 148, 0, 149, 0, 21, 86, 152, 87, 90, 0, 22, 86, 152, 87, 90, 0, 150, 0, 90, 0, 15, 108, 90, 0, 18, 120, 90, 0, 113, 0, 109, 0, 122, 0, 117, 0, 108, 91, 116, 0, 116, 0, 0, 19, 68, 110, 88, 111, 89, 90, 0, 111, 91, 112, 0, 112, 0, 115, 0, 68, 0, 17, 16, 114, 90, 0, 114, 91, 115, 0, 115, 0, 68, 92, 151, 0, 68, 0, 68, 92, 151, 0, 35, 15, 118, 90, 0, 119, 0, 118, 91, 119, 0, 68, 0, 120, 91, 121, 0, 121, 0, 68, 92, 66, 0, 11, 101, 90, 0, 151, 92, 151, 90, 0, 3, 86, 151, 87, 106, 0, 3, 86, 151, 87, 106, 4, 106, 0, 6, 86, 151, 87, 106, 0, 130, 87, 106, 0, 0, 130, 9, 68, 127, 87, 106, 0, 0, 0, 130, 9, 68, 128, 10, 68, 129, 87, 106, 0, 131, 68, 8, 165, 0, 7, 86, 0, 155, 90, 0, 154, 157, 21, 86, 152, 87, 90, 0, 154, 157, 31, 86, 87, 90, 0, 5, 151, 90, 0, 5, 90, 0, 20, 106, 0, 20, 86, 151, 87, 88, 137, 89, 0, 137, 138, 0, 0, 14, 66, 139, 93, 105, 0, 86, 29, 87, 0, 0, 32, 141, 146, 143, 0, 151, 0, 142, 143, 0, 143, 0, 37, 90, 0, 38, 151, 143, 90, 0, 39, 90, 0, 40, 90, 0, 41, 151, 90, 0, 41, 151, 56, 90, 0, 29, 90, 0, 42, 90, 0, 43, 90, 0, 44, 151, 90, 0, 57, 44, 162, 90, 0, 45, 90, 0, 46, 44, 90, 0, 46, 44, 48, 90, 0, 47, 44, 90, 0, 47, 44, 48, 90, 0, 21, 151, 90, 0, 49, 151, 90, 0, 49, 144, 90, 0, 50, 151, 90, 0, 51, 151, 90, 0, 51, 151, 91, 145, 90, 0, 52, 151, 90, 0, 53, 151, 90, 0, 54, 151, 90, 0, 55, 151, 90, 0, 88, 142, 89, 0, 58, 0, 62, 0, 60, 0, 64, 0, 59, 0, 65, 0, 61, 0, 63, 0, 162, 0, 33, 151, 34, 0, 0, 12, 90, 0, 68, 93, 0, 13, 68, 0, 30, 86, 153, 87, 90, 0, 29, 86, 153, 87, 90, 0, 154, 0, 151, 79, 151, 0, 151, 78, 151, 0, 151, 81, 151, 0, 151, 82, 151, 0, 151, 83, 151, 0, 151, 72, 151, 0, 23, 72, 151, 0, 151, 73, 151, 0, 151, 76, 151, 0, 151, 74, 151, 0, 151, 77, 151, 0, 151, 75, 151, 0, 151, 70, 151, 0, 151, 71, 151, 0, 151, 8, 151, 0, 151, 80, 151, 0, 78, 154, 0, 84, 154, 0, 94, 153, 95, 0, 66, 0, 67, 0, 153, 0, 0, 153, 91, 151, 0, 151, 0, 69, 0, 164, 0, 165, 94, 151, 95, 0, 25, 94, 162, 95, 0, 155, 0, 27, 0, 28, 0, 24, 0, 26, 0, 86, 151, 87, 0, 158, 0, 156, 0, 154, 157, 158, 0, 85, 0, 96, 0, 68, 159, 86, 152, 87, 0, 36, 0, 0, 161, 0, 0, 161, 91, 163, 68, 0, 163, 68, 0, 69, 0, 166, 0, 15, 0, 0, 166, 0, 166, 0, 68, 0 }; #endif #if YYDEBUG /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { 0, 140, 142, 145, 147, 152, 153, 154, 157, 157, 169, 177, 179, 183, 183, 193, 199, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 221, 223, 224, 228, 231, 233, 235, 237, 243, 247, 267, 271, 271, 275, 277, 280, 282, 292, 296, 298, 301, 317, 323, 331, 335, 337, 340, 350, 352, 355, 362, 367, 372, 375, 379, 384, 391, 391, 399, 399, 399, 410, 418, 423, 428, 441, 449, 452, 456, 461, 466, 472, 476, 484, 487, 491, 507, 511, 514, 521, 524, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 577, 579, 581, 583, 585, 589, 592, 594, 596, 598, 600, 602, 604, 608, 612, 615, 619, 624, 642, 647, 654, 662, 665, 667, 669, 671, 673, 675, 677, 679, 681, 683, 685, 687, 689, 691, 693, 695, 697, 700, 702, 704, 706, 710, 712, 716, 719, 726, 729, 731, 733, 735, 737, 739, 741, 743, 745, 749, 751, 754, 762, 764, 767, 784, 787, 791, 793, 797, 800, 807, 809, 825, 827, 830, 844, 860 }; #endif #if (YYDEBUG) || defined YYERROR_VERBOSE /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { "$", "error", "$undefined.", "IF", "ELSE", "RETURN", "WHILE", "FOR", "UCC_IN", "WITH", "TO", "EXTERN", "BREAK", "GOTO", "CASE", "VAR", "UCC_INT", "UCC_CONST", "STRING", "ENUM", "CONVERSE", "SAY", "MESSAGE", "RESPONSE", "EVENT", "FLAG", "ITEM", "UCTRUE", "UCFALSE", "REMOVE", "ADD", "HIDE", "SCRIPT", "AFTER", "TICKS", "STATIC_", "ORIGINAL", "CONTINUE", "REPEAT", "NOP", "NOHALT", "WAIT", "RISE", "DESCEND", "FRAME", "HATCH", "NEXT", "PREVIOUS", "CYCLE", "STEP", "MUSIC", "CALL", "SPEECH", "SFX", "FACE", "HIT", "HOURS", "ACTOR", "NORTH", "SOUTH", "EAST", "WEST", "NE", "NW", "SE", "SW", "STRING_LITERAL", "STRING_PREFIX", "IDENTIFIER", "INT_LITERAL", "AND", "OR", "EQUALS", "NEQUALS", "LTEQUALS", "GTEQUALS", "'<'", "'>'", "'-'", "'+'", "'&'", "'*'", "'/'", "'%'", "NOT", "UCC_POINTS", "'('", "')'", "'{'", "'}'", "';'", "','", "'='", "':'", "'['", "']'", "'.'", "design", "global_decl", "function", "@1", "function_proto", "opt_int", "statement_block", "@2", "statement_list", "statement", "declaration", "var_decl_list", "enum_decl", "@3", "enum_item_list", "enum_item", "const_int_decl", "const_int_decl_list", "const_int", "var_decl", "static_decl", "static_var_decl_list", "static_var", "string_decl_list", "string_decl", "function_decl", "assignment_statement", "if_statement", "while_statement", "array_loop_statement", "@4", "@5", "@6", "start_array_loop", "start_for", "function_call_statement", "special_method_call_statement", "return_statement", "converse_statement", "converse2_statement", "converse_case_list", "converse_case", "converse_options", "script_statement", "item", "script_command_list", "script_command", "direction", "eventid", "opt_script_delay", "break_statement", "label_statement", "goto_statement", "answer_statement", "expression", "opt_expression_list", "expression_list", "primary", "function_call", "method_call", "hierarchy_tok", "routine_call", "opt_original", "opt_identifier_list", "identifier_list", "int_literal", "opt_var", "declared_var_value", "declared_var", "declared_sym", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { 0, 97, 97, 98, 98, 98, 98, 98, 100, 99, 101, 102, 102, 104, 103, 105, 105, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 107, 107, 107, 107, 107, 107, 108, 108, 110, 109, 111, 111, 112, 112, 113, 114, 114, 115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 123, 124, 124, 125, 126, 127, 126, 128, 129, 126, 130, 131, 132, 133, 133, 134, 134, 135, 136, 137, 137, 138, 139, 139, 140, 141, 142, 142, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 144, 144, 145, 146, 146, 147, 148, 149, 150, 150, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 153, 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, 154, 155, 155, 156, 157, 157, 158, 159, 159, 160, 160, 161, 161, 162, 162, 163, 163, 164, 165, 166 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 0, 3, 6, 1, 0, 0, 4, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 1, 1, 3, 3, 1, 1, 1, 1, 3, 1, 0, 7, 3, 1, 1, 1, 4, 3, 1, 3, 1, 3, 4, 1, 3, 1, 3, 1, 3, 3, 4, 5, 7, 5, 3, 0, 6, 0, 0, 9, 4, 2, 2, 7, 6, 3, 2, 2, 7, 2, 0, 5, 3, 0, 4, 1, 2, 1, 2, 4, 2, 2, 3, 4, 2, 2, 2, 3, 4, 2, 3, 4, 3, 4, 3, 3, 3, 3, 3, 5, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, 2, 5, 5, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 1, 1, 1, 0, 3, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, 3, 1, 1, 3, 1, 1, 5, 1, 0, 1, 0, 4, 2, 1, 1, 1, 0, 1, 1, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const short yydefact[] = { 186, 186, 185, 0, 0, 0, 186, 2, 3, 8, 6, 5, 7, 4, 0, 0, 0, 44, 0, 1, 0, 12, 63, 0, 0, 52, 0, 59, 0, 57, 13, 9, 189, 183, 0, 11, 184, 0, 50, 0, 0, 56, 0, 16, 180, 0, 168, 0, 169, 166, 167, 155, 156, 189, 161, 0, 0, 0, 0, 53, 135, 165, 172, 171, 162, 0, 187, 51, 49, 0, 47, 48, 58, 0, 0, 179, 0, 0, 0, 177, 0, 152, 153, 0, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 189, 14, 35, 25, 15, 17, 39, 38, 41, 40, 18, 19, 20, 21, 0, 0, 22, 23, 24, 26, 27, 28, 29, 30, 31, 34, 0, 135, 165, 10, 186, 182, 142, 0, 158, 170, 0, 154, 150, 148, 149, 141, 143, 145, 147, 144, 146, 137, 136, 151, 138, 139, 140, 178, 173, 0, 45, 46, 0, 80, 0, 0, 75, 130, 132, 54, 0, 43, 0, 0, 61, 0, 81, 158, 158, 0, 0, 129, 89, 131, 0, 0, 0, 0, 0, 76, 0, 164, 0, 157, 159, 163, 0, 79, 0, 0, 36, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 0, 69, 68, 0, 0, 0, 0, 181, 176, 0, 0, 55, 42, 62, 60, 170, 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, 88, 0, 0, 74, 188, 64, 158, 0, 65, 67, 84, 32, 33, 134, 133, 128, 0, 98, 92, 0, 94, 95, 0, 99, 100, 0, 103, 0, 0, 119, 123, 121, 125, 120, 126, 122, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 0, 0, 0, 0, 0, 0, 108, 0, 0, 96, 101, 0, 104, 0, 106, 110, 109, 111, 112, 0, 114, 115, 116, 117, 0, 118, 90, 70, 72, 0, 78, 66, 0, 82, 83, 93, 97, 105, 107, 0, 127, 102, 0, 77, 87, 113, 0, 0, 0, 73, 0, 16, 86, 85, 0, 0 }; static const short yydefgoto[] = { 6, 7, 8, 20, 9, 34, 124, 43, 73, 125, 126, 187, 127, 26, 69, 70, 128, 24, 71, 188, 129, 28, 29, 190, 191, 130, 131, 132, 133, 134, 272, 273, 361, 135, 136, 137, 138, 139, 140, 141, 324, 353, 367, 142, 198, 317, 271, 308, 358, 228, 143, 144, 145, 146, 147, 209, 210, 60, 61, 62, 103, 63, 80, 74, 75, 35, 14, 64, 65, 66 }; static const short yypact[] = { 98, 53,-32768, 91, 14, 99, 101,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 51, 32, 76,-32768, 103,-32768, 81, -3,-32768, 35, 40,-32768, 84,-32768, 44,-32768, -32768,-32768,-32768,-32768, 87,-32768,-32768, 936,-32768, 76, 107,-32768, 103,-32768, 27, 104,-32768, 85,-32768,-32768, -32768,-32768,-32768, -14,-32768, 22, 22, 936, 936, 868, -33,-32768,-32768,-32768,-32768, 86, 90,-32768, 35, -35, -32768,-32768,-32768, 8, 94, 96, 109, 936, -3,-32768, 92, -33, -33, 788, 868, -38, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936, 936,-32768,-32768, 117, 936, 112, 107, 119, 206, 120, 121, 113, 136, 140, 141, 333, 125, 129, 130, 131, 936, -24,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 0, 150,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 299, -33, 132, -32768, 53,-32768, 59, 124, 936,-32768, 936,-32768, 59, 581, 581, 59, 59, 59, 59, 59, 59, 23, 23, 23,-32768,-32768,-32768, 184,-32768, 118,-32768,-32768, 936, -32768, 465, 936,-32768,-32768,-32768, 133, 58,-32768, 134, 60,-32768, 936,-32768, 936, 936, 936, 936, 191, 868, -32768, 159, 419, 220, 936, 20,-32768, 167,-32768, 149, 146, 868,-32768, 809,-32768, 827, 936,-32768, 140, 172, -32768, 141, 845, 152, 153, -7, 34, 936, 1022, 231, -32768, 174, 486, 158, 160,-32768,-32768, 419, 419, 868, -32768,-32768,-32768, 162, 157, 161, 164, 165, 903, 936, 169, 176, 936, 177, 179, 936, 181, 186, 936, 187, 208, 213, 929, 936, 936, 936, 936, 936, 936, 234, 1022,-32768, 192, 270,-32768,-32768,-32768, 936, 194, 279, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 520,-32768,-32768, 769,-32768,-32768, 444,-32768,-32768, 541,-32768, -9, 10, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 195, 562, 596, 385, 617, 638, 672, 693, -3, 995,-32768, 419, 218, 200, 198, 419, -4,-32768, 199, 201,-32768,-32768, 204,-32768, 209,-32768,-32768,-32768,-32768,-32768, -3,-32768, -32768,-32768,-32768, 211,-32768,-32768,-32768,-32768, 214,-32768, -32768, 232,-32768,-32768,-32768,-32768,-32768,-32768, 215,-32768, -32768, 216,-32768, 222,-32768, 419, 277, 219,-32768, 224, -32768,-32768, 419, 309,-32768 }; static const short yypgoto[] = { -32768, 307,-32768,-32768, 313,-32768, 296,-32768, -50, -109, -32768,-32768, 61,-32768,-32768, 217, 64,-32768, 39, 108, 73,-32768, 280,-32768, 106, 83,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -246,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 66, -178, -51, -55, -70,-32768, 189, -95,-32768,-32768,-32768, -73, -40,-32768, 110, -19 }; #define YYLAST 1110 static const short yytable[] = { 81, 82, 36, 149, 76, 154, 193, 85, 175, 201, 351, 107, 79, 108, 109, 110, 223, 224, 148, 1, 111, 112, 79, 113, 318, 3, 114, 4, 115, 116, 117, 45, 46, 47, 48, 49, 50, 118, 119, 330, 120, 233, 2, 5, 326, 149, 46, 47, 48, 49, 50, 234, 101, 157, 105, 25, 106, 158, 332, 36, 148, 10, -178, 102, 11, 32, 33, 10, 2, 200, 11, 345, -178, 12, 51, 52, 121, 54, 67, 12, 246, 331, 17, 13, 157, 352, 55, 202, 174, 13, 53, 54, 56, 230, 57, -186, 30, 122, 123, 321, 333, 373, 58, 59, 98, 99, 100, 16, 57, 1, 175, 207, 1, 2, 18, 3, 2, 4, 3, 21, 4, 247, 22, 83, 84, 157, 86, 37, 279, 280, 38, 39, 149, 5, 41, 42, 5, 95, 96, 97, 98, 99, 100, 153, 23, 225, 226, 148, 217, 218, 220, 221, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 149, 149, 30, 176, 27, 40, 44, 181, 68, 77, 152, 155, 78, 104, 150, 148, 148, -188, 174, 199, 151, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 177, 184, 185, 179, 182, 183, 186, 189, 346, 194, 275, 212, 350, 195, 196, 197, 203, 208, 79, 84, 206, 211, 227, 216, 219, 229, 231, 45, 46, 47, 48, 49, 50, 235, 236, 157, 241, 244, 245, -71, 32, 343, 277, 213, 278, 282, 215, 149, 281, 283, 298, 149, 284, 285, 368, 299, 222, 288, 84, 84, 84, 84, 148, 359, 289, 291, 148, 292, 232, 294, 51, 52, 53, 54, 295, 297, 316, 319, 320, 322, 239, 323, 55, 334, 347, 348, 349, 354, 56, 355, 57, 248, 356, 149, 180, 36, 363, 357, 58, 360, 149, 365, 362, 364, 369, 86, 366, 374, 148, 371, 370, 19, 15, 287, 31, 148, 290, 36, 372, 293, 72, 178, 296, 0, 240, 242, 309, 310, 311, 312, 313, 314, 315, 0, 107, 205, 108, 109, 110, 274, 0, 84, 1, 111, 112, 0, 113, 0, 3, 114, 4, 115, 116, 117, 45, 46, 47, 48, 49, 50, 118, 119, 0, 120, 0, 0, 5, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 0, 0, 0, 0, 0, 204, 0, 86, 0, 0, 0, 0, 0, 51, 52, 121, 54, 0, 0, 0, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 56, 0, 192, 0, 30, 107, 123, 108, 109, 110, 58, 0, 0, 1, 111, 112, 0, 113, 0, 3, 114, 4, 115, 116, 117, 45, 46, 47, 48, 49, 50, 118, 119, 0, 120, 86, 0, 5, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 0, 86, 0, 337, 338, 0, 0, 0, 0, 0, 0, 0, 0, 51, 52, 121, 54, 0, 0, 0, 0, 0, 86, 0, 0, 55, 0, 0, 327, 0, 0, 56, 0, 57, 0, 30, 0, 123, 0, 0, 0, 58, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 328, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 214, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 276, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 325, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 329, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 335, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 336, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 339, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 0, 0, 0, 340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 0, 0, 0, 341, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 0, 0, 342, 0, 0, 0, 0, 0, 0, 249, 0, 0, 0, 0, 0, 86, 0, 250, 0, 0, 0, 0, 0, 0, 0, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 86, 262, 263, 264, 265, 266, 267, 268, 0, 269, 0, 0, 0, 0, 0, 0, 0, 0, 86, 0, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 0, 270, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 156, 86, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 237, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 86, 0, 0, 238, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 0, 0, 0, 243, 0, 0, 0, 0, 286, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 45, 46, 47, 48, 49, 50, 0, 45, 46, 47, 48, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 300, 301, 302, 303, 304, 305, 306, 307, 51, 52, 53, 54, 0, 0, 0, 51, 52, 53, 54, 0, 55, 0, 0, 0, 0, 0, 56, 55, 57, 249, 0, 0, 0, 56, 0, 57, 58, 250, 0, 0, 0, 0, 0, 58, 0, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 249, 262, 263, 264, 265, 266, 267, 268, 250, 269, 0, 0, 0, 0, 0, 0, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 0, 262, 263, 264, 265, 266, 267, 268, 0, 269, 0, 0, 0, 270, 344, 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, 270 }; static const short yycheck[] = { 55, 56, 21, 73, 44, 78, 115, 58, 103, 9, 14, 3, 36, 5, 6, 7, 194, 195, 73, 11, 12, 13, 36, 15, 270, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 48, 32, 21, 15, 35, 290, 115, 24, 25, 26, 27, 28, 31, 85, 91, 89, 16, 91, 95, 48, 78, 115, 0, 86, 96, 0, 68, 69, 6, 15, 93, 6, 317, 86, 0, 66, 67, 68, 69, 39, 6, 87, 90, 68, 0, 91, 89, 78, 87, 68, 6, 68, 69, 84, 202, 86, 68, 88, 89, 90, 277, 90, 0, 94, 37, 81, 82, 83, 16, 86, 11, 205, 151, 11, 15, 15, 17, 15, 19, 17, 68, 19, 87, 90, 57, 58, 91, 8, 92, 237, 238, 90, 91, 202, 35, 90, 91, 35, 78, 79, 80, 81, 82, 83, 77, 68, 196, 197, 202, 90, 91, 90, 91, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 237, 238, 88, 104, 68, 88, 86, 108, 68, 72, 68, 86, 94, 94, 87, 237, 238, 94, 68, 120, 91, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 90, 90, 68, 86, 86, 86, 68, 68, 319, 86, 231, 95, 323, 86, 86, 86, 68, 95, 36, 155, 90, 157, 33, 92, 92, 68, 8, 23, 24, 25, 26, 27, 28, 68, 87, 91, 66, 87, 87, 10, 68, 316, 86, 179, 86, 90, 182, 319, 88, 90, 44, 323, 90, 90, 365, 44, 192, 90, 194, 195, 196, 197, 319, 338, 90, 90, 323, 90, 204, 90, 66, 67, 68, 69, 90, 90, 44, 87, 10, 87, 216, 4, 78, 90, 68, 87, 90, 90, 84, 90, 86, 227, 90, 365, 90, 316, 66, 90, 94, 90, 372, 87, 90, 90, 29, 8, 86, 0, 365, 87, 93, 6, 1, 249, 20, 372, 252, 338, 370, 255, 42, 106, 258, -1, 218, 221, 262, 263, 264, 265, 266, 267, 268, -1, 3, 148, 5, 6, 7, 231, -1, 277, 11, 12, 13, -1, 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, -1, -1, 35, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, -1, -1, -1, -1, -1, 92, -1, 8, -1, -1, -1, -1, -1, 66, 67, 68, 69, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1, -1, 84, -1, 86, -1, 88, 3, 90, 5, 6, 7, 94, -1, -1, 11, 12, 13, -1, 15, -1, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, 32, 8, -1, 35, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, -1, 8, -1, 90, 91, -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, 68, 69, -1, -1, -1, -1, -1, 8, -1, -1, 78, -1, -1, 56, -1, -1, 84, -1, 86, -1, 88, -1, 90, -1, -1, -1, 94, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, -1, -1, -1, 90, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, 8, -1, 29, -1, -1, -1, -1, -1, -1, -1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 8, 49, 50, 51, 52, 53, 54, 55, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, -1, 88, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, 87, 8, -1, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, 87, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 8, -1, -1, 87, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, 34, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 23, 24, 25, 26, 27, 28, -1, 23, 24, 25, 26, 27, 28, -1, -1, -1, -1, -1, -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, -1, -1, -1, 66, 67, 68, 69, -1, 78, -1, -1, -1, -1, -1, 84, 78, 86, 21, -1, -1, -1, 84, -1, 86, 94, 29, -1, -1, -1, -1, -1, 94, -1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 21, 49, 50, 51, 52, 53, 54, 55, 29, 57, -1, -1, -1, -1, -1, -1, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, 50, 51, 52, 53, 54, 55, -1, 57, -1, -1, -1, 88, 89, -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, 88 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; # if YYLSP_NEEDED YYLTYPE yyls; # endif }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # if YYLSP_NEEDED # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) # else # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) # endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). When YYLLOC_DEFAULT is run, CURRENT is set the location of the first token. By default, to implement support for ranges, extend its range to the last symbol. */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #if YYPURE # if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else # define YYLEX yylex (&yylval, &yylloc) # endif # else /* !YYLSP_NEEDED */ # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) # else # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ #else /* !YYPURE */ # define YYLEX yylex () #endif /* !YYPURE */ /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #ifdef YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif #line 315 "/usr/share/bison/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* YY_DECL_VARIABLES -- depending whether we use a pure parser, variables are global, or local to YYPARSE. */ #define YY_DECL_NON_LSP_VARIABLES \ /* The lookahead symbol. */ \ int yychar; \ \ /* The semantic value of the lookahead symbol. */ \ YYSTYPE yylval; \ \ /* Number of parse errors so far. */ \ int yynerrs; #if YYLSP_NEEDED # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES \ \ /* Location data for the lookahead symbol. */ \ YYLTYPE yylloc; #else # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES #endif /* If nonreentrant, generate the variables here. */ #if !YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { /* If reentrant, generate the variables here. */ #if YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif #if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYLSP_NEEDED YYLTYPE yyloc; #endif /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; #if YYLSP_NEEDED yylsp = yyls; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ # if YYLSP_NEEDED YYLTYPE *yyls1 = yyls; /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; # else yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); # endif yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; #if YYLSP_NEEDED yylsp = yyls + yysize - 1; #endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { YYFPRINTF (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT YYPRINT (stderr, yychar, yylval); # endif YYFPRINTF (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to the semantic value of the lookahead token. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; #if YYLSP_NEEDED /* Similarly for the default location. Let the user run additional commands if for instance locations are ranges. */ yyloc = yylsp[1-yylen]; YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 4: #line 148 "ucparse.yy" { if (!Uc_function::add_global_function_symbol(yyvsp[0].funsym)) delete yyvsp[0].funsym; } break; case 8: #line 159 "ucparse.yy" { function = new Uc_function(yyvsp[0].funsym); } break; case 9: #line 161 "ucparse.yy" { function->set_statement(yyvsp[0].stmt); functions.push_back(function); function = 0; } break; case 10: #line 171 "ucparse.yy" { yyval.funsym = new Uc_function_symbol(yyvsp[-4].strval, yyvsp[-3].intval, *yyvsp[-1].strvec); delete yyvsp[-1].strvec; // A copy was made. } break; case 12: #line 180 "ucparse.yy" { yyval.intval = -1; } break; case 13: #line 185 "ucparse.yy" { function->push_scope(); } break; case 14: #line 187 "ucparse.yy" { yyval.stmt = yyvsp[-1].block; function->pop_scope(); } break; case 15: #line 195 "ucparse.yy" { if (yyvsp[0].stmt) yyval.block->add(yyvsp[0].stmt); } break; case 16: #line 200 "ucparse.yy" { yyval.block = new Uc_block_statement(); } break; case 32: #line 220 "ucparse.yy" { yyval.stmt = new Uc_say_statement(yyvsp[-2].exprlist); } break; case 33: #line 222 "ucparse.yy" { yyval.stmt = new Uc_message_statement(yyvsp[-2].exprlist); } break; case 35: #line 225 "ucparse.yy" { yyval.stmt = 0; } break; case 36: #line 230 "ucparse.yy" { yyval.stmt = yyvsp[-1].stmt; } break; case 37: #line 232 "ucparse.yy" { yyval.stmt = 0; } break; case 38: #line 234 "ucparse.yy" { yyval.stmt = 0; } break; case 39: #line 236 "ucparse.yy" { yyval.stmt = 0; } break; case 40: #line 238 "ucparse.yy" { if (!function->add_function_symbol(yyvsp[0].funsym)) delete yyvsp[0].funsym; yyval.stmt = 0; } break; case 41: #line 244 "ucparse.yy" { yyval.stmt = 0; } break; case 42: #line 249 "ucparse.yy" { if (!yyvsp[0].stmt) yyval.stmt = yyvsp[-2].stmt; else if (!yyvsp[-2].stmt) yyval.stmt = yyvsp[0].stmt; else /* Both nonzero. Need a list. */ { Uc_block_statement *b = dynamic_cast(yyvsp[-2].stmt); if (!b) { b = new Uc_block_statement(); b->add(yyvsp[-2].stmt); } b->add(yyvsp[0].stmt); yyval.stmt = b; } } break; case 43: #line 268 "ucparse.yy" { yyval.stmt = yyvsp[0].stmt; } break; case 44: #line 272 "ucparse.yy" { enum_val = -1; } break; case 49: #line 283 "ucparse.yy" { /* Increment last value. */ ++enum_val; if (function) function->add_int_const_symbol(yyvsp[0].strval, enum_val); else // Global. Uc_function::add_global_int_const_symbol(yyvsp[0].strval, enum_val); } break; case 53: #line 303 "ucparse.yy" { int val; // Get constant. if (yyvsp[0].expr->eval_const(val)) { if (function) function->add_int_const_symbol(yyvsp[-2].strval, val); else // Global. Uc_function::add_global_int_const_symbol( yyvsp[-2].strval, val); enum_val = val; // In case we're in an enum. } } break; case 54: #line 319 "ucparse.yy" { function->add_symbol(yyvsp[0].strval); yyval.stmt = 0; } break; case 55: #line 324 "ucparse.yy" { Uc_var_symbol *var = function->add_symbol(yyvsp[-2].strval); yyval.stmt = new Uc_assignment_statement( new Uc_var_expression(var), yyvsp[0].expr); } break; case 59: #line 342 "ucparse.yy" { if (function) function->add_static(yyvsp[0].strval); else Uc_function::add_global_static(yyvsp[0].strval); } break; case 62: #line 357 "ucparse.yy" { function->add_string_symbol(yyvsp[-2].strval, yyvsp[0].strval); } break; case 63: #line 364 "ucparse.yy" { yyval.funsym = yyvsp[-1].funsym; } break; case 64: #line 369 "ucparse.yy" { yyval.stmt = new Uc_assignment_statement(yyvsp[-3].expr, yyvsp[-1].expr); } break; case 65: #line 374 "ucparse.yy" { yyval.stmt = new Uc_if_statement(yyvsp[-2].expr, yyvsp[0].stmt, 0); } break; case 66: #line 376 "ucparse.yy" { yyval.stmt = new Uc_if_statement(yyvsp[-4].expr, yyvsp[-2].stmt, yyvsp[0].stmt); } break; case 67: #line 381 "ucparse.yy" { yyval.stmt = new Uc_while_statement(yyvsp[-2].expr, yyvsp[0].stmt); } break; case 68: #line 386 "ucparse.yy" { yyvsp[-2].arrayloop->set_statement(yyvsp[0].stmt); yyvsp[-2].arrayloop->finish(function); function->pop_scope(); } break; case 69: #line 392 "ucparse.yy" { yyvsp[-2].arrayloop->set_index(function->add_symbol(yyvsp[0].strval)); } break; case 70: #line 394 "ucparse.yy" { yyvsp[-5].arrayloop->set_statement(yyvsp[0].stmt); yyvsp[-5].arrayloop->finish(function); function->pop_scope(); } break; case 71: #line 400 "ucparse.yy" { yyvsp[-2].arrayloop->set_index(function->add_symbol(yyvsp[0].strval)); } break; case 72: #line 402 "ucparse.yy" { yyvsp[-5].arrayloop->set_array_size(function->add_symbol(yyvsp[0].strval)); } break; case 73: #line 404 "ucparse.yy" { yyvsp[-8].arrayloop->set_statement(yyvsp[0].stmt); function->pop_scope(); } break; case 74: #line 412 "ucparse.yy" { Uc_var_symbol *var = function->add_symbol(yyvsp[-2].strval); yyval.arrayloop = new Uc_arrayloop_statement(var, yyvsp[0].var); } break; case 75: #line 420 "ucparse.yy" { function->push_scope(); } break; case 76: #line 425 "ucparse.yy" { yyval.stmt = new Uc_call_statement(yyvsp[-1].funcall); } break; case 77: #line 431 "ucparse.yy" { Uc_block_statement *stmts = new Uc_block_statement(); /* Set up 'show' call. */ stmts->add(new Uc_call_statement( new Uc_call_expression(Uc_function::get_show_face(), new Uc_array_expression(yyvsp[-6].expr, new Uc_int_expression(0)), function))); stmts->add(new Uc_say_statement(yyvsp[-2].exprlist)); yyval.stmt = stmts; } break; case 78: #line 442 "ucparse.yy" { yyval.stmt = new Uc_call_statement( new Uc_call_expression(Uc_function::get_remove_face(), new Uc_array_expression(yyvsp[-5].expr), function)); } break; case 79: #line 451 "ucparse.yy" { yyval.stmt = new Uc_return_statement(yyvsp[-1].expr); } break; case 80: #line 453 "ucparse.yy" { yyval.stmt = new Uc_return_statement(); } break; case 81: #line 458 "ucparse.yy" { yyval.stmt = new Uc_converse_statement(yyvsp[0].stmt); } break; case 82: #line 463 "ucparse.yy" { yyval.stmt = new Uc_converse2_statement(yyvsp[-4].expr, yyvsp[-1].block); } break; case 83: #line 468 "ucparse.yy" { if (yyvsp[0].stmt) yyval.block->add(yyvsp[0].stmt); } break; case 84: #line 473 "ucparse.yy" { yyval.block = new Uc_block_statement(); } break; case 85: #line 478 "ucparse.yy" { yyval.stmt = new Uc_converse_case_statement(function->add_string(yyvsp[-3].strval), (yyvsp[-2].intval ? true : false), yyvsp[0].block); } break; case 86: #line 486 "ucparse.yy" { yyval.intval = 1; } break; case 87: #line 488 "ucparse.yy" { yyval.intval = 0; } break; case 88: #line 493 "ucparse.yy" { Uc_array_expression *parms = new Uc_array_expression(); parms->add(yyvsp[-2].expr); // Itemref. parms->add(yyvsp[0].expr); // Script. if (yyvsp[-1].expr) // Delay? parms->add(yyvsp[-1].expr); // Get the script intrinsic. Uc_symbol *sym = Uc_function::get_intrinsic(yyvsp[-1].expr ? 2 : 1); Uc_call_expression *fcall = new Uc_call_expression(sym, parms, function); yyval.stmt = new Uc_call_statement(fcall); } break; case 90: #line 513 "ucparse.yy" { yyval.exprlist->concat(yyvsp[0].expr); } break; case 91: #line 515 "ucparse.yy" { yyval.exprlist = new Uc_array_expression(); yyval.exprlist->concat(yyvsp[0].expr); } break; case 92: #line 523 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::cont); } break; case 93: #line 525 "ucparse.yy" { Uc_array_expression *result = new Uc_array_expression(); result->concat(yyvsp[-1].expr); // Start with cmnds. to repeat. int sz = result->get_exprs().size(); result->add(new Uc_int_expression(Ucscript::repeat)); // Then -offset to start. result->add(new Uc_int_expression(-sz)); result->add(yyvsp[-2].expr); // Then #times to repeat. yyval.expr = result; } break; case 94: #line 537 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::nop); } break; case 95: #line 539 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::dont_halt); } break; case 96: #line 541 "ucparse.yy" { yyval.expr = Create_array(Ucscript::delay_ticks, yyvsp[-1].expr); } break; case 97: #line 543 "ucparse.yy" { yyval.expr = Create_array(Ucscript::delay_hours, yyvsp[-2].expr); } break; case 98: #line 545 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::remove); } break; case 99: #line 547 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::rise); } break; case 100: #line 549 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::descend); } break; case 101: #line 551 "ucparse.yy" { yyval.expr = Create_array(Ucscript::frame, yyvsp[-1].expr); } break; case 102: #line 553 "ucparse.yy" { yyval.expr = new Uc_int_expression(0x61 + (yyvsp[-1].intval & 15)); } break; case 103: #line 555 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::egg); } break; case 104: #line 557 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::next_frame_max); } break; case 105: #line 559 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::next_frame); } break; case 106: #line 561 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::prev_frame_min); } break; case 107: #line 563 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::prev_frame); } break; case 108: #line 565 "ucparse.yy" { yyval.expr = Create_array(Ucscript::say, yyvsp[-1].expr); } break; case 109: #line 567 "ucparse.yy" { yyval.expr = Create_array(Ucscript::step, yyvsp[-1].expr); } break; case 110: #line 569 "ucparse.yy" { yyval.expr = new Uc_int_expression(Ucscript::step_n + yyvsp[-1].intval); } break; case 111: #line 571 "ucparse.yy" { yyval.expr = Create_array(Ucscript::music, yyvsp[-1].expr); } break; case 112: #line 573 "ucparse.yy" { yyval.expr = Create_array(Ucscript::usecode, yyvsp[-1].expr); } break; case 113: #line 575 "ucparse.yy" { yyval.expr = Create_array(Ucscript::usecode2, yyvsp[-3].expr, new Uc_int_expression(yyvsp[-1].intval)); } break; case 114: #line 578 "ucparse.yy" { yyval.expr = Create_array(Ucscript::speech, yyvsp[-1].expr); } break; case 115: #line 580 "ucparse.yy" { yyval.expr = Create_array(Ucscript::sfx, yyvsp[-1].expr); } break; case 116: #line 582 "ucparse.yy" { yyval.expr = Create_array(Ucscript::face_dir, yyvsp[-1].expr); } break; case 117: #line 584 "ucparse.yy" { yyval.expr = Create_array(Ucscript::hit, yyvsp[-1].expr); } break; case 118: #line 586 "ucparse.yy" { yyval.expr = yyvsp[-1].exprlist; } break; case 119: #line 591 "ucparse.yy" { yyval.intval = 0; } break; case 120: #line 593 "ucparse.yy" { yyval.intval = 1; } break; case 121: #line 595 "ucparse.yy" { yyval.intval = 2; } break; case 122: #line 597 "ucparse.yy" { yyval.intval = 3; } break; case 123: #line 599 "ucparse.yy" { yyval.intval = 4; } break; case 124: #line 601 "ucparse.yy" { yyval.intval = 5; } break; case 125: #line 603 "ucparse.yy" { yyval.intval = 6; } break; case 126: #line 605 "ucparse.yy" { yyval.intval = 7; } break; case 128: #line 614 "ucparse.yy" { yyval.expr = yyvsp[-1].expr; } break; case 129: #line 616 "ucparse.yy" { yyval.expr = 0; } break; case 130: #line 621 "ucparse.yy" { yyval.stmt = new Uc_break_statement(); } break; case 131: #line 626 "ucparse.yy" { Uc_label *label = function->search_label(yyvsp[-1].strval); if (label) { char buf[150]; sprintf(buf, "duplicate label: '%s'", yyvsp[-1].strval); yyerror(buf); yyval.stmt = 0; } else { label = new Uc_label(yyvsp[-1].strval); function->add_label(label); yyval.stmt = new Uc_label_statement(label); } } break; case 132: #line 644 "ucparse.yy" { yyval.stmt = new Uc_goto_statement(yyvsp[0].strval); } break; case 133: #line 649 "ucparse.yy" { yyval.stmt = new Uc_call_statement( new Uc_call_expression(Uc_function::get_add_answer(), yyvsp[-2].exprlist, function)); } break; case 134: #line 655 "ucparse.yy" { yyval.stmt = new Uc_call_statement(new Uc_call_expression( Uc_function::get_remove_answer(), yyvsp[-2].exprlist, function)); } break; case 135: #line 664 "ucparse.yy" { yyval.expr = yyvsp[0].expr; } break; case 136: #line 666 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_ADD, yyvsp[-2].expr, yyvsp[0].expr); } break; case 137: #line 668 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_SUB, yyvsp[-2].expr, yyvsp[0].expr); } break; case 138: #line 670 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_MUL, yyvsp[-2].expr, yyvsp[0].expr); } break; case 139: #line 672 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_DIV, yyvsp[-2].expr, yyvsp[0].expr); } break; case 140: #line 674 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_MOD, yyvsp[-2].expr, yyvsp[0].expr); } break; case 141: #line 676 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPEQ, yyvsp[-2].expr, yyvsp[0].expr); } break; case 142: #line 678 "ucparse.yy" { yyval.expr = new Uc_response_expression(yyvsp[0].expr); } break; case 143: #line 680 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPNE, yyvsp[-2].expr, yyvsp[0].expr); } break; case 144: #line 682 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPL, yyvsp[-2].expr, yyvsp[0].expr); } break; case 145: #line 684 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPLE, yyvsp[-2].expr, yyvsp[0].expr); } break; case 146: #line 686 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPG, yyvsp[-2].expr, yyvsp[0].expr); } break; case 147: #line 688 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_CMPGE, yyvsp[-2].expr, yyvsp[0].expr); } break; case 148: #line 690 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_AND, yyvsp[-2].expr, yyvsp[0].expr); } break; case 149: #line 692 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_OR, yyvsp[-2].expr, yyvsp[0].expr); } break; case 150: #line 694 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_IN, yyvsp[-2].expr, yyvsp[0].expr); } break; case 151: #line 696 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_ARRA, yyvsp[-2].expr, yyvsp[0].expr); } break; case 152: #line 698 "ucparse.yy" { yyval.expr = new Uc_binary_expression(UC_SUB, new Uc_int_expression(0), yyvsp[0].expr); } break; case 153: #line 701 "ucparse.yy" { yyval.expr = new Uc_unary_expression(UC_NOT, yyvsp[0].expr); } break; case 154: #line 703 "ucparse.yy" { yyval.expr = yyvsp[-1].exprlist; } break; case 155: #line 705 "ucparse.yy" { yyval.expr = new Uc_string_expression(function->add_string(yyvsp[0].strval)); } break; case 156: #line 707 "ucparse.yy" { yyval.expr = new Uc_string_prefix_expression(function, yyvsp[0].strval); } break; case 158: #line 713 "ucparse.yy" { yyval.exprlist = new Uc_array_expression(); } break; case 159: #line 718 "ucparse.yy" { yyval.exprlist->add(yyvsp[0].expr); } break; case 160: #line 720 "ucparse.yy" { yyval.exprlist = new Uc_array_expression(); yyval.exprlist->add(yyvsp[0].expr); } break; case 161: #line 728 "ucparse.yy" { yyval.expr = new Uc_int_expression(yyvsp[0].intval); } break; case 162: #line 730 "ucparse.yy" { yyval.expr = yyvsp[0].expr; } break; case 163: #line 732 "ucparse.yy" { yyval.expr = new Uc_arrayelem_expression(yyvsp[-3].var, yyvsp[-1].expr); } break; case 164: #line 734 "ucparse.yy" { yyval.expr = new Uc_flag_expression(yyvsp[-1].intval); } break; case 165: #line 736 "ucparse.yy" { yyval.expr = yyvsp[0].funcall; } break; case 166: #line 738 "ucparse.yy" { yyval.expr = new Uc_bool_expression(true); } break; case 167: #line 740 "ucparse.yy" { yyval.expr = new Uc_bool_expression(false); } break; case 168: #line 742 "ucparse.yy" { yyval.expr = new Uc_event_expression(); } break; case 169: #line 744 "ucparse.yy" { yyval.expr = new Uc_item_expression(); } break; case 170: #line 746 "ucparse.yy" { yyval.expr = yyvsp[-1].expr; } break; case 173: #line 756 "ucparse.yy" { yyvsp[0].funcall->set_itemref(yyvsp[-2].expr); yyval.funcall = yyvsp[0].funcall; } break; case 176: #line 769 "ucparse.yy" { Uc_symbol *sym = function->search_up(yyvsp[-4].strval); if (!sym) { char buf[150]; sprintf(buf, "'%s' not declared", yyvsp[-4].strval); yyerror(buf); yyval.funcall = 0; } else yyval.funcall = new Uc_call_expression(sym, yyvsp[-1].exprlist, function, yyvsp[-3].intval ? true : false); } break; case 177: #line 786 "ucparse.yy" { yyval.intval = 1; } break; case 178: #line 788 "ucparse.yy" { yyval.intval = 0; } break; case 180: #line 794 "ucparse.yy" { yyval.strvec = new std::vector; } break; case 181: #line 799 "ucparse.yy" { yyvsp[-3].strvec->push_back(yyvsp[0].strval); } break; case 182: #line 801 "ucparse.yy" { yyval.strvec = new std::vector; yyval.strvec->push_back(yyvsp[0].strval); } break; case 184: #line 810 "ucparse.yy" { Uc_const_int_symbol *sym = dynamic_cast(yyvsp[0].sym); if (!sym) { char buf[150]; sprintf(buf, "'%s' is not a const int"); yyerror(buf); yyval.intval = 0; } else yyval.intval = sym->get_value(); } break; case 187: #line 832 "ucparse.yy" { yyval.expr = yyvsp[0].sym->create_expression(); if (!yyval.expr) { char buf[150]; sprintf(buf, "Can't use '%s' here", yyvsp[0].sym->get_name()); yyerror(buf); yyval.expr = new Uc_int_expression(0); } } break; case 188: #line 846 "ucparse.yy" { Uc_var_symbol *var = dynamic_cast(yyvsp[0].sym); if (!var) { char buf[150]; sprintf(buf, "'%s' not a 'var'", yyvsp[0].sym); yyerror(buf); sprintf(buf, "%s_needvar", yyvsp[0].sym->get_name()); var = function->add_symbol(buf); } yyval.var = var; } break; case 189: #line 862 "ucparse.yy" { Uc_symbol *sym = function->search_up(yyvsp[0].strval); if (!sym) { char buf[150]; sprintf(buf, "'%s' not declared", yyvsp[0].strval); yyerror(buf); sym = function->add_symbol(yyvsp[0].strval); } yyval.sym = sym; } break; } #line 705 "/usr/share/bison/bison.simple" yyvsp -= yylen; yyssp -= yylen; #if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; #if YYLSP_NEEDED *++yylsp = yyloc; #endif /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { YYSIZE_T yysize = 0; char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; /*--------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action | `--------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; /*-------------------------------------------------------------------. | yyerrdefault -- current state does not do anything special for the | | error token. | `-------------------------------------------------------------------*/ yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ /* If its default is to accept any token, ok. Otherwise pop it. */ yyn = yydefact[yystate]; if (yyn) goto yydefault; #endif /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | | error token | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif /*--------------. | yyerrhandle. | `--------------*/ yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; /*---------------------------------------------. | yyoverflowab -- parser overflow comes here. | `---------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 875 "ucparse.yy" /* * Create an array with an integer as the first element. */ static Uc_array_expression *Create_array ( int e1, Uc_expression *e2 ) { Uc_array_expression *arr = new Uc_array_expression(); arr->add(new Uc_int_expression(e1)); arr->add(e2); return arr; } static Uc_array_expression *Create_array ( int e1, Uc_expression *e2, Uc_expression *e3 ) { Uc_array_expression *arr = new Uc_array_expression(); arr->add(new Uc_int_expression(e1)); arr->add(e2); arr->add(e3); return arr; }