00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define YYBISON 1
00047
00048
00049 #define YYBISON_VERSION "2.4.1"
00050
00051
00052 #define YYSKELETON_NAME "yacc.c"
00053
00054
00055 #define YYPURE 1
00056
00057
00058 #define YYPUSH 0
00059
00060
00061 #define YYPULL 1
00062
00063
00064 #define YYLSP_NEEDED 0
00065
00066
00067
00068
00069
00070
00071 #line 37 "jsgf_parser.y"
00072
00073 #include <stdio.h>
00074 #include <string.h>
00075
00076 #include <hash_table.h>
00077 #include <ckd_alloc.h>
00078 #include <err.h>
00079
00080 #include "jsgf_internal.h"
00081 #include "jsgf_parser.h"
00082 #include "jsgf_scanner.h"
00083
00084 void yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s);
00085
00086
00087
00088
00089 #line 90 "jsgf_parser.c"
00090
00091
00092 #ifndef YYDEBUG
00093 # define YYDEBUG 0
00094 #endif
00095
00096
00097 #ifdef YYERROR_VERBOSE
00098 # undef YYERROR_VERBOSE
00099 # define YYERROR_VERBOSE 1
00100 #else
00101 # define YYERROR_VERBOSE 0
00102 #endif
00103
00104
00105 #ifndef YYTOKEN_TABLE
00106 # define YYTOKEN_TABLE 0
00107 #endif
00108
00109
00110
00111 #ifndef YYTOKENTYPE
00112 # define YYTOKENTYPE
00113
00114
00115 enum yytokentype {
00116 HEADER = 258,
00117 GRAMMAR = 259,
00118 IMPORT = 260,
00119 PUBLIC = 261,
00120 TOKEN = 262,
00121 RULENAME = 263,
00122 TAG = 264,
00123 WEIGHT = 265
00124 };
00125 #endif
00126
00127 #define HEADER 258
00128 #define GRAMMAR 259
00129 #define IMPORT 260
00130 #define PUBLIC 261
00131 #define TOKEN 262
00132 #define RULENAME 263
00133 #define TAG 264
00134 #define WEIGHT 265
00135
00136
00137
00138
00139 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00140 typedef union YYSTYPE
00141 {
00142
00143
00144 #line 58 "jsgf_parser.y"
00145
00146 char *name;
00147 float weight;
00148 jsgf_rule_t *rule;
00149 jsgf_rhs_t *rhs;
00150 jsgf_atom_t *atom;
00151
00152
00153
00154
00155 #line 156 "jsgf_parser.c"
00156 } YYSTYPE;
00157 # define YYSTYPE_IS_TRIVIAL 1
00158 # define yystype YYSTYPE
00159 # define YYSTYPE_IS_DECLARED 1
00160 #endif
00161
00162
00163
00164
00165
00166
00167 #line 168 "jsgf_parser.c"
00168
00169 #ifdef short
00170 # undef short
00171 #endif
00172
00173 #ifdef YYTYPE_UINT8
00174 typedef YYTYPE_UINT8 yytype_uint8;
00175 #else
00176 typedef unsigned char yytype_uint8;
00177 #endif
00178
00179 #ifdef YYTYPE_INT8
00180 typedef YYTYPE_INT8 yytype_int8;
00181 #elif (defined __STDC__ || defined __C99__FUNC__ \
00182 || defined __cplusplus || defined _MSC_VER)
00183 typedef signed char yytype_int8;
00184 #else
00185 typedef short int yytype_int8;
00186 #endif
00187
00188 #ifdef YYTYPE_UINT16
00189 typedef YYTYPE_UINT16 yytype_uint16;
00190 #else
00191 typedef unsigned short int yytype_uint16;
00192 #endif
00193
00194 #ifdef YYTYPE_INT16
00195 typedef YYTYPE_INT16 yytype_int16;
00196 #else
00197 typedef short int yytype_int16;
00198 #endif
00199
00200 #ifndef YYSIZE_T
00201 # ifdef __SIZE_TYPE__
00202 # define YYSIZE_T __SIZE_TYPE__
00203 # elif defined size_t
00204 # define YYSIZE_T size_t
00205 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00206 || defined __cplusplus || defined _MSC_VER)
00207 # include <stddef.h>
00208 # define YYSIZE_T size_t
00209 # else
00210 # define YYSIZE_T unsigned int
00211 # endif
00212 #endif
00213
00214 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00215
00216 #ifndef YY_
00217 # if YYENABLE_NLS
00218 # if ENABLE_NLS
00219 # include <libintl.h>
00220 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00221 # endif
00222 # endif
00223 # ifndef YY_
00224 # define YY_(msgid) msgid
00225 # endif
00226 #endif
00227
00228
00229 #if ! defined lint || defined __GNUC__
00230 # define YYUSE(e) ((void) (e))
00231 #else
00232 # define YYUSE(e)
00233 #endif
00234
00235
00236 #ifndef lint
00237 # define YYID(n) (n)
00238 #else
00239 #if (defined __STDC__ || defined __C99__FUNC__ \
00240 || defined __cplusplus || defined _MSC_VER)
00241 static int
00242 YYID (int yyi)
00243 #else
00244 static int
00245 YYID (yyi)
00246 int yyi;
00247 #endif
00248 {
00249 return yyi;
00250 }
00251 #endif
00252
00253 #if ! defined yyoverflow || YYERROR_VERBOSE
00254
00255
00256
00257 # ifdef YYSTACK_USE_ALLOCA
00258 # if YYSTACK_USE_ALLOCA
00259 # ifdef __GNUC__
00260 # define YYSTACK_ALLOC __builtin_alloca
00261 # elif defined __BUILTIN_VA_ARG_INCR
00262 # include <alloca.h>
00263 # elif defined _AIX
00264 # define YYSTACK_ALLOC __alloca
00265 # elif defined _MSC_VER
00266 # include <malloc.h>
00267 # define alloca _alloca
00268 # else
00269 # define YYSTACK_ALLOC alloca
00270 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00271 || defined __cplusplus || defined _MSC_VER)
00272 # include <stdlib.h>
00273 # ifndef _STDLIB_H
00274 # define _STDLIB_H 1
00275 # endif
00276 # endif
00277 # endif
00278 # endif
00279 # endif
00280
00281 # ifdef YYSTACK_ALLOC
00282
00283 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00284 # ifndef YYSTACK_ALLOC_MAXIMUM
00285
00286
00287
00288
00289 # define YYSTACK_ALLOC_MAXIMUM 4032
00290 # endif
00291 # else
00292 # define YYSTACK_ALLOC YYMALLOC
00293 # define YYSTACK_FREE YYFREE
00294 # ifndef YYSTACK_ALLOC_MAXIMUM
00295 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00296 # endif
00297 # if (defined __cplusplus && ! defined _STDLIB_H \
00298 && ! ((defined YYMALLOC || defined malloc) \
00299 && (defined YYFREE || defined free)))
00300 # include <stdlib.h>
00301 # ifndef _STDLIB_H
00302 # define _STDLIB_H 1
00303 # endif
00304 # endif
00305 # ifndef YYMALLOC
00306 # define YYMALLOC malloc
00307 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00308 || defined __cplusplus || defined _MSC_VER)
00309 void *malloc (YYSIZE_T);
00310 # endif
00311 # endif
00312 # ifndef YYFREE
00313 # define YYFREE free
00314 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00315 || defined __cplusplus || defined _MSC_VER)
00316 void free (void *);
00317 # endif
00318 # endif
00319 # endif
00320 #endif
00321
00322
00323 #if (! defined yyoverflow \
00324 && (! defined __cplusplus \
00325 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00326
00327
00328 union yyalloc
00329 {
00330 yytype_int16 yyss_alloc;
00331 YYSTYPE yyvs_alloc;
00332 };
00333
00334
00335 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00336
00337
00338
00339 # define YYSTACK_BYTES(N) \
00340 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00341 + YYSTACK_GAP_MAXIMUM)
00342
00343
00344
00345 # ifndef YYCOPY
00346 # if defined __GNUC__ && 1 < __GNUC__
00347 # define YYCOPY(To, From, Count) \
00348 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00349 # else
00350 # define YYCOPY(To, From, Count) \
00351 do \
00352 { \
00353 YYSIZE_T yyi; \
00354 for (yyi = 0; yyi < (Count); yyi++) \
00355 (To)[yyi] = (From)[yyi]; \
00356 } \
00357 while (YYID (0))
00358 # endif
00359 # endif
00360
00361
00362
00363
00364
00365
00366 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
00367 do \
00368 { \
00369 YYSIZE_T yynewbytes; \
00370 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
00371 Stack = &yyptr->Stack_alloc; \
00372 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00373 yyptr += yynewbytes / sizeof (*yyptr); \
00374 } \
00375 while (YYID (0))
00376
00377 #endif
00378
00379
00380 #define YYFINAL 7
00381
00382 #define YYLAST 54
00383
00384
00385 #define YYNTOKENS 20
00386
00387 #define YYNNTS 16
00388
00389 #define YYNRULES 33
00390
00391 #define YYNSTATES 58
00392
00393
00394 #define YYUNDEFTOK 2
00395 #define YYMAXUTOK 265
00396
00397 #define YYTRANSLATE(YYX) \
00398 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00399
00400
00401 static const yytype_uint8 yytranslate[] =
00402 {
00403 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00407 14, 15, 18, 19, 2, 2, 2, 2, 2, 2,
00408 2, 2, 2, 2, 2, 2, 2, 2, 2, 11,
00409 2, 12, 2, 2, 2, 2, 2, 2, 2, 2,
00410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00412 2, 16, 2, 17, 2, 2, 2, 2, 2, 2,
00413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00415 2, 2, 2, 2, 13, 2, 2, 2, 2, 2,
00416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00428 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00429 5, 6, 7, 8, 9, 10
00430 };
00431
00432 #if YYDEBUG
00433
00434
00435 static const yytype_uint8 yyprhs[] =
00436 {
00437 0, 0, 3, 5, 8, 12, 15, 18, 22, 27,
00438 33, 37, 39, 42, 46, 48, 51, 56, 62, 64,
00439 68, 70, 73, 75, 78, 80, 83, 87, 91, 93,
00440 95, 97, 99, 102
00441 };
00442
00443
00444 static const yytype_int8 yyrhs[] =
00445 {
00446 21, 0, -1, 22, -1, 22, 27, -1, 22, 25,
00447 27, -1, 23, 24, -1, 3, 11, -1, 3, 7,
00448 11, -1, 3, 7, 7, 11, -1, 3, 7, 7,
00449 7, 11, -1, 4, 7, 11, -1, 26, -1, 25,
00450 26, -1, 5, 8, 11, -1, 28, -1, 27, 28,
00451 -1, 8, 12, 29, 11, -1, 6, 8, 12, 29,
00452 11, -1, 30, -1, 29, 13, 30, -1, 31, -1,
00453 30, 31, -1, 32, -1, 31, 9, -1, 35, -1,
00454 10, 35, -1, 14, 29, 15, -1, 16, 29, 17,
00455 -1, 7, -1, 8, -1, 33, -1, 34, -1, 35,
00456 18, -1, 35, 19, -1
00457 };
00458
00459
00460 static const yytype_uint8 yyrline[] =
00461 {
00462 0, 75, 75, 76, 77, 80, 83, 84, 85, 86,
00463 90, 93, 94, 97, 100, 101, 104, 105, 108, 109,
00464 114, 116, 120, 121, 125, 126, 129, 132, 135, 136,
00465 137, 138, 139, 140
00466 };
00467 #endif
00468
00469 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00470
00471
00472 static const char *const yytname[] =
00473 {
00474 "$end", "error", "$undefined", "HEADER", "GRAMMAR", "IMPORT", "PUBLIC",
00475 "TOKEN", "RULENAME", "TAG", "WEIGHT", "';'", "'='", "'|'", "'('", "')'",
00476 "'['", "']'", "'*'", "'+'", "$accept", "grammar", "header",
00477 "jsgf_header", "grammar_header", "import_header", "import_statement",
00478 "rule_list", "rule", "alternate_list", "rule_expansion",
00479 "tagged_rule_item", "rule_item", "rule_group", "rule_optional",
00480 "rule_atom", 0
00481 };
00482 #endif
00483
00484 # ifdef YYPRINT
00485
00486
00487 static const yytype_uint16 yytoknum[] =
00488 {
00489 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
00490 265, 59, 61, 124, 40, 41, 91, 93, 42, 43
00491 };
00492 # endif
00493
00494
00495 static const yytype_uint8 yyr1[] =
00496 {
00497 0, 20, 21, 21, 21, 22, 23, 23, 23, 23,
00498 24, 25, 25, 26, 27, 27, 28, 28, 29, 29,
00499 30, 30, 31, 31, 32, 32, 33, 34, 35, 35,
00500 35, 35, 35, 35
00501 };
00502
00503
00504 static const yytype_uint8 yyr2[] =
00505 {
00506 0, 2, 1, 2, 3, 2, 2, 3, 4, 5,
00507 3, 1, 2, 3, 1, 2, 4, 5, 1, 3,
00508 1, 2, 1, 2, 1, 2, 3, 3, 1, 1,
00509 1, 1, 2, 2
00510 };
00511
00512
00513
00514
00515 static const yytype_uint8 yydefact[] =
00516 {
00517 0, 0, 0, 2, 0, 0, 6, 1, 0, 0,
00518 0, 0, 11, 3, 14, 0, 5, 0, 7, 0,
00519 0, 0, 12, 4, 15, 0, 0, 8, 13, 0,
00520 28, 29, 0, 0, 0, 0, 18, 20, 22, 30,
00521 31, 24, 10, 9, 0, 25, 0, 0, 16, 0,
00522 21, 23, 32, 33, 17, 26, 27, 19
00523 };
00524
00525
00526 static const yytype_int8 yydefgoto[] =
00527 {
00528 -1, 2, 3, 4, 16, 11, 12, 13, 14, 35,
00529 36, 37, 38, 39, 40, 41
00530 };
00531
00532
00533
00534 #define YYPACT_NINF -37
00535 static const yytype_int8 yypact[] =
00536 {
00537 -1, -2, 36, 22, 35, 8, -37, -37, 32, 33,
00538 30, 22, -37, 17, -37, 37, -37, 13, -37, 34,
00539 31, -4, -37, 17, -37, 38, 39, -37, -37, -4,
00540 -37, -37, 0, -4, -4, 18, -4, 42, -37, -37,
00541 -37, 19, -37, -37, 21, 19, 20, 9, -37, -4,
00542 42, -37, -37, -37, -37, -37, -37, -4
00543 };
00544
00545
00546 static const yytype_int8 yypgoto[] =
00547 {
00548 -37, -37, -37, -37, -37, -37, 41, 43, -12, -16,
00549 -3, -36, -37, -37, -37, 15
00550 };
00551
00552
00553
00554
00555
00556 #define YYTABLE_NINF -1
00557 static const yytype_uint8 yytable[] =
00558 {
00559 50, 24, 1, 30, 31, 5, 32, 30, 31, 6,
00560 33, 24, 34, 44, 33, 17, 34, 46, 47, 18,
00561 26, 50, 49, 9, 27, 10, 56, 8, 9, 48,
00562 10, 49, 54, 49, 49, 55, 7, 52, 53, 15,
00563 19, 20, 21, 29, 25, 28, 57, 45, 0, 42,
00564 43, 51, 22, 0, 23
00565 };
00566
00567 static const yytype_int8 yycheck[] =
00568 {
00569 36, 13, 3, 7, 8, 7, 10, 7, 8, 11,
00570 14, 23, 16, 29, 14, 7, 16, 33, 34, 11,
00571 7, 57, 13, 6, 11, 8, 17, 5, 6, 11,
00572 8, 13, 11, 13, 13, 15, 0, 18, 19, 4,
00573 8, 8, 12, 12, 7, 11, 49, 32, -1, 11,
00574 11, 9, 11, -1, 11
00575 };
00576
00577
00578
00579 static const yytype_uint8 yystos[] =
00580 {
00581 0, 3, 21, 22, 23, 7, 11, 0, 5, 6,
00582 8, 25, 26, 27, 28, 4, 24, 7, 11, 8,
00583 8, 12, 26, 27, 28, 7, 7, 11, 11, 12,
00584 7, 8, 10, 14, 16, 29, 30, 31, 32, 33,
00585 34, 35, 11, 11, 29, 35, 29, 29, 11, 13,
00586 31, 9, 18, 19, 11, 15, 17, 30
00587 };
00588
00589 #define yyerrok (yyerrstatus = 0)
00590 #define yyclearin (yychar = YYEMPTY)
00591 #define YYEMPTY (-2)
00592 #define YYEOF 0
00593
00594 #define YYACCEPT goto yyacceptlab
00595 #define YYABORT goto yyabortlab
00596 #define YYERROR goto yyerrorlab
00597
00598
00599
00600
00601
00602
00603 #define YYFAIL goto yyerrlab
00604
00605 #define YYRECOVERING() (!!yyerrstatus)
00606
00607 #define YYBACKUP(Token, Value) \
00608 do \
00609 if (yychar == YYEMPTY && yylen == 1) \
00610 { \
00611 yychar = (Token); \
00612 yylval = (Value); \
00613 yytoken = YYTRANSLATE (yychar); \
00614 YYPOPSTACK (1); \
00615 goto yybackup; \
00616 } \
00617 else \
00618 { \
00619 yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \
00620 YYERROR; \
00621 } \
00622 while (YYID (0))
00623
00624
00625 #define YYTERROR 1
00626 #define YYERRCODE 256
00627
00628
00629
00630
00631
00632
00633 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00634 #ifndef YYLLOC_DEFAULT
00635 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00636 do \
00637 if (YYID (N)) \
00638 { \
00639 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00640 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00641 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00642 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00643 } \
00644 else \
00645 { \
00646 (Current).first_line = (Current).last_line = \
00647 YYRHSLOC (Rhs, 0).last_line; \
00648 (Current).first_column = (Current).last_column = \
00649 YYRHSLOC (Rhs, 0).last_column; \
00650 } \
00651 while (YYID (0))
00652 #endif
00653
00654
00655
00656
00657
00658
00659 #ifndef YY_LOCATION_PRINT
00660 # if YYLTYPE_IS_TRIVIAL
00661 # define YY_LOCATION_PRINT(File, Loc) \
00662 fprintf (File, "%d.%d-%d.%d", \
00663 (Loc).first_line, (Loc).first_column, \
00664 (Loc).last_line, (Loc).last_column)
00665 # else
00666 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00667 # endif
00668 #endif
00669
00670
00671
00672
00673 #ifdef YYLEX_PARAM
00674 # define YYLEX yylex (&yylval, YYLEX_PARAM)
00675 #else
00676 # define YYLEX yylex (&yylval, yyscanner)
00677 #endif
00678
00679
00680 #if YYDEBUG
00681
00682 # ifndef YYFPRINTF
00683 # include <stdio.h>
00684 # define YYFPRINTF fprintf
00685 # endif
00686
00687 # define YYDPRINTF(Args) \
00688 do { \
00689 if (yydebug) \
00690 YYFPRINTF Args; \
00691 } while (YYID (0))
00692
00693 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00694 do { \
00695 if (yydebug) \
00696 { \
00697 YYFPRINTF (stderr, "%s ", Title); \
00698 yy_symbol_print (stderr, \
00699 Type, Value, yyscanner, jsgf); \
00700 YYFPRINTF (stderr, "\n"); \
00701 } \
00702 } while (YYID (0))
00703
00704
00705
00706
00707
00708
00709
00710 #if (defined __STDC__ || defined __C99__FUNC__ \
00711 || defined __cplusplus || defined _MSC_VER)
00712 static void
00713 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
00714 #else
00715 static void
00716 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
00717 FILE *yyoutput;
00718 int yytype;
00719 YYSTYPE const * const yyvaluep;
00720 yyscan_t yyscanner;
00721 jsgf_t *jsgf;
00722 #endif
00723 {
00724 if (!yyvaluep)
00725 return;
00726 YYUSE (yyscanner);
00727 YYUSE (jsgf);
00728 # ifdef YYPRINT
00729 if (yytype < YYNTOKENS)
00730 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00731 # else
00732 YYUSE (yyoutput);
00733 # endif
00734 switch (yytype)
00735 {
00736 default:
00737 break;
00738 }
00739 }
00740
00741
00742
00743
00744
00745
00746 #if (defined __STDC__ || defined __C99__FUNC__ \
00747 || defined __cplusplus || defined _MSC_VER)
00748 static void
00749 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
00750 #else
00751 static void
00752 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
00753 FILE *yyoutput;
00754 int yytype;
00755 YYSTYPE const * const yyvaluep;
00756 yyscan_t yyscanner;
00757 jsgf_t *jsgf;
00758 #endif
00759 {
00760 if (yytype < YYNTOKENS)
00761 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00762 else
00763 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00764
00765 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
00766 YYFPRINTF (yyoutput, ")");
00767 }
00768
00769
00770
00771
00772
00773
00774 #if (defined __STDC__ || defined __C99__FUNC__ \
00775 || defined __cplusplus || defined _MSC_VER)
00776 static void
00777 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
00778 #else
00779 static void
00780 yy_stack_print (yybottom, yytop)
00781 yytype_int16 *yybottom;
00782 yytype_int16 *yytop;
00783 #endif
00784 {
00785 YYFPRINTF (stderr, "Stack now");
00786 for (; yybottom <= yytop; yybottom++)
00787 {
00788 int yybot = *yybottom;
00789 YYFPRINTF (stderr, " %d", yybot);
00790 }
00791 YYFPRINTF (stderr, "\n");
00792 }
00793
00794 # define YY_STACK_PRINT(Bottom, Top) \
00795 do { \
00796 if (yydebug) \
00797 yy_stack_print ((Bottom), (Top)); \
00798 } while (YYID (0))
00799
00800
00801
00802
00803
00804
00805 #if (defined __STDC__ || defined __C99__FUNC__ \
00806 || defined __cplusplus || defined _MSC_VER)
00807 static void
00808 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner, jsgf_t *jsgf)
00809 #else
00810 static void
00811 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf)
00812 YYSTYPE *yyvsp;
00813 int yyrule;
00814 yyscan_t yyscanner;
00815 jsgf_t *jsgf;
00816 #endif
00817 {
00818 int yynrhs = yyr2[yyrule];
00819 int yyi;
00820 unsigned long int yylno = yyrline[yyrule];
00821 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00822 yyrule - 1, yylno);
00823
00824 for (yyi = 0; yyi < yynrhs; yyi++)
00825 {
00826 YYFPRINTF (stderr, " $%d = ", yyi + 1);
00827 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00828 &(yyvsp[(yyi + 1) - (yynrhs)])
00829 , yyscanner, jsgf);
00830 YYFPRINTF (stderr, "\n");
00831 }
00832 }
00833
00834 # define YY_REDUCE_PRINT(Rule) \
00835 do { \
00836 if (yydebug) \
00837 yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \
00838 } while (YYID (0))
00839
00840
00841
00842 int yydebug;
00843 #else
00844 # define YYDPRINTF(Args)
00845 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00846 # define YY_STACK_PRINT(Bottom, Top)
00847 # define YY_REDUCE_PRINT(Rule)
00848 #endif
00849
00850
00851
00852 #ifndef YYINITDEPTH
00853 # define YYINITDEPTH 200
00854 #endif
00855
00856
00857
00858
00859
00860
00861
00862
00863 #ifndef YYMAXDEPTH
00864 # define YYMAXDEPTH 10000
00865 #endif
00866
00867
00868
00869 #if YYERROR_VERBOSE
00870
00871 # ifndef yystrlen
00872 # if defined __GLIBC__ && defined _STRING_H
00873 # define yystrlen strlen
00874 # else
00875
00876 #if (defined __STDC__ || defined __C99__FUNC__ \
00877 || defined __cplusplus || defined _MSC_VER)
00878 static YYSIZE_T
00879 yystrlen (const char *yystr)
00880 #else
00881 static YYSIZE_T
00882 yystrlen (yystr)
00883 const char *yystr;
00884 #endif
00885 {
00886 YYSIZE_T yylen;
00887 for (yylen = 0; yystr[yylen]; yylen++)
00888 continue;
00889 return yylen;
00890 }
00891 # endif
00892 # endif
00893
00894 # ifndef yystpcpy
00895 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00896 # define yystpcpy stpcpy
00897 # else
00898
00899
00900 #if (defined __STDC__ || defined __C99__FUNC__ \
00901 || defined __cplusplus || defined _MSC_VER)
00902 static char *
00903 yystpcpy (char *yydest, const char *yysrc)
00904 #else
00905 static char *
00906 yystpcpy (yydest, yysrc)
00907 char *yydest;
00908 const char *yysrc;
00909 #endif
00910 {
00911 char *yyd = yydest;
00912 const char *yys = yysrc;
00913
00914 while ((*yyd++ = *yys++) != '\0')
00915 continue;
00916
00917 return yyd - 1;
00918 }
00919 # endif
00920 # endif
00921
00922 # ifndef yytnamerr
00923
00924
00925
00926
00927
00928
00929
00930 static YYSIZE_T
00931 yytnamerr (char *yyres, const char *yystr)
00932 {
00933 if (*yystr == '"')
00934 {
00935 YYSIZE_T yyn = 0;
00936 char const *yyp = yystr;
00937
00938 for (;;)
00939 switch (*++yyp)
00940 {
00941 case '\'':
00942 case ',':
00943 goto do_not_strip_quotes;
00944
00945 case '\\':
00946 if (*++yyp != '\\')
00947 goto do_not_strip_quotes;
00948
00949 default:
00950 if (yyres)
00951 yyres[yyn] = *yyp;
00952 yyn++;
00953 break;
00954
00955 case '"':
00956 if (yyres)
00957 yyres[yyn] = '\0';
00958 return yyn;
00959 }
00960 do_not_strip_quotes: ;
00961 }
00962
00963 if (! yyres)
00964 return yystrlen (yystr);
00965
00966 return yystpcpy (yyres, yystr) - yyres;
00967 }
00968 # endif
00969
00970
00971
00972
00973
00974
00975
00976
00977 static YYSIZE_T
00978 yysyntax_error (char *yyresult, int yystate, int yychar)
00979 {
00980 int yyn = yypact[yystate];
00981
00982 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
00983 return 0;
00984 else
00985 {
00986 int yytype = YYTRANSLATE (yychar);
00987 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
00988 YYSIZE_T yysize = yysize0;
00989 YYSIZE_T yysize1;
00990 int yysize_overflow = 0;
00991 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
00992 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
00993 int yyx;
00994
00995 # if 0
00996
00997
00998 YY_("syntax error, unexpected %s");
00999 YY_("syntax error, unexpected %s, expecting %s");
01000 YY_("syntax error, unexpected %s, expecting %s or %s");
01001 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01002 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01003 # endif
01004 char *yyfmt;
01005 char const *yyf;
01006 static char const yyunexpected[] = "syntax error, unexpected %s";
01007 static char const yyexpecting[] = ", expecting %s";
01008 static char const yyor[] = " or %s";
01009 char yyformat[sizeof yyunexpected
01010 + sizeof yyexpecting - 1
01011 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01012 * (sizeof yyor - 1))];
01013 char const *yyprefix = yyexpecting;
01014
01015
01016
01017 int yyxbegin = yyn < 0 ? -yyn : 0;
01018
01019
01020 int yychecklim = YYLAST - yyn + 1;
01021 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01022 int yycount = 1;
01023
01024 yyarg[0] = yytname[yytype];
01025 yyfmt = yystpcpy (yyformat, yyunexpected);
01026
01027 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01028 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01029 {
01030 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01031 {
01032 yycount = 1;
01033 yysize = yysize0;
01034 yyformat[sizeof yyunexpected - 1] = '\0';
01035 break;
01036 }
01037 yyarg[yycount++] = yytname[yyx];
01038 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01039 yysize_overflow |= (yysize1 < yysize);
01040 yysize = yysize1;
01041 yyfmt = yystpcpy (yyfmt, yyprefix);
01042 yyprefix = yyor;
01043 }
01044
01045 yyf = YY_(yyformat);
01046 yysize1 = yysize + yystrlen (yyf);
01047 yysize_overflow |= (yysize1 < yysize);
01048 yysize = yysize1;
01049
01050 if (yysize_overflow)
01051 return YYSIZE_MAXIMUM;
01052
01053 if (yyresult)
01054 {
01055
01056
01057
01058 char *yyp = yyresult;
01059 int yyi = 0;
01060 while ((*yyp = *yyf) != '\0')
01061 {
01062 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01063 {
01064 yyp += yytnamerr (yyp, yyarg[yyi++]);
01065 yyf += 2;
01066 }
01067 else
01068 {
01069 yyp++;
01070 yyf++;
01071 }
01072 }
01073 }
01074 return yysize;
01075 }
01076 }
01077 #endif
01078
01079
01080
01081
01082
01083
01084
01085 #if (defined __STDC__ || defined __C99__FUNC__ \
01086 || defined __cplusplus || defined _MSC_VER)
01087 static void
01088 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
01089 #else
01090 static void
01091 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf)
01092 const char *yymsg;
01093 int yytype;
01094 YYSTYPE *yyvaluep;
01095 yyscan_t yyscanner;
01096 jsgf_t *jsgf;
01097 #endif
01098 {
01099 YYUSE (yyvaluep);
01100 YYUSE (yyscanner);
01101 YYUSE (jsgf);
01102
01103 if (!yymsg)
01104 yymsg = "Deleting";
01105 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01106
01107 switch (yytype)
01108 {
01109
01110 default:
01111 break;
01112 }
01113 }
01114
01115
01116 #ifdef YYPARSE_PARAM
01117 #if defined __STDC__ || defined __cplusplus
01118 int yyparse (void *YYPARSE_PARAM);
01119 #else
01120 int yyparse ();
01121 #endif
01122 #else
01123 #if defined __STDC__ || defined __cplusplus
01124 int yyparse (yyscan_t yyscanner, jsgf_t *jsgf);
01125 #else
01126 int yyparse ();
01127 #endif
01128 #endif
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138 #ifdef YYPARSE_PARAM
01139 #if (defined __STDC__ || defined __C99__FUNC__ \
01140 || defined __cplusplus || defined _MSC_VER)
01141 int
01142 yyparse (void *YYPARSE_PARAM)
01143 #else
01144 int
01145 yyparse (YYPARSE_PARAM)
01146 void *YYPARSE_PARAM;
01147 #endif
01148 #else
01149 #if (defined __STDC__ || defined __C99__FUNC__ \
01150 || defined __cplusplus || defined _MSC_VER)
01151 int
01152 yyparse (yyscan_t yyscanner, jsgf_t *jsgf)
01153 #else
01154 int
01155 yyparse (yyscanner, jsgf)
01156 yyscan_t yyscanner;
01157 jsgf_t *jsgf;
01158 #endif
01159 #endif
01160 {
01161
01162 int yychar;
01163
01164
01165 YYSTYPE yylval;
01166
01167
01168 int yynerrs;
01169
01170 int yystate;
01171
01172 int yyerrstatus;
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182 yytype_int16 yyssa[YYINITDEPTH];
01183 yytype_int16 *yyss;
01184 yytype_int16 *yyssp;
01185
01186
01187 YYSTYPE yyvsa[YYINITDEPTH];
01188 YYSTYPE *yyvs;
01189 YYSTYPE *yyvsp;
01190
01191 YYSIZE_T yystacksize;
01192
01193 int yyn;
01194 int yyresult;
01195
01196 int yytoken;
01197
01198
01199 YYSTYPE yyval;
01200
01201 #if YYERROR_VERBOSE
01202
01203 char yymsgbuf[128];
01204 char *yymsg = yymsgbuf;
01205 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01206 #endif
01207
01208 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01209
01210
01211
01212 int yylen = 0;
01213
01214 yytoken = 0;
01215 yyss = yyssa;
01216 yyvs = yyvsa;
01217 yystacksize = YYINITDEPTH;
01218
01219 YYDPRINTF ((stderr, "Starting parse\n"));
01220
01221 yystate = 0;
01222 yyerrstatus = 0;
01223 yynerrs = 0;
01224 yychar = YYEMPTY;
01225
01226
01227
01228
01229
01230 yyssp = yyss;
01231 yyvsp = yyvs;
01232
01233 goto yysetstate;
01234
01235
01236
01237
01238 yynewstate:
01239
01240
01241 yyssp++;
01242
01243 yysetstate:
01244 *yyssp = yystate;
01245
01246 if (yyss + yystacksize - 1 <= yyssp)
01247 {
01248
01249 YYSIZE_T yysize = yyssp - yyss + 1;
01250
01251 #ifdef yyoverflow
01252 {
01253
01254
01255
01256 YYSTYPE *yyvs1 = yyvs;
01257 yytype_int16 *yyss1 = yyss;
01258
01259
01260
01261
01262
01263 yyoverflow (YY_("memory exhausted"),
01264 &yyss1, yysize * sizeof (*yyssp),
01265 &yyvs1, yysize * sizeof (*yyvsp),
01266 &yystacksize);
01267
01268 yyss = yyss1;
01269 yyvs = yyvs1;
01270 }
01271 #else
01272 # ifndef YYSTACK_RELOCATE
01273 goto yyexhaustedlab;
01274 # else
01275
01276 if (YYMAXDEPTH <= yystacksize)
01277 goto yyexhaustedlab;
01278 yystacksize *= 2;
01279 if (YYMAXDEPTH < yystacksize)
01280 yystacksize = YYMAXDEPTH;
01281
01282 {
01283 yytype_int16 *yyss1 = yyss;
01284 union yyalloc *yyptr =
01285 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01286 if (! yyptr)
01287 goto yyexhaustedlab;
01288 YYSTACK_RELOCATE (yyss_alloc, yyss);
01289 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
01290 # undef YYSTACK_RELOCATE
01291 if (yyss1 != yyssa)
01292 YYSTACK_FREE (yyss1);
01293 }
01294 # endif
01295 #endif
01296
01297 yyssp = yyss + yysize - 1;
01298 yyvsp = yyvs + yysize - 1;
01299
01300 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01301 (unsigned long int) yystacksize));
01302
01303 if (yyss + yystacksize - 1 <= yyssp)
01304 YYABORT;
01305 }
01306
01307 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01308
01309 if (yystate == YYFINAL)
01310 YYACCEPT;
01311
01312 goto yybackup;
01313
01314
01315
01316
01317 yybackup:
01318
01319
01320
01321
01322
01323 yyn = yypact[yystate];
01324 if (yyn == YYPACT_NINF)
01325 goto yydefault;
01326
01327
01328
01329
01330 if (yychar == YYEMPTY)
01331 {
01332 YYDPRINTF ((stderr, "Reading a token: "));
01333 yychar = YYLEX;
01334 }
01335
01336 if (yychar <= YYEOF)
01337 {
01338 yychar = yytoken = YYEOF;
01339 YYDPRINTF ((stderr, "Now at end of input.\n"));
01340 }
01341 else
01342 {
01343 yytoken = YYTRANSLATE (yychar);
01344 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01345 }
01346
01347
01348
01349 yyn += yytoken;
01350 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01351 goto yydefault;
01352 yyn = yytable[yyn];
01353 if (yyn <= 0)
01354 {
01355 if (yyn == 0 || yyn == YYTABLE_NINF)
01356 goto yyerrlab;
01357 yyn = -yyn;
01358 goto yyreduce;
01359 }
01360
01361
01362
01363 if (yyerrstatus)
01364 yyerrstatus--;
01365
01366
01367 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01368
01369
01370 yychar = YYEMPTY;
01371
01372 yystate = yyn;
01373 *++yyvsp = yylval;
01374
01375 goto yynewstate;
01376
01377
01378
01379
01380
01381 yydefault:
01382 yyn = yydefact[yystate];
01383 if (yyn == 0)
01384 goto yyerrlab;
01385 goto yyreduce;
01386
01387
01388
01389
01390
01391 yyreduce:
01392
01393 yylen = yyr2[yyn];
01394
01395
01396
01397
01398
01399
01400
01401
01402
01403 yyval = yyvsp[1-yylen];
01404
01405
01406 YY_REDUCE_PRINT (yyn);
01407 switch (yyn)
01408 {
01409 case 5:
01410
01411
01412 #line 80 "jsgf_parser.y"
01413 { jsgf->name = (yyvsp[(2) - (2)].name); }
01414 break;
01415
01416 case 7:
01417
01418
01419 #line 84 "jsgf_parser.y"
01420 { jsgf->version = (yyvsp[(2) - (3)].name); }
01421 break;
01422
01423 case 8:
01424
01425
01426 #line 85 "jsgf_parser.y"
01427 { jsgf->version = (yyvsp[(2) - (4)].name); jsgf->charset = (yyvsp[(3) - (4)].name); }
01428 break;
01429
01430 case 9:
01431
01432
01433 #line 86 "jsgf_parser.y"
01434 { jsgf->version = (yyvsp[(2) - (5)].name); jsgf->charset = (yyvsp[(3) - (5)].name);
01435 jsgf->locale = (yyvsp[(4) - (5)].name); }
01436 break;
01437
01438 case 10:
01439
01440
01441 #line 90 "jsgf_parser.y"
01442 { (yyval.name) = (yyvsp[(2) - (3)].name); }
01443 break;
01444
01445 case 13:
01446
01447
01448 #line 97 "jsgf_parser.y"
01449 { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name)); ckd_free((yyvsp[(2) - (3)].name)); }
01450 break;
01451
01452 case 16:
01453
01454
01455 #line 104 "jsgf_parser.y"
01456 { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0); ckd_free((yyvsp[(1) - (4)].name)); }
01457 break;
01458
01459 case 17:
01460
01461
01462 #line 105 "jsgf_parser.y"
01463 { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1); ckd_free((yyvsp[(2) - (5)].name)); }
01464 break;
01465
01466 case 18:
01467
01468
01469 #line 108 "jsgf_parser.y"
01470 { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms); }
01471 break;
01472
01473 case 19:
01474
01475
01476 #line 109 "jsgf_parser.y"
01477 { (yyval.rhs) = (yyvsp[(3) - (3)].rhs);
01478 (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms);
01479 (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); }
01480 break;
01481
01482 case 20:
01483
01484
01485 #line 114 "jsgf_parser.y"
01486 { (yyval.rhs) = ckd_calloc(1, sizeof(*(yyval.rhs)));
01487 (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); }
01488 break;
01489
01490 case 21:
01491
01492
01493 #line 116 "jsgf_parser.y"
01494 { (yyval.rhs) = (yyvsp[(1) - (2)].rhs);
01495 (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); }
01496 break;
01497
01498 case 23:
01499
01500
01501 #line 121 "jsgf_parser.y"
01502 { (yyval.atom) = (yyvsp[(1) - (2)].atom);
01503 (yyval.atom)->tags = glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); }
01504 break;
01505
01506 case 25:
01507
01508
01509 #line 126 "jsgf_parser.y"
01510 { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); }
01511 break;
01512
01513 case 26:
01514
01515
01516 #line 129 "jsgf_parser.y"
01517 { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); }
01518 break;
01519
01520 case 27:
01521
01522
01523 #line 132 "jsgf_parser.y"
01524 { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); }
01525 break;
01526
01527 case 28:
01528
01529
01530 #line 135 "jsgf_parser.y"
01531 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); }
01532 break;
01533
01534 case 29:
01535
01536
01537 #line 136 "jsgf_parser.y"
01538 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); }
01539 break;
01540
01541 case 30:
01542
01543
01544 #line 137 "jsgf_parser.y"
01545 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
01546 break;
01547
01548 case 31:
01549
01550
01551 #line 138 "jsgf_parser.y"
01552 { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
01553 break;
01554
01555 case 32:
01556
01557
01558 #line 139 "jsgf_parser.y"
01559 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); }
01560 break;
01561
01562 case 33:
01563
01564
01565 #line 140 "jsgf_parser.y"
01566 { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); }
01567 break;
01568
01569
01570
01571
01572 #line 1573 "jsgf_parser.c"
01573 default: break;
01574 }
01575 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01576
01577 YYPOPSTACK (yylen);
01578 yylen = 0;
01579 YY_STACK_PRINT (yyss, yyssp);
01580
01581 *++yyvsp = yyval;
01582
01583
01584
01585
01586
01587 yyn = yyr1[yyn];
01588
01589 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01590 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01591 yystate = yytable[yystate];
01592 else
01593 yystate = yydefgoto[yyn - YYNTOKENS];
01594
01595 goto yynewstate;
01596
01597
01598
01599
01600
01601 yyerrlab:
01602
01603 if (!yyerrstatus)
01604 {
01605 ++yynerrs;
01606 #if ! YYERROR_VERBOSE
01607 yyerror (yyscanner, jsgf, YY_("syntax error"));
01608 #else
01609 {
01610 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01611 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01612 {
01613 YYSIZE_T yyalloc = 2 * yysize;
01614 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01615 yyalloc = YYSTACK_ALLOC_MAXIMUM;
01616 if (yymsg != yymsgbuf)
01617 YYSTACK_FREE (yymsg);
01618 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01619 if (yymsg)
01620 yymsg_alloc = yyalloc;
01621 else
01622 {
01623 yymsg = yymsgbuf;
01624 yymsg_alloc = sizeof yymsgbuf;
01625 }
01626 }
01627
01628 if (0 < yysize && yysize <= yymsg_alloc)
01629 {
01630 (void) yysyntax_error (yymsg, yystate, yychar);
01631 yyerror (yyscanner, jsgf, yymsg);
01632 }
01633 else
01634 {
01635 yyerror (yyscanner, jsgf, YY_("syntax error"));
01636 if (yysize != 0)
01637 goto yyexhaustedlab;
01638 }
01639 }
01640 #endif
01641 }
01642
01643
01644
01645 if (yyerrstatus == 3)
01646 {
01647
01648
01649
01650 if (yychar <= YYEOF)
01651 {
01652
01653 if (yychar == YYEOF)
01654 YYABORT;
01655 }
01656 else
01657 {
01658 yydestruct ("Error: discarding",
01659 yytoken, &yylval, yyscanner, jsgf);
01660 yychar = YYEMPTY;
01661 }
01662 }
01663
01664
01665
01666 goto yyerrlab1;
01667
01668
01669
01670
01671
01672 yyerrorlab:
01673
01674
01675
01676
01677 if ( 0)
01678 goto yyerrorlab;
01679
01680
01681
01682 YYPOPSTACK (yylen);
01683 yylen = 0;
01684 YY_STACK_PRINT (yyss, yyssp);
01685 yystate = *yyssp;
01686 goto yyerrlab1;
01687
01688
01689
01690
01691
01692 yyerrlab1:
01693 yyerrstatus = 3;
01694
01695 for (;;)
01696 {
01697 yyn = yypact[yystate];
01698 if (yyn != YYPACT_NINF)
01699 {
01700 yyn += YYTERROR;
01701 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01702 {
01703 yyn = yytable[yyn];
01704 if (0 < yyn)
01705 break;
01706 }
01707 }
01708
01709
01710 if (yyssp == yyss)
01711 YYABORT;
01712
01713
01714 yydestruct ("Error: popping",
01715 yystos[yystate], yyvsp, yyscanner, jsgf);
01716 YYPOPSTACK (1);
01717 yystate = *yyssp;
01718 YY_STACK_PRINT (yyss, yyssp);
01719 }
01720
01721 *++yyvsp = yylval;
01722
01723
01724
01725 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01726
01727 yystate = yyn;
01728 goto yynewstate;
01729
01730
01731
01732
01733
01734 yyacceptlab:
01735 yyresult = 0;
01736 goto yyreturn;
01737
01738
01739
01740
01741 yyabortlab:
01742 yyresult = 1;
01743 goto yyreturn;
01744
01745 #if !defined(yyoverflow) || YYERROR_VERBOSE
01746
01747
01748
01749 yyexhaustedlab:
01750 yyerror (yyscanner, jsgf, YY_("memory exhausted"));
01751 yyresult = 2;
01752
01753 #endif
01754
01755 yyreturn:
01756 if (yychar != YYEMPTY)
01757 yydestruct ("Cleanup: discarding lookahead",
01758 yytoken, &yylval, yyscanner, jsgf);
01759
01760
01761 YYPOPSTACK (yylen);
01762 YY_STACK_PRINT (yyss, yyssp);
01763 while (yyssp != yyss)
01764 {
01765 yydestruct ("Cleanup: popping",
01766 yystos[*yyssp], yyvsp, yyscanner, jsgf);
01767 YYPOPSTACK (1);
01768 }
01769 #ifndef yyoverflow
01770 if (yyss != yyssa)
01771 YYSTACK_FREE (yyss);
01772 #endif
01773 #if YYERROR_VERBOSE
01774 if (yymsg != yymsgbuf)
01775 YYSTACK_FREE (yymsg);
01776 #endif
01777
01778 return YYID (yyresult);
01779 }
01780
01781
01782
01783
01784 #line 143 "jsgf_parser.y"
01785
01786
01787 void
01788 yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s)
01789 {
01790 fprintf(stderr, "ERROR: %s\n", s);
01791 }
01792