47 #define YYBISON_VERSION "2.6.4"
50 #define YYSKELETON_NAME "yacc.c"
66 #line 37 "jsgf_parser.y"
68 #define YYERROR_VERBOSE
78 #include "jsgf_parser.h"
79 #include "jsgf_scanner.h"
83 #pragma warning(disable: 4273)
86 void yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s);
90 #line 91 "jsgf_parser.c"
93 # if defined __cplusplus && 201103L <= __cplusplus
94 # define YY_NULL nullptr
101 #ifdef YYERROR_VERBOSE
102 # undef YYERROR_VERBOSE
103 # define YYERROR_VERBOSE 1
105 # define YYERROR_VERBOSE 0
110 #ifndef YY_YY_JSGF_PARSER_H_INCLUDED
111 # define YY_YY_JSGF_PARSER_H_INCLUDED
148 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
152 #line 65 "jsgf_parser.y"
162 #line 163 "jsgf_parser.c"
164 # define YYSTYPE_IS_TRIVIAL 1
165 # define yystype YYSTYPE
166 # define YYSTYPE_IS_DECLARED 1
171 #if defined __STDC__ || defined __cplusplus
172 int yyparse (
void *YYPARSE_PARAM);
177 #if defined __STDC__ || defined __cplusplus
178 int yyparse (
void* yyscanner,
jsgf_t *jsgf);
189 #line 190 "jsgf_parser.c"
196 typedef YYTYPE_UINT8 yytype_uint8;
198 typedef unsigned char yytype_uint8;
202 typedef YYTYPE_INT8 yytype_int8;
203 #elif (defined __STDC__ || defined __C99__FUNC__ \
204 || defined __cplusplus || defined _MSC_VER)
205 typedef signed char yytype_int8;
207 typedef short int yytype_int8;
211 typedef YYTYPE_UINT16 yytype_uint16;
213 typedef unsigned short int yytype_uint16;
217 typedef YYTYPE_INT16 yytype_int16;
219 typedef short int yytype_int16;
223 # ifdef __SIZE_TYPE__
224 # define YYSIZE_T __SIZE_TYPE__
225 # elif defined size_t
226 # define YYSIZE_T size_t
227 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
228 || defined __cplusplus || defined _MSC_VER)
230 # define YYSIZE_T size_t
232 # define YYSIZE_T unsigned int
236 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
239 # if defined YYENABLE_NLS && YYENABLE_NLS
241 # include <libintl.h>
242 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
246 # define YY_(Msgid) Msgid
251 #if ! defined lint || defined __GNUC__
252 # define YYUSE(E) ((void) (E))
261 #if (defined __STDC__ || defined __C99__FUNC__ \
262 || defined __cplusplus || defined _MSC_VER)
275 #if ! defined yyoverflow || YYERROR_VERBOSE
279 # ifdef YYSTACK_USE_ALLOCA
280 # if YYSTACK_USE_ALLOCA
282 # define YYSTACK_ALLOC __builtin_alloca
283 # elif defined __BUILTIN_VA_ARG_INCR
286 # define YYSTACK_ALLOC __alloca
287 # elif defined _MSC_VER
289 # define alloca _alloca
291 # define YYSTACK_ALLOC alloca
292 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
293 || defined __cplusplus || defined _MSC_VER)
296 # ifndef EXIT_SUCCESS
297 # define EXIT_SUCCESS 0
304 # ifdef YYSTACK_ALLOC
306 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
307 # ifndef YYSTACK_ALLOC_MAXIMUM
312 # define YYSTACK_ALLOC_MAXIMUM 4032
315 # define YYSTACK_ALLOC YYMALLOC
316 # define YYSTACK_FREE YYFREE
317 # ifndef YYSTACK_ALLOC_MAXIMUM
318 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
320 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
321 && ! ((defined YYMALLOC || defined malloc) \
322 && (defined YYFREE || defined free)))
324 # ifndef EXIT_SUCCESS
325 # define EXIT_SUCCESS 0
329 # define YYMALLOC malloc
330 # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
331 || defined __cplusplus || defined _MSC_VER)
332 void *malloc (YYSIZE_T);
337 # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
338 || defined __cplusplus || defined _MSC_VER)
346 #if (! defined yyoverflow \
347 && (! defined __cplusplus \
348 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
353 yytype_int16 yyss_alloc;
358 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
362 # define YYSTACK_BYTES(N) \
363 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
364 + YYSTACK_GAP_MAXIMUM)
366 # define YYCOPY_NEEDED 1
373 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
376 YYSIZE_T yynewbytes; \
377 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
378 Stack = &yyptr->Stack_alloc; \
379 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
380 yyptr += yynewbytes / sizeof (*yyptr); \
386 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
390 # if defined __GNUC__ && 1 < __GNUC__
391 # define YYCOPY(Dst, Src, Count) \
392 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
394 # define YYCOPY(Dst, Src, Count) \
398 for (yyi = 0; yyi < (Count); yyi++) \
399 (Dst)[yyi] = (Src)[yyi]; \
422 #define YYMAXUTOK 265
424 #define YYTRANSLATE(YYX) \
425 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
428 static const yytype_uint8 yytranslate[] =
430 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
431 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
432 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
433 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
434 14, 15, 18, 19, 2, 2, 2, 2, 2, 2,
435 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,
436 2, 12, 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 2, 16, 2, 17, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 13, 2, 2, 2, 2, 2,
443 2, 2, 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, 2, 2, 2, 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, 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, 1, 2, 3, 4,
462 static const yytype_uint8 yyprhs[] =
464 0, 0, 3, 5, 8, 12, 15, 18, 22, 27,
465 33, 37, 39, 42, 46, 48, 51, 56, 62, 64,
466 68, 70, 73, 75, 78, 80, 83, 87, 91, 93,
471 static const yytype_int8 yyrhs[] =
473 21, 0, -1, 22, -1, 22, 27, -1, 22, 25,
474 27, -1, 23, 24, -1, 3, 11, -1, 3, 7,
475 11, -1, 3, 7, 7, 11, -1, 3, 7, 7,
476 7, 11, -1, 4, 7, 11, -1, 26, -1, 25,
477 26, -1, 5, 8, 11, -1, 28, -1, 27, 28,
478 -1, 8, 12, 29, 11, -1, 6, 8, 12, 29,
479 11, -1, 30, -1, 29, 13, 30, -1, 31, -1,
480 30, 31, -1, 32, -1, 31, 9, -1, 35, -1,
481 10, 35, -1, 14, 29, 15, -1, 16, 29, 17,
482 -1, 7, -1, 8, -1, 33, -1, 34, -1, 35,
487 static const yytype_uint8 yyrline[] =
489 0, 82, 82, 83, 84, 87, 90, 91, 92, 93,
490 97, 100, 101, 104, 107, 108, 111, 112, 115, 116,
491 121, 123, 127, 128, 132, 133, 136, 139, 142, 143,
496 #if YYDEBUG || YYERROR_VERBOSE || 0
499 static const char *
const yytname[] =
501 "$end",
"error",
"$undefined",
"HEADER",
"GRAMMAR",
"IMPORT",
"PUBLIC",
502 "TOKEN",
"RULENAME",
"TAG",
"WEIGHT",
"';'",
"'='",
"'|'",
"'('",
"')'",
503 "'['",
"']'",
"'*'",
"'+'",
"$accept",
"grammar",
"header",
504 "jsgf_header",
"grammar_header",
"import_header",
"import_statement",
505 "rule_list",
"rule",
"alternate_list",
"rule_expansion",
506 "tagged_rule_item",
"rule_item",
"rule_group",
"rule_optional",
514 static const yytype_uint16 yytoknum[] =
516 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
517 265, 59, 61, 124, 40, 41, 91, 93, 42, 43
522 static const yytype_uint8 yyr1[] =
524 0, 20, 21, 21, 21, 22, 23, 23, 23, 23,
525 24, 25, 25, 26, 27, 27, 28, 28, 29, 29,
526 30, 30, 31, 31, 32, 32, 33, 34, 35, 35,
531 static const yytype_uint8 yyr2[] =
533 0, 2, 1, 2, 3, 2, 2, 3, 4, 5,
534 3, 1, 2, 3, 1, 2, 4, 5, 1, 3,
535 1, 2, 1, 2, 1, 2, 3, 3, 1, 1,
542 static const yytype_uint8 yydefact[] =
544 0, 0, 0, 2, 0, 0, 6, 1, 0, 0,
545 0, 0, 11, 3, 14, 0, 5, 0, 7, 0,
546 0, 0, 12, 4, 15, 0, 0, 8, 13, 0,
547 28, 29, 0, 0, 0, 0, 18, 20, 22, 30,
548 31, 24, 10, 9, 0, 25, 0, 0, 16, 0,
549 21, 23, 32, 33, 17, 26, 27, 19
553 static const yytype_int8 yydefgoto[] =
555 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35,
556 36, 37, 38, 39, 40, 41
561 #define YYPACT_NINF -37
562 static const yytype_int8 yypact[] =
564 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33,
565 30, 22, -37, 17, -37, 37, -37, 13, -37, 34,
566 31, -4, -37, 17, -37, 38, 39, -37, -37, -4,
567 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37,
568 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4,
569 42, -37, -37, -37, -37, -37, -37, -4
573 static const yytype_int8 yypgoto[] =
575 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16,
576 -3, -36, -37, -37, -37, 15
582 #define YYTABLE_NINF -1
583 static const yytype_uint8 yytable[] =
585 50, 24, 1, 30, 31, 5, 32, 30, 31, 6,
586 33, 24, 34, 44, 33, 17, 34, 46, 47, 18,
587 26, 50, 49, 9, 27, 10, 56, 8, 9, 48,
588 10, 49, 54, 49, 49, 55, 7, 52, 53, 15,
589 19, 20, 21, 29, 25, 28, 57, 45, 0, 42,
593 #define yypact_value_is_default(Yystate) \
594 (!!((Yystate) == (-37)))
596 #define yytable_value_is_error(Yytable_value) \
599 static const yytype_int8 yycheck[] =
601 36, 13, 3, 7, 8, 7, 10, 7, 8, 11,
602 14, 23, 16, 29, 14, 7, 16, 33, 34, 11,
603 7, 57, 13, 6, 11, 8, 17, 5, 6, 11,
604 8, 13, 11, 13, 13, 15, 0, 18, 19, 4,
605 8, 8, 12, 12, 7, 11, 49, 32, -1, 11,
611 static const yytype_uint8 yystos[] =
613 0, 3, 21, 22, 23, 7, 11, 0, 5, 6,
614 8, 25, 26, 27, 28, 4, 24, 7, 11, 8,
615 8, 12, 26, 27, 28, 7, 7, 11, 11, 12,
616 7, 8, 10, 14, 16, 29, 30, 31, 32, 33,
617 34, 35, 11, 11, 29, 35, 29, 29, 11, 13,
618 31, 9, 18, 19, 11, 15, 17, 30
621 #define yyerrok (yyerrstatus = 0)
622 #define yyclearin (yychar = YYEMPTY)
626 #define YYACCEPT goto yyacceptlab
627 #define YYABORT goto yyabortlab
628 #define YYERROR goto yyerrorlab
638 #define YYFAIL goto yyerrlab
646 #define YYRECOVERING() (!!yyerrstatus)
648 #define YYBACKUP(Token, Value) \
650 if (yychar == YYEMPTY) \
654 YYPOPSTACK (yylen); \
660 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \
667 #define YYERRCODE 256
673 #ifndef YYLLOC_DEFAULT
674 # define YYLLOC_DEFAULT(Current, Rhs, N) \
678 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
679 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
680 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
681 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
685 (Current).first_line = (Current).last_line = \
686 YYRHSLOC (Rhs, 0).last_line; \
687 (Current).first_column = (Current).last_column = \
688 YYRHSLOC (Rhs, 0).last_column; \
693 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
699 #ifndef YY_LOCATION_PRINT
700 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
707 # define YYLEX yylex (&yylval, YYLEX_PARAM)
709 # define YYLEX yylex (&yylval, yyscanner)
717 # define YYFPRINTF fprintf
720 # define YYDPRINTF(Args) \
726 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
730 YYFPRINTF (stderr, "%s ", Title); \
731 yy_symbol_print (stderr, \
732 Type, Value, yyscanner, jsgf); \
733 YYFPRINTF (stderr, "\n"); \
743 #if (defined __STDC__ || defined __C99__FUNC__ \
744 || defined __cplusplus || defined _MSC_VER)
746 yy_symbol_value_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
749 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
752 YYSTYPE const * const yyvaluep;
757 FILE *yyo = yyoutput;
764 if (yytype < YYNTOKENS)
765 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
781 #if (defined __STDC__ || defined __C99__FUNC__ \
782 || defined __cplusplus || defined _MSC_VER)
784 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
787 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
790 YYSTYPE const * const yyvaluep;
795 if (yytype < YYNTOKENS)
796 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
798 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
800 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
801 YYFPRINTF (yyoutput,
")");
809 #if (defined __STDC__ || defined __C99__FUNC__ \
810 || defined __cplusplus || defined _MSC_VER)
812 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
815 yy_stack_print (yybottom, yytop)
816 yytype_int16 *yybottom;
820 YYFPRINTF (stderr,
"Stack now");
821 for (; yybottom <= yytop; yybottom++)
823 int yybot = *yybottom;
824 YYFPRINTF (stderr,
" %d", yybot);
826 YYFPRINTF (stderr,
"\n");
829 # define YY_STACK_PRINT(Bottom, Top) \
832 yy_stack_print ((Bottom), (Top)); \
840 #if (defined __STDC__ || defined __C99__FUNC__ \
841 || defined __cplusplus || defined _MSC_VER)
843 yy_reduce_print (
YYSTYPE *yyvsp,
int yyrule,
void* yyscanner,
jsgf_t *jsgf)
846 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf)
853 int yynrhs = yyr2[yyrule];
855 unsigned long int yylno = yyrline[yyrule];
856 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
859 for (yyi = 0; yyi < yynrhs; yyi++)
861 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
862 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
863 &(yyvsp[(yyi + 1) - (yynrhs)])
865 YYFPRINTF (stderr,
"\n");
869 # define YY_REDUCE_PRINT(Rule) \
872 yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \
879 # define YYDPRINTF(Args)
880 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
881 # define YY_STACK_PRINT(Bottom, Top)
882 # define YY_REDUCE_PRINT(Rule)
888 # define YYINITDEPTH 200
899 # define YYMAXDEPTH 10000
906 # if defined __GLIBC__ && defined _STRING_H
907 # define yystrlen strlen
910 #if (defined __STDC__ || defined __C99__FUNC__ \
911 || defined __cplusplus || defined _MSC_VER)
913 yystrlen (
const char *yystr)
921 for (yylen = 0; yystr[yylen]; yylen++)
929 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
930 # define yystpcpy stpcpy
934 #if (defined __STDC__ || defined __C99__FUNC__ \
935 || defined __cplusplus || defined _MSC_VER)
937 yystpcpy (
char *yydest,
const char *yysrc)
940 yystpcpy (yydest, yysrc)
946 const char *yys = yysrc;
948 while ((*yyd++ = *yys++) !=
'\0')
965 yytnamerr (
char *yyres,
const char *yystr)
970 char const *yyp = yystr;
977 goto do_not_strip_quotes;
981 goto do_not_strip_quotes;
994 do_not_strip_quotes: ;
998 return yystrlen (yystr);
1000 return yystpcpy (yyres, yystr) - yyres;
1013 yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
1014 yytype_int16 *yyssp,
int yytoken)
1016 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
1017 YYSIZE_T yysize = yysize0;
1019 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1021 const char *yyformat = YY_NULL;
1023 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1055 if (yytoken != YYEMPTY)
1057 int yyn = yypact[*yyssp];
1058 yyarg[yycount++] = yytname[yytoken];
1059 if (!yypact_value_is_default (yyn))
1064 int yyxbegin = yyn < 0 ? -yyn : 0;
1066 int yychecklim = YYLAST - yyn + 1;
1067 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1070 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1071 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1072 && !yytable_value_is_error (yytable[yyx + yyn]))
1074 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1080 yyarg[yycount++] = yytname[yyx];
1081 yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1082 if (! (yysize <= yysize1
1083 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1092 # define YYCASE_(N, S) \
1096 YYCASE_(0, YY_(
"syntax error"));
1097 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
1098 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
1099 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1100 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1101 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1105 yysize1 = yysize + yystrlen (yyformat);
1106 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1110 if (*yymsg_alloc < yysize)
1112 *yymsg_alloc = 2 * yysize;
1113 if (! (yysize <= *yymsg_alloc
1114 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1115 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1125 while ((*yyp = *yyformat) !=
'\0')
1126 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1128 yyp += yytnamerr (yyp, yyarg[yyi++]);
1146 #if (defined __STDC__ || defined __C99__FUNC__ \
1147 || defined __cplusplus || defined _MSC_VER)
1149 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1152 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf)
1166 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1183 #ifdef YYPARSE_PARAM
1184 #if (defined __STDC__ || defined __C99__FUNC__ \
1185 || defined __cplusplus || defined _MSC_VER)
1187 yyparse (
void *YYPARSE_PARAM)
1190 yyparse (YYPARSE_PARAM)
1191 void *YYPARSE_PARAM;
1194 #if (defined __STDC__ || defined __C99__FUNC__ \
1195 || defined __cplusplus || defined _MSC_VER)
1197 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1200 yyparse (yyscanner, jsgf)
1210 #if defined __GNUC__ && (4 < __GNUC__ + (6 <= __GNUC_MINOR__))
1212 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1213 _Pragma ("GCC diagnostic push") \
1214 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1215 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1216 _Pragma ("GCC diagnostic pop")
1221 # define YYLVAL_INITIALIZE() (yylval = yyval_default)
1223 #ifndef YYLVAL_INITIALIZE
1224 # define YYLVAL_INITIALIZE()
1226 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1227 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1228 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1249 yytype_int16 yyssa[YYINITDEPTH];
1251 yytype_int16 *yyssp;
1258 YYSIZE_T yystacksize;
1271 char *yymsg = yymsgbuf;
1272 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1275 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1283 yystacksize = YYINITDEPTH;
1285 YYDPRINTF ((stderr,
"Starting parse\n"));
1299 YYLVAL_INITIALIZE ();
1313 if (yyss + yystacksize - 1 <= yyssp)
1316 YYSIZE_T yysize = yyssp - yyss + 1;
1324 yytype_int16 *yyss1 = yyss;
1330 yyoverflow (YY_(
"memory exhausted"),
1331 &yyss1, yysize *
sizeof (*yyssp),
1332 &yyvs1, yysize *
sizeof (*yyvsp),
1339 # ifndef YYSTACK_RELOCATE
1340 goto yyexhaustedlab;
1343 if (YYMAXDEPTH <= yystacksize)
1344 goto yyexhaustedlab;
1346 if (YYMAXDEPTH < yystacksize)
1347 yystacksize = YYMAXDEPTH;
1350 yytype_int16 *yyss1 = yyss;
1352 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1354 goto yyexhaustedlab;
1355 YYSTACK_RELOCATE (yyss_alloc, yyss);
1356 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1357 # undef YYSTACK_RELOCATE
1359 YYSTACK_FREE (yyss1);
1364 yyssp = yyss + yysize - 1;
1365 yyvsp = yyvs + yysize - 1;
1367 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1368 (
unsigned long int) yystacksize));
1370 if (yyss + yystacksize - 1 <= yyssp)
1374 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1376 if (yystate == YYFINAL)
1390 yyn = yypact[yystate];
1391 if (yypact_value_is_default (yyn))
1397 if (yychar == YYEMPTY)
1399 YYDPRINTF ((stderr,
"Reading a token: "));
1403 if (yychar <= YYEOF)
1405 yychar = yytoken = YYEOF;
1406 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1410 yytoken = YYTRANSLATE (yychar);
1411 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1417 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1422 if (yytable_value_is_error (yyn))
1434 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1440 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1442 YY_IGNORE_MAYBE_UNINITIALIZED_END
1451 yyn = yydefact[yystate];
1472 yyval = yyvsp[1-yylen];
1475 YY_REDUCE_PRINT (yyn);
1480 #line 87 "jsgf_parser.y"
1481 { jsgf->
name = (yyvsp[(2) - (2)].name); }
1486 #line 91 "jsgf_parser.y"
1487 { jsgf->
version = (yyvsp[(2) - (3)].name); }
1492 #line 92 "jsgf_parser.y"
1493 { jsgf->
version = (yyvsp[(2) - (4)].name); jsgf->
charset = (yyvsp[(3) - (4)].name); }
1498 #line 93 "jsgf_parser.y"
1499 { jsgf->
version = (yyvsp[(2) - (5)].name); jsgf->
charset = (yyvsp[(3) - (5)].name);
1500 jsgf->
locale = (yyvsp[(4) - (5)].name); }
1505 #line 97 "jsgf_parser.y"
1506 { (yyval.name) = (yyvsp[(2) - (3)].name); }
1511 #line 104 "jsgf_parser.y"
1512 { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name));
ckd_free((yyvsp[(2) - (3)].name)); }
1517 #line 111 "jsgf_parser.y"
1518 { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0);
ckd_free((yyvsp[(1) - (4)].name)); }
1523 #line 112 "jsgf_parser.y"
1524 { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1);
ckd_free((yyvsp[(2) - (5)].name)); }
1529 #line 115 "jsgf_parser.y"
1530 { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1535 #line 116 "jsgf_parser.y"
1536 { (yyval.rhs) = (yyvsp[(3) - (3)].rhs);
1538 (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); }
1543 #line 121 "jsgf_parser.y"
1544 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1545 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); }
1550 #line 123 "jsgf_parser.y"
1551 { (yyval.rhs) = (yyvsp[(1) - (2)].rhs);
1552 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); }
1557 #line 128 "jsgf_parser.y"
1558 { (yyval.atom) = (yyvsp[(1) - (2)].atom);
1559 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); }
1564 #line 133 "jsgf_parser.y"
1565 { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); }
1570 #line 136 "jsgf_parser.y"
1571 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); }
1576 #line 139 "jsgf_parser.y"
1577 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); }
1582 #line 142 "jsgf_parser.y"
1583 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1588 #line 143 "jsgf_parser.y"
1589 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1594 #line 144 "jsgf_parser.y"
1595 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1600 #line 145 "jsgf_parser.y"
1601 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1606 #line 146 "jsgf_parser.y"
1607 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); }
1612 #line 147 "jsgf_parser.y"
1613 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); }
1618 #line 1619 "jsgf_parser.c"
1632 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1636 YY_STACK_PRINT (yyss, yyssp);
1646 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1647 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1648 yystate = yytable[yystate];
1650 yystate = yydefgoto[yyn - YYNTOKENS];
1661 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1667 #if ! YYERROR_VERBOSE
1668 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1670 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1673 char const *yymsgp = YY_(
"syntax error");
1674 int yysyntax_error_status;
1675 yysyntax_error_status = YYSYNTAX_ERROR;
1676 if (yysyntax_error_status == 0)
1678 else if (yysyntax_error_status == 1)
1680 if (yymsg != yymsgbuf)
1681 YYSTACK_FREE (yymsg);
1682 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1686 yymsg_alloc =
sizeof yymsgbuf;
1687 yysyntax_error_status = 2;
1691 yysyntax_error_status = YYSYNTAX_ERROR;
1695 yyerror (yyscanner, jsgf, yymsgp);
1696 if (yysyntax_error_status == 2)
1697 goto yyexhaustedlab;
1699 # undef YYSYNTAX_ERROR
1705 if (yyerrstatus == 3)
1710 if (yychar <= YYEOF)
1713 if (yychar == YYEOF)
1718 yydestruct (
"Error: discarding",
1719 yytoken, &yylval, yyscanner, jsgf);
1744 YY_STACK_PRINT (yyss, yyssp);
1757 yyn = yypact[yystate];
1758 if (!yypact_value_is_default (yyn))
1761 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1774 yydestruct (
"Error: popping",
1775 yystos[yystate], yyvsp, yyscanner, jsgf);
1778 YY_STACK_PRINT (yyss, yyssp);
1781 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1783 YY_IGNORE_MAYBE_UNINITIALIZED_END
1787 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1807 #if !defined yyoverflow || YYERROR_VERBOSE
1812 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1818 if (yychar != YYEMPTY)
1822 yytoken = YYTRANSLATE (yychar);
1823 yydestruct (
"Cleanup: discarding lookahead",
1824 yytoken, &yylval, yyscanner, jsgf);
1829 YY_STACK_PRINT (yyss, yyssp);
1830 while (yyssp != yyss)
1832 yydestruct (
"Cleanup: popping",
1833 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1838 YYSTACK_FREE (yyss);
1841 if (yymsg != yymsgbuf)
1842 YYSTACK_FREE (yymsg);
1845 return YYID (yyresult);
1850 #line 150 "jsgf_parser.y"
1854 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1856 E_ERROR(
"%s at line %d current token '%s'\n", s, yyget_lineno(lex), yyget_text(lex));