51 #define YYBISON_VERSION "3.4.1" 54 #define YYSKELETON_NAME "yacc.c" 69 #line 37 "jsgf_parser.y" 71 #define YYERROR_VERBOSE 81 #include "jsgf_parser.h" 82 #include "jsgf_scanner.h" 86 #pragma warning(disable: 4273) 89 void yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s);
92 #line 93 "jsgf_parser.c" 95 # if defined __cplusplus 96 # if 201103L <= __cplusplus 97 # define YY_NULLPTR nullptr 102 # define YY_NULLPTR ((void*)0) 107 #ifdef YYERROR_VERBOSE 108 # undef YYERROR_VERBOSE 109 # define YYERROR_VERBOSE 1 111 # define YYERROR_VERBOSE 0 116 #ifndef YY_YY_JSGF_PARSER_H_INCLUDED 117 # define YY_YY_JSGF_PARSER_H_INCLUDED 152 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 155 #line 65 "jsgf_parser.y" 163 #line 164 "jsgf_parser.c" 167 # define YYSTYPE_IS_TRIVIAL 1 168 # define YYSTYPE_IS_DECLARED 1 173 int yyparse (
void* yyscanner,
jsgf_t *jsgf);
184 typedef YYTYPE_UINT8 yytype_uint8;
186 typedef unsigned char yytype_uint8;
190 typedef YYTYPE_INT8 yytype_int8;
192 typedef signed char yytype_int8;
196 typedef YYTYPE_UINT16 yytype_uint16;
198 typedef unsigned short yytype_uint16;
202 typedef YYTYPE_INT16 yytype_int16;
204 typedef short yytype_int16;
208 # ifdef __SIZE_TYPE__ 209 # define YYSIZE_T __SIZE_TYPE__ 210 # elif defined size_t 211 # define YYSIZE_T size_t 212 # elif ! defined YYSIZE_T 214 # define YYSIZE_T size_t 216 # define YYSIZE_T unsigned 220 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 223 # if defined YYENABLE_NLS && YYENABLE_NLS 225 # include <libintl.h> 226 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 230 # define YY_(Msgid) Msgid 235 # if (defined __GNUC__ \ 236 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 237 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 238 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 240 # define YY_ATTRIBUTE(Spec) 244 #ifndef YY_ATTRIBUTE_PURE 245 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 248 #ifndef YY_ATTRIBUTE_UNUSED 249 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 253 #if ! defined lint || defined __GNUC__ 254 # define YYUSE(E) ((void) (E)) 259 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 261 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 262 _Pragma ("GCC diagnostic push") \ 263 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 264 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 265 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 266 _Pragma ("GCC diagnostic pop") 268 # define YY_INITIAL_VALUE(Value) Value 270 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 271 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 272 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 274 #ifndef YY_INITIAL_VALUE 275 # define YY_INITIAL_VALUE(Value) 279 #define YY_ASSERT(E) ((void) (0 && (E))) 281 #if ! defined yyoverflow || YYERROR_VERBOSE 285 # ifdef YYSTACK_USE_ALLOCA 286 # if YYSTACK_USE_ALLOCA 288 # define YYSTACK_ALLOC __builtin_alloca 289 # elif defined __BUILTIN_VA_ARG_INCR 292 # define YYSTACK_ALLOC __alloca 293 # elif defined _MSC_VER 295 # define alloca _alloca 297 # define YYSTACK_ALLOC alloca 298 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 301 # ifndef EXIT_SUCCESS 302 # define EXIT_SUCCESS 0 309 # ifdef YYSTACK_ALLOC 311 # define YYSTACK_FREE(Ptr) do { ; } while (0) 312 # ifndef YYSTACK_ALLOC_MAXIMUM 317 # define YYSTACK_ALLOC_MAXIMUM 4032 320 # define YYSTACK_ALLOC YYMALLOC 321 # define YYSTACK_FREE YYFREE 322 # ifndef YYSTACK_ALLOC_MAXIMUM 323 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 325 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 326 && ! ((defined YYMALLOC || defined malloc) \ 327 && (defined YYFREE || defined free))) 329 # ifndef EXIT_SUCCESS 330 # define EXIT_SUCCESS 0 334 # define YYMALLOC malloc 335 # if ! defined malloc && ! defined EXIT_SUCCESS 336 void *malloc (YYSIZE_T);
341 # if ! defined free && ! defined EXIT_SUCCESS 349 #if (! defined yyoverflow \ 350 && (! defined __cplusplus \ 351 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 356 yytype_int16 yyss_alloc;
361 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 365 # define YYSTACK_BYTES(N) \ 366 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 367 + YYSTACK_GAP_MAXIMUM) 369 # define YYCOPY_NEEDED 1 376 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 379 YYSIZE_T yynewbytes; \ 380 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 381 Stack = &yyptr->Stack_alloc; \ 382 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 383 yyptr += yynewbytes / sizeof (*yyptr); \ 389 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 393 # if defined __GNUC__ && 1 < __GNUC__ 394 # define YYCOPY(Dst, Src, Count) \ 395 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 397 # define YYCOPY(Dst, Src, Count) \ 401 for (yyi = 0; yyi < (Count); yyi++) \ 402 (Dst)[yyi] = (Src)[yyi]; \ 424 #define YYMAXUTOK 265 428 #define YYTRANSLATE(YYX) \ 429 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 433 static const yytype_uint8 yytranslate[] =
435 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
436 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 14, 15, 18, 19, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,
441 2, 12, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 16, 2, 17, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 13, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
466 static const yytype_uint8 yyrline[] =
468 0, 82, 82, 83, 84, 87, 90, 91, 92, 93,
469 97, 100, 101, 104, 107, 108, 111, 112, 115, 116,
470 121, 123, 127, 128, 132, 133, 136, 139, 142, 143,
475 #if YYDEBUG || YYERROR_VERBOSE || 0 478 static const char *
const yytname[] =
480 "$end",
"error",
"$undefined",
"HEADER",
"GRAMMAR",
"IMPORT",
"PUBLIC",
481 "TOKEN",
"RULENAME",
"TAG",
"WEIGHT",
"';'",
"'='",
"'|'",
"'('",
"')'",
482 "'['",
"']'",
"'*'",
"'+'",
"$accept",
"grammar",
"header",
483 "jsgf_header",
"grammar_header",
"import_header",
"import_statement",
484 "rule_list",
"rule",
"alternate_list",
"rule_expansion",
485 "tagged_rule_item",
"rule_item",
"rule_group",
"rule_optional",
486 "rule_atom", YY_NULLPTR
493 static const yytype_uint16 yytoknum[] =
495 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
496 265, 59, 61, 124, 40, 41, 91, 93, 42, 43
500 #define YYPACT_NINF -37 502 #define yypact_value_is_default(Yystate) \ 503 (!!((Yystate) == (-37))) 505 #define YYTABLE_NINF -1 507 #define yytable_value_is_error(Yytable_value) \ 512 static const yytype_int8 yypact[] =
514 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33,
515 30, 22, -37, 17, -37, 37, -37, 13, -37, 34,
516 31, -4, -37, 17, -37, 38, 39, -37, -37, -4,
517 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37,
518 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4,
519 42, -37, -37, -37, -37, -37, -37, -4
525 static const yytype_uint8 yydefact[] =
527 0, 0, 0, 2, 0, 0, 6, 1, 0, 0,
528 0, 0, 11, 3, 14, 0, 5, 0, 7, 0,
529 0, 0, 12, 4, 15, 0, 0, 8, 13, 0,
530 28, 29, 0, 0, 0, 0, 18, 20, 22, 30,
531 31, 24, 10, 9, 0, 25, 0, 0, 16, 0,
532 21, 23, 32, 33, 17, 26, 27, 19
536 static const yytype_int8 yypgoto[] =
538 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16,
539 -3, -36, -37, -37, -37, 15
543 static const yytype_int8 yydefgoto[] =
545 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35,
546 36, 37, 38, 39, 40, 41
552 static const yytype_uint8 yytable[] =
554 50, 24, 1, 30, 31, 5, 32, 30, 31, 6,
555 33, 24, 34, 44, 33, 17, 34, 46, 47, 18,
556 26, 50, 49, 9, 27, 10, 56, 8, 9, 48,
557 10, 49, 54, 49, 49, 55, 7, 52, 53, 15,
558 19, 20, 21, 29, 25, 28, 57, 45, 0, 42,
562 static const yytype_int8 yycheck[] =
564 36, 13, 3, 7, 8, 7, 10, 7, 8, 11,
565 14, 23, 16, 29, 14, 7, 16, 33, 34, 11,
566 7, 57, 13, 6, 11, 8, 17, 5, 6, 11,
567 8, 13, 11, 13, 13, 15, 0, 18, 19, 4,
568 8, 8, 12, 12, 7, 11, 49, 32, -1, 11,
574 static const yytype_uint8 yystos[] =
576 0, 3, 21, 22, 23, 7, 11, 0, 5, 6,
577 8, 25, 26, 27, 28, 4, 24, 7, 11, 8,
578 8, 12, 26, 27, 28, 7, 7, 11, 11, 12,
579 7, 8, 10, 14, 16, 29, 30, 31, 32, 33,
580 34, 35, 11, 11, 29, 35, 29, 29, 11, 13,
581 31, 9, 18, 19, 11, 15, 17, 30
585 static const yytype_uint8 yyr1[] =
587 0, 20, 21, 21, 21, 22, 23, 23, 23, 23,
588 24, 25, 25, 26, 27, 27, 28, 28, 29, 29,
589 30, 30, 31, 31, 32, 32, 33, 34, 35, 35,
594 static const yytype_uint8 yyr2[] =
596 0, 2, 1, 2, 3, 2, 2, 3, 4, 5,
597 3, 1, 2, 3, 1, 2, 4, 5, 1, 3,
598 1, 2, 1, 2, 1, 2, 3, 3, 1, 1,
603 #define yyerrok (yyerrstatus = 0) 604 #define yyclearin (yychar = YYEMPTY) 608 #define YYACCEPT goto yyacceptlab 609 #define YYABORT goto yyabortlab 610 #define YYERROR goto yyerrorlab 613 #define YYRECOVERING() (!!yyerrstatus) 615 #define YYBACKUP(Token, Value) \ 617 if (yychar == YYEMPTY) \ 621 YYPOPSTACK (yylen); \ 627 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \ 634 #define YYERRCODE 256 643 # define YYFPRINTF fprintf 646 # define YYDPRINTF(Args) \ 653 #ifndef YY_LOCATION_PRINT 654 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 658 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 662 YYFPRINTF (stderr, "%s ", Title); \ 663 yy_symbol_print (stderr, \ 664 Type, Value, yyscanner, jsgf); \ 665 YYFPRINTF (stderr, "\n"); \ 675 yy_symbol_value_print (FILE *yyo,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
677 FILE *yyoutput = yyo;
684 if (yytype < YYNTOKENS)
685 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
696 yy_symbol_print (FILE *yyo,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
698 YYFPRINTF (yyo,
"%s %s (",
699 yytype < YYNTOKENS ?
"token" :
"nterm", yytname[yytype]);
701 yy_symbol_value_print (yyo, yytype, yyvaluep, yyscanner, jsgf);
702 YYFPRINTF (yyo,
")");
711 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
713 YYFPRINTF (stderr,
"Stack now");
714 for (; yybottom <= yytop; yybottom++)
716 int yybot = *yybottom;
717 YYFPRINTF (stderr,
" %d", yybot);
719 YYFPRINTF (stderr,
"\n");
722 # define YY_STACK_PRINT(Bottom, Top) \ 725 yy_stack_print ((Bottom), (Top)); \ 734 yy_reduce_print (yytype_int16 *yyssp,
YYSTYPE *yyvsp,
int yyrule,
void* yyscanner,
jsgf_t *jsgf)
736 unsigned long yylno = yyrline[yyrule];
737 int yynrhs = yyr2[yyrule];
739 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
742 for (yyi = 0; yyi < yynrhs; yyi++)
744 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
745 yy_symbol_print (stderr,
746 yystos[yyssp[yyi + 1 - yynrhs]],
747 &yyvsp[(yyi + 1) - (yynrhs)]
749 YYFPRINTF (stderr,
"\n");
753 # define YY_REDUCE_PRINT(Rule) \ 756 yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, jsgf); \ 763 # define YYDPRINTF(Args) 764 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 765 # define YY_STACK_PRINT(Bottom, Top) 766 # define YY_REDUCE_PRINT(Rule) 772 # define YYINITDEPTH 200 783 # define YYMAXDEPTH 10000 790 # if defined __GLIBC__ && defined _STRING_H 791 # define yystrlen strlen 795 yystrlen (
const char *yystr)
798 for (yylen = 0; yystr[yylen]; yylen++)
806 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 807 # define yystpcpy stpcpy 812 yystpcpy (
char *yydest,
const char *yysrc)
815 const char *yys = yysrc;
817 while ((*yyd++ = *yys++) !=
'\0')
834 yytnamerr (
char *yyres,
const char *yystr)
839 char const *yyp = yystr;
846 goto do_not_strip_quotes;
850 goto do_not_strip_quotes;
866 do_not_strip_quotes: ;
870 return yystrlen (yystr);
872 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
885 yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
886 yytype_int16 *yyssp,
int yytoken)
888 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
889 YYSIZE_T yysize = yysize0;
890 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
892 const char *yyformat = YY_NULLPTR;
894 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
922 if (yytoken != YYEMPTY)
924 int yyn = yypact[*yyssp];
925 yyarg[yycount++] = yytname[yytoken];
926 if (!yypact_value_is_default (yyn))
931 int yyxbegin = yyn < 0 ? -yyn : 0;
933 int yychecklim = YYLAST - yyn + 1;
934 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
937 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
938 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
939 && !yytable_value_is_error (yytable[yyx + yyn]))
941 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
947 yyarg[yycount++] = yytname[yyx];
949 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
950 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
961 # define YYCASE_(N, S) \ 966 YYCASE_(0, YY_(
"syntax error"));
967 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
968 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
969 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
970 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
971 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
976 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
977 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
983 if (*yymsg_alloc < yysize)
985 *yymsg_alloc = 2 * yysize;
986 if (! (yysize <= *yymsg_alloc
987 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
988 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
998 while ((*yyp = *yyformat) !=
'\0')
999 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1001 yyp += yytnamerr (yyp, yyarg[yyi++]);
1019 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1026 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1028 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1030 YY_IGNORE_MAYBE_UNINITIALIZED_END
1041 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1050 YY_INITIAL_VALUE (
static YYSTYPE yyval_default;)
1051 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1068 yytype_int16 yyssa[YYINITDEPTH];
1070 yytype_int16 *yyssp;
1077 YYSIZE_T yystacksize;
1090 char *yymsg = yymsgbuf;
1091 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1094 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1100 yyssp = yyss = yyssa;
1101 yyvsp = yyvs = yyvsa;
1102 yystacksize = YYINITDEPTH;
1104 YYDPRINTF ((stderr,
"Starting parse\n"));
1126 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1127 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1128 *yyssp = (yytype_int16) yystate;
1130 if (yyss + yystacksize - 1 <= yyssp)
1131 #if !defined yyoverflow && !defined YYSTACK_RELOCATE 1132 goto yyexhaustedlab;
1136 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1138 # if defined yyoverflow 1144 yytype_int16 *yyss1 = yyss;
1150 yyoverflow (YY_(
"memory exhausted"),
1151 &yyss1, yysize *
sizeof (*yyssp),
1152 &yyvs1, yysize *
sizeof (*yyvsp),
1159 if (YYMAXDEPTH <= yystacksize)
1160 goto yyexhaustedlab;
1162 if (YYMAXDEPTH < yystacksize)
1163 yystacksize = YYMAXDEPTH;
1166 yytype_int16 *yyss1 = yyss;
1168 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1170 goto yyexhaustedlab;
1171 YYSTACK_RELOCATE (yyss_alloc, yyss);
1172 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1173 # undef YYSTACK_RELOCATE 1175 YYSTACK_FREE (yyss1);
1179 yyssp = yyss + yysize - 1;
1180 yyvsp = yyvs + yysize - 1;
1182 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1183 (
unsigned long) yystacksize));
1185 if (yyss + yystacksize - 1 <= yyssp)
1190 if (yystate == YYFINAL)
1204 yyn = yypact[yystate];
1205 if (yypact_value_is_default (yyn))
1211 if (yychar == YYEMPTY)
1213 YYDPRINTF ((stderr,
"Reading a token: "));
1214 yychar = yylex (&yylval, yyscanner);
1217 if (yychar <= YYEOF)
1219 yychar = yytoken = YYEOF;
1220 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1224 yytoken = YYTRANSLATE (yychar);
1225 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1231 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1236 if (yytable_value_is_error (yyn))
1248 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1254 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1256 YY_IGNORE_MAYBE_UNINITIALIZED_END
1264 yyn = yydefact[yystate];
1285 yyval = yyvsp[1-yylen];
1288 YY_REDUCE_PRINT (yyn);
1292 #line 87 "jsgf_parser.y" 1293 { jsgf->
name = (yyvsp[0].name); }
1294 #line 1295 "jsgf_parser.c" 1298 #line 91 "jsgf_parser.y" 1299 { jsgf->
version = (yyvsp[-1].name); }
1300 #line 1301 "jsgf_parser.c" 1304 #line 92 "jsgf_parser.y" 1305 { jsgf->
version = (yyvsp[-2].name); jsgf->
charset = (yyvsp[-1].name); }
1306 #line 1307 "jsgf_parser.c" 1310 #line 93 "jsgf_parser.y" 1311 { jsgf->
version = (yyvsp[-3].name); jsgf->
charset = (yyvsp[-2].name);
1312 jsgf->
locale = (yyvsp[-1].name); }
1313 #line 1314 "jsgf_parser.c" 1317 #line 97 "jsgf_parser.y" 1318 { (yyval.name) = (yyvsp[-1].name); }
1319 #line 1320 "jsgf_parser.c" 1323 #line 104 "jsgf_parser.y" 1324 { jsgf_import_rule(jsgf, (yyvsp[-1].name));
ckd_free((yyvsp[-1].name)); }
1325 #line 1326 "jsgf_parser.c" 1329 #line 111 "jsgf_parser.y" 1330 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 0);
ckd_free((yyvsp[-3].name)); }
1331 #line 1332 "jsgf_parser.c" 1335 #line 112 "jsgf_parser.y" 1336 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 1);
ckd_free((yyvsp[-3].name)); }
1337 #line 1338 "jsgf_parser.c" 1341 #line 115 "jsgf_parser.y" 1342 { (yyval.rhs) = (yyvsp[0].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1343 #line 1344 "jsgf_parser.c" 1347 #line 116 "jsgf_parser.y" 1348 { (yyval.rhs) = (yyvsp[0].rhs);
1350 (yyval.rhs)->alt = (yyvsp[-2].rhs); }
1351 #line 1352 "jsgf_parser.c" 1355 #line 121 "jsgf_parser.y" 1356 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1357 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1358 #line 1359 "jsgf_parser.c" 1362 #line 123 "jsgf_parser.y" 1363 { (yyval.rhs) = (yyvsp[-1].rhs);
1364 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1365 #line 1366 "jsgf_parser.c" 1369 #line 128 "jsgf_parser.y" 1370 { (yyval.atom) = (yyvsp[-1].atom);
1371 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[0].name)); }
1372 #line 1373 "jsgf_parser.c" 1376 #line 133 "jsgf_parser.y" 1377 { (yyval.atom) = (yyvsp[0].atom); (yyval.atom)->weight = (yyvsp[-1].weight); }
1378 #line 1379 "jsgf_parser.c" 1382 #line 136 "jsgf_parser.y" 1383 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[-1].rhs), 0); }
1384 #line 1385 "jsgf_parser.c" 1388 #line 139 "jsgf_parser.y" 1389 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[-1].rhs)); }
1390 #line 1391 "jsgf_parser.c" 1394 #line 142 "jsgf_parser.y" 1395 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1396 #line 1397 "jsgf_parser.c" 1400 #line 143 "jsgf_parser.y" 1401 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1402 #line 1403 "jsgf_parser.c" 1406 #line 144 "jsgf_parser.y" 1407 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1408 #line 1409 "jsgf_parser.c" 1412 #line 145 "jsgf_parser.y" 1413 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1414 #line 1415 "jsgf_parser.c" 1418 #line 146 "jsgf_parser.y" 1419 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 0); }
1420 #line 1421 "jsgf_parser.c" 1424 #line 147 "jsgf_parser.y" 1425 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 1); }
1426 #line 1427 "jsgf_parser.c" 1430 #line 1431 "jsgf_parser.c" 1445 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1449 YY_STACK_PRINT (yyss, yyssp);
1457 const int yylhs = yyr1[yyn] - YYNTOKENS;
1458 const int yyi = yypgoto[yylhs] + *yyssp;
1459 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1461 : yydefgoto[yylhs]);
1473 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1479 #if ! YYERROR_VERBOSE 1480 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1482 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1485 char const *yymsgp = YY_(
"syntax error");
1486 int yysyntax_error_status;
1487 yysyntax_error_status = YYSYNTAX_ERROR;
1488 if (yysyntax_error_status == 0)
1490 else if (yysyntax_error_status == 1)
1492 if (yymsg != yymsgbuf)
1493 YYSTACK_FREE (yymsg);
1494 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1498 yymsg_alloc =
sizeof yymsgbuf;
1499 yysyntax_error_status = 2;
1503 yysyntax_error_status = YYSYNTAX_ERROR;
1507 yyerror (yyscanner, jsgf, yymsgp);
1508 if (yysyntax_error_status == 2)
1509 goto yyexhaustedlab;
1511 # undef YYSYNTAX_ERROR 1517 if (yyerrstatus == 3)
1522 if (yychar <= YYEOF)
1525 if (yychar == YYEOF)
1530 yydestruct (
"Error: discarding",
1531 yytoken, &yylval, yyscanner, jsgf);
1554 YY_STACK_PRINT (yyss, yyssp);
1567 yyn = yypact[yystate];
1568 if (!yypact_value_is_default (yyn))
1571 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1584 yydestruct (
"Error: popping",
1585 yystos[yystate], yyvsp, yyscanner, jsgf);
1588 YY_STACK_PRINT (yyss, yyssp);
1591 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1593 YY_IGNORE_MAYBE_UNINITIALIZED_END
1597 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1619 #if !defined yyoverflow || YYERROR_VERBOSE 1624 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1634 if (yychar != YYEMPTY)
1638 yytoken = YYTRANSLATE (yychar);
1639 yydestruct (
"Cleanup: discarding lookahead",
1640 yytoken, &yylval, yyscanner, jsgf);
1645 YY_STACK_PRINT (yyss, yyssp);
1646 while (yyssp != yyss)
1648 yydestruct (
"Cleanup: popping",
1649 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1654 YYSTACK_FREE (yyss);
1657 if (yymsg != yymsgbuf)
1658 YYSTACK_FREE (yymsg);
1662 #line 150 "jsgf_parser.y" 1666 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1668 E_ERROR(
"%s at line %d current token '%s'\n", s, yyget_lineno(lex), yyget_text(lex));
Internal definitions for JSGF grammar compiler.
#define ckd_calloc(n, sz)
Macros to simplify the use of above functions.
#define E_ERROR(...)
Print error message to error log.
Sphinx's memory allocation/deallocation routines.
SPHINXBASE_EXPORT void ckd_free(void *ptr)
Test and free a 1-D array.
SPHINXBASE_EXPORT glist_t glist_add_ptr(glist_t g, void *ptr)
Create and prepend a new list node, with the given user-defined data, at the HEAD of the given generi...
char * charset
JSGF charset (default UTF-8)
SPHINXBASE_EXPORT glist_t glist_reverse(glist_t g)
Reverse the order of the given glist.
Implementation of logging routines.
char * version
JSGF version (from header)
Hash table implementation.
char * locale
JSGF locale (default C)