47 #define YYBISON_VERSION "3.0.5" 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) \ 965 YYCASE_(0, YY_(
"syntax error"));
966 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
967 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
968 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
969 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
970 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
975 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
976 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
981 if (*yymsg_alloc < yysize)
983 *yymsg_alloc = 2 * yysize;
984 if (! (yysize <= *yymsg_alloc
985 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
986 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
996 while ((*yyp = *yyformat) !=
'\0')
997 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
999 yyp += yytnamerr (yyp, yyarg[yyi++]);
1017 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1024 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1026 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1028 YY_IGNORE_MAYBE_UNINITIALIZED_END
1039 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1048 YY_INITIAL_VALUE (
static YYSTYPE yyval_default;)
1049 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1066 yytype_int16 yyssa[YYINITDEPTH];
1068 yytype_int16 *yyssp;
1075 YYSIZE_T yystacksize;
1088 char *yymsg = yymsgbuf;
1089 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1092 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) 1098 yyssp = yyss = yyssa;
1099 yyvsp = yyvs = yyvsa;
1100 yystacksize = YYINITDEPTH;
1102 YYDPRINTF ((stderr,
"Starting parse\n"));
1121 if (yyss + yystacksize - 1 <= yyssp)
1124 YYSIZE_T yysize = yyssp - yyss + 1;
1132 yytype_int16 *yyss1 = yyss;
1138 yyoverflow (YY_(
"memory exhausted"),
1139 &yyss1, yysize *
sizeof (*yyssp),
1140 &yyvs1, yysize *
sizeof (*yyvsp),
1147 # ifndef YYSTACK_RELOCATE 1148 goto yyexhaustedlab;
1151 if (YYMAXDEPTH <= yystacksize)
1152 goto yyexhaustedlab;
1154 if (YYMAXDEPTH < yystacksize)
1155 yystacksize = YYMAXDEPTH;
1158 yytype_int16 *yyss1 = yyss;
1160 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1162 goto yyexhaustedlab;
1163 YYSTACK_RELOCATE (yyss_alloc, yyss);
1164 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1165 # undef YYSTACK_RELOCATE 1167 YYSTACK_FREE (yyss1);
1172 yyssp = yyss + yysize - 1;
1173 yyvsp = yyvs + yysize - 1;
1175 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1176 (
unsigned long int) yystacksize));
1178 if (yyss + yystacksize - 1 <= yyssp)
1182 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1184 if (yystate == YYFINAL)
1198 yyn = yypact[yystate];
1199 if (yypact_value_is_default (yyn))
1205 if (yychar == YYEMPTY)
1207 YYDPRINTF ((stderr,
"Reading a token: "));
1208 yychar = yylex (&yylval, yyscanner);
1211 if (yychar <= YYEOF)
1213 yychar = yytoken = YYEOF;
1214 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1218 yytoken = YYTRANSLATE (yychar);
1219 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1225 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1230 if (yytable_value_is_error (yyn))
1242 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1248 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1250 YY_IGNORE_MAYBE_UNINITIALIZED_END
1259 yyn = yydefact[yystate];
1280 yyval = yyvsp[1-yylen];
1283 YY_REDUCE_PRINT (yyn);
1287 #line 87 "jsgf_parser.y" 1288 { jsgf->
name = (yyvsp[0].name); }
1289 #line 1290 "jsgf_parser.c" 1293 #line 91 "jsgf_parser.y" 1294 { jsgf->
version = (yyvsp[-1].name); }
1295 #line 1296 "jsgf_parser.c" 1299 #line 92 "jsgf_parser.y" 1300 { jsgf->
version = (yyvsp[-2].name); jsgf->
charset = (yyvsp[-1].name); }
1301 #line 1302 "jsgf_parser.c" 1305 #line 93 "jsgf_parser.y" 1306 { jsgf->
version = (yyvsp[-3].name); jsgf->
charset = (yyvsp[-2].name);
1307 jsgf->
locale = (yyvsp[-1].name); }
1308 #line 1309 "jsgf_parser.c" 1312 #line 97 "jsgf_parser.y" 1313 { (yyval.name) = (yyvsp[-1].name); }
1314 #line 1315 "jsgf_parser.c" 1318 #line 104 "jsgf_parser.y" 1319 { jsgf_import_rule(jsgf, (yyvsp[-1].name));
ckd_free((yyvsp[-1].name)); }
1320 #line 1321 "jsgf_parser.c" 1324 #line 111 "jsgf_parser.y" 1325 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 0);
ckd_free((yyvsp[-3].name)); }
1326 #line 1327 "jsgf_parser.c" 1330 #line 112 "jsgf_parser.y" 1331 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 1);
ckd_free((yyvsp[-3].name)); }
1332 #line 1333 "jsgf_parser.c" 1336 #line 115 "jsgf_parser.y" 1337 { (yyval.rhs) = (yyvsp[0].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1338 #line 1339 "jsgf_parser.c" 1342 #line 116 "jsgf_parser.y" 1343 { (yyval.rhs) = (yyvsp[0].rhs);
1345 (yyval.rhs)->alt = (yyvsp[-2].rhs); }
1346 #line 1347 "jsgf_parser.c" 1350 #line 121 "jsgf_parser.y" 1351 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1352 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1353 #line 1354 "jsgf_parser.c" 1357 #line 123 "jsgf_parser.y" 1358 { (yyval.rhs) = (yyvsp[-1].rhs);
1359 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1360 #line 1361 "jsgf_parser.c" 1364 #line 128 "jsgf_parser.y" 1365 { (yyval.atom) = (yyvsp[-1].atom);
1366 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[0].name)); }
1367 #line 1368 "jsgf_parser.c" 1371 #line 133 "jsgf_parser.y" 1372 { (yyval.atom) = (yyvsp[0].atom); (yyval.atom)->weight = (yyvsp[-1].weight); }
1373 #line 1374 "jsgf_parser.c" 1377 #line 136 "jsgf_parser.y" 1378 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[-1].rhs), 0); }
1379 #line 1380 "jsgf_parser.c" 1383 #line 139 "jsgf_parser.y" 1384 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[-1].rhs)); }
1385 #line 1386 "jsgf_parser.c" 1389 #line 142 "jsgf_parser.y" 1390 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1391 #line 1392 "jsgf_parser.c" 1395 #line 143 "jsgf_parser.y" 1396 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1397 #line 1398 "jsgf_parser.c" 1401 #line 144 "jsgf_parser.y" 1402 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1403 #line 1404 "jsgf_parser.c" 1407 #line 145 "jsgf_parser.y" 1408 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1409 #line 1410 "jsgf_parser.c" 1413 #line 146 "jsgf_parser.y" 1414 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 0); }
1415 #line 1416 "jsgf_parser.c" 1419 #line 147 "jsgf_parser.y" 1420 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 1); }
1421 #line 1422 "jsgf_parser.c" 1425 #line 1426 "jsgf_parser.c" 1439 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1443 YY_STACK_PRINT (yyss, yyssp);
1453 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1454 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1455 yystate = yytable[yystate];
1457 yystate = yydefgoto[yyn - YYNTOKENS];
1468 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1474 #if ! YYERROR_VERBOSE 1475 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1477 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ 1480 char const *yymsgp = YY_(
"syntax error");
1481 int yysyntax_error_status;
1482 yysyntax_error_status = YYSYNTAX_ERROR;
1483 if (yysyntax_error_status == 0)
1485 else if (yysyntax_error_status == 1)
1487 if (yymsg != yymsgbuf)
1488 YYSTACK_FREE (yymsg);
1489 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1493 yymsg_alloc =
sizeof yymsgbuf;
1494 yysyntax_error_status = 2;
1498 yysyntax_error_status = YYSYNTAX_ERROR;
1502 yyerror (yyscanner, jsgf, yymsgp);
1503 if (yysyntax_error_status == 2)
1504 goto yyexhaustedlab;
1506 # undef YYSYNTAX_ERROR 1512 if (yyerrstatus == 3)
1517 if (yychar <= YYEOF)
1520 if (yychar == YYEOF)
1525 yydestruct (
"Error: discarding",
1526 yytoken, &yylval, yyscanner, jsgf);
1551 YY_STACK_PRINT (yyss, yyssp);
1564 yyn = yypact[yystate];
1565 if (!yypact_value_is_default (yyn))
1568 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1581 yydestruct (
"Error: popping",
1582 yystos[yystate], yyvsp, yyscanner, jsgf);
1585 YY_STACK_PRINT (yyss, yyssp);
1588 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1590 YY_IGNORE_MAYBE_UNINITIALIZED_END
1594 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1614 #if !defined yyoverflow || YYERROR_VERBOSE 1619 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1625 if (yychar != YYEMPTY)
1629 yytoken = YYTRANSLATE (yychar);
1630 yydestruct (
"Cleanup: discarding lookahead",
1631 yytoken, &yylval, yyscanner, jsgf);
1636 YY_STACK_PRINT (yyss, yyssp);
1637 while (yyssp != yyss)
1639 yydestruct (
"Cleanup: popping",
1640 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1645 YYSTACK_FREE (yyss);
1648 if (yymsg != yymsgbuf)
1649 YYSTACK_FREE (yymsg);
1653 #line 150 "jsgf_parser.y" 1657 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1659 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)