47 #define YYBISON_VERSION "3.0.4" 50 #define YYSKELETON_NAME "yacc.c" 65 #line 37 "jsgf_parser.y" 67 #define YYERROR_VERBOSE 77 #include "jsgf_parser.h" 78 #include "jsgf_scanner.h" 82 #pragma warning(disable: 4273) 85 void yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s);
88 #line 89 "jsgf_parser.c" 91 # if defined __cplusplus && 201103L <= __cplusplus 92 # define YY_NULLPTR nullptr 99 #ifdef YYERROR_VERBOSE 100 # undef YYERROR_VERBOSE 101 # define YYERROR_VERBOSE 1 103 # define YYERROR_VERBOSE 0 108 #ifndef YY_YY_JSGF_PARSER_H_INCLUDED 109 # define YY_YY_JSGF_PARSER_H_INCLUDED 144 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED 148 #line 65 "jsgf_parser.y" 156 #line 157 "jsgf_parser.c" 160 # define YYSTYPE_IS_TRIVIAL 1 161 # define YYSTYPE_IS_DECLARED 1 166 int yyparse (
void* yyscanner,
jsgf_t *jsgf);
172 #line 173 "jsgf_parser.c" 179 typedef YYTYPE_UINT8 yytype_uint8;
181 typedef unsigned char yytype_uint8;
185 typedef YYTYPE_INT8 yytype_int8;
187 typedef signed char yytype_int8;
191 typedef YYTYPE_UINT16 yytype_uint16;
193 typedef unsigned short int yytype_uint16;
197 typedef YYTYPE_INT16 yytype_int16;
199 typedef short int yytype_int16;
203 # ifdef __SIZE_TYPE__ 204 # define YYSIZE_T __SIZE_TYPE__ 205 # elif defined size_t 206 # define YYSIZE_T size_t 207 # elif ! defined YYSIZE_T 209 # define YYSIZE_T size_t 211 # define YYSIZE_T unsigned int 215 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) 218 # if defined YYENABLE_NLS && YYENABLE_NLS 220 # include <libintl.h> 221 # define YY_(Msgid) dgettext ("bison-runtime", Msgid) 225 # define YY_(Msgid) Msgid 230 # if (defined __GNUC__ \ 231 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ 232 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C 233 # define YY_ATTRIBUTE(Spec) __attribute__(Spec) 235 # define YY_ATTRIBUTE(Spec) 239 #ifndef YY_ATTRIBUTE_PURE 240 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) 243 #ifndef YY_ATTRIBUTE_UNUSED 244 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) 247 #if !defined _Noreturn \ 248 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) 249 # if defined _MSC_VER && 1200 <= _MSC_VER 250 # define _Noreturn __declspec (noreturn) 252 # define _Noreturn YY_ATTRIBUTE ((__noreturn__)) 257 #if ! defined lint || defined __GNUC__ 258 # define YYUSE(E) ((void) (E)) 263 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ 265 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ 266 _Pragma ("GCC diagnostic push") \ 267 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ 268 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") 269 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \ 270 _Pragma ("GCC diagnostic pop") 272 # define YY_INITIAL_VALUE(Value) Value 274 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 275 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN 276 # define YY_IGNORE_MAYBE_UNINITIALIZED_END 278 #ifndef YY_INITIAL_VALUE 279 # define YY_INITIAL_VALUE(Value) 283 #if ! defined yyoverflow || YYERROR_VERBOSE 287 # ifdef YYSTACK_USE_ALLOCA 288 # if YYSTACK_USE_ALLOCA 290 # define YYSTACK_ALLOC __builtin_alloca 291 # elif defined __BUILTIN_VA_ARG_INCR 294 # define YYSTACK_ALLOC __alloca 295 # elif defined _MSC_VER 297 # define alloca _alloca 299 # define YYSTACK_ALLOC alloca 300 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS 303 # ifndef EXIT_SUCCESS 304 # define EXIT_SUCCESS 0 311 # ifdef YYSTACK_ALLOC 313 # define YYSTACK_FREE(Ptr) do { ; } while (0) 314 # ifndef YYSTACK_ALLOC_MAXIMUM 319 # define YYSTACK_ALLOC_MAXIMUM 4032 322 # define YYSTACK_ALLOC YYMALLOC 323 # define YYSTACK_FREE YYFREE 324 # ifndef YYSTACK_ALLOC_MAXIMUM 325 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM 327 # if (defined __cplusplus && ! defined EXIT_SUCCESS \ 328 && ! ((defined YYMALLOC || defined malloc) \ 329 && (defined YYFREE || defined free))) 331 # ifndef EXIT_SUCCESS 332 # define EXIT_SUCCESS 0 336 # define YYMALLOC malloc 337 # if ! defined malloc && ! defined EXIT_SUCCESS 338 void *malloc (YYSIZE_T);
343 # if ! defined free && ! defined EXIT_SUCCESS 351 #if (! defined yyoverflow \ 352 && (! defined __cplusplus \ 353 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 358 yytype_int16 yyss_alloc;
363 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) 367 # define YYSTACK_BYTES(N) \ 368 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ 369 + YYSTACK_GAP_MAXIMUM) 371 # define YYCOPY_NEEDED 1 378 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ 381 YYSIZE_T yynewbytes; \ 382 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ 383 Stack = &yyptr->Stack_alloc; \ 384 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ 385 yyptr += yynewbytes / sizeof (*yyptr); \ 391 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED 395 # if defined __GNUC__ && 1 < __GNUC__ 396 # define YYCOPY(Dst, Src, Count) \ 397 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) 399 # define YYCOPY(Dst, Src, Count) \ 403 for (yyi = 0; yyi < (Count); yyi++) \ 404 (Dst)[yyi] = (Src)[yyi]; \ 428 #define YYMAXUTOK 265 430 #define YYTRANSLATE(YYX) \ 431 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) 435 static const yytype_uint8 yytranslate[] =
437 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 14, 15, 18, 19, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,
443 2, 12, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 16, 2, 17, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 13, 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, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
468 static const yytype_uint8 yyrline[] =
470 0, 82, 82, 83, 84, 87, 90, 91, 92, 93,
471 97, 100, 101, 104, 107, 108, 111, 112, 115, 116,
472 121, 123, 127, 128, 132, 133, 136, 139, 142, 143,
477 #if YYDEBUG || YYERROR_VERBOSE || 0 480 static const char *
const yytname[] =
482 "$end",
"error",
"$undefined",
"HEADER",
"GRAMMAR",
"IMPORT",
"PUBLIC",
483 "TOKEN",
"RULENAME",
"TAG",
"WEIGHT",
"';'",
"'='",
"'|'",
"'('",
"')'",
484 "'['",
"']'",
"'*'",
"'+'",
"$accept",
"grammar",
"header",
485 "jsgf_header",
"grammar_header",
"import_header",
"import_statement",
486 "rule_list",
"rule",
"alternate_list",
"rule_expansion",
487 "tagged_rule_item",
"rule_item",
"rule_group",
"rule_optional",
488 "rule_atom", YY_NULLPTR
495 static const yytype_uint16 yytoknum[] =
497 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
498 265, 59, 61, 124, 40, 41, 91, 93, 42, 43
502 #define YYPACT_NINF -37 504 #define yypact_value_is_default(Yystate) \ 505 (!!((Yystate) == (-37))) 507 #define YYTABLE_NINF -1 509 #define yytable_value_is_error(Yytable_value) \ 514 static const yytype_int8 yypact[] =
516 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33,
517 30, 22, -37, 17, -37, 37, -37, 13, -37, 34,
518 31, -4, -37, 17, -37, 38, 39, -37, -37, -4,
519 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37,
520 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4,
521 42, -37, -37, -37, -37, -37, -37, -4
527 static const yytype_uint8 yydefact[] =
529 0, 0, 0, 2, 0, 0, 6, 1, 0, 0,
530 0, 0, 11, 3, 14, 0, 5, 0, 7, 0,
531 0, 0, 12, 4, 15, 0, 0, 8, 13, 0,
532 28, 29, 0, 0, 0, 0, 18, 20, 22, 30,
533 31, 24, 10, 9, 0, 25, 0, 0, 16, 0,
534 21, 23, 32, 33, 17, 26, 27, 19
538 static const yytype_int8 yypgoto[] =
540 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16,
541 -3, -36, -37, -37, -37, 15
545 static const yytype_int8 yydefgoto[] =
547 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35,
548 36, 37, 38, 39, 40, 41
554 static const yytype_uint8 yytable[] =
556 50, 24, 1, 30, 31, 5, 32, 30, 31, 6,
557 33, 24, 34, 44, 33, 17, 34, 46, 47, 18,
558 26, 50, 49, 9, 27, 10, 56, 8, 9, 48,
559 10, 49, 54, 49, 49, 55, 7, 52, 53, 15,
560 19, 20, 21, 29, 25, 28, 57, 45, 0, 42,
564 static const yytype_int8 yycheck[] =
566 36, 13, 3, 7, 8, 7, 10, 7, 8, 11,
567 14, 23, 16, 29, 14, 7, 16, 33, 34, 11,
568 7, 57, 13, 6, 11, 8, 17, 5, 6, 11,
569 8, 13, 11, 13, 13, 15, 0, 18, 19, 4,
570 8, 8, 12, 12, 7, 11, 49, 32, -1, 11,
576 static const yytype_uint8 yystos[] =
578 0, 3, 21, 22, 23, 7, 11, 0, 5, 6,
579 8, 25, 26, 27, 28, 4, 24, 7, 11, 8,
580 8, 12, 26, 27, 28, 7, 7, 11, 11, 12,
581 7, 8, 10, 14, 16, 29, 30, 31, 32, 33,
582 34, 35, 11, 11, 29, 35, 29, 29, 11, 13,
583 31, 9, 18, 19, 11, 15, 17, 30
587 static const yytype_uint8 yyr1[] =
589 0, 20, 21, 21, 21, 22, 23, 23, 23, 23,
590 24, 25, 25, 26, 27, 27, 28, 28, 29, 29,
591 30, 30, 31, 31, 32, 32, 33, 34, 35, 35,
596 static const yytype_uint8 yyr2[] =
598 0, 2, 1, 2, 3, 2, 2, 3, 4, 5,
599 3, 1, 2, 3, 1, 2, 4, 5, 1, 3,
600 1, 2, 1, 2, 1, 2, 3, 3, 1, 1,
605 #define yyerrok (yyerrstatus = 0) 606 #define yyclearin (yychar = YYEMPTY) 610 #define YYACCEPT goto yyacceptlab 611 #define YYABORT goto yyabortlab 612 #define YYERROR goto yyerrorlab 615 #define YYRECOVERING() (!!yyerrstatus) 617 #define YYBACKUP(Token, Value) \ 619 if (yychar == YYEMPTY) \ 623 YYPOPSTACK (yylen); \ 629 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \ 636 #define YYERRCODE 256 645 # define YYFPRINTF fprintf 648 # define YYDPRINTF(Args) \ 655 #ifndef YY_LOCATION_PRINT 656 # define YY_LOCATION_PRINT(File, Loc) ((void) 0) 660 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ 664 YYFPRINTF (stderr, "%s ", Title); \ 665 yy_symbol_print (stderr, \ 666 Type, Value, yyscanner, jsgf); \ 667 YYFPRINTF (stderr, "\n"); \ 677 yy_symbol_value_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
679 FILE *yyo = yyoutput;
686 if (yytype < YYNTOKENS)
687 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
698 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
700 YYFPRINTF (yyoutput,
"%s %s (",
701 yytype < YYNTOKENS ?
"token" :
"nterm", yytname[yytype]);
703 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
704 YYFPRINTF (yyoutput,
")");
713 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
715 YYFPRINTF (stderr,
"Stack now");
716 for (; yybottom <= yytop; yybottom++)
718 int yybot = *yybottom;
719 YYFPRINTF (stderr,
" %d", yybot);
721 YYFPRINTF (stderr,
"\n");
724 # define YY_STACK_PRINT(Bottom, Top) \ 727 yy_stack_print ((Bottom), (Top)); \ 736 yy_reduce_print (yytype_int16 *yyssp,
YYSTYPE *yyvsp,
int yyrule,
void* yyscanner,
jsgf_t *jsgf)
738 unsigned long int yylno = yyrline[yyrule];
739 int yynrhs = yyr2[yyrule];
741 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
744 for (yyi = 0; yyi < yynrhs; yyi++)
746 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
747 yy_symbol_print (stderr,
748 yystos[yyssp[yyi + 1 - yynrhs]],
749 &(yyvsp[(yyi + 1) - (yynrhs)])
751 YYFPRINTF (stderr,
"\n");
755 # define YY_REDUCE_PRINT(Rule) \ 758 yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, jsgf); \ 765 # define YYDPRINTF(Args) 766 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) 767 # define YY_STACK_PRINT(Bottom, Top) 768 # define YY_REDUCE_PRINT(Rule) 774 # define YYINITDEPTH 200 785 # define YYMAXDEPTH 10000 792 # if defined __GLIBC__ && defined _STRING_H 793 # define yystrlen strlen 797 yystrlen (
const char *yystr)
800 for (yylen = 0; yystr[yylen]; yylen++)
808 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE 809 # define yystpcpy stpcpy 814 yystpcpy (
char *yydest,
const char *yysrc)
817 const char *yys = yysrc;
819 while ((*yyd++ = *yys++) !=
'\0')
836 yytnamerr (
char *yyres,
const char *yystr)
841 char const *yyp = yystr;
848 goto do_not_strip_quotes;
852 goto do_not_strip_quotes;
865 do_not_strip_quotes: ;
869 return yystrlen (yystr);
871 return yystpcpy (yyres, yystr) - yyres;
884 yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
885 yytype_int16 *yyssp,
int yytoken)
887 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
888 YYSIZE_T yysize = yysize0;
889 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
891 const char *yyformat = YY_NULLPTR;
893 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
921 if (yytoken != YYEMPTY)
923 int yyn = yypact[*yyssp];
924 yyarg[yycount++] = yytname[yytoken];
925 if (!yypact_value_is_default (yyn))
930 int yyxbegin = yyn < 0 ? -yyn : 0;
932 int yychecklim = YYLAST - yyn + 1;
933 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
936 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
937 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
938 && !yytable_value_is_error (yytable[yyx + yyn]))
940 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
946 yyarg[yycount++] = yytname[yyx];
948 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
949 if (! (yysize <= yysize1
950 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
960 # define YYCASE_(N, S) \ 964 YYCASE_(0, YY_(
"syntax error"));
965 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
966 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
967 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
968 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
969 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
974 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
975 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
980 if (*yymsg_alloc < yysize)
982 *yymsg_alloc = 2 * yysize;
983 if (! (yysize <= *yymsg_alloc
984 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
985 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
995 while ((*yyp = *yyformat) !=
'\0')
996 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
998 yyp += yytnamerr (yyp, yyarg[yyi++]);
1016 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1023 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1025 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1027 YY_IGNORE_MAYBE_UNINITIALIZED_END
1038 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1047 YY_INITIAL_VALUE (
static YYSTYPE yyval_default;)
1048 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1065 yytype_int16 yyssa[YYINITDEPTH];
1067 yytype_int16 *yyssp;
1074 YYSIZE_T yystacksize;
1087 char *yymsg = yymsgbuf;
1088 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1091 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1097 yyssp = yyss = yyssa;
1098 yyvsp = yyvs = yyvsa;
1099 yystacksize = YYINITDEPTH;
1101 YYDPRINTF ((stderr,
"Starting parse\n"));
1120 if (yyss + yystacksize - 1 <= yyssp)
1123 YYSIZE_T yysize = yyssp - yyss + 1;
1131 yytype_int16 *yyss1 = yyss;
1137 yyoverflow (YY_(
"memory exhausted"),
1138 &yyss1, yysize *
sizeof (*yyssp),
1139 &yyvs1, yysize *
sizeof (*yyvsp),
1146 # ifndef YYSTACK_RELOCATE 1147 goto yyexhaustedlab;
1150 if (YYMAXDEPTH <= yystacksize)
1151 goto yyexhaustedlab;
1153 if (YYMAXDEPTH < yystacksize)
1154 yystacksize = YYMAXDEPTH;
1157 yytype_int16 *yyss1 = yyss;
1159 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1161 goto yyexhaustedlab;
1162 YYSTACK_RELOCATE (yyss_alloc, yyss);
1163 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1164 # undef YYSTACK_RELOCATE 1166 YYSTACK_FREE (yyss1);
1171 yyssp = yyss + yysize - 1;
1172 yyvsp = yyvs + yysize - 1;
1174 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1175 (
unsigned long int) yystacksize));
1177 if (yyss + yystacksize - 1 <= yyssp)
1181 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1183 if (yystate == YYFINAL)
1197 yyn = yypact[yystate];
1198 if (yypact_value_is_default (yyn))
1204 if (yychar == YYEMPTY)
1206 YYDPRINTF ((stderr,
"Reading a token: "));
1207 yychar = yylex (&yylval, yyscanner);
1210 if (yychar <= YYEOF)
1212 yychar = yytoken = YYEOF;
1213 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1217 yytoken = YYTRANSLATE (yychar);
1218 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1224 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1229 if (yytable_value_is_error (yyn))
1241 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1247 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1249 YY_IGNORE_MAYBE_UNINITIALIZED_END
1258 yyn = yydefact[yystate];
1279 yyval = yyvsp[1-yylen];
1282 YY_REDUCE_PRINT (yyn);
1286 #line 87 "jsgf_parser.y" 1287 { jsgf->
name = (yyvsp[0].name); }
1288 #line 1289 "jsgf_parser.c" 1292 #line 91 "jsgf_parser.y" 1293 { jsgf->
version = (yyvsp[-1].name); }
1294 #line 1295 "jsgf_parser.c" 1298 #line 92 "jsgf_parser.y" 1299 { jsgf->
version = (yyvsp[-2].name); jsgf->
charset = (yyvsp[-1].name); }
1300 #line 1301 "jsgf_parser.c" 1304 #line 93 "jsgf_parser.y" 1305 { jsgf->
version = (yyvsp[-3].name); jsgf->
charset = (yyvsp[-2].name);
1306 jsgf->
locale = (yyvsp[-1].name); }
1307 #line 1308 "jsgf_parser.c" 1311 #line 97 "jsgf_parser.y" 1312 { (yyval.name) = (yyvsp[-1].name); }
1313 #line 1314 "jsgf_parser.c" 1317 #line 104 "jsgf_parser.y" 1318 { jsgf_import_rule(jsgf, (yyvsp[-1].name));
ckd_free((yyvsp[-1].name)); }
1319 #line 1320 "jsgf_parser.c" 1323 #line 111 "jsgf_parser.y" 1324 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 0);
ckd_free((yyvsp[-3].name)); }
1325 #line 1326 "jsgf_parser.c" 1329 #line 112 "jsgf_parser.y" 1330 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 1);
ckd_free((yyvsp[-3].name)); }
1331 #line 1332 "jsgf_parser.c" 1335 #line 115 "jsgf_parser.y" 1336 { (yyval.rhs) = (yyvsp[0].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1337 #line 1338 "jsgf_parser.c" 1341 #line 116 "jsgf_parser.y" 1342 { (yyval.rhs) = (yyvsp[0].rhs);
1344 (yyval.rhs)->alt = (yyvsp[-2].rhs); }
1345 #line 1346 "jsgf_parser.c" 1349 #line 121 "jsgf_parser.y" 1350 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1351 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1352 #line 1353 "jsgf_parser.c" 1356 #line 123 "jsgf_parser.y" 1357 { (yyval.rhs) = (yyvsp[-1].rhs);
1358 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1359 #line 1360 "jsgf_parser.c" 1363 #line 128 "jsgf_parser.y" 1364 { (yyval.atom) = (yyvsp[-1].atom);
1365 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[0].name)); }
1366 #line 1367 "jsgf_parser.c" 1370 #line 133 "jsgf_parser.y" 1371 { (yyval.atom) = (yyvsp[0].atom); (yyval.atom)->weight = (yyvsp[-1].weight); }
1372 #line 1373 "jsgf_parser.c" 1376 #line 136 "jsgf_parser.y" 1377 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[-1].rhs), 0); }
1378 #line 1379 "jsgf_parser.c" 1382 #line 139 "jsgf_parser.y" 1383 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[-1].rhs)); }
1384 #line 1385 "jsgf_parser.c" 1388 #line 142 "jsgf_parser.y" 1389 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1390 #line 1391 "jsgf_parser.c" 1394 #line 143 "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 144 "jsgf_parser.y" 1401 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1402 #line 1403 "jsgf_parser.c" 1406 #line 145 "jsgf_parser.y" 1407 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1408 #line 1409 "jsgf_parser.c" 1412 #line 146 "jsgf_parser.y" 1413 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 0); }
1414 #line 1415 "jsgf_parser.c" 1418 #line 147 "jsgf_parser.y" 1419 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 1); }
1420 #line 1421 "jsgf_parser.c" 1424 #line 1425 "jsgf_parser.c" 1438 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1442 YY_STACK_PRINT (yyss, yyssp);
1452 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1453 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1454 yystate = yytable[yystate];
1456 yystate = yydefgoto[yyn - YYNTOKENS];
1467 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1473 #if ! YYERROR_VERBOSE 1474 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1476 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1479 char const *yymsgp = YY_(
"syntax error");
1480 int yysyntax_error_status;
1481 yysyntax_error_status = YYSYNTAX_ERROR;
1482 if (yysyntax_error_status == 0)
1484 else if (yysyntax_error_status == 1)
1486 if (yymsg != yymsgbuf)
1487 YYSTACK_FREE (yymsg);
1488 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1492 yymsg_alloc =
sizeof yymsgbuf;
1493 yysyntax_error_status = 2;
1497 yysyntax_error_status = YYSYNTAX_ERROR;
1501 yyerror (yyscanner, jsgf, yymsgp);
1502 if (yysyntax_error_status == 2)
1503 goto yyexhaustedlab;
1505 # undef YYSYNTAX_ERROR 1511 if (yyerrstatus == 3)
1516 if (yychar <= YYEOF)
1519 if (yychar == YYEOF)
1524 yydestruct (
"Error: discarding",
1525 yytoken, &yylval, yyscanner, jsgf);
1550 YY_STACK_PRINT (yyss, yyssp);
1563 yyn = yypact[yystate];
1564 if (!yypact_value_is_default (yyn))
1567 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1580 yydestruct (
"Error: popping",
1581 yystos[yystate], yyvsp, yyscanner, jsgf);
1584 YY_STACK_PRINT (yyss, yyssp);
1587 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1589 YY_IGNORE_MAYBE_UNINITIALIZED_END
1593 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1613 #if !defined yyoverflow || YYERROR_VERBOSE 1618 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1624 if (yychar != YYEMPTY)
1628 yytoken = YYTRANSLATE (yychar);
1629 yydestruct (
"Cleanup: discarding lookahead",
1630 yytoken, &yylval, yyscanner, jsgf);
1635 YY_STACK_PRINT (yyss, yyssp);
1636 while (yyssp != yyss)
1638 yydestruct (
"Cleanup: popping",
1639 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1644 YYSTACK_FREE (yyss);
1647 if (yymsg != yymsgbuf)
1648 YYSTACK_FREE (yymsg);
1652 #line 150 "jsgf_parser.y" 1656 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1658 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)