49 #define YYBISON_VERSION "2.4.1"
52 #define YYSKELETON_NAME "yacc.c"
64 #define YYLSP_NEEDED 0
71 #line 37 "jsgf_parser.y"
81 #include "jsgf_parser.h"
82 #include "jsgf_scanner.h"
86 #pragma warning(disable: 4273)
89 void yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s);
94 #line 95 "jsgf_parser.c"
102 #ifdef YYERROR_VERBOSE
103 # undef YYERROR_VERBOSE
104 # define YYERROR_VERBOSE 1
106 # define YYERROR_VERBOSE 0
110 #ifndef YYTOKEN_TABLE
111 # define YYTOKEN_TABLE 0
144 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
149 #line 63 "jsgf_parser.y"
160 #line 161 "jsgf_parser.c"
162 # define YYSTYPE_IS_TRIVIAL 1
163 # define yystype YYSTYPE
164 # define YYSTYPE_IS_DECLARED 1
172 #line 173 "jsgf_parser.c"
179 typedef YYTYPE_UINT8 yytype_uint8;
181 typedef unsigned char yytype_uint8;
185 typedef YYTYPE_INT8 yytype_int8;
186 #elif (defined __STDC__ || defined __C99__FUNC__ \
187 || defined __cplusplus || defined _MSC_VER)
188 typedef signed char yytype_int8;
190 typedef short int yytype_int8;
194 typedef YYTYPE_UINT16 yytype_uint16;
196 typedef unsigned short int yytype_uint16;
200 typedef YYTYPE_INT16 yytype_int16;
202 typedef short int yytype_int16;
206 # ifdef __SIZE_TYPE__
207 # define YYSIZE_T __SIZE_TYPE__
208 # elif defined size_t
209 # define YYSIZE_T size_t
210 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
211 || defined __cplusplus || defined _MSC_VER)
213 # define YYSIZE_T size_t
215 # define YYSIZE_T unsigned int
219 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
224 # include <libintl.h>
225 # define YY_(msgid) dgettext ("bison-runtime", msgid)
229 # define YY_(msgid) msgid
234 #if ! defined lint || defined __GNUC__
235 # define YYUSE(e) ((void) (e))
244 #if (defined __STDC__ || defined __C99__FUNC__ \
245 || defined __cplusplus || defined _MSC_VER)
258 #if ! defined yyoverflow || YYERROR_VERBOSE
262 # ifdef YYSTACK_USE_ALLOCA
263 # if YYSTACK_USE_ALLOCA
265 # define YYSTACK_ALLOC __builtin_alloca
266 # elif defined __BUILTIN_VA_ARG_INCR
269 # define YYSTACK_ALLOC __alloca
270 # elif defined _MSC_VER
272 # define alloca _alloca
274 # define YYSTACK_ALLOC alloca
275 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
276 || defined __cplusplus || defined _MSC_VER)
286 # ifdef YYSTACK_ALLOC
288 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
289 # ifndef YYSTACK_ALLOC_MAXIMUM
294 # define YYSTACK_ALLOC_MAXIMUM 4032
297 # define YYSTACK_ALLOC YYMALLOC
298 # define YYSTACK_FREE YYFREE
299 # ifndef YYSTACK_ALLOC_MAXIMUM
300 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
302 # if (defined __cplusplus && ! defined _STDLIB_H \
303 && ! ((defined YYMALLOC || defined malloc) \
304 && (defined YYFREE || defined free)))
311 # define YYMALLOC malloc
312 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
313 || defined __cplusplus || defined _MSC_VER)
314 void *malloc (YYSIZE_T);
319 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
320 || defined __cplusplus || defined _MSC_VER)
328 #if (! defined yyoverflow \
329 && (! defined __cplusplus \
330 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
335 yytype_int16 yyss_alloc;
340 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
344 # define YYSTACK_BYTES(N) \
345 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
346 + YYSTACK_GAP_MAXIMUM)
351 # if defined __GNUC__ && 1 < __GNUC__
352 # define YYCOPY(To, From, Count) \
353 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
355 # define YYCOPY(To, From, Count) \
359 for (yyi = 0; yyi < (Count); yyi++) \
360 (To)[yyi] = (From)[yyi]; \
371 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
374 YYSIZE_T yynewbytes; \
375 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
376 Stack = &yyptr->Stack_alloc; \
377 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
378 yyptr += yynewbytes / sizeof (*yyptr); \
400 #define YYMAXUTOK 265
402 #define YYTRANSLATE(YYX) \
403 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
406 static const yytype_uint8 yytranslate[] =
408 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 14, 15, 18, 19, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,
414 2, 12, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 16, 2, 17, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 13, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
430 2, 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, 1, 2, 3, 4,
440 static const yytype_uint8 yyprhs[] =
442 0, 0, 3, 5, 8, 12, 15, 18, 22, 27,
443 33, 37, 39, 42, 46, 48, 51, 56, 62, 64,
444 68, 70, 73, 75, 78, 80, 83, 87, 91, 93,
449 static const yytype_int8 yyrhs[] =
451 21, 0, -1, 22, -1, 22, 27, -1, 22, 25,
452 27, -1, 23, 24, -1, 3, 11, -1, 3, 7,
453 11, -1, 3, 7, 7, 11, -1, 3, 7, 7,
454 7, 11, -1, 4, 7, 11, -1, 26, -1, 25,
455 26, -1, 5, 8, 11, -1, 28, -1, 27, 28,
456 -1, 8, 12, 29, 11, -1, 6, 8, 12, 29,
457 11, -1, 30, -1, 29, 13, 30, -1, 31, -1,
458 30, 31, -1, 32, -1, 31, 9, -1, 35, -1,
459 10, 35, -1, 14, 29, 15, -1, 16, 29, 17,
460 -1, 7, -1, 8, -1, 33, -1, 34, -1, 35,
465 static const yytype_uint8 yyrline[] =
467 0, 80, 80, 81, 82, 85, 88, 89, 90, 91,
468 95, 98, 99, 102, 105, 106, 109, 110, 113, 114,
469 119, 121, 125, 126, 130, 131, 134, 137, 140, 141,
474 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
477 static const char *
const yytname[] =
479 "$end",
"error",
"$undefined",
"HEADER",
"GRAMMAR",
"IMPORT",
"PUBLIC",
480 "TOKEN",
"RULENAME",
"TAG",
"WEIGHT",
"';'",
"'='",
"'|'",
"'('",
"')'",
481 "'['",
"']'",
"'*'",
"'+'",
"$accept",
"grammar",
"header",
482 "jsgf_header",
"grammar_header",
"import_header",
"import_statement",
483 "rule_list",
"rule",
"alternate_list",
"rule_expansion",
484 "tagged_rule_item",
"rule_item",
"rule_group",
"rule_optional",
492 static const yytype_uint16 yytoknum[] =
494 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
495 265, 59, 61, 124, 40, 41, 91, 93, 42, 43
500 static const yytype_uint8 yyr1[] =
502 0, 20, 21, 21, 21, 22, 23, 23, 23, 23,
503 24, 25, 25, 26, 27, 27, 28, 28, 29, 29,
504 30, 30, 31, 31, 32, 32, 33, 34, 35, 35,
509 static const yytype_uint8 yyr2[] =
511 0, 2, 1, 2, 3, 2, 2, 3, 4, 5,
512 3, 1, 2, 3, 1, 2, 4, 5, 1, 3,
513 1, 2, 1, 2, 1, 2, 3, 3, 1, 1,
520 static const yytype_uint8 yydefact[] =
522 0, 0, 0, 2, 0, 0, 6, 1, 0, 0,
523 0, 0, 11, 3, 14, 0, 5, 0, 7, 0,
524 0, 0, 12, 4, 15, 0, 0, 8, 13, 0,
525 28, 29, 0, 0, 0, 0, 18, 20, 22, 30,
526 31, 24, 10, 9, 0, 25, 0, 0, 16, 0,
527 21, 23, 32, 33, 17, 26, 27, 19
531 static const yytype_int8 yydefgoto[] =
533 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35,
534 36, 37, 38, 39, 40, 41
539 #define YYPACT_NINF -37
540 static const yytype_int8 yypact[] =
542 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33,
543 30, 22, -37, 17, -37, 37, -37, 13, -37, 34,
544 31, -4, -37, 17, -37, 38, 39, -37, -37, -4,
545 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37,
546 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4,
547 42, -37, -37, -37, -37, -37, -37, -4
551 static const yytype_int8 yypgoto[] =
553 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16,
554 -3, -36, -37, -37, -37, 15
561 #define YYTABLE_NINF -1
562 static const yytype_uint8 yytable[] =
564 50, 24, 1, 30, 31, 5, 32, 30, 31, 6,
565 33, 24, 34, 44, 33, 17, 34, 46, 47, 18,
566 26, 50, 49, 9, 27, 10, 56, 8, 9, 48,
567 10, 49, 54, 49, 49, 55, 7, 52, 53, 15,
568 19, 20, 21, 29, 25, 28, 57, 45, 0, 42,
572 static const yytype_int8 yycheck[] =
574 36, 13, 3, 7, 8, 7, 10, 7, 8, 11,
575 14, 23, 16, 29, 14, 7, 16, 33, 34, 11,
576 7, 57, 13, 6, 11, 8, 17, 5, 6, 11,
577 8, 13, 11, 13, 13, 15, 0, 18, 19, 4,
578 8, 8, 12, 12, 7, 11, 49, 32, -1, 11,
584 static const yytype_uint8 yystos[] =
586 0, 3, 21, 22, 23, 7, 11, 0, 5, 6,
587 8, 25, 26, 27, 28, 4, 24, 7, 11, 8,
588 8, 12, 26, 27, 28, 7, 7, 11, 11, 12,
589 7, 8, 10, 14, 16, 29, 30, 31, 32, 33,
590 34, 35, 11, 11, 29, 35, 29, 29, 11, 13,
591 31, 9, 18, 19, 11, 15, 17, 30
594 #define yyerrok (yyerrstatus = 0)
595 #define yyclearin (yychar = YYEMPTY)
599 #define YYACCEPT goto yyacceptlab
600 #define YYABORT goto yyabortlab
601 #define YYERROR goto yyerrorlab
608 #define YYFAIL goto yyerrlab
610 #define YYRECOVERING() (!!yyerrstatus)
612 #define YYBACKUP(Token, Value) \
614 if (yychar == YYEMPTY && yylen == 1) \
618 yytoken = YYTRANSLATE (yychar); \
624 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \
631 #define YYERRCODE 256
638 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
639 #ifndef YYLLOC_DEFAULT
640 # define YYLLOC_DEFAULT(Current, Rhs, N) \
644 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
645 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
646 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
647 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
651 (Current).first_line = (Current).last_line = \
652 YYRHSLOC (Rhs, 0).last_line; \
653 (Current).first_column = (Current).last_column = \
654 YYRHSLOC (Rhs, 0).last_column; \
664 #ifndef YY_LOCATION_PRINT
665 # if YYLTYPE_IS_TRIVIAL
666 # define YY_LOCATION_PRINT(File, Loc) \
667 fprintf (File, "%d.%d-%d.%d", \
668 (Loc).first_line, (Loc).first_column, \
669 (Loc).last_line, (Loc).last_column)
671 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
679 # define YYLEX yylex (&yylval, YYLEX_PARAM)
681 # define YYLEX yylex (&yylval, yyscanner)
689 # define YYFPRINTF fprintf
692 # define YYDPRINTF(Args) \
698 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
702 YYFPRINTF (stderr, "%s ", Title); \
703 yy_symbol_print (stderr, \
704 Type, Value, yyscanner, jsgf); \
705 YYFPRINTF (stderr, "\n"); \
715 #if (defined __STDC__ || defined __C99__FUNC__ \
716 || defined __cplusplus || defined _MSC_VER)
718 yy_symbol_value_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep, yyscan_t yyscanner,
jsgf_t *jsgf)
721 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
724 YYSTYPE const * const yyvaluep;
734 if (yytype < YYNTOKENS)
735 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
751 #if (defined __STDC__ || defined __C99__FUNC__ \
752 || defined __cplusplus || defined _MSC_VER)
754 yy_symbol_print (FILE *yyoutput,
int yytype,
YYSTYPE const *
const yyvaluep, yyscan_t yyscanner,
jsgf_t *jsgf)
757 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
760 YYSTYPE const * const yyvaluep;
765 if (yytype < YYNTOKENS)
766 YYFPRINTF (yyoutput,
"token %s (", yytname[yytype]);
768 YYFPRINTF (yyoutput,
"nterm %s (", yytname[yytype]);
770 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
771 YYFPRINTF (yyoutput,
")");
779 #if (defined __STDC__ || defined __C99__FUNC__ \
780 || defined __cplusplus || defined _MSC_VER)
782 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
785 yy_stack_print (yybottom, yytop)
786 yytype_int16 *yybottom;
790 YYFPRINTF (stderr,
"Stack now");
791 for (; yybottom <= yytop; yybottom++)
793 int yybot = *yybottom;
794 YYFPRINTF (stderr,
" %d", yybot);
796 YYFPRINTF (stderr,
"\n");
799 # define YY_STACK_PRINT(Bottom, Top) \
802 yy_stack_print ((Bottom), (Top)); \
810 #if (defined __STDC__ || defined __C99__FUNC__ \
811 || defined __cplusplus || defined _MSC_VER)
813 yy_reduce_print (
YYSTYPE *yyvsp,
int yyrule, yyscan_t yyscanner,
jsgf_t *jsgf)
816 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf)
823 int yynrhs = yyr2[yyrule];
825 unsigned long int yylno = yyrline[yyrule];
826 YYFPRINTF (stderr,
"Reducing stack by rule %d (line %lu):\n",
829 for (yyi = 0; yyi < yynrhs; yyi++)
831 YYFPRINTF (stderr,
" $%d = ", yyi + 1);
832 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
833 &(yyvsp[(yyi + 1) - (yynrhs)])
835 YYFPRINTF (stderr,
"\n");
839 # define YY_REDUCE_PRINT(Rule) \
842 yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \
849 # define YYDPRINTF(Args)
850 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
851 # define YY_STACK_PRINT(Bottom, Top)
852 # define YY_REDUCE_PRINT(Rule)
858 # define YYINITDEPTH 200
869 # 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;
983 yysyntax_error (
char *yyresult,
int yystate,
int yychar)
985 int yyn = yypact[yystate];
987 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
991 int yytype = YYTRANSLATE (yychar);
992 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
993 YYSIZE_T yysize = yysize0;
995 int yysize_overflow = 0;
996 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
997 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1003 YY_(
"syntax error, unexpected %s");
1004 YY_(
"syntax error, unexpected %s, expecting %s");
1005 YY_(
"syntax error, unexpected %s, expecting %s or %s");
1006 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s");
1007 YY_(
"syntax error, unexpected %s, expecting %s or %s or %s or %s");
1011 static char const yyunexpected[] =
"syntax error, unexpected %s";
1012 static char const yyexpecting[] =
", expecting %s";
1013 static char const yyor[] =
" or %s";
1014 char yyformat[
sizeof yyunexpected
1015 +
sizeof yyexpecting - 1
1016 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1017 * (
sizeof yyor - 1))];
1018 char const *yyprefix = yyexpecting;
1022 int yyxbegin = yyn < 0 ? -yyn : 0;
1025 int yychecklim = YYLAST - yyn + 1;
1026 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1029 yyarg[0] = yytname[yytype];
1030 yyfmt = yystpcpy (yyformat, yyunexpected);
1032 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1033 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1035 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1039 yyformat[
sizeof yyunexpected - 1] =
'\0';
1042 yyarg[yycount++] = yytname[yyx];
1043 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1044 yysize_overflow |= (yysize1 < yysize);
1046 yyfmt = yystpcpy (yyfmt, yyprefix);
1050 yyf = YY_(yyformat);
1051 yysize1 = yysize + yystrlen (yyf);
1052 yysize_overflow |= (yysize1 < yysize);
1055 if (yysize_overflow)
1056 return YYSIZE_MAXIMUM;
1063 char *yyp = yyresult;
1065 while ((*yyp = *yyf) !=
'\0')
1067 if (*yyp ==
'%' && yyf[1] ==
's' && yyi < yycount)
1069 yyp += yytnamerr (yyp, yyarg[yyi++]);
1090 #if (defined __STDC__ || defined __C99__FUNC__ \
1091 || defined __cplusplus || defined _MSC_VER)
1093 yydestruct (
const char *yymsg,
int yytype,
YYSTYPE *yyvaluep, yyscan_t yyscanner,
jsgf_t *jsgf)
1096 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf)
1110 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1121 #ifdef YYPARSE_PARAM
1122 #if defined __STDC__ || defined __cplusplus
1123 int yyparse (
void *YYPARSE_PARAM);
1128 #if defined __STDC__ || defined __cplusplus
1129 int yyparse (yyscan_t yyscanner,
jsgf_t *jsgf);
1143 #ifdef YYPARSE_PARAM
1144 #if (defined __STDC__ || defined __C99__FUNC__ \
1145 || defined __cplusplus || defined _MSC_VER)
1147 yyparse (
void *YYPARSE_PARAM)
1150 yyparse (YYPARSE_PARAM)
1151 void *YYPARSE_PARAM;
1154 #if (defined __STDC__ || defined __C99__FUNC__ \
1155 || defined __cplusplus || defined _MSC_VER)
1157 yyparse (yyscan_t yyscanner,
jsgf_t *jsgf)
1160 yyparse (yyscanner, jsgf)
1187 yytype_int16 yyssa[YYINITDEPTH];
1189 yytype_int16 *yyssp;
1196 YYSIZE_T yystacksize;
1209 char *yymsg = yymsgbuf;
1210 YYSIZE_T yymsg_alloc =
sizeof yymsgbuf;
1213 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1222 yystacksize = YYINITDEPTH;
1224 YYDPRINTF ((stderr,
"Starting parse\n"));
1251 if (yyss + yystacksize - 1 <= yyssp)
1254 YYSIZE_T yysize = yyssp - yyss + 1;
1262 yytype_int16 *yyss1 = yyss;
1268 yyoverflow (YY_(
"memory exhausted"),
1269 &yyss1, yysize *
sizeof (*yyssp),
1270 &yyvs1, yysize *
sizeof (*yyvsp),
1277 # ifndef YYSTACK_RELOCATE
1278 goto yyexhaustedlab;
1281 if (YYMAXDEPTH <= yystacksize)
1282 goto yyexhaustedlab;
1284 if (YYMAXDEPTH < yystacksize)
1285 yystacksize = YYMAXDEPTH;
1288 yytype_int16 *yyss1 = yyss;
1290 (
union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1292 goto yyexhaustedlab;
1293 YYSTACK_RELOCATE (yyss_alloc, yyss);
1294 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1295 # undef YYSTACK_RELOCATE
1297 YYSTACK_FREE (yyss1);
1302 yyssp = yyss + yysize - 1;
1303 yyvsp = yyvs + yysize - 1;
1305 YYDPRINTF ((stderr,
"Stack size increased to %lu\n",
1306 (
unsigned long int) yystacksize));
1308 if (yyss + yystacksize - 1 <= yyssp)
1312 YYDPRINTF ((stderr,
"Entering state %d\n", yystate));
1314 if (yystate == YYFINAL)
1328 yyn = yypact[yystate];
1329 if (yyn == YYPACT_NINF)
1335 if (yychar == YYEMPTY)
1337 YYDPRINTF ((stderr,
"Reading a token: "));
1341 if (yychar <= YYEOF)
1343 yychar = yytoken = YYEOF;
1344 YYDPRINTF ((stderr,
"Now at end of input.\n"));
1348 yytoken = YYTRANSLATE (yychar);
1349 YY_SYMBOL_PRINT (
"Next token is", yytoken, &yylval, &yylloc);
1355 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1360 if (yyn == 0 || yyn == YYTABLE_NINF)
1372 YY_SYMBOL_PRINT (
"Shifting", yytoken, &yylval, &yylloc);
1387 yyn = yydefact[yystate];
1408 yyval = yyvsp[1-yylen];
1411 YY_REDUCE_PRINT (yyn);
1417 #line 85 "jsgf_parser.y"
1418 { jsgf->
name = (yyvsp[(2) - (2)].name); }
1424 #line 89 "jsgf_parser.y"
1425 { jsgf->
version = (yyvsp[(2) - (3)].name); }
1431 #line 90 "jsgf_parser.y"
1432 { jsgf->
version = (yyvsp[(2) - (4)].name); jsgf->
charset = (yyvsp[(3) - (4)].name); }
1438 #line 91 "jsgf_parser.y"
1439 { jsgf->
version = (yyvsp[(2) - (5)].name); jsgf->
charset = (yyvsp[(3) - (5)].name);
1440 jsgf->
locale = (yyvsp[(4) - (5)].name); }
1446 #line 95 "jsgf_parser.y"
1447 { (yyval.name) = (yyvsp[(2) - (3)].name); }
1453 #line 102 "jsgf_parser.y"
1454 { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name));
ckd_free((yyvsp[(2) - (3)].name)); }
1460 #line 109 "jsgf_parser.y"
1461 { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0);
ckd_free((yyvsp[(1) - (4)].name)); }
1467 #line 110 "jsgf_parser.y"
1468 { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1);
ckd_free((yyvsp[(2) - (5)].name)); }
1474 #line 113 "jsgf_parser.y"
1475 { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms =
glist_reverse((yyval.rhs)->atoms); }
1481 #line 114 "jsgf_parser.y"
1482 { (yyval.rhs) = (yyvsp[(3) - (3)].rhs);
1484 (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); }
1490 #line 119 "jsgf_parser.y"
1491 { (yyval.rhs) =
ckd_calloc(1,
sizeof(*(yyval.rhs)));
1492 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); }
1498 #line 121 "jsgf_parser.y"
1499 { (yyval.rhs) = (yyvsp[(1) - (2)].rhs);
1500 (yyval.rhs)->atoms =
glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); }
1506 #line 126 "jsgf_parser.y"
1507 { (yyval.atom) = (yyvsp[(1) - (2)].atom);
1508 (yyval.atom)->tags =
glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); }
1514 #line 131 "jsgf_parser.y"
1515 { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); }
1521 #line 134 "jsgf_parser.y"
1522 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); }
1528 #line 137 "jsgf_parser.y"
1529 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); }
1535 #line 140 "jsgf_parser.y"
1536 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1542 #line 141 "jsgf_parser.y"
1543 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0);
ckd_free((yyvsp[(1) - (1)].name)); }
1549 #line 142 "jsgf_parser.y"
1550 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1556 #line 143 "jsgf_parser.y"
1557 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
1563 #line 144 "jsgf_parser.y"
1564 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); }
1570 #line 145 "jsgf_parser.y"
1571 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); }
1577 #line 1578 "jsgf_parser.c"
1580 YY_SYMBOL_PRINT (
"-> $$ =", yyr1[yyn], &yyval, &yyloc);
1584 YY_STACK_PRINT (yyss, yyssp);
1594 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1595 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1596 yystate = yytable[yystate];
1598 yystate = yydefgoto[yyn - YYNTOKENS];
1611 #if ! YYERROR_VERBOSE
1612 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1615 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1616 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1618 YYSIZE_T
yyalloc = 2 * yysize;
1619 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1620 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1621 if (yymsg != yymsgbuf)
1622 YYSTACK_FREE (yymsg);
1623 yymsg = (
char *) YYSTACK_ALLOC (yyalloc);
1625 yymsg_alloc = yyalloc;
1629 yymsg_alloc =
sizeof yymsgbuf;
1633 if (0 < yysize && yysize <= yymsg_alloc)
1635 (void) yysyntax_error (yymsg, yystate, yychar);
1636 yyerror (yyscanner, jsgf, yymsg);
1640 yyerror (yyscanner, jsgf, YY_(
"syntax error"));
1642 goto yyexhaustedlab;
1650 if (yyerrstatus == 3)
1655 if (yychar <= YYEOF)
1658 if (yychar == YYEOF)
1663 yydestruct (
"Error: discarding",
1664 yytoken, &yylval, yyscanner, jsgf);
1689 YY_STACK_PRINT (yyss, yyssp);
1702 yyn = yypact[yystate];
1703 if (yyn != YYPACT_NINF)
1706 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1719 yydestruct (
"Error: popping",
1720 yystos[yystate], yyvsp, yyscanner, jsgf);
1723 YY_STACK_PRINT (yyss, yyssp);
1730 YY_SYMBOL_PRINT (
"Shifting", yystos[yyn], yyvsp, yylsp);
1750 #if !defined(yyoverflow) || YYERROR_VERBOSE
1755 yyerror (yyscanner, jsgf, YY_(
"memory exhausted"));
1761 if (yychar != YYEMPTY)
1762 yydestruct (
"Cleanup: discarding lookahead",
1763 yytoken, &yylval, yyscanner, jsgf);
1767 YY_STACK_PRINT (yyss, yyssp);
1768 while (yyssp != yyss)
1770 yydestruct (
"Cleanup: popping",
1771 yystos[*yyssp], yyvsp, yyscanner, jsgf);
1776 YYSTACK_FREE (yyss);
1779 if (yymsg != yymsgbuf)
1780 YYSTACK_FREE (yymsg);
1783 return YYID (yyresult);
1789 #line 148 "jsgf_parser.y"
1793 yyerror(yyscan_t lex,
jsgf_t *jsgf,
const char *s)
1795 fprintf(stderr,
"ERROR: %s\n", s);