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