47 #define YYBISON_VERSION "2.7"
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
671 #ifndef YY_LOCATION_PRINT
672 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
678 # define YYLEX yylex (&yylval, YYLEX_PARAM)
680 # define YYLEX yylex (&yylval, yyscanner)
688 # define YYFPRINTF fprintf
691 # define YYDPRINTF(Args) \
697 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
701 YYFPRINTF (stderr, "%s ", Title); \
702 yy_symbol_print (stderr, \
703 Type, Value, yyscanner, jsgf); \
704 YYFPRINTF (stderr, "\n"); \
714 #if (defined __STDC__ || defined __C99__FUNC__ \
715 || defined __cplusplus || defined _MSC_VER)
717 yy_symbol_value_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
720 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
723 YYSTYPE const * const yyvaluep;
728 FILE *yyo = yyoutput;
735 if (yytype < YYNTOKENS)
736 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
752 #if (defined __STDC__ || defined __C99__FUNC__ \
753 || defined __cplusplus || defined _MSC_VER)
755 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
758 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
761 YYSTYPE const * const yyvaluep;
766 if (yytype < YYNTOKENS)
767 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
769 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
771 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
772 YYFPRINTF (yyoutput,
")");
780 #if (defined __STDC__ || defined __C99__FUNC__ \
781 || defined __cplusplus || defined _MSC_VER)
783 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
786 yy_stack_print (yybottom, yytop)
787 yytype_int16 *yybottom;
791 YYFPRINTF (stderr,
"Stack now");
792 for (; yybottom <= yytop; yybottom++)
794 int yybot = *yybottom;
795 YYFPRINTF (stderr,
" %d", yybot);
797 YYFPRINTF (stderr,
"\n");
800 # define YY_STACK_PRINT(Bottom, Top) \
803 yy_stack_print ((Bottom), (Top)); \
811 #if (defined __STDC__ || defined __C99__FUNC__ \
812 || defined __cplusplus || defined _MSC_VER)
814 yy_reduce_print (
YYSTYPE *yyvsp,
int yyrule,
void* yyscanner,
jsgf_t *jsgf)
817 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf)
824 int yynrhs = yyr2[yyrule];
826 unsigned long int yylno = yyrline[yyrule];
827 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
830 for (yyi = 0; yyi < yynrhs; yyi++)
832 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
833 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
834 &(yyvsp[(yyi + 1) - (yynrhs)])
836 YYFPRINTF (stderr,
"\n");
840 # define YY_REDUCE_PRINT(Rule) \
843 yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \
850 # define YYDPRINTF(Args)
851 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
852 # define YY_STACK_PRINT(Bottom, Top)
853 # define YY_REDUCE_PRINT(Rule)
859 # define YYINITDEPTH 200
870 # define YYMAXDEPTH 10000
877 # if defined __GLIBC__ && defined _STRING_H
878 # define yystrlen strlen
881 #if (defined __STDC__ || defined __C99__FUNC__ \
882 || defined __cplusplus || defined _MSC_VER)
884 yystrlen (
const char *yystr)
892 for (yylen = 0; yystr[yylen]; yylen++)
900 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
901 # define yystpcpy stpcpy
905 #if (defined __STDC__ || defined __C99__FUNC__ \
906 || defined __cplusplus || defined _MSC_VER)
908 yystpcpy (
char *yydest,
const char *yysrc)
911 yystpcpy (yydest, yysrc)
917 const char *yys = yysrc;
919 while ((*yyd++ = *yys++) !=
'\0')
936 yytnamerr (
char *yyres,
const char *yystr)
941 char const *yyp = yystr;
948 goto do_not_strip_quotes;
952 goto do_not_strip_quotes;
965 do_not_strip_quotes: ;
969 return yystrlen (yystr);
971 return yystpcpy (yyres, yystr) - yyres;
984 yysyntax_error (YYSIZE_T *yymsg_alloc,
char **yymsg,
985 yytype_int16 *yyssp,
int yytoken)
987 YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
988 YYSIZE_T yysize = yysize0;
989 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
991 const char *yyformat = YY_NULL;
993 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1025 if (yytoken != YYEMPTY)
1027 int yyn = yypact[*yyssp];
1028 yyarg[yycount++] = yytname[yytoken];
1029 if (!yypact_value_is_default (yyn))
1034 int yyxbegin = yyn < 0 ? -yyn : 0;
1036 int yychecklim = YYLAST - yyn + 1;
1037 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1040 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1041 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1042 && !yytable_value_is_error (yytable[yyx + yyn]))
1044 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1050 yyarg[yycount++] = yytname[yyx];
1052 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
1053 if (! (yysize <= yysize1
1054 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1064 # define YYCASE_(N, S) \
1068 YYCASE_(0, YY_(
"syntax error"));
1069 YYCASE_(1, YY_(
"syntax error, unexpected %s"));
1070 YYCASE_(2, YY_(
"syntax error, unexpected %s, expecting %s"));
1071 YYCASE_(3, YY_(
"syntax error, unexpected %s, expecting %s or %s"));
1072 YYCASE_(4, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s"));
1073 YYCASE_(5, YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1078 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1079 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1084 if (*yymsg_alloc < yysize)
1086 *yymsg_alloc = 2 * yysize;
1087 if (! (yysize <= *yymsg_alloc
1088 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1089 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1099 while ((*yyp = *yyformat) !=
'\0')
1100 if (*yyp ==
'%' && yyformat[1] ==
's' && yyi < yycount)
1102 yyp += yytnamerr (yyp, yyarg[yyi++]);
1120 #if (defined __STDC__ || defined __C99__FUNC__ \
1121 || defined __cplusplus || defined _MSC_VER)
1123 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep,
void* yyscanner,
jsgf_t *jsgf)
1126 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf)
1140 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1157 #ifdef YYPARSE_PARAM
1158 #if (defined __STDC__ || defined __C99__FUNC__ \
1159 || defined __cplusplus || defined _MSC_VER)
1161 yyparse (
void *YYPARSE_PARAM)
1164 yyparse (YYPARSE_PARAM)
1165 void *YYPARSE_PARAM;
1168 #if (defined __STDC__ || defined __C99__FUNC__ \
1169 || defined __cplusplus || defined _MSC_VER)
1171 yyparse (
void* yyscanner,
jsgf_t *jsgf)
1174 yyparse (yyscanner, jsgf)
1184 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
1186 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1187 _Pragma ("GCC diagnostic push") \
1188 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
1189 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1190 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1191 _Pragma ("GCC diagnostic pop")
1196 # define YY_INITIAL_VALUE(Value) = Value
1198 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1199 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1200 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1202 #ifndef YY_INITIAL_VALUE
1203 # define YY_INITIAL_VALUE(Value)
1207 YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
1224 yytype_int16 yyssa[YYINITDEPTH];
1226 yytype_int16 *yyssp;
1233 YYSIZE_T yystacksize;
1246 char *yymsg = yymsgbuf;
1247 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1250 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1256 yyssp = yyss = yyssa;
1257 yyvsp = yyvs = yyvsa;
1258 yystacksize = YYINITDEPTH;
1260 YYDPRINTF ((stderr,
"Starting parse\n"));
1279 if (yyss + yystacksize - 1 <= yyssp)
1282 YYSIZE_T yysize = yyssp - yyss + 1;
1290 yytype_int16 *yyss1 = yyss;
1296 yyoverflow (YY_(
"memory exhausted"),
1297 &yyss1, yysize *
sizeof (*yyssp),
1298 &yyvs1, yysize *
sizeof (*yyvsp),
1305 # ifndef YYSTACK_RELOCATE
1306 goto yyexhaustedlab;
1309 if (YYMAXDEPTH <= yystacksize)
1310 goto yyexhaustedlab;
1312 if (YYMAXDEPTH < yystacksize)
1313 yystacksize = YYMAXDEPTH;
1316 yytype_int16 *yyss1 = yyss;
1318 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1320 goto yyexhaustedlab;
1321 YYSTACK_RELOCATE (yyss_alloc, yyss);
1322 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1323 # undef YYSTACK_RELOCATE
1325 YYSTACK_FREE (yyss1);
1330 yyssp = yyss + yysize - 1;
1331 yyvsp = yyvs + yysize - 1;
1333 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1334 (
unsigned long int) yystacksize));
1336 if (yyss + yystacksize - 1 <= yyssp)
1340 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1342 if (yystate == YYFINAL)
1356 yyn = yypact[yystate];
1357 if (yypact_value_is_default (yyn))
1363 if (yychar == YYEMPTY)
1365 YYDPRINTF ((stderr,
"Reading a token: "));
1369 if (yychar <= YYEOF)
1371 yychar = yytoken = YYEOF;
1372 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1376 yytoken = YYTRANSLATE (yychar);
1377 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1383 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1388 if (yytable_value_is_error (yyn))
1400 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1406 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1408 YY_IGNORE_MAYBE_UNINITIALIZED_END
1417 yyn = yydefact[yystate];
1438 yyval = yyvsp[1-yylen];
1441 YY_REDUCE_PRINT (yyn);
1446 #line 87 "jsgf_parser.y"
1447 { jsgf->
name = (yyvsp[(2) - (2)].name); }
1452 #line 91 "jsgf_parser.y"
1453 { jsgf->
version = (yyvsp[(2) - (3)].name); }
1458 #line 92 "jsgf_parser.y"
1459 { jsgf->
version = (yyvsp[(2) - (4)].name); jsgf->
charset = (yyvsp[(3) - (4)].name); }
1464 #line 93 "jsgf_parser.y"
1465 { jsgf->
version = (yyvsp[(2) - (5)].name); jsgf->
charset = (yyvsp[(3) - (5)].name);
1466 jsgf->
locale = (yyvsp[(4) - (5)].name); }
1471 #line 97 "jsgf_parser.y"
1472 { (yyval.name) = (yyvsp[(2) - (3)].name); }
1477 #line 104 "jsgf_parser.y"
1478 { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name));
ckd_free((yyvsp[(2) - (3)].name)); }
1483 #line 111 "jsgf_parser.y"
1484 { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0);
ckd_free((yyvsp[(1) - (4)].name)); }
1489 #line 112 "jsgf_parser.y"
1490 { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1);
ckd_free((yyvsp[(2) - (5)].name)); }
1495 #line 115 "jsgf_parser.y"
1496 { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1501 #line 116 "jsgf_parser.y"
1502 { (yyval.rhs) = (yyvsp[(3) - (3)].rhs);
1504 (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); }
1509 #line 121 "jsgf_parser.y"
1510 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1511 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); }
1516 #line 123 "jsgf_parser.y"
1517 { (yyval.rhs) = (yyvsp[(1) - (2)].rhs);
1518 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); }
1523 #line 128 "jsgf_parser.y"
1524 { (yyval.atom) = (yyvsp[(1) - (2)].atom);
1525 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); }
1530 #line 133 "jsgf_parser.y"
1531 { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); }
1536 #line 136 "jsgf_parser.y"
1537 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); }
1542 #line 139 "jsgf_parser.y"
1543 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); }
1548 #line 142 "jsgf_parser.y"
1549 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1554 #line 143 "jsgf_parser.y"
1555 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1560 #line 144 "jsgf_parser.y"
1561 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1566 #line 145 "jsgf_parser.y"
1567 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1572 #line 146 "jsgf_parser.y"
1573 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); }
1578 #line 147 "jsgf_parser.y"
1579 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); }
1584 #line 1585 "jsgf_parser.c"
1598 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1602 YY_STACK_PRINT (yyss, yyssp);
1612 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1613 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1614 yystate = yytable[yystate];
1616 yystate = yydefgoto[yyn - YYNTOKENS];
1627 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1633 #if ! YYERROR_VERBOSE
1634 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1636 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1639 char const *yymsgp = YY_(
"syntax error");
1640 int yysyntax_error_status;
1641 yysyntax_error_status = YYSYNTAX_ERROR;
1642 if (yysyntax_error_status == 0)
1644 else if (yysyntax_error_status == 1)
1646 if (yymsg != yymsgbuf)
1647 YYSTACK_FREE (yymsg);
1648 yymsg = (
char *) YYSTACK_ALLOC (yymsg_alloc);
1652 yymsg_alloc =
sizeof yymsgbuf;
1653 yysyntax_error_status = 2;
1657 yysyntax_error_status = YYSYNTAX_ERROR;
1661 yyerror (yyscanner, jsgf, yymsgp);
1662 if (yysyntax_error_status == 2)
1663 goto yyexhaustedlab;
1665 # undef YYSYNTAX_ERROR
1671 if (yyerrstatus == 3)
1676 if (yychar <= YYEOF)
1679 if (yychar == YYEOF)
1684 yydestruct (
"Error: discarding",
1685 yytoken, &yylval, yyscanner, jsgf);
1710 YY_STACK_PRINT (yyss, yyssp);
1723 yyn = yypact[yystate];
1724 if (!yypact_value_is_default (yyn))
1727 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1740 yydestruct (
"Error: popping",
1741 yystos[yystate], yyvsp, yyscanner, jsgf);
1744 YY_STACK_PRINT (yyss, yyssp);
1747 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1749 YY_IGNORE_MAYBE_UNINITIALIZED_END
1753 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1773 #if !defined yyoverflow || YYERROR_VERBOSE
1778 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1784 if (yychar != YYEMPTY)
1788 yytoken = YYTRANSLATE (yychar);
1789 yydestruct (
"Cleanup: discarding lookahead",
1790 yytoken, &yylval, yyscanner, jsgf);
1795 YY_STACK_PRINT (yyss, yyssp);
1796 while (yyssp != yyss)
1798 yydestruct (
"Cleanup: popping",
1799 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1804 YYSTACK_FREE (yyss);
1807 if (yymsg != yymsgbuf)
1808 YYSTACK_FREE (yymsg);
1811 return YYID (yyresult);
1816 #line 150 "jsgf_parser.y"
1820 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1822 E_ERROR(
"%s at line %d current token '%s'\n", s, yyget_lineno(lex), yyget_text(lex));