SphinxBase 0.6
|
00001 00002 /* A Bison parser, made by GNU Bison 2.4.1. */ 00003 00004 /* Skeleton implementation for Bison's Yacc-like parsers in C 00005 00006 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 00007 Free Software Foundation, Inc. 00008 00009 This program is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 You should have received a copy of the GNU General Public License 00020 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00021 00022 /* As a special exception, you may create a larger work that contains 00023 part or all of the Bison parser skeleton and distribute that work 00024 under terms of your choice, so long as that work isn't itself a 00025 parser generator using the skeleton or a modified version thereof 00026 as a parser skeleton. Alternatively, if you modify or redistribute 00027 the parser skeleton itself, you may (at your option) remove this 00028 special exception, which will cause the skeleton and the resulting 00029 Bison output files to be licensed under the GNU General Public 00030 License without this special exception. 00031 00032 This special exception was added by the Free Software Foundation in 00033 version 2.2 of Bison. */ 00034 00035 /* C LALR(1) parser skeleton written by Richard Stallman, by 00036 simplifying the original so-called "semantic" parser. */ 00037 00038 /* All symbols defined below should begin with yy or YY, to avoid 00039 infringing on user name space. This should be done even for local 00040 variables, as they might otherwise be expanded by user macros. 00041 There are some unavoidable exceptions within include files to 00042 define necessary library symbols; they are noted "INFRINGES ON 00043 USER NAME SPACE" below. */ 00044 00045 /* Identify Bison output. */ 00046 #define YYBISON 1 00047 00048 /* Bison version. */ 00049 #define YYBISON_VERSION "2.4.1" 00050 00051 /* Skeleton name. */ 00052 #define YYSKELETON_NAME "yacc.c" 00053 00054 /* Pure parsers. */ 00055 #define YYPURE 1 00056 00057 /* Push parsers. */ 00058 #define YYPUSH 0 00059 00060 /* Pull parsers. */ 00061 #define YYPULL 1 00062 00063 /* Using locations. */ 00064 #define YYLSP_NEEDED 0 00065 00066 00067 00068 /* Copy the first part of user declarations. */ 00069 00070 /* Line 189 of yacc.c */ 00071 #line 37 "jsgf_parser.y" 00072 00073 #define YYERROR_VERBOSE 00074 00075 #include <stdio.h> 00076 #include <string.h> 00077 00078 #include <sphinxbase/hash_table.h> 00079 #include <sphinxbase/ckd_alloc.h> 00080 #include <sphinxbase/err.h> 00081 00082 #include "jsgf_internal.h" 00083 #include "jsgf_parser.h" 00084 #include "jsgf_scanner.h" 00085 00086 /* Suppress warnings from generated code */ 00087 #if defined _MSC_VER 00088 #pragma warning(disable: 4273) 00089 #endif 00090 00091 void yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s); 00092 00093 00094 00095 /* Line 189 of yacc.c */ 00096 #line 97 "jsgf_parser.c" 00097 00098 /* Enabling traces. */ 00099 #ifndef YYDEBUG 00100 # define YYDEBUG 0 00101 #endif 00102 00103 /* Enabling verbose error messages. */ 00104 #ifdef YYERROR_VERBOSE 00105 # undef YYERROR_VERBOSE 00106 # define YYERROR_VERBOSE 1 00107 #else 00108 # define YYERROR_VERBOSE 0 00109 #endif 00110 00111 /* Enabling the token table. */ 00112 #ifndef YYTOKEN_TABLE 00113 # define YYTOKEN_TABLE 0 00114 #endif 00115 00116 00117 /* Tokens. */ 00118 #ifndef YYTOKENTYPE 00119 # define YYTOKENTYPE 00120 /* Put the tokens into the symbol table, so that GDB and other debuggers 00121 know about them. */ 00122 enum yytokentype { 00123 HEADER = 258, 00124 GRAMMAR = 259, 00125 IMPORT = 260, 00126 PUBLIC = 261, 00127 TOKEN = 262, 00128 RULENAME = 263, 00129 TAG = 264, 00130 WEIGHT = 265 00131 }; 00132 #endif 00133 /* Tokens. */ 00134 #define HEADER 258 00135 #define GRAMMAR 259 00136 #define IMPORT 260 00137 #define PUBLIC 261 00138 #define TOKEN 262 00139 #define RULENAME 263 00140 #define TAG 264 00141 #define WEIGHT 265 00142 00143 00144 00145 00146 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 00147 typedef union YYSTYPE 00148 { 00149 00150 /* Line 214 of yacc.c */ 00151 #line 65 "jsgf_parser.y" 00152 00153 char *name; 00154 float weight; 00155 jsgf_rule_t *rule; 00156 jsgf_rhs_t *rhs; 00157 jsgf_atom_t *atom; 00158 00159 00160 00161 /* Line 214 of yacc.c */ 00162 #line 163 "jsgf_parser.c" 00163 } YYSTYPE; 00164 # define YYSTYPE_IS_TRIVIAL 1 00165 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ 00166 # define YYSTYPE_IS_DECLARED 1 00167 #endif 00168 00169 00170 /* Copy the second part of user declarations. */ 00171 00172 00173 /* Line 264 of yacc.c */ 00174 #line 175 "jsgf_parser.c" 00175 00176 #ifdef short 00177 # undef short 00178 #endif 00179 00180 #ifdef YYTYPE_UINT8 00181 typedef YYTYPE_UINT8 yytype_uint8; 00182 #else 00183 typedef unsigned char yytype_uint8; 00184 #endif 00185 00186 #ifdef YYTYPE_INT8 00187 typedef YYTYPE_INT8 yytype_int8; 00188 #elif (defined __STDC__ || defined __C99__FUNC__ \ 00189 || defined __cplusplus || defined _MSC_VER) 00190 typedef signed char yytype_int8; 00191 #else 00192 typedef short int yytype_int8; 00193 #endif 00194 00195 #ifdef YYTYPE_UINT16 00196 typedef YYTYPE_UINT16 yytype_uint16; 00197 #else 00198 typedef unsigned short int yytype_uint16; 00199 #endif 00200 00201 #ifdef YYTYPE_INT16 00202 typedef YYTYPE_INT16 yytype_int16; 00203 #else 00204 typedef short int yytype_int16; 00205 #endif 00206 00207 #ifndef YYSIZE_T 00208 # ifdef __SIZE_TYPE__ 00209 # define YYSIZE_T __SIZE_TYPE__ 00210 # elif defined size_t 00211 # define YYSIZE_T size_t 00212 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ 00213 || defined __cplusplus || defined _MSC_VER) 00214 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 00215 # define YYSIZE_T size_t 00216 # else 00217 # define YYSIZE_T unsigned int 00218 # endif 00219 #endif 00220 00221 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 00222 00223 #ifndef YY_ 00224 # if YYENABLE_NLS 00225 # if ENABLE_NLS 00226 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ 00227 # define YY_(msgid) dgettext ("bison-runtime", msgid) 00228 # endif 00229 # endif 00230 # ifndef YY_ 00231 # define YY_(msgid) msgid 00232 # endif 00233 #endif 00234 00235 /* Suppress unused-variable warnings by "using" E. */ 00236 #if ! defined lint || defined __GNUC__ 00237 # define YYUSE(e) ((void) (e)) 00238 #else 00239 # define YYUSE(e) /* empty */ 00240 #endif 00241 00242 /* Identity function, used to suppress warnings about constant conditions. */ 00243 #ifndef lint 00244 # define YYID(n) (n) 00245 #else 00246 #if (defined __STDC__ || defined __C99__FUNC__ \ 00247 || defined __cplusplus || defined _MSC_VER) 00248 static int 00249 YYID (int yyi) 00250 #else 00251 static int 00252 YYID (yyi) 00253 int yyi; 00254 #endif 00255 { 00256 return yyi; 00257 } 00258 #endif 00259 00260 #if ! defined yyoverflow || YYERROR_VERBOSE 00261 00262 /* The parser invokes alloca or malloc; define the necessary symbols. */ 00263 00264 # ifdef YYSTACK_USE_ALLOCA 00265 # if YYSTACK_USE_ALLOCA 00266 # ifdef __GNUC__ 00267 # define YYSTACK_ALLOC __builtin_alloca 00268 # elif defined __BUILTIN_VA_ARG_INCR 00269 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ 00270 # elif defined _AIX 00271 # define YYSTACK_ALLOC __alloca 00272 # elif defined _MSC_VER 00273 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ 00274 # define alloca _alloca 00275 # else 00276 # define YYSTACK_ALLOC alloca 00277 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00278 || defined __cplusplus || defined _MSC_VER) 00279 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00280 # ifndef _STDLIB_H 00281 # define _STDLIB_H 1 00282 # endif 00283 # endif 00284 # endif 00285 # endif 00286 # endif 00287 00288 # ifdef YYSTACK_ALLOC 00289 /* Pacify GCC's `empty if-body' warning. */ 00290 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) 00291 # ifndef YYSTACK_ALLOC_MAXIMUM 00292 /* The OS might guarantee only one guard page at the bottom of the stack, 00293 and a page size can be as small as 4096 bytes. So we cannot safely 00294 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number 00295 to allow for a few compiler-allocated temporary stack slots. */ 00296 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ 00297 # endif 00298 # else 00299 # define YYSTACK_ALLOC YYMALLOC 00300 # define YYSTACK_FREE YYFREE 00301 # ifndef YYSTACK_ALLOC_MAXIMUM 00302 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 00303 # endif 00304 # if (defined __cplusplus && ! defined _STDLIB_H \ 00305 && ! ((defined YYMALLOC || defined malloc) \ 00306 && (defined YYFREE || defined free))) 00307 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 00308 # ifndef _STDLIB_H 00309 # define _STDLIB_H 1 00310 # endif 00311 # endif 00312 # ifndef YYMALLOC 00313 # define YYMALLOC malloc 00314 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00315 || defined __cplusplus || defined _MSC_VER) 00316 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ 00317 # endif 00318 # endif 00319 # ifndef YYFREE 00320 # define YYFREE free 00321 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ 00322 || defined __cplusplus || defined _MSC_VER) 00323 void free (void *); /* INFRINGES ON USER NAME SPACE */ 00324 # endif 00325 # endif 00326 # endif 00327 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ 00328 00329 00330 #if (! defined yyoverflow \ 00331 && (! defined __cplusplus \ 00332 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 00333 00334 /* A type that is properly aligned for any stack member. */ 00335 union yyalloc 00336 { 00337 yytype_int16 yyss_alloc; 00338 YYSTYPE yyvs_alloc; 00339 }; 00340 00341 /* The size of the maximum gap between one aligned stack and the next. */ 00342 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 00343 00344 /* The size of an array large to enough to hold all stacks, each with 00345 N elements. */ 00346 # define YYSTACK_BYTES(N) \ 00347 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 00348 + YYSTACK_GAP_MAXIMUM) 00349 00350 /* Copy COUNT objects from FROM to TO. The source and destination do 00351 not overlap. */ 00352 # ifndef YYCOPY 00353 # if defined __GNUC__ && 1 < __GNUC__ 00354 # define YYCOPY(To, From, Count) \ 00355 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 00356 # else 00357 # define YYCOPY(To, From, Count) \ 00358 do \ 00359 { \ 00360 YYSIZE_T yyi; \ 00361 for (yyi = 0; yyi < (Count); yyi++) \ 00362 (To)[yyi] = (From)[yyi]; \ 00363 } \ 00364 while (YYID (0)) 00365 # endif 00366 # endif 00367 00368 /* Relocate STACK from its old location to the new one. The 00369 local variables YYSIZE and YYSTACKSIZE give the old and new number of 00370 elements in the stack, and YYPTR gives the new location of the 00371 stack. Advance YYPTR to a properly aligned location for the next 00372 stack. */ 00373 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 00374 do \ 00375 { \ 00376 YYSIZE_T yynewbytes; \ 00377 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 00378 Stack = &yyptr->Stack_alloc; \ 00379 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 00380 yyptr += yynewbytes / sizeof (*yyptr); \ 00381 } \ 00382 while (YYID (0)) 00383 00384 #endif 00385 00386 /* YYFINAL -- State number of the termination state. */ 00387 #define YYFINAL 7 00388 /* YYLAST -- Last index in YYTABLE. */ 00389 #define YYLAST 54 00390 00391 /* YYNTOKENS -- Number of terminals. */ 00392 #define YYNTOKENS 20 00393 /* YYNNTS -- Number of nonterminals. */ 00394 #define YYNNTS 16 00395 /* YYNRULES -- Number of rules. */ 00396 #define YYNRULES 33 00397 /* YYNRULES -- Number of states. */ 00398 #define YYNSTATES 58 00399 00400 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 00401 #define YYUNDEFTOK 2 00402 #define YYMAXUTOK 265 00403 00404 #define YYTRANSLATE(YYX) \ 00405 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 00406 00407 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ 00408 static const yytype_uint8 yytranslate[] = 00409 { 00410 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00414 14, 15, 18, 19, 2, 2, 2, 2, 2, 2, 00415 2, 2, 2, 2, 2, 2, 2, 2, 2, 11, 00416 2, 12, 2, 2, 2, 2, 2, 2, 2, 2, 00417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00419 2, 16, 2, 17, 2, 2, 2, 2, 2, 2, 00420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00422 2, 2, 2, 2, 13, 2, 2, 2, 2, 2, 00423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00430 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00434 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 00435 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 00436 5, 6, 7, 8, 9, 10 00437 }; 00438 00439 #if YYDEBUG 00440 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in 00441 YYRHS. */ 00442 static const yytype_uint8 yyprhs[] = 00443 { 00444 0, 0, 3, 5, 8, 12, 15, 18, 22, 27, 00445 33, 37, 39, 42, 46, 48, 51, 56, 62, 64, 00446 68, 70, 73, 75, 78, 80, 83, 87, 91, 93, 00447 95, 97, 99, 102 00448 }; 00449 00450 /* YYRHS -- A `-1'-separated list of the rules' RHS. */ 00451 static const yytype_int8 yyrhs[] = 00452 { 00453 21, 0, -1, 22, -1, 22, 27, -1, 22, 25, 00454 27, -1, 23, 24, -1, 3, 11, -1, 3, 7, 00455 11, -1, 3, 7, 7, 11, -1, 3, 7, 7, 00456 7, 11, -1, 4, 7, 11, -1, 26, -1, 25, 00457 26, -1, 5, 8, 11, -1, 28, -1, 27, 28, 00458 -1, 8, 12, 29, 11, -1, 6, 8, 12, 29, 00459 11, -1, 30, -1, 29, 13, 30, -1, 31, -1, 00460 30, 31, -1, 32, -1, 31, 9, -1, 35, -1, 00461 10, 35, -1, 14, 29, 15, -1, 16, 29, 17, 00462 -1, 7, -1, 8, -1, 33, -1, 34, -1, 35, 00463 18, -1, 35, 19, -1 00464 }; 00465 00466 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 00467 static const yytype_uint8 yyrline[] = 00468 { 00469 0, 82, 82, 83, 84, 87, 90, 91, 92, 93, 00470 97, 100, 101, 104, 107, 108, 111, 112, 115, 116, 00471 121, 123, 127, 128, 132, 133, 136, 139, 142, 143, 00472 144, 145, 146, 147 00473 }; 00474 #endif 00475 00476 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE 00477 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. 00478 First, the terminals, then, starting at YYNTOKENS, nonterminals. */ 00479 static const char *const yytname[] = 00480 { 00481 "$end", "error", "$undefined", "HEADER", "GRAMMAR", "IMPORT", "PUBLIC", 00482 "TOKEN", "RULENAME", "TAG", "WEIGHT", "';'", "'='", "'|'", "'('", "')'", 00483 "'['", "']'", "'*'", "'+'", "$accept", "grammar", "header", 00484 "jsgf_header", "grammar_header", "import_header", "import_statement", 00485 "rule_list", "rule", "alternate_list", "rule_expansion", 00486 "tagged_rule_item", "rule_item", "rule_group", "rule_optional", 00487 "rule_atom", 0 00488 }; 00489 #endif 00490 00491 # ifdef YYPRINT 00492 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to 00493 token YYLEX-NUM. */ 00494 static const yytype_uint16 yytoknum[] = 00495 { 00496 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 00497 265, 59, 61, 124, 40, 41, 91, 93, 42, 43 00498 }; 00499 # endif 00500 00501 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 00502 static const yytype_uint8 yyr1[] = 00503 { 00504 0, 20, 21, 21, 21, 22, 23, 23, 23, 23, 00505 24, 25, 25, 26, 27, 27, 28, 28, 29, 29, 00506 30, 30, 31, 31, 32, 32, 33, 34, 35, 35, 00507 35, 35, 35, 35 00508 }; 00509 00510 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 00511 static const yytype_uint8 yyr2[] = 00512 { 00513 0, 2, 1, 2, 3, 2, 2, 3, 4, 5, 00514 3, 1, 2, 3, 1, 2, 4, 5, 1, 3, 00515 1, 2, 1, 2, 1, 2, 3, 3, 1, 1, 00516 1, 1, 2, 2 00517 }; 00518 00519 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 00520 STATE-NUM when YYTABLE doesn't specify something else to do. Zero 00521 means the default is an error. */ 00522 static const yytype_uint8 yydefact[] = 00523 { 00524 0, 0, 0, 2, 0, 0, 6, 1, 0, 0, 00525 0, 0, 11, 3, 14, 0, 5, 0, 7, 0, 00526 0, 0, 12, 4, 15, 0, 0, 8, 13, 0, 00527 28, 29, 0, 0, 0, 0, 18, 20, 22, 30, 00528 31, 24, 10, 9, 0, 25, 0, 0, 16, 0, 00529 21, 23, 32, 33, 17, 26, 27, 19 00530 }; 00531 00532 /* YYDEFGOTO[NTERM-NUM]. */ 00533 static const yytype_int8 yydefgoto[] = 00534 { 00535 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35, 00536 36, 37, 38, 39, 40, 41 00537 }; 00538 00539 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 00540 STATE-NUM. */ 00541 #define YYPACT_NINF -37 00542 static const yytype_int8 yypact[] = 00543 { 00544 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33, 00545 30, 22, -37, 17, -37, 37, -37, 13, -37, 34, 00546 31, -4, -37, 17, -37, 38, 39, -37, -37, -4, 00547 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37, 00548 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4, 00549 42, -37, -37, -37, -37, -37, -37, -4 00550 }; 00551 00552 /* YYPGOTO[NTERM-NUM]. */ 00553 static const yytype_int8 yypgoto[] = 00554 { 00555 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16, 00556 -3, -36, -37, -37, -37, 15 00557 }; 00558 00559 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 00560 positive, shift that token. If negative, reduce the rule which 00561 number is the opposite. If zero, do what YYDEFACT says. 00562 If YYTABLE_NINF, syntax error. */ 00563 #define YYTABLE_NINF -1 00564 static const yytype_uint8 yytable[] = 00565 { 00566 50, 24, 1, 30, 31, 5, 32, 30, 31, 6, 00567 33, 24, 34, 44, 33, 17, 34, 46, 47, 18, 00568 26, 50, 49, 9, 27, 10, 56, 8, 9, 48, 00569 10, 49, 54, 49, 49, 55, 7, 52, 53, 15, 00570 19, 20, 21, 29, 25, 28, 57, 45, 0, 42, 00571 43, 51, 22, 0, 23 00572 }; 00573 00574 static const yytype_int8 yycheck[] = 00575 { 00576 36, 13, 3, 7, 8, 7, 10, 7, 8, 11, 00577 14, 23, 16, 29, 14, 7, 16, 33, 34, 11, 00578 7, 57, 13, 6, 11, 8, 17, 5, 6, 11, 00579 8, 13, 11, 13, 13, 15, 0, 18, 19, 4, 00580 8, 8, 12, 12, 7, 11, 49, 32, -1, 11, 00581 11, 9, 11, -1, 11 00582 }; 00583 00584 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 00585 symbol of state STATE-NUM. */ 00586 static const yytype_uint8 yystos[] = 00587 { 00588 0, 3, 21, 22, 23, 7, 11, 0, 5, 6, 00589 8, 25, 26, 27, 28, 4, 24, 7, 11, 8, 00590 8, 12, 26, 27, 28, 7, 7, 11, 11, 12, 00591 7, 8, 10, 14, 16, 29, 30, 31, 32, 33, 00592 34, 35, 11, 11, 29, 35, 29, 29, 11, 13, 00593 31, 9, 18, 19, 11, 15, 17, 30 00594 }; 00595 00596 #define yyerrok (yyerrstatus = 0) 00597 #define yyclearin (yychar = YYEMPTY) 00598 #define YYEMPTY (-2) 00599 #define YYEOF 0 00600 00601 #define YYACCEPT goto yyacceptlab 00602 #define YYABORT goto yyabortlab 00603 #define YYERROR goto yyerrorlab 00604 00605 00606 /* Like YYERROR except do call yyerror. This remains here temporarily 00607 to ease the transition to the new meaning of YYERROR, for GCC. 00608 Once GCC version 2 has supplanted version 1, this can go. */ 00609 00610 #define YYFAIL goto yyerrlab 00611 00612 #define YYRECOVERING() (!!yyerrstatus) 00613 00614 #define YYBACKUP(Token, Value) \ 00615 do \ 00616 if (yychar == YYEMPTY && yylen == 1) \ 00617 { \ 00618 yychar = (Token); \ 00619 yylval = (Value); \ 00620 yytoken = YYTRANSLATE (yychar); \ 00621 YYPOPSTACK (1); \ 00622 goto yybackup; \ 00623 } \ 00624 else \ 00625 { \ 00626 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \ 00627 YYERROR; \ 00628 } \ 00629 while (YYID (0)) 00630 00631 00632 #define YYTERROR 1 00633 #define YYERRCODE 256 00634 00635 00636 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 00637 If N is 0, then set CURRENT to the empty location which ends 00638 the previous symbol: RHS[0] (always defined). */ 00639 00640 #define YYRHSLOC(Rhs, K) ((Rhs)[K]) 00641 #ifndef YYLLOC_DEFAULT 00642 # define YYLLOC_DEFAULT(Current, Rhs, N) \ 00643 do \ 00644 if (YYID (N)) \ 00645 { \ 00646 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ 00647 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ 00648 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ 00649 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ 00650 } \ 00651 else \ 00652 { \ 00653 (Current).first_line = (Current).last_line = \ 00654 YYRHSLOC (Rhs, 0).last_line; \ 00655 (Current).first_column = (Current).last_column = \ 00656 YYRHSLOC (Rhs, 0).last_column; \ 00657 } \ 00658 while (YYID (0)) 00659 #endif 00660 00661 00662 /* YY_LOCATION_PRINT -- Print the location on the stream. 00663 This macro was not mandated originally: define only if we know 00664 we won't break user code: when these are the locations we know. */ 00665 00666 #ifndef YY_LOCATION_PRINT 00667 # if YYLTYPE_IS_TRIVIAL 00668 # define YY_LOCATION_PRINT(File, Loc) \ 00669 fprintf (File, "%d.%d-%d.%d", \ 00670 (Loc).first_line, (Loc).first_column, \ 00671 (Loc).last_line, (Loc).last_column) 00672 # else 00673 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 00674 # endif 00675 #endif 00676 00677 00678 /* YYLEX -- calling `yylex' with the right arguments. */ 00679 00680 #ifdef YYLEX_PARAM 00681 # define YYLEX yylex (&yylval, YYLEX_PARAM) 00682 #else 00683 # define YYLEX yylex (&yylval, yyscanner) 00684 #endif 00685 00686 /* Enable debugging if requested. */ 00687 #if YYDEBUG 00688 00689 # ifndef YYFPRINTF 00690 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 00691 # define YYFPRINTF fprintf 00692 # endif 00693 00694 # define YYDPRINTF(Args) \ 00695 do { \ 00696 if (yydebug) \ 00697 YYFPRINTF Args; \ 00698 } while (YYID (0)) 00699 00700 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 00701 do { \ 00702 if (yydebug) \ 00703 { \ 00704 YYFPRINTF (stderr, "%s ", Title); \ 00705 yy_symbol_print (stderr, \ 00706 Type, Value, yyscanner, jsgf); \ 00707 YYFPRINTF (stderr, "\n"); \ 00708 } \ 00709 } while (YYID (0)) 00710 00711 00712 /*--------------------------------. 00713 | Print this symbol on YYOUTPUT. | 00714 `--------------------------------*/ 00715 00716 /*ARGSUSED*/ 00717 #if (defined __STDC__ || defined __C99__FUNC__ \ 00718 || defined __cplusplus || defined _MSC_VER) 00719 static void 00720 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void* yyscanner, jsgf_t *jsgf) 00721 #else 00722 static void 00723 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf) 00724 FILE *yyoutput; 00725 int yytype; 00726 YYSTYPE const * const yyvaluep; 00727 void* yyscanner; 00728 jsgf_t *jsgf; 00729 #endif 00730 { 00731 if (!yyvaluep) 00732 return; 00733 YYUSE (yyscanner); 00734 YYUSE (jsgf); 00735 # ifdef YYPRINT 00736 if (yytype < YYNTOKENS) 00737 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); 00738 # else 00739 YYUSE (yyoutput); 00740 # endif 00741 switch (yytype) 00742 { 00743 default: 00744 break; 00745 } 00746 } 00747 00748 00749 /*--------------------------------. 00750 | Print this symbol on YYOUTPUT. | 00751 `--------------------------------*/ 00752 00753 #if (defined __STDC__ || defined __C99__FUNC__ \ 00754 || defined __cplusplus || defined _MSC_VER) 00755 static void 00756 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void* yyscanner, jsgf_t *jsgf) 00757 #else 00758 static void 00759 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf) 00760 FILE *yyoutput; 00761 int yytype; 00762 YYSTYPE const * const yyvaluep; 00763 void* yyscanner; 00764 jsgf_t *jsgf; 00765 #endif 00766 { 00767 if (yytype < YYNTOKENS) 00768 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); 00769 else 00770 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); 00771 00772 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf); 00773 YYFPRINTF (yyoutput, ")"); 00774 } 00775 00776 /*------------------------------------------------------------------. 00777 | yy_stack_print -- Print the state stack from its BOTTOM up to its | 00778 | TOP (included). | 00779 `------------------------------------------------------------------*/ 00780 00781 #if (defined __STDC__ || defined __C99__FUNC__ \ 00782 || defined __cplusplus || defined _MSC_VER) 00783 static void 00784 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) 00785 #else 00786 static void 00787 yy_stack_print (yybottom, yytop) 00788 yytype_int16 *yybottom; 00789 yytype_int16 *yytop; 00790 #endif 00791 { 00792 YYFPRINTF (stderr, "Stack now"); 00793 for (; yybottom <= yytop; yybottom++) 00794 { 00795 int yybot = *yybottom; 00796 YYFPRINTF (stderr, " %d", yybot); 00797 } 00798 YYFPRINTF (stderr, "\n"); 00799 } 00800 00801 # define YY_STACK_PRINT(Bottom, Top) \ 00802 do { \ 00803 if (yydebug) \ 00804 yy_stack_print ((Bottom), (Top)); \ 00805 } while (YYID (0)) 00806 00807 00808 /*------------------------------------------------. 00809 | Report that the YYRULE is going to be reduced. | 00810 `------------------------------------------------*/ 00811 00812 #if (defined __STDC__ || defined __C99__FUNC__ \ 00813 || defined __cplusplus || defined _MSC_VER) 00814 static void 00815 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void* yyscanner, jsgf_t *jsgf) 00816 #else 00817 static void 00818 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf) 00819 YYSTYPE *yyvsp; 00820 int yyrule; 00821 void* yyscanner; 00822 jsgf_t *jsgf; 00823 #endif 00824 { 00825 int yynrhs = yyr2[yyrule]; 00826 int yyi; 00827 unsigned long int yylno = yyrline[yyrule]; 00828 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", 00829 yyrule - 1, yylno); 00830 /* The symbols being reduced. */ 00831 for (yyi = 0; yyi < yynrhs; yyi++) 00832 { 00833 YYFPRINTF (stderr, " $%d = ", yyi + 1); 00834 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], 00835 &(yyvsp[(yyi + 1) - (yynrhs)]) 00836 , yyscanner, jsgf); 00837 YYFPRINTF (stderr, "\n"); 00838 } 00839 } 00840 00841 # define YY_REDUCE_PRINT(Rule) \ 00842 do { \ 00843 if (yydebug) \ 00844 yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \ 00845 } while (YYID (0)) 00846 00847 /* Nonzero means print parse trace. It is left uninitialized so that 00848 multiple parsers can coexist. */ 00849 int yydebug; 00850 #else /* !YYDEBUG */ 00851 # define YYDPRINTF(Args) 00852 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 00853 # define YY_STACK_PRINT(Bottom, Top) 00854 # define YY_REDUCE_PRINT(Rule) 00855 #endif /* !YYDEBUG */ 00856 00857 00858 /* YYINITDEPTH -- initial size of the parser's stacks. */ 00859 #ifndef YYINITDEPTH 00860 # define YYINITDEPTH 200 00861 #endif 00862 00863 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 00864 if the built-in stack extension method is used). 00865 00866 Do not make this value too large; the results are undefined if 00867 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) 00868 evaluated with infinite-precision integer arithmetic. */ 00869 00870 #ifndef YYMAXDEPTH 00871 # define YYMAXDEPTH 10000 00872 #endif 00873 00874 00875 00876 #if YYERROR_VERBOSE 00877 00878 # ifndef yystrlen 00879 # if defined __GLIBC__ && defined _STRING_H 00880 # define yystrlen strlen 00881 # else 00882 /* Return the length of YYSTR. */ 00883 #if (defined __STDC__ || defined __C99__FUNC__ \ 00884 || defined __cplusplus || defined _MSC_VER) 00885 static YYSIZE_T 00886 yystrlen (const char *yystr) 00887 #else 00888 static YYSIZE_T 00889 yystrlen (yystr) 00890 const char *yystr; 00891 #endif 00892 { 00893 YYSIZE_T yylen; 00894 for (yylen = 0; yystr[yylen]; yylen++) 00895 continue; 00896 return yylen; 00897 } 00898 # endif 00899 # endif 00900 00901 # ifndef yystpcpy 00902 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 00903 # define yystpcpy stpcpy 00904 # else 00905 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 00906 YYDEST. */ 00907 #if (defined __STDC__ || defined __C99__FUNC__ \ 00908 || defined __cplusplus || defined _MSC_VER) 00909 static char * 00910 yystpcpy (char *yydest, const char *yysrc) 00911 #else 00912 static char * 00913 yystpcpy (yydest, yysrc) 00914 char *yydest; 00915 const char *yysrc; 00916 #endif 00917 { 00918 char *yyd = yydest; 00919 const char *yys = yysrc; 00920 00921 while ((*yyd++ = *yys++) != '\0') 00922 continue; 00923 00924 return yyd - 1; 00925 } 00926 # endif 00927 # endif 00928 00929 # ifndef yytnamerr 00930 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary 00931 quotes and backslashes, so that it's suitable for yyerror. The 00932 heuristic is that double-quoting is unnecessary unless the string 00933 contains an apostrophe, a comma, or backslash (other than 00934 backslash-backslash). YYSTR is taken from yytname. If YYRES is 00935 null, do not copy; instead, return the length of what the result 00936 would have been. */ 00937 static YYSIZE_T 00938 yytnamerr (char *yyres, const char *yystr) 00939 { 00940 if (*yystr == '"') 00941 { 00942 YYSIZE_T yyn = 0; 00943 char const *yyp = yystr; 00944 00945 for (;;) 00946 switch (*++yyp) 00947 { 00948 case '\'': 00949 case ',': 00950 goto do_not_strip_quotes; 00951 00952 case '\\': 00953 if (*++yyp != '\\') 00954 goto do_not_strip_quotes; 00955 /* Fall through. */ 00956 default: 00957 if (yyres) 00958 yyres[yyn] = *yyp; 00959 yyn++; 00960 break; 00961 00962 case '"': 00963 if (yyres) 00964 yyres[yyn] = '\0'; 00965 return yyn; 00966 } 00967 do_not_strip_quotes: ; 00968 } 00969 00970 if (! yyres) 00971 return yystrlen (yystr); 00972 00973 return yystpcpy (yyres, yystr) - yyres; 00974 } 00975 # endif 00976 00977 /* Copy into YYRESULT an error message about the unexpected token 00978 YYCHAR while in state YYSTATE. Return the number of bytes copied, 00979 including the terminating null byte. If YYRESULT is null, do not 00980 copy anything; just return the number of bytes that would be 00981 copied. As a special case, return 0 if an ordinary "syntax error" 00982 message will do. Return YYSIZE_MAXIMUM if overflow occurs during 00983 size calculation. */ 00984 static YYSIZE_T 00985 yysyntax_error (char *yyresult, int yystate, int yychar) 00986 { 00987 int yyn = yypact[yystate]; 00988 00989 if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) 00990 return 0; 00991 else 00992 { 00993 int yytype = YYTRANSLATE (yychar); 00994 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); 00995 YYSIZE_T yysize = yysize0; 00996 YYSIZE_T yysize1; 00997 int yysize_overflow = 0; 00998 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; 00999 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; 01000 int yyx; 01001 01002 # if 0 01003 /* This is so xgettext sees the translatable formats that are 01004 constructed on the fly. */ 01005 YY_("syntax error, unexpected %s"); 01006 YY_("syntax error, unexpected %s, expecting %s"); 01007 YY_("syntax error, unexpected %s, expecting %s or %s"); 01008 YY_("syntax error, unexpected %s, expecting %s or %s or %s"); 01009 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); 01010 # endif 01011 char *yyfmt; 01012 char const *yyf; 01013 static char const yyunexpected[] = "syntax error, unexpected %s"; 01014 static char const yyexpecting[] = ", expecting %s"; 01015 static char const yyor[] = " or %s"; 01016 char yyformat[sizeof yyunexpected 01017 + sizeof yyexpecting - 1 01018 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) 01019 * (sizeof yyor - 1))]; 01020 char const *yyprefix = yyexpecting; 01021 01022 /* Start YYX at -YYN if negative to avoid negative indexes in 01023 YYCHECK. */ 01024 int yyxbegin = yyn < 0 ? -yyn : 0; 01025 01026 /* Stay within bounds of both yycheck and yytname. */ 01027 int yychecklim = YYLAST - yyn + 1; 01028 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; 01029 int yycount = 1; 01030 01031 yyarg[0] = yytname[yytype]; 01032 yyfmt = yystpcpy (yyformat, yyunexpected); 01033 01034 for (yyx = yyxbegin; yyx < yyxend; ++yyx) 01035 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) 01036 { 01037 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) 01038 { 01039 yycount = 1; 01040 yysize = yysize0; 01041 yyformat[sizeof yyunexpected - 1] = '\0'; 01042 break; 01043 } 01044 yyarg[yycount++] = yytname[yyx]; 01045 yysize1 = yysize + yytnamerr (0, yytname[yyx]); 01046 yysize_overflow |= (yysize1 < yysize); 01047 yysize = yysize1; 01048 yyfmt = yystpcpy (yyfmt, yyprefix); 01049 yyprefix = yyor; 01050 } 01051 01052 yyf = YY_(yyformat); 01053 yysize1 = yysize + yystrlen (yyf); 01054 yysize_overflow |= (yysize1 < yysize); 01055 yysize = yysize1; 01056 01057 if (yysize_overflow) 01058 return YYSIZE_MAXIMUM; 01059 01060 if (yyresult) 01061 { 01062 /* Avoid sprintf, as that infringes on the user's name space. 01063 Don't have undefined behavior even if the translation 01064 produced a string with the wrong number of "%s"s. */ 01065 char *yyp = yyresult; 01066 int yyi = 0; 01067 while ((*yyp = *yyf) != '\0') 01068 { 01069 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) 01070 { 01071 yyp += yytnamerr (yyp, yyarg[yyi++]); 01072 yyf += 2; 01073 } 01074 else 01075 { 01076 yyp++; 01077 yyf++; 01078 } 01079 } 01080 } 01081 return yysize; 01082 } 01083 } 01084 #endif /* YYERROR_VERBOSE */ 01085 01086 01087 /*-----------------------------------------------. 01088 | Release the memory associated to this symbol. | 01089 `-----------------------------------------------*/ 01090 01091 /*ARGSUSED*/ 01092 #if (defined __STDC__ || defined __C99__FUNC__ \ 01093 || defined __cplusplus || defined _MSC_VER) 01094 static void 01095 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void* yyscanner, jsgf_t *jsgf) 01096 #else 01097 static void 01098 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf) 01099 const char *yymsg; 01100 int yytype; 01101 YYSTYPE *yyvaluep; 01102 void* yyscanner; 01103 jsgf_t *jsgf; 01104 #endif 01105 { 01106 YYUSE (yyvaluep); 01107 YYUSE (yyscanner); 01108 YYUSE (jsgf); 01109 01110 if (!yymsg) 01111 yymsg = "Deleting"; 01112 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); 01113 01114 switch (yytype) 01115 { 01116 01117 default: 01118 break; 01119 } 01120 } 01121 01122 /* Prevent warnings from -Wmissing-prototypes. */ 01123 #ifdef YYPARSE_PARAM 01124 #if defined __STDC__ || defined __cplusplus 01125 int yyparse (void *YYPARSE_PARAM); 01126 #else 01127 int yyparse (); 01128 #endif 01129 #else /* ! YYPARSE_PARAM */ 01130 #if defined __STDC__ || defined __cplusplus 01131 int yyparse (void* yyscanner, jsgf_t *jsgf); 01132 #else 01133 int yyparse (); 01134 #endif 01135 #endif /* ! YYPARSE_PARAM */ 01136 01137 01138 01139 01140 01141 /*-------------------------. 01142 | yyparse or yypush_parse. | 01143 `-------------------------*/ 01144 01145 #ifdef YYPARSE_PARAM 01146 #if (defined __STDC__ || defined __C99__FUNC__ \ 01147 || defined __cplusplus || defined _MSC_VER) 01148 int 01149 yyparse (void *YYPARSE_PARAM) 01150 #else 01151 int 01152 yyparse (YYPARSE_PARAM) 01153 void *YYPARSE_PARAM; 01154 #endif 01155 #else /* ! YYPARSE_PARAM */ 01156 #if (defined __STDC__ || defined __C99__FUNC__ \ 01157 || defined __cplusplus || defined _MSC_VER) 01158 int 01159 yyparse (void* yyscanner, jsgf_t *jsgf) 01160 #else 01161 int 01162 yyparse (yyscanner, jsgf) 01163 void* yyscanner; 01164 jsgf_t *jsgf; 01165 #endif 01166 #endif 01167 { 01168 /* The lookahead symbol. */ 01169 int yychar; 01170 01171 /* The semantic value of the lookahead symbol. */ 01172 YYSTYPE yylval; 01173 01174 /* Number of syntax errors so far. */ 01175 int yynerrs; 01176 01177 int yystate; 01178 /* Number of tokens to shift before error messages enabled. */ 01179 int yyerrstatus; 01180 01181 /* The stacks and their tools: 01182 `yyss': related to states. 01183 `yyvs': related to semantic values. 01184 01185 Refer to the stacks thru separate pointers, to allow yyoverflow 01186 to reallocate them elsewhere. */ 01187 01188 /* The state stack. */ 01189 yytype_int16 yyssa[YYINITDEPTH]; 01190 yytype_int16 *yyss; 01191 yytype_int16 *yyssp; 01192 01193 /* The semantic value stack. */ 01194 YYSTYPE yyvsa[YYINITDEPTH]; 01195 YYSTYPE *yyvs; 01196 YYSTYPE *yyvsp; 01197 01198 YYSIZE_T yystacksize; 01199 01200 int yyn; 01201 int yyresult; 01202 /* Lookahead token as an internal (translated) token number. */ 01203 int yytoken; 01204 /* The variables used to return semantic value and location from the 01205 action routines. */ 01206 YYSTYPE yyval; 01207 01208 #if YYERROR_VERBOSE 01209 /* Buffer for error messages, and its allocated size. */ 01210 char yymsgbuf[128]; 01211 char *yymsg = yymsgbuf; 01212 YYSIZE_T yymsg_alloc = sizeof yymsgbuf; 01213 #endif 01214 01215 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 01216 01217 /* The number of symbols on the RHS of the reduced rule. 01218 Keep to zero when no symbol should be popped. */ 01219 int yylen = 0; 01220 01221 yytoken = 0; 01222 yyss = yyssa; 01223 yyvs = yyvsa; 01224 yystacksize = YYINITDEPTH; 01225 01226 YYDPRINTF ((stderr, "Starting parse\n")); 01227 01228 yystate = 0; 01229 yyerrstatus = 0; 01230 yynerrs = 0; 01231 yychar = YYEMPTY; /* Cause a token to be read. */ 01232 01233 /* Initialize stack pointers. 01234 Waste one element of value and location stack 01235 so that they stay on the same level as the state stack. 01236 The wasted elements are never initialized. */ 01237 yyssp = yyss; 01238 yyvsp = yyvs; 01239 01240 goto yysetstate; 01241 01242 /*------------------------------------------------------------. 01243 | yynewstate -- Push a new state, which is found in yystate. | 01244 `------------------------------------------------------------*/ 01245 yynewstate: 01246 /* In all cases, when you get here, the value and location stacks 01247 have just been pushed. So pushing a state here evens the stacks. */ 01248 yyssp++; 01249 01250 yysetstate: 01251 *yyssp = yystate; 01252 01253 if (yyss + yystacksize - 1 <= yyssp) 01254 { 01255 /* Get the current used size of the three stacks, in elements. */ 01256 YYSIZE_T yysize = yyssp - yyss + 1; 01257 01258 #ifdef yyoverflow 01259 { 01260 /* Give user a chance to reallocate the stack. Use copies of 01261 these so that the &'s don't force the real ones into 01262 memory. */ 01263 YYSTYPE *yyvs1 = yyvs; 01264 yytype_int16 *yyss1 = yyss; 01265 01266 /* Each stack pointer address is followed by the size of the 01267 data in use in that stack, in bytes. This used to be a 01268 conditional around just the two extra args, but that might 01269 be undefined if yyoverflow is a macro. */ 01270 yyoverflow (YY_("memory exhausted"), 01271 &yyss1, yysize * sizeof (*yyssp), 01272 &yyvs1, yysize * sizeof (*yyvsp), 01273 &yystacksize); 01274 01275 yyss = yyss1; 01276 yyvs = yyvs1; 01277 } 01278 #else /* no yyoverflow */ 01279 # ifndef YYSTACK_RELOCATE 01280 goto yyexhaustedlab; 01281 # else 01282 /* Extend the stack our own way. */ 01283 if (YYMAXDEPTH <= yystacksize) 01284 goto yyexhaustedlab; 01285 yystacksize *= 2; 01286 if (YYMAXDEPTH < yystacksize) 01287 yystacksize = YYMAXDEPTH; 01288 01289 { 01290 yytype_int16 *yyss1 = yyss; 01291 union yyalloc *yyptr = 01292 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 01293 if (! yyptr) 01294 goto yyexhaustedlab; 01295 YYSTACK_RELOCATE (yyss_alloc, yyss); 01296 YYSTACK_RELOCATE (yyvs_alloc, yyvs); 01297 # undef YYSTACK_RELOCATE 01298 if (yyss1 != yyssa) 01299 YYSTACK_FREE (yyss1); 01300 } 01301 # endif 01302 #endif /* no yyoverflow */ 01303 01304 yyssp = yyss + yysize - 1; 01305 yyvsp = yyvs + yysize - 1; 01306 01307 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 01308 (unsigned long int) yystacksize)); 01309 01310 if (yyss + yystacksize - 1 <= yyssp) 01311 YYABORT; 01312 } 01313 01314 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 01315 01316 if (yystate == YYFINAL) 01317 YYACCEPT; 01318 01319 goto yybackup; 01320 01321 /*-----------. 01322 | yybackup. | 01323 `-----------*/ 01324 yybackup: 01325 01326 /* Do appropriate processing given the current state. Read a 01327 lookahead token if we need one and don't already have one. */ 01328 01329 /* First try to decide what to do without reference to lookahead token. */ 01330 yyn = yypact[yystate]; 01331 if (yyn == YYPACT_NINF) 01332 goto yydefault; 01333 01334 /* Not known => get a lookahead token if don't already have one. */ 01335 01336 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ 01337 if (yychar == YYEMPTY) 01338 { 01339 YYDPRINTF ((stderr, "Reading a token: ")); 01340 yychar = YYLEX; 01341 } 01342 01343 if (yychar <= YYEOF) 01344 { 01345 yychar = yytoken = YYEOF; 01346 YYDPRINTF ((stderr, "Now at end of input.\n")); 01347 } 01348 else 01349 { 01350 yytoken = YYTRANSLATE (yychar); 01351 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); 01352 } 01353 01354 /* If the proper action on seeing token YYTOKEN is to reduce or to 01355 detect an error, take that action. */ 01356 yyn += yytoken; 01357 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) 01358 goto yydefault; 01359 yyn = yytable[yyn]; 01360 if (yyn <= 0) 01361 { 01362 if (yyn == 0 || yyn == YYTABLE_NINF) 01363 goto yyerrlab; 01364 yyn = -yyn; 01365 goto yyreduce; 01366 } 01367 01368 /* Count tokens shifted since error; after three, turn off error 01369 status. */ 01370 if (yyerrstatus) 01371 yyerrstatus--; 01372 01373 /* Shift the lookahead token. */ 01374 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); 01375 01376 /* Discard the shifted token. */ 01377 yychar = YYEMPTY; 01378 01379 yystate = yyn; 01380 *++yyvsp = yylval; 01381 01382 goto yynewstate; 01383 01384 01385 /*-----------------------------------------------------------. 01386 | yydefault -- do the default action for the current state. | 01387 `-----------------------------------------------------------*/ 01388 yydefault: 01389 yyn = yydefact[yystate]; 01390 if (yyn == 0) 01391 goto yyerrlab; 01392 goto yyreduce; 01393 01394 01395 /*-----------------------------. 01396 | yyreduce -- Do a reduction. | 01397 `-----------------------------*/ 01398 yyreduce: 01399 /* yyn is the number of a rule to reduce with. */ 01400 yylen = yyr2[yyn]; 01401 01402 /* If YYLEN is nonzero, implement the default value of the action: 01403 `$$ = $1'. 01404 01405 Otherwise, the following line sets YYVAL to garbage. 01406 This behavior is undocumented and Bison 01407 users should not rely upon it. Assigning to YYVAL 01408 unconditionally makes the parser a bit smaller, and it avoids a 01409 GCC warning that YYVAL may be used uninitialized. */ 01410 yyval = yyvsp[1-yylen]; 01411 01412 01413 YY_REDUCE_PRINT (yyn); 01414 switch (yyn) 01415 { 01416 case 5: 01417 01418 /* Line 1455 of yacc.c */ 01419 #line 87 "jsgf_parser.y" 01420 { jsgf->name = (yyvsp[(2) - (2)].name); } 01421 break; 01422 01423 case 7: 01424 01425 /* Line 1455 of yacc.c */ 01426 #line 91 "jsgf_parser.y" 01427 { jsgf->version = (yyvsp[(2) - (3)].name); } 01428 break; 01429 01430 case 8: 01431 01432 /* Line 1455 of yacc.c */ 01433 #line 92 "jsgf_parser.y" 01434 { jsgf->version = (yyvsp[(2) - (4)].name); jsgf->charset = (yyvsp[(3) - (4)].name); } 01435 break; 01436 01437 case 9: 01438 01439 /* Line 1455 of yacc.c */ 01440 #line 93 "jsgf_parser.y" 01441 { jsgf->version = (yyvsp[(2) - (5)].name); jsgf->charset = (yyvsp[(3) - (5)].name); 01442 jsgf->locale = (yyvsp[(4) - (5)].name); } 01443 break; 01444 01445 case 10: 01446 01447 /* Line 1455 of yacc.c */ 01448 #line 97 "jsgf_parser.y" 01449 { (yyval.name) = (yyvsp[(2) - (3)].name); } 01450 break; 01451 01452 case 13: 01453 01454 /* Line 1455 of yacc.c */ 01455 #line 104 "jsgf_parser.y" 01456 { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name)); ckd_free((yyvsp[(2) - (3)].name)); } 01457 break; 01458 01459 case 16: 01460 01461 /* Line 1455 of yacc.c */ 01462 #line 111 "jsgf_parser.y" 01463 { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0); ckd_free((yyvsp[(1) - (4)].name)); } 01464 break; 01465 01466 case 17: 01467 01468 /* Line 1455 of yacc.c */ 01469 #line 112 "jsgf_parser.y" 01470 { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1); ckd_free((yyvsp[(2) - (5)].name)); } 01471 break; 01472 01473 case 18: 01474 01475 /* Line 1455 of yacc.c */ 01476 #line 115 "jsgf_parser.y" 01477 { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms); } 01478 break; 01479 01480 case 19: 01481 01482 /* Line 1455 of yacc.c */ 01483 #line 116 "jsgf_parser.y" 01484 { (yyval.rhs) = (yyvsp[(3) - (3)].rhs); 01485 (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms); 01486 (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); } 01487 break; 01488 01489 case 20: 01490 01491 /* Line 1455 of yacc.c */ 01492 #line 121 "jsgf_parser.y" 01493 { (yyval.rhs) = ckd_calloc(1, sizeof(*(yyval.rhs))); 01494 (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); } 01495 break; 01496 01497 case 21: 01498 01499 /* Line 1455 of yacc.c */ 01500 #line 123 "jsgf_parser.y" 01501 { (yyval.rhs) = (yyvsp[(1) - (2)].rhs); 01502 (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); } 01503 break; 01504 01505 case 23: 01506 01507 /* Line 1455 of yacc.c */ 01508 #line 128 "jsgf_parser.y" 01509 { (yyval.atom) = (yyvsp[(1) - (2)].atom); 01510 (yyval.atom)->tags = glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); } 01511 break; 01512 01513 case 25: 01514 01515 /* Line 1455 of yacc.c */ 01516 #line 133 "jsgf_parser.y" 01517 { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); } 01518 break; 01519 01520 case 26: 01521 01522 /* Line 1455 of yacc.c */ 01523 #line 136 "jsgf_parser.y" 01524 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); } 01525 break; 01526 01527 case 27: 01528 01529 /* Line 1455 of yacc.c */ 01530 #line 139 "jsgf_parser.y" 01531 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); } 01532 break; 01533 01534 case 28: 01535 01536 /* Line 1455 of yacc.c */ 01537 #line 142 "jsgf_parser.y" 01538 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); } 01539 break; 01540 01541 case 29: 01542 01543 /* Line 1455 of yacc.c */ 01544 #line 143 "jsgf_parser.y" 01545 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); } 01546 break; 01547 01548 case 30: 01549 01550 /* Line 1455 of yacc.c */ 01551 #line 144 "jsgf_parser.y" 01552 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); } 01553 break; 01554 01555 case 31: 01556 01557 /* Line 1455 of yacc.c */ 01558 #line 145 "jsgf_parser.y" 01559 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); } 01560 break; 01561 01562 case 32: 01563 01564 /* Line 1455 of yacc.c */ 01565 #line 146 "jsgf_parser.y" 01566 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); } 01567 break; 01568 01569 case 33: 01570 01571 /* Line 1455 of yacc.c */ 01572 #line 147 "jsgf_parser.y" 01573 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); } 01574 break; 01575 01576 01577 01578 /* Line 1455 of yacc.c */ 01579 #line 1580 "jsgf_parser.c" 01580 default: break; 01581 } 01582 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); 01583 01584 YYPOPSTACK (yylen); 01585 yylen = 0; 01586 YY_STACK_PRINT (yyss, yyssp); 01587 01588 *++yyvsp = yyval; 01589 01590 /* Now `shift' the result of the reduction. Determine what state 01591 that goes to, based on the state we popped back to and the rule 01592 number reduced by. */ 01593 01594 yyn = yyr1[yyn]; 01595 01596 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; 01597 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) 01598 yystate = yytable[yystate]; 01599 else 01600 yystate = yydefgoto[yyn - YYNTOKENS]; 01601 01602 goto yynewstate; 01603 01604 01605 /*------------------------------------. 01606 | yyerrlab -- here on detecting error | 01607 `------------------------------------*/ 01608 yyerrlab: 01609 /* If not already recovering from an error, report this error. */ 01610 if (!yyerrstatus) 01611 { 01612 ++yynerrs; 01613 #if ! YYERROR_VERBOSE 01614 yyerror (yyscanner, jsgf, YY_("syntax error")); 01615 #else 01616 { 01617 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); 01618 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) 01619 { 01620 YYSIZE_T yyalloc = 2 * yysize; 01621 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) 01622 yyalloc = YYSTACK_ALLOC_MAXIMUM; 01623 if (yymsg != yymsgbuf) 01624 YYSTACK_FREE (yymsg); 01625 yymsg = (char *) YYSTACK_ALLOC (yyalloc); 01626 if (yymsg) 01627 yymsg_alloc = yyalloc; 01628 else 01629 { 01630 yymsg = yymsgbuf; 01631 yymsg_alloc = sizeof yymsgbuf; 01632 } 01633 } 01634 01635 if (0 < yysize && yysize <= yymsg_alloc) 01636 { 01637 (void) yysyntax_error (yymsg, yystate, yychar); 01638 yyerror (yyscanner, jsgf, yymsg); 01639 } 01640 else 01641 { 01642 yyerror (yyscanner, jsgf, YY_("syntax error")); 01643 if (yysize != 0) 01644 goto yyexhaustedlab; 01645 } 01646 } 01647 #endif 01648 } 01649 01650 01651 01652 if (yyerrstatus == 3) 01653 { 01654 /* If just tried and failed to reuse lookahead token after an 01655 error, discard it. */ 01656 01657 if (yychar <= YYEOF) 01658 { 01659 /* Return failure if at end of input. */ 01660 if (yychar == YYEOF) 01661 YYABORT; 01662 } 01663 else 01664 { 01665 yydestruct ("Error: discarding", 01666 yytoken, &yylval, yyscanner, jsgf); 01667 yychar = YYEMPTY; 01668 } 01669 } 01670 01671 /* Else will try to reuse lookahead token after shifting the error 01672 token. */ 01673 goto yyerrlab1; 01674 01675 01676 /*---------------------------------------------------. 01677 | yyerrorlab -- error raised explicitly by YYERROR. | 01678 `---------------------------------------------------*/ 01679 yyerrorlab: 01680 01681 /* Pacify compilers like GCC when the user code never invokes 01682 YYERROR and the label yyerrorlab therefore never appears in user 01683 code. */ 01684 if (/*CONSTCOND*/ 0) 01685 goto yyerrorlab; 01686 01687 /* Do not reclaim the symbols of the rule which action triggered 01688 this YYERROR. */ 01689 YYPOPSTACK (yylen); 01690 yylen = 0; 01691 YY_STACK_PRINT (yyss, yyssp); 01692 yystate = *yyssp; 01693 goto yyerrlab1; 01694 01695 01696 /*-------------------------------------------------------------. 01697 | yyerrlab1 -- common code for both syntax error and YYERROR. | 01698 `-------------------------------------------------------------*/ 01699 yyerrlab1: 01700 yyerrstatus = 3; /* Each real token shifted decrements this. */ 01701 01702 for (;;) 01703 { 01704 yyn = yypact[yystate]; 01705 if (yyn != YYPACT_NINF) 01706 { 01707 yyn += YYTERROR; 01708 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) 01709 { 01710 yyn = yytable[yyn]; 01711 if (0 < yyn) 01712 break; 01713 } 01714 } 01715 01716 /* Pop the current state because it cannot handle the error token. */ 01717 if (yyssp == yyss) 01718 YYABORT; 01719 01720 01721 yydestruct ("Error: popping", 01722 yystos[yystate], yyvsp, yyscanner, jsgf); 01723 YYPOPSTACK (1); 01724 yystate = *yyssp; 01725 YY_STACK_PRINT (yyss, yyssp); 01726 } 01727 01728 *++yyvsp = yylval; 01729 01730 01731 /* Shift the error token. */ 01732 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); 01733 01734 yystate = yyn; 01735 goto yynewstate; 01736 01737 01738 /*-------------------------------------. 01739 | yyacceptlab -- YYACCEPT comes here. | 01740 `-------------------------------------*/ 01741 yyacceptlab: 01742 yyresult = 0; 01743 goto yyreturn; 01744 01745 /*-----------------------------------. 01746 | yyabortlab -- YYABORT comes here. | 01747 `-----------------------------------*/ 01748 yyabortlab: 01749 yyresult = 1; 01750 goto yyreturn; 01751 01752 #if !defined(yyoverflow) || YYERROR_VERBOSE 01753 /*-------------------------------------------------. 01754 | yyexhaustedlab -- memory exhaustion comes here. | 01755 `-------------------------------------------------*/ 01756 yyexhaustedlab: 01757 yyerror (yyscanner, jsgf, YY_("memory exhausted")); 01758 yyresult = 2; 01759 /* Fall through. */ 01760 #endif 01761 01762 yyreturn: 01763 if (yychar != YYEMPTY) 01764 yydestruct ("Cleanup: discarding lookahead", 01765 yytoken, &yylval, yyscanner, jsgf); 01766 /* Do not reclaim the symbols of the rule which action triggered 01767 this YYABORT or YYACCEPT. */ 01768 YYPOPSTACK (yylen); 01769 YY_STACK_PRINT (yyss, yyssp); 01770 while (yyssp != yyss) 01771 { 01772 yydestruct ("Cleanup: popping", 01773 yystos[*yyssp], yyvsp, yyscanner, jsgf); 01774 YYPOPSTACK (1); 01775 } 01776 #ifndef yyoverflow 01777 if (yyss != yyssa) 01778 YYSTACK_FREE (yyss); 01779 #endif 01780 #if YYERROR_VERBOSE 01781 if (yymsg != yymsgbuf) 01782 YYSTACK_FREE (yymsg); 01783 #endif 01784 /* Make sure YYID is used. */ 01785 return YYID (yyresult); 01786 } 01787 01788 01789 01790 /* Line 1675 of yacc.c */ 01791 #line 150 "jsgf_parser.y" 01792 01793 01794 void 01795 yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s) 01796 { 01797 E_ERROR("%s at line %d current token '%s'\n", s, yyget_lineno(lex), yyget_text(lex)); 01798 } 01799