47 #define YYBISON_VERSION "3.0.2"
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"
158 # define YYSTYPE_IS_TRIVIAL 1
159 # define YYSTYPE_IS_DECLARED 1
164 int yyparse (
void* yyscanner,
jsgf_t *jsgf);
170 #line 171 "jsgf_parser.c"
177 typedef YYTYPE_UINT8 yytype_uint8;
179 typedef unsigned char yytype_uint8;
183 typedef YYTYPE_INT8 yytype_int8;
185 typedef signed char yytype_int8;
189 typedef YYTYPE_UINT16 yytype_uint16;
191 typedef unsigned short int yytype_uint16;
195 typedef YYTYPE_INT16 yytype_int16;
197 typedef short int yytype_int16;
201 # ifdef __SIZE_TYPE__
202 # define YYSIZE_T __SIZE_TYPE__
203 # elif defined size_t
204 # define YYSIZE_T size_t
205 # elif ! defined YYSIZE_T
207 # define YYSIZE_T size_t
209 # define YYSIZE_T unsigned int
213 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
216 # if defined YYENABLE_NLS && YYENABLE_NLS
218 # include <libintl.h>
219 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
223 # define YY_(Msgid) Msgid
228 # if (defined __GNUC__ \
229 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
230 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
231 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
233 # define YY_ATTRIBUTE(Spec)
237 #ifndef YY_ATTRIBUTE_PURE
238 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
241 #ifndef YY_ATTRIBUTE_UNUSED
242 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
245 #if !defined _Noreturn \
246 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
247 # if defined _MSC_VER && 1200 <= _MSC_VER
248 # define _Noreturn __declspec (noreturn)
250 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
255 #if ! defined lint || defined __GNUC__
256 # define YYUSE(E) ((void) (E))
261 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
263 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
264 _Pragma ("GCC diagnostic push") \
265 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
266 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
267 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
268 _Pragma ("GCC diagnostic pop")
270 # define YY_INITIAL_VALUE(Value) Value
272 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
273 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
274 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
276 #ifndef YY_INITIAL_VALUE
277 # define YY_INITIAL_VALUE(Value)
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]; \
426 #define YYMAXUTOK 265
428 #define YYTRANSLATE(YYX) \
429 ((unsigned int) (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 *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
677 FILE *yyo = yyoutput;
684 if (yytype < YYNTOKENS)
685 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
696 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
698 YYFPRINTF (yyoutput,
"%s %s (",
699 yytype < YYNTOKENS ?
"token" :
"nterm", yytname[yytype]);
701 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
702 YYFPRINTF (yyoutput,
")");
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 int 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;
863 do_not_strip_quotes: ;
867 return yystrlen (yystr);
869 return yystpcpy (yyres, yystr) - yyres;
882 yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
883 yytype_int16 *yyssp,
int yytoken)
885 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
886 YYSIZE_T yysize = yysize0;
887 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
889 const char *yyformat = YY_NULLPTR;
891 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
919 if (yytoken != YYEMPTY)
921 int yyn = yypact[*yyssp];
922 yyarg[yycount++] = yytname[yytoken];
923 if (!yypact_value_is_default (yyn))
928 int yyxbegin = yyn < 0 ? -yyn : 0;
930 int yychecklim = YYLAST - yyn + 1;
931 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
934 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
935 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
936 && !yytable_value_is_error (yytable[yyx + yyn]))
938 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
944 yyarg[yycount++] = yytname[yyx];
946 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
947 if (! (yysize <= yysize1
948 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
958 # define YYCASE_(N, S) \
962 YYCASE_(0, YY_(
"syntax error"));
963 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
964 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
965 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
966 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
967 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
972 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
973 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
978 if (*yymsg_alloc < yysize)
980 *yymsg_alloc = 2 * yysize;
981 if (! (yysize <= *yymsg_alloc
982 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
983 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
993 while ((*yyp = *yyformat) !=
'\0')
994 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
996 yyp += yytnamerr (yyp, yyarg[yyi++]);
1014 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1021 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1023 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1025 YY_IGNORE_MAYBE_UNINITIALIZED_END
1036 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1045 YY_INITIAL_VALUE (
static YYSTYPE yyval_default;)
1046 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1063 yytype_int16 yyssa[YYINITDEPTH];
1065 yytype_int16 *yyssp;
1072 YYSIZE_T yystacksize;
1085 char *yymsg = yymsgbuf;
1086 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1089 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1095 yyssp = yyss = yyssa;
1096 yyvsp = yyvs = yyvsa;
1097 yystacksize = YYINITDEPTH;
1099 YYDPRINTF ((stderr,
"Starting parse\n"));
1118 if (yyss + yystacksize - 1 <= yyssp)
1121 YYSIZE_T yysize = yyssp - yyss + 1;
1129 yytype_int16 *yyss1 = yyss;
1135 yyoverflow (YY_(
"memory exhausted"),
1136 &yyss1, yysize *
sizeof (*yyssp),
1137 &yyvs1, yysize *
sizeof (*yyvsp),
1144 # ifndef YYSTACK_RELOCATE
1145 goto yyexhaustedlab;
1148 if (YYMAXDEPTH <= yystacksize)
1149 goto yyexhaustedlab;
1151 if (YYMAXDEPTH < yystacksize)
1152 yystacksize = YYMAXDEPTH;
1155 yytype_int16 *yyss1 = yyss;
1157 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1159 goto yyexhaustedlab;
1160 YYSTACK_RELOCATE (yyss_alloc, yyss);
1161 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1162 # undef YYSTACK_RELOCATE
1164 YYSTACK_FREE (yyss1);
1169 yyssp = yyss + yysize - 1;
1170 yyvsp = yyvs + yysize - 1;
1172 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1173 (
unsigned long int) yystacksize));
1175 if (yyss + yystacksize - 1 <= yyssp)
1179 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1181 if (yystate == YYFINAL)
1195 yyn = yypact[yystate];
1196 if (yypact_value_is_default (yyn))
1202 if (yychar == YYEMPTY)
1204 YYDPRINTF ((stderr,
"Reading a token: "));
1205 yychar = yylex (&yylval, yyscanner);
1208 if (yychar <= YYEOF)
1210 yychar = yytoken = YYEOF;
1211 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1215 yytoken = YYTRANSLATE (yychar);
1216 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1222 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1227 if (yytable_value_is_error (yyn))
1239 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1245 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1247 YY_IGNORE_MAYBE_UNINITIALIZED_END
1256 yyn = yydefact[yystate];
1277 yyval = yyvsp[1-yylen];
1280 YY_REDUCE_PRINT (yyn);
1284 #line 87 "jsgf_parser.y"
1285 { jsgf->
name = (yyvsp[0].name); }
1286 #line 1287 "jsgf_parser.c"
1290 #line 91 "jsgf_parser.y"
1291 { jsgf->
version = (yyvsp[-1].name); }
1292 #line 1293 "jsgf_parser.c"
1296 #line 92 "jsgf_parser.y"
1297 { jsgf->
version = (yyvsp[-2].name); jsgf->
charset = (yyvsp[-1].name); }
1298 #line 1299 "jsgf_parser.c"
1302 #line 93 "jsgf_parser.y"
1303 { jsgf->
version = (yyvsp[-3].name); jsgf->
charset = (yyvsp[-2].name);
1304 jsgf->
locale = (yyvsp[-1].name); }
1305 #line 1306 "jsgf_parser.c"
1309 #line 97 "jsgf_parser.y"
1310 { (yyval.name) = (yyvsp[-1].name); }
1311 #line 1312 "jsgf_parser.c"
1315 #line 104 "jsgf_parser.y"
1316 { jsgf_import_rule(jsgf, (yyvsp[-1].name));
ckd_free((yyvsp[-1].name)); }
1317 #line 1318 "jsgf_parser.c"
1321 #line 111 "jsgf_parser.y"
1322 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 0);
ckd_free((yyvsp[-3].name)); }
1323 #line 1324 "jsgf_parser.c"
1327 #line 112 "jsgf_parser.y"
1328 { jsgf_define_rule(jsgf, (yyvsp[-3].name), (yyvsp[-1].rhs), 1);
ckd_free((yyvsp[-3].name)); }
1329 #line 1330 "jsgf_parser.c"
1333 #line 115 "jsgf_parser.y"
1334 { (yyval.rhs) = (yyvsp[0].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1335 #line 1336 "jsgf_parser.c"
1339 #line 116 "jsgf_parser.y"
1340 { (yyval.rhs) = (yyvsp[0].rhs);
1342 (yyval.rhs)->alt = (yyvsp[-2].rhs); }
1343 #line 1344 "jsgf_parser.c"
1347 #line 121 "jsgf_parser.y"
1348 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1349 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1350 #line 1351 "jsgf_parser.c"
1354 #line 123 "jsgf_parser.y"
1355 { (yyval.rhs) = (yyvsp[-1].rhs);
1356 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[0].atom)); }
1357 #line 1358 "jsgf_parser.c"
1361 #line 128 "jsgf_parser.y"
1362 { (yyval.atom) = (yyvsp[-1].atom);
1363 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[0].name)); }
1364 #line 1365 "jsgf_parser.c"
1368 #line 133 "jsgf_parser.y"
1369 { (yyval.atom) = (yyvsp[0].atom); (yyval.atom)->weight = (yyvsp[-1].weight); }
1370 #line 1371 "jsgf_parser.c"
1374 #line 136 "jsgf_parser.y"
1375 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[-1].rhs), 0); }
1376 #line 1377 "jsgf_parser.c"
1380 #line 139 "jsgf_parser.y"
1381 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[-1].rhs)); }
1382 #line 1383 "jsgf_parser.c"
1386 #line 142 "jsgf_parser.y"
1387 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1388 #line 1389 "jsgf_parser.c"
1392 #line 143 "jsgf_parser.y"
1393 { (yyval.atom) = jsgf_atom_new((yyvsp[0].name), 1.0);
ckd_free((yyvsp[0].name)); }
1394 #line 1395 "jsgf_parser.c"
1398 #line 144 "jsgf_parser.y"
1399 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1400 #line 1401 "jsgf_parser.c"
1404 #line 145 "jsgf_parser.y"
1405 { (yyval.atom) = jsgf_atom_new((yyvsp[0].rule)->name, 1.0); }
1406 #line 1407 "jsgf_parser.c"
1410 #line 146 "jsgf_parser.y"
1411 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 0); }
1412 #line 1413 "jsgf_parser.c"
1416 #line 147 "jsgf_parser.y"
1417 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[-1].atom), 1); }
1418 #line 1419 "jsgf_parser.c"
1422 #line 1423 "jsgf_parser.c"
1436 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1440 YY_STACK_PRINT (yyss, yyssp);
1450 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1451 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1452 yystate = yytable[yystate];
1454 yystate = yydefgoto[yyn - YYNTOKENS];
1465 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1471 #if ! YYERROR_VERBOSE
1472 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1474 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1477 char const *yymsgp = YY_(
"syntax error");
1478 int yysyntax_error_status;
1479 yysyntax_error_status = YYSYNTAX_ERROR;
1480 if (yysyntax_error_status == 0)
1482 else if (yysyntax_error_status == 1)
1484 if (yymsg != yymsgbuf)
1485 YYSTACK_FREE (yymsg);
1486 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1490 yymsg_alloc =
sizeof yymsgbuf;
1491 yysyntax_error_status = 2;
1495 yysyntax_error_status = YYSYNTAX_ERROR;
1499 yyerror (yyscanner, jsgf, yymsgp);
1500 if (yysyntax_error_status == 2)
1501 goto yyexhaustedlab;
1503 # undef YYSYNTAX_ERROR
1509 if (yyerrstatus == 3)
1514 if (yychar <= YYEOF)
1517 if (yychar == YYEOF)
1522 yydestruct (
"Error: discarding",
1523 yytoken, &yylval, yyscanner, jsgf);
1548 YY_STACK_PRINT (yyss, yyssp);
1561 yyn = yypact[yystate];
1562 if (!yypact_value_is_default (yyn))
1565 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1578 yydestruct (
"Error: popping",
1579 yystos[yystate], yyvsp, yyscanner, jsgf);
1582 YY_STACK_PRINT (yyss, yyssp);
1585 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1587 YY_IGNORE_MAYBE_UNINITIALIZED_END
1591 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1611 #if !defined yyoverflow || YYERROR_VERBOSE
1616 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1622 if (yychar != YYEMPTY)
1626 yytoken = YYTRANSLATE (yychar);
1627 yydestruct (
"Cleanup: discarding lookahead",
1628 yytoken, &yylval, yyscanner, jsgf);
1633 YY_STACK_PRINT (yyss, yyssp);
1634 while (yyssp != yyss)
1636 yydestruct (
"Cleanup: popping",
1637 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1642 YYSTACK_FREE (yyss);
1645 if (yymsg != yymsgbuf)
1646 YYSTACK_FREE (yymsg);
1650 #line 150 "jsgf_parser.y"
1654 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1656 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.
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)
#define E_ERROR
Print error message to standard error stream.
Hash table implementation.
char * locale
JSGF locale (default C)