• Main Page
  • Related Pages
  • Data Structures
  • Files
  • File List
  • Globals

src/libsphinxbase/lm/jsgf_parser.c

00001 /* A Bison parser, made by GNU Bison 2.3.  */
00002 
00003 /* Skeleton implementation for Bison's Yacc-like parsers in C
00004 
00005    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
00006    Free Software Foundation, Inc.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2, or (at your option)
00011    any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00021    Boston, MA 02110-1301, USA.  */
00022 
00023 /* As a special exception, you may create a larger work that contains
00024    part or all of the Bison parser skeleton and distribute that work
00025    under terms of your choice, so long as that work isn't itself a
00026    parser generator using the skeleton or a modified version thereof
00027    as a parser skeleton.  Alternatively, if you modify or redistribute
00028    the parser skeleton itself, you may (at your option) remove this
00029    special exception, which will cause the skeleton and the resulting
00030    Bison output files to be licensed under the GNU General Public
00031    License without this special exception.
00032 
00033    This special exception was added by the Free Software Foundation in
00034    version 2.2 of Bison.  */
00035 
00036 /* C LALR(1) parser skeleton written by Richard Stallman, by
00037    simplifying the original so-called "semantic" parser.  */
00038 
00039 /* All symbols defined below should begin with yy or YY, to avoid
00040    infringing on user name space.  This should be done even for local
00041    variables, as they might otherwise be expanded by user macros.
00042    There are some unavoidable exceptions within include files to
00043    define necessary library symbols; they are noted "INFRINGES ON
00044    USER NAME SPACE" below.  */
00045 
00046 /* Identify Bison output.  */
00047 #define YYBISON 1
00048 
00049 /* Bison version.  */
00050 #define YYBISON_VERSION "2.3"
00051 
00052 /* Skeleton name.  */
00053 #define YYSKELETON_NAME "yacc.c"
00054 
00055 /* Pure parsers.  */
00056 #define YYPURE 1
00057 
00058 /* Using locations.  */
00059 #define YYLSP_NEEDED 0
00060 
00061 
00062 
00063 /* Tokens.  */
00064 #ifndef YYTOKENTYPE
00065 # define YYTOKENTYPE
00066    /* Put the tokens into the symbol table, so that GDB and other debuggers
00067       know about them.  */
00068    enum yytokentype {
00069      HEADER = 258,
00070      GRAMMAR = 259,
00071      IMPORT = 260,
00072      PUBLIC = 261,
00073      TOKEN = 262,
00074      RULENAME = 263,
00075      TAG = 264,
00076      WEIGHT = 265
00077    };
00078 #endif
00079 /* Tokens.  */
00080 #define HEADER 258
00081 #define GRAMMAR 259
00082 #define IMPORT 260
00083 #define PUBLIC 261
00084 #define TOKEN 262
00085 #define RULENAME 263
00086 #define TAG 264
00087 #define WEIGHT 265
00088 
00089 
00090 
00091 
00092 /* Copy the first part of user declarations.  */
00093 #line 37 "jsgf_parser.y"
00094 
00095 #include <stdio.h>
00096 #include <string.h>
00097 
00098 #include <hash_table.h>
00099 #include <ckd_alloc.h>
00100 #include <err.h>
00101 
00102 #include "jsgf_internal.h"
00103 #include "jsgf_parser.h"
00104 #include "jsgf_scanner.h"
00105 
00106 void yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s);
00107 
00108 
00109 
00110 /* Enabling traces.  */
00111 #ifndef YYDEBUG
00112 # define YYDEBUG 0
00113 #endif
00114 
00115 /* Enabling verbose error messages.  */
00116 #ifdef YYERROR_VERBOSE
00117 # undef YYERROR_VERBOSE
00118 # define YYERROR_VERBOSE 1
00119 #else
00120 # define YYERROR_VERBOSE 0
00121 #endif
00122 
00123 /* Enabling the token table.  */
00124 #ifndef YYTOKEN_TABLE
00125 # define YYTOKEN_TABLE 0
00126 #endif
00127 
00128 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00129 typedef union YYSTYPE
00130 #line 58 "jsgf_parser.y"
00131 {
00132        char *name;
00133        float weight;
00134        jsgf_rule_t *rule;
00135        jsgf_rhs_t *rhs;
00136        jsgf_atom_t *atom;
00137 }
00138 /* Line 187 of yacc.c.  */
00139 #line 140 "jsgf_parser.c"
00140         YYSTYPE;
00141 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00142 # define YYSTYPE_IS_DECLARED 1
00143 # define YYSTYPE_IS_TRIVIAL 1
00144 #endif
00145 
00146 
00147 
00148 /* Copy the second part of user declarations.  */
00149 
00150 
00151 /* Line 216 of yacc.c.  */
00152 #line 153 "jsgf_parser.c"
00153 
00154 #ifdef short
00155 # undef short
00156 #endif
00157 
00158 #ifdef YYTYPE_UINT8
00159 typedef YYTYPE_UINT8 yytype_uint8;
00160 #else
00161 typedef unsigned char yytype_uint8;
00162 #endif
00163 
00164 #ifdef YYTYPE_INT8
00165 typedef YYTYPE_INT8 yytype_int8;
00166 #elif (defined __STDC__ || defined __C99__FUNC__ \
00167      || defined __cplusplus || defined _MSC_VER)
00168 typedef signed char yytype_int8;
00169 #else
00170 typedef short int yytype_int8;
00171 #endif
00172 
00173 #ifdef YYTYPE_UINT16
00174 typedef YYTYPE_UINT16 yytype_uint16;
00175 #else
00176 typedef unsigned short int yytype_uint16;
00177 #endif
00178 
00179 #ifdef YYTYPE_INT16
00180 typedef YYTYPE_INT16 yytype_int16;
00181 #else
00182 typedef short int yytype_int16;
00183 #endif
00184 
00185 #ifndef YYSIZE_T
00186 # ifdef __SIZE_TYPE__
00187 #  define YYSIZE_T __SIZE_TYPE__
00188 # elif defined size_t
00189 #  define YYSIZE_T size_t
00190 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00191      || defined __cplusplus || defined _MSC_VER)
00192 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00193 #  define YYSIZE_T size_t
00194 # else
00195 #  define YYSIZE_T unsigned int
00196 # endif
00197 #endif
00198 
00199 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00200 
00201 #ifndef YY_
00202 # if YYENABLE_NLS
00203 #  if ENABLE_NLS
00204 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00205 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00206 #  endif
00207 # endif
00208 # ifndef YY_
00209 #  define YY_(msgid) msgid
00210 # endif
00211 #endif
00212 
00213 /* Suppress unused-variable warnings by "using" E.  */
00214 #if ! defined lint || defined __GNUC__
00215 # define YYUSE(e) ((void) (e))
00216 #else
00217 # define YYUSE(e) /* empty */
00218 #endif
00219 
00220 /* Identity function, used to suppress warnings about constant conditions.  */
00221 #ifndef lint
00222 # define YYID(n) (n)
00223 #else
00224 #if (defined __STDC__ || defined __C99__FUNC__ \
00225      || defined __cplusplus || defined _MSC_VER)
00226 static int
00227 YYID (int i)
00228 #else
00229 static int
00230 YYID (i)
00231     int i;
00232 #endif
00233 {
00234   return i;
00235 }
00236 #endif
00237 
00238 #if ! defined yyoverflow || YYERROR_VERBOSE
00239 
00240 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00241 
00242 # ifdef YYSTACK_USE_ALLOCA
00243 #  if YYSTACK_USE_ALLOCA
00244 #   ifdef __GNUC__
00245 #    define YYSTACK_ALLOC __builtin_alloca
00246 #   elif defined __BUILTIN_VA_ARG_INCR
00247 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00248 #   elif defined _AIX
00249 #    define YYSTACK_ALLOC __alloca
00250 #   elif defined _MSC_VER
00251 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00252 #    define alloca _alloca
00253 #   else
00254 #    define YYSTACK_ALLOC alloca
00255 #    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00256      || defined __cplusplus || defined _MSC_VER)
00257 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00258 #     ifndef _STDLIB_H
00259 #      define _STDLIB_H 1
00260 #     endif
00261 #    endif
00262 #   endif
00263 #  endif
00264 # endif
00265 
00266 # ifdef YYSTACK_ALLOC
00267    /* Pacify GCC's `empty if-body' warning.  */
00268 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00269 #  ifndef YYSTACK_ALLOC_MAXIMUM
00270     /* The OS might guarantee only one guard page at the bottom of the stack,
00271        and a page size can be as small as 4096 bytes.  So we cannot safely
00272        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00273        to allow for a few compiler-allocated temporary stack slots.  */
00274 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00275 #  endif
00276 # else
00277 #  define YYSTACK_ALLOC YYMALLOC
00278 #  define YYSTACK_FREE YYFREE
00279 #  ifndef YYSTACK_ALLOC_MAXIMUM
00280 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00281 #  endif
00282 #  if (defined __cplusplus && ! defined _STDLIB_H \
00283        && ! ((defined YYMALLOC || defined malloc) \
00284              && (defined YYFREE || defined free)))
00285 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00286 #   ifndef _STDLIB_H
00287 #    define _STDLIB_H 1
00288 #   endif
00289 #  endif
00290 #  ifndef YYMALLOC
00291 #   define YYMALLOC malloc
00292 #   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00293      || defined __cplusplus || defined _MSC_VER)
00294 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00295 #   endif
00296 #  endif
00297 #  ifndef YYFREE
00298 #   define YYFREE free
00299 #   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00300      || defined __cplusplus || defined _MSC_VER)
00301 void free (void *); /* INFRINGES ON USER NAME SPACE */
00302 #   endif
00303 #  endif
00304 # endif
00305 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
00306 
00307 
00308 #if (! defined yyoverflow \
00309      && (! defined __cplusplus \
00310          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00311 
00312 /* A type that is properly aligned for any stack member.  */
00313 union yyalloc
00314 {
00315   yytype_int16 yyss;
00316   YYSTYPE yyvs;
00317   };
00318 
00319 /* The size of the maximum gap between one aligned stack and the next.  */
00320 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00321 
00322 /* The size of an array large to enough to hold all stacks, each with
00323    N elements.  */
00324 # define YYSTACK_BYTES(N) \
00325      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00326       + YYSTACK_GAP_MAXIMUM)
00327 
00328 /* Copy COUNT objects from FROM to TO.  The source and destination do
00329    not overlap.  */
00330 # ifndef YYCOPY
00331 #  if defined __GNUC__ && 1 < __GNUC__
00332 #   define YYCOPY(To, From, Count) \
00333       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00334 #  else
00335 #   define YYCOPY(To, From, Count)              \
00336       do                                        \
00337         {                                       \
00338           YYSIZE_T yyi;                         \
00339           for (yyi = 0; yyi < (Count); yyi++)   \
00340             (To)[yyi] = (From)[yyi];            \
00341         }                                       \
00342       while (YYID (0))
00343 #  endif
00344 # endif
00345 
00346 /* Relocate STACK from its old location to the new one.  The
00347    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00348    elements in the stack, and YYPTR gives the new location of the
00349    stack.  Advance YYPTR to a properly aligned location for the next
00350    stack.  */
00351 # define YYSTACK_RELOCATE(Stack)                                        \
00352     do                                                                  \
00353       {                                                                 \
00354         YYSIZE_T yynewbytes;                                            \
00355         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
00356         Stack = &yyptr->Stack;                                          \
00357         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00358         yyptr += yynewbytes / sizeof (*yyptr);                          \
00359       }                                                                 \
00360     while (YYID (0))
00361 
00362 #endif
00363 
00364 /* YYFINAL -- State number of the termination state.  */
00365 #define YYFINAL  7
00366 /* YYLAST -- Last index in YYTABLE.  */
00367 #define YYLAST   54
00368 
00369 /* YYNTOKENS -- Number of terminals.  */
00370 #define YYNTOKENS  20
00371 /* YYNNTS -- Number of nonterminals.  */
00372 #define YYNNTS  16
00373 /* YYNRULES -- Number of rules.  */
00374 #define YYNRULES  33
00375 /* YYNRULES -- Number of states.  */
00376 #define YYNSTATES  58
00377 
00378 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00379 #define YYUNDEFTOK  2
00380 #define YYMAXUTOK   265
00381 
00382 #define YYTRANSLATE(YYX)                                                \
00383   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00384 
00385 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00386 static const yytype_uint8 yytranslate[] =
00387 {
00388        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00389        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00390        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00391        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00392       14,    15,    18,    19,     2,     2,     2,     2,     2,     2,
00393        2,     2,     2,     2,     2,     2,     2,     2,     2,    11,
00394        2,    12,     2,     2,     2,     2,     2,     2,     2,     2,
00395        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00396        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00397        2,    16,     2,    17,     2,     2,     2,     2,     2,     2,
00398        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00399        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00400        2,     2,     2,     2,    13,     2,     2,     2,     2,     2,
00401        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00402        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00403        2,     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        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00408        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00409        2,     2,     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,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00413        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00414        5,     6,     7,     8,     9,    10
00415 };
00416 
00417 #if YYDEBUG
00418 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00419    YYRHS.  */
00420 static const yytype_uint8 yyprhs[] =
00421 {
00422        0,     0,     3,     5,     8,    12,    15,    18,    22,    27,
00423       33,    37,    39,    42,    46,    48,    51,    56,    62,    64,
00424       68,    70,    73,    75,    78,    80,    83,    87,    91,    93,
00425       95,    97,    99,   102
00426 };
00427 
00428 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00429 static const yytype_int8 yyrhs[] =
00430 {
00431       21,     0,    -1,    22,    -1,    22,    27,    -1,    22,    25,
00432       27,    -1,    23,    24,    -1,     3,    11,    -1,     3,     7,
00433       11,    -1,     3,     7,     7,    11,    -1,     3,     7,     7,
00434        7,    11,    -1,     4,     7,    11,    -1,    26,    -1,    25,
00435       26,    -1,     5,     8,    11,    -1,    28,    -1,    27,    28,
00436       -1,     8,    12,    29,    11,    -1,     6,     8,    12,    29,
00437       11,    -1,    30,    -1,    29,    13,    30,    -1,    31,    -1,
00438       30,    31,    -1,    32,    -1,    31,     9,    -1,    35,    -1,
00439       10,    35,    -1,    14,    29,    15,    -1,    16,    29,    17,
00440       -1,     7,    -1,     8,    -1,    33,    -1,    34,    -1,    35,
00441       18,    -1,    35,    19,    -1
00442 };
00443 
00444 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00445 static const yytype_uint8 yyrline[] =
00446 {
00447        0,    75,    75,    76,    77,    80,    83,    84,    85,    86,
00448       90,    93,    94,    97,   100,   101,   104,   105,   108,   109,
00449      114,   116,   120,   121,   125,   126,   129,   132,   135,   136,
00450      137,   138,   139,   140
00451 };
00452 #endif
00453 
00454 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00455 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00456    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00457 static const char *const yytname[] =
00458 {
00459   "$end", "error", "$undefined", "HEADER", "GRAMMAR", "IMPORT", "PUBLIC",
00460   "TOKEN", "RULENAME", "TAG", "WEIGHT", "';'", "'='", "'|'", "'('", "')'",
00461   "'['", "']'", "'*'", "'+'", "$accept", "grammar", "header",
00462   "jsgf_header", "grammar_header", "import_header", "import_statement",
00463   "rule_list", "rule", "alternate_list", "rule_expansion",
00464   "tagged_rule_item", "rule_item", "rule_group", "rule_optional",
00465   "rule_atom", 0
00466 };
00467 #endif
00468 
00469 # ifdef YYPRINT
00470 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00471    token YYLEX-NUM.  */
00472 static const yytype_uint16 yytoknum[] =
00473 {
00474        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00475      265,    59,    61,   124,    40,    41,    91,    93,    42,    43
00476 };
00477 # endif
00478 
00479 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00480 static const yytype_uint8 yyr1[] =
00481 {
00482        0,    20,    21,    21,    21,    22,    23,    23,    23,    23,
00483       24,    25,    25,    26,    27,    27,    28,    28,    29,    29,
00484       30,    30,    31,    31,    32,    32,    33,    34,    35,    35,
00485       35,    35,    35,    35
00486 };
00487 
00488 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00489 static const yytype_uint8 yyr2[] =
00490 {
00491        0,     2,     1,     2,     3,     2,     2,     3,     4,     5,
00492        3,     1,     2,     3,     1,     2,     4,     5,     1,     3,
00493        1,     2,     1,     2,     1,     2,     3,     3,     1,     1,
00494        1,     1,     2,     2
00495 };
00496 
00497 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
00498    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
00499    means the default is an error.  */
00500 static const yytype_uint8 yydefact[] =
00501 {
00502        0,     0,     0,     2,     0,     0,     6,     1,     0,     0,
00503        0,     0,    11,     3,    14,     0,     5,     0,     7,     0,
00504        0,     0,    12,     4,    15,     0,     0,     8,    13,     0,
00505       28,    29,     0,     0,     0,     0,    18,    20,    22,    30,
00506       31,    24,    10,     9,     0,    25,     0,     0,    16,     0,
00507       21,    23,    32,    33,    17,    26,    27,    19
00508 };
00509 
00510 /* YYDEFGOTO[NTERM-NUM].  */
00511 static const yytype_int8 yydefgoto[] =
00512 {
00513       -1,     2,     3,     4,    16,    11,    12,    13,    14,    35,
00514       36,    37,    38,    39,    40,    41
00515 };
00516 
00517 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00518    STATE-NUM.  */
00519 #define YYPACT_NINF -37
00520 static const yytype_int8 yypact[] =
00521 {
00522       -1,    -2,    36,    22,    35,     8,   -37,   -37,    32,    33,
00523       30,    22,   -37,    17,   -37,    37,   -37,    13,   -37,    34,
00524       31,    -4,   -37,    17,   -37,    38,    39,   -37,   -37,    -4,
00525      -37,   -37,     0,    -4,    -4,    18,    -4,    42,   -37,   -37,
00526      -37,    19,   -37,   -37,    21,    19,    20,     9,   -37,    -4,
00527       42,   -37,   -37,   -37,   -37,   -37,   -37,    -4
00528 };
00529 
00530 /* YYPGOTO[NTERM-NUM].  */
00531 static const yytype_int8 yypgoto[] =
00532 {
00533      -37,   -37,   -37,   -37,   -37,   -37,    41,    43,   -12,   -16,
00534       -3,   -36,   -37,   -37,   -37,    15
00535 };
00536 
00537 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00538    positive, shift that token.  If negative, reduce the rule which
00539    number is the opposite.  If zero, do what YYDEFACT says.
00540    If YYTABLE_NINF, syntax error.  */
00541 #define YYTABLE_NINF -1
00542 static const yytype_uint8 yytable[] =
00543 {
00544       50,    24,     1,    30,    31,     5,    32,    30,    31,     6,
00545       33,    24,    34,    44,    33,    17,    34,    46,    47,    18,
00546       26,    50,    49,     9,    27,    10,    56,     8,     9,    48,
00547       10,    49,    54,    49,    49,    55,     7,    52,    53,    15,
00548       19,    20,    21,    29,    25,    28,    57,    45,     0,    42,
00549       43,    51,    22,     0,    23
00550 };
00551 
00552 static const yytype_int8 yycheck[] =
00553 {
00554       36,    13,     3,     7,     8,     7,    10,     7,     8,    11,
00555       14,    23,    16,    29,    14,     7,    16,    33,    34,    11,
00556        7,    57,    13,     6,    11,     8,    17,     5,     6,    11,
00557        8,    13,    11,    13,    13,    15,     0,    18,    19,     4,
00558        8,     8,    12,    12,     7,    11,    49,    32,    -1,    11,
00559       11,     9,    11,    -1,    11
00560 };
00561 
00562 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00563    symbol of state STATE-NUM.  */
00564 static const yytype_uint8 yystos[] =
00565 {
00566        0,     3,    21,    22,    23,     7,    11,     0,     5,     6,
00567        8,    25,    26,    27,    28,     4,    24,     7,    11,     8,
00568        8,    12,    26,    27,    28,     7,     7,    11,    11,    12,
00569        7,     8,    10,    14,    16,    29,    30,    31,    32,    33,
00570       34,    35,    11,    11,    29,    35,    29,    29,    11,    13,
00571       31,     9,    18,    19,    11,    15,    17,    30
00572 };
00573 
00574 #define yyerrok         (yyerrstatus = 0)
00575 #define yyclearin       (yychar = YYEMPTY)
00576 #define YYEMPTY         (-2)
00577 #define YYEOF           0
00578 
00579 #define YYACCEPT        goto yyacceptlab
00580 #define YYABORT         goto yyabortlab
00581 #define YYERROR         goto yyerrorlab
00582 
00583 
00584 /* Like YYERROR except do call yyerror.  This remains here temporarily
00585    to ease the transition to the new meaning of YYERROR, for GCC.
00586    Once GCC version 2 has supplanted version 1, this can go.  */
00587 
00588 #define YYFAIL          goto yyerrlab
00589 
00590 #define YYRECOVERING()  (!!yyerrstatus)
00591 
00592 #define YYBACKUP(Token, Value)                                  \
00593 do                                                              \
00594   if (yychar == YYEMPTY && yylen == 1)                          \
00595     {                                                           \
00596       yychar = (Token);                                         \
00597       yylval = (Value);                                         \
00598       yytoken = YYTRANSLATE (yychar);                           \
00599       YYPOPSTACK (1);                                           \
00600       goto yybackup;                                            \
00601     }                                                           \
00602   else                                                          \
00603     {                                                           \
00604       yyerror (yyscanner, jsgf, YY_("syntax error: cannot back up")); \
00605       YYERROR;                                                  \
00606     }                                                           \
00607 while (YYID (0))
00608 
00609 
00610 #define YYTERROR        1
00611 #define YYERRCODE       256
00612 
00613 
00614 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00615    If N is 0, then set CURRENT to the empty location which ends
00616    the previous symbol: RHS[0] (always defined).  */
00617 
00618 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00619 #ifndef YYLLOC_DEFAULT
00620 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
00621     do                                                                  \
00622       if (YYID (N))                                                    \
00623         {                                                               \
00624           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
00625           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
00626           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
00627           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
00628         }                                                               \
00629       else                                                              \
00630         {                                                               \
00631           (Current).first_line   = (Current).last_line   =              \
00632             YYRHSLOC (Rhs, 0).last_line;                                \
00633           (Current).first_column = (Current).last_column =              \
00634             YYRHSLOC (Rhs, 0).last_column;                              \
00635         }                                                               \
00636     while (YYID (0))
00637 #endif
00638 
00639 
00640 /* YY_LOCATION_PRINT -- Print the location on the stream.
00641    This macro was not mandated originally: define only if we know
00642    we won't break user code: when these are the locations we know.  */
00643 
00644 #ifndef YY_LOCATION_PRINT
00645 # if YYLTYPE_IS_TRIVIAL
00646 #  define YY_LOCATION_PRINT(File, Loc)                  \
00647      fprintf (File, "%d.%d-%d.%d",                      \
00648               (Loc).first_line, (Loc).first_column,     \
00649               (Loc).last_line,  (Loc).last_column)
00650 # else
00651 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00652 # endif
00653 #endif
00654 
00655 
00656 /* YYLEX -- calling `yylex' with the right arguments.  */
00657 
00658 #ifdef YYLEX_PARAM
00659 # define YYLEX yylex (&yylval, YYLEX_PARAM)
00660 #else
00661 # define YYLEX yylex (&yylval, yyscanner)
00662 #endif
00663 
00664 /* Enable debugging if requested.  */
00665 #if YYDEBUG
00666 
00667 # ifndef YYFPRINTF
00668 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
00669 #  define YYFPRINTF fprintf
00670 # endif
00671 
00672 # define YYDPRINTF(Args)                        \
00673 do {                                            \
00674   if (yydebug)                                  \
00675     YYFPRINTF Args;                             \
00676 } while (YYID (0))
00677 
00678 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
00679 do {                                                                      \
00680   if (yydebug)                                                            \
00681     {                                                                     \
00682       YYFPRINTF (stderr, "%s ", Title);                                   \
00683       yy_symbol_print (stderr,                                            \
00684                   Type, Value, yyscanner, jsgf); \
00685       YYFPRINTF (stderr, "\n");                                           \
00686     }                                                                     \
00687 } while (YYID (0))
00688 
00689 
00690 /*--------------------------------.
00691 | Print this symbol on YYOUTPUT.  |
00692 `--------------------------------*/
00693 
00694 /*ARGSUSED*/
00695 #if (defined __STDC__ || defined __C99__FUNC__ \
00696      || defined __cplusplus || defined _MSC_VER)
00697 static void
00698 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
00699 #else
00700 static void
00701 yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
00702     FILE *yyoutput;
00703     int yytype;
00704     YYSTYPE const * const yyvaluep;
00705     yyscan_t yyscanner;
00706     jsgf_t *jsgf;
00707 #endif
00708 {
00709   if (!yyvaluep)
00710     return;
00711   YYUSE (yyscanner);
00712   YYUSE (jsgf);
00713 # ifdef YYPRINT
00714   if (yytype < YYNTOKENS)
00715     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00716 # else
00717   YYUSE (yyoutput);
00718 # endif
00719   switch (yytype)
00720     {
00721       default:
00722         break;
00723     }
00724 }
00725 
00726 
00727 /*--------------------------------.
00728 | Print this symbol on YYOUTPUT.  |
00729 `--------------------------------*/
00730 
00731 #if (defined __STDC__ || defined __C99__FUNC__ \
00732      || defined __cplusplus || defined _MSC_VER)
00733 static void
00734 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
00735 #else
00736 static void
00737 yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf)
00738     FILE *yyoutput;
00739     int yytype;
00740     YYSTYPE const * const yyvaluep;
00741     yyscan_t yyscanner;
00742     jsgf_t *jsgf;
00743 #endif
00744 {
00745   if (yytype < YYNTOKENS)
00746     YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00747   else
00748     YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00749 
00750   yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, jsgf);
00751   YYFPRINTF (yyoutput, ")");
00752 }
00753 
00754 /*------------------------------------------------------------------.
00755 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
00756 | TOP (included).                                                   |
00757 `------------------------------------------------------------------*/
00758 
00759 #if (defined __STDC__ || defined __C99__FUNC__ \
00760      || defined __cplusplus || defined _MSC_VER)
00761 static void
00762 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
00763 #else
00764 static void
00765 yy_stack_print (bottom, top)
00766     yytype_int16 *bottom;
00767     yytype_int16 *top;
00768 #endif
00769 {
00770   YYFPRINTF (stderr, "Stack now");
00771   for (; bottom <= top; ++bottom)
00772     YYFPRINTF (stderr, " %d", *bottom);
00773   YYFPRINTF (stderr, "\n");
00774 }
00775 
00776 # define YY_STACK_PRINT(Bottom, Top)                            \
00777 do {                                                            \
00778   if (yydebug)                                                  \
00779     yy_stack_print ((Bottom), (Top));                           \
00780 } while (YYID (0))
00781 
00782 
00783 /*------------------------------------------------.
00784 | Report that the YYRULE is going to be reduced.  |
00785 `------------------------------------------------*/
00786 
00787 #if (defined __STDC__ || defined __C99__FUNC__ \
00788      || defined __cplusplus || defined _MSC_VER)
00789 static void
00790 yy_reduce_print (YYSTYPE *yyvsp, int yyrule, yyscan_t yyscanner, jsgf_t *jsgf)
00791 #else
00792 static void
00793 yy_reduce_print (yyvsp, yyrule, yyscanner, jsgf)
00794     YYSTYPE *yyvsp;
00795     int yyrule;
00796     yyscan_t yyscanner;
00797     jsgf_t *jsgf;
00798 #endif
00799 {
00800   int yynrhs = yyr2[yyrule];
00801   int yyi;
00802   unsigned long int yylno = yyrline[yyrule];
00803   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00804              yyrule - 1, yylno);
00805   /* The symbols being reduced.  */
00806   for (yyi = 0; yyi < yynrhs; yyi++)
00807     {
00808       fprintf (stderr, "   $%d = ", yyi + 1);
00809       yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00810                        &(yyvsp[(yyi + 1) - (yynrhs)])
00811                                        , yyscanner, jsgf);
00812       fprintf (stderr, "\n");
00813     }
00814 }
00815 
00816 # define YY_REDUCE_PRINT(Rule)          \
00817 do {                                    \
00818   if (yydebug)                          \
00819     yy_reduce_print (yyvsp, Rule, yyscanner, jsgf); \
00820 } while (YYID (0))
00821 
00822 /* Nonzero means print parse trace.  It is left uninitialized so that
00823    multiple parsers can coexist.  */
00824 int yydebug;
00825 #else /* !YYDEBUG */
00826 # define YYDPRINTF(Args)
00827 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00828 # define YY_STACK_PRINT(Bottom, Top)
00829 # define YY_REDUCE_PRINT(Rule)
00830 #endif /* !YYDEBUG */
00831 
00832 
00833 /* YYINITDEPTH -- initial size of the parser's stacks.  */
00834 #ifndef YYINITDEPTH
00835 # define YYINITDEPTH 200
00836 #endif
00837 
00838 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
00839    if the built-in stack extension method is used).
00840 
00841    Do not make this value too large; the results are undefined if
00842    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
00843    evaluated with infinite-precision integer arithmetic.  */
00844 
00845 #ifndef YYMAXDEPTH
00846 # define YYMAXDEPTH 10000
00847 #endif
00848 
00849 
00850 
00851 #if YYERROR_VERBOSE
00852 
00853 # ifndef yystrlen
00854 #  if defined __GLIBC__ && defined _STRING_H
00855 #   define yystrlen strlen
00856 #  else
00857 /* Return the length of YYSTR.  */
00858 #if (defined __STDC__ || defined __C99__FUNC__ \
00859      || defined __cplusplus || defined _MSC_VER)
00860 static YYSIZE_T
00861 yystrlen (const char *yystr)
00862 #else
00863 static YYSIZE_T
00864 yystrlen (yystr)
00865     const char *yystr;
00866 #endif
00867 {
00868   YYSIZE_T yylen;
00869   for (yylen = 0; yystr[yylen]; yylen++)
00870     continue;
00871   return yylen;
00872 }
00873 #  endif
00874 # endif
00875 
00876 # ifndef yystpcpy
00877 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00878 #   define yystpcpy stpcpy
00879 #  else
00880 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
00881    YYDEST.  */
00882 #if (defined __STDC__ || defined __C99__FUNC__ \
00883      || defined __cplusplus || defined _MSC_VER)
00884 static char *
00885 yystpcpy (char *yydest, const char *yysrc)
00886 #else
00887 static char *
00888 yystpcpy (yydest, yysrc)
00889     char *yydest;
00890     const char *yysrc;
00891 #endif
00892 {
00893   char *yyd = yydest;
00894   const char *yys = yysrc;
00895 
00896   while ((*yyd++ = *yys++) != '\0')
00897     continue;
00898 
00899   return yyd - 1;
00900 }
00901 #  endif
00902 # endif
00903 
00904 # ifndef yytnamerr
00905 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
00906    quotes and backslashes, so that it's suitable for yyerror.  The
00907    heuristic is that double-quoting is unnecessary unless the string
00908    contains an apostrophe, a comma, or backslash (other than
00909    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
00910    null, do not copy; instead, return the length of what the result
00911    would have been.  */
00912 static YYSIZE_T
00913 yytnamerr (char *yyres, const char *yystr)
00914 {
00915   if (*yystr == '"')
00916     {
00917       YYSIZE_T yyn = 0;
00918       char const *yyp = yystr;
00919 
00920       for (;;)
00921         switch (*++yyp)
00922           {
00923           case '\'':
00924           case ',':
00925             goto do_not_strip_quotes;
00926 
00927           case '\\':
00928             if (*++yyp != '\\')
00929               goto do_not_strip_quotes;
00930             /* Fall through.  */
00931           default:
00932             if (yyres)
00933               yyres[yyn] = *yyp;
00934             yyn++;
00935             break;
00936 
00937           case '"':
00938             if (yyres)
00939               yyres[yyn] = '\0';
00940             return yyn;
00941           }
00942     do_not_strip_quotes: ;
00943     }
00944 
00945   if (! yyres)
00946     return yystrlen (yystr);
00947 
00948   return yystpcpy (yyres, yystr) - yyres;
00949 }
00950 # endif
00951 
00952 /* Copy into YYRESULT an error message about the unexpected token
00953    YYCHAR while in state YYSTATE.  Return the number of bytes copied,
00954    including the terminating null byte.  If YYRESULT is null, do not
00955    copy anything; just return the number of bytes that would be
00956    copied.  As a special case, return 0 if an ordinary "syntax error"
00957    message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
00958    size calculation.  */
00959 static YYSIZE_T
00960 yysyntax_error (char *yyresult, int yystate, int yychar)
00961 {
00962   int yyn = yypact[yystate];
00963 
00964   if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
00965     return 0;
00966   else
00967     {
00968       int yytype = YYTRANSLATE (yychar);
00969       YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
00970       YYSIZE_T yysize = yysize0;
00971       YYSIZE_T yysize1;
00972       int yysize_overflow = 0;
00973       enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
00974       char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
00975       int yyx;
00976 
00977 # if 0
00978       /* This is so xgettext sees the translatable formats that are
00979          constructed on the fly.  */
00980       YY_("syntax error, unexpected %s");
00981       YY_("syntax error, unexpected %s, expecting %s");
00982       YY_("syntax error, unexpected %s, expecting %s or %s");
00983       YY_("syntax error, unexpected %s, expecting %s or %s or %s");
00984       YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
00985 # endif
00986       char *yyfmt;
00987       char const *yyf;
00988       static char const yyunexpected[] = "syntax error, unexpected %s";
00989       static char const yyexpecting[] = ", expecting %s";
00990       static char const yyor[] = " or %s";
00991       char yyformat[sizeof yyunexpected
00992                     + sizeof yyexpecting - 1
00993                     + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
00994                        * (sizeof yyor - 1))];
00995       char const *yyprefix = yyexpecting;
00996 
00997       /* Start YYX at -YYN if negative to avoid negative indexes in
00998          YYCHECK.  */
00999       int yyxbegin = yyn < 0 ? -yyn : 0;
01000 
01001       /* Stay within bounds of both yycheck and yytname.  */
01002       int yychecklim = YYLAST - yyn + 1;
01003       int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01004       int yycount = 1;
01005 
01006       yyarg[0] = yytname[yytype];
01007       yyfmt = yystpcpy (yyformat, yyunexpected);
01008 
01009       for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01010         if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01011           {
01012             if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01013               {
01014                 yycount = 1;
01015                 yysize = yysize0;
01016                 yyformat[sizeof yyunexpected - 1] = '\0';
01017                 break;
01018               }
01019             yyarg[yycount++] = yytname[yyx];
01020             yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01021             yysize_overflow |= (yysize1 < yysize);
01022             yysize = yysize1;
01023             yyfmt = yystpcpy (yyfmt, yyprefix);
01024             yyprefix = yyor;
01025           }
01026 
01027       yyf = YY_(yyformat);
01028       yysize1 = yysize + yystrlen (yyf);
01029       yysize_overflow |= (yysize1 < yysize);
01030       yysize = yysize1;
01031 
01032       if (yysize_overflow)
01033         return YYSIZE_MAXIMUM;
01034 
01035       if (yyresult)
01036         {
01037           /* Avoid sprintf, as that infringes on the user's name space.
01038              Don't have undefined behavior even if the translation
01039              produced a string with the wrong number of "%s"s.  */
01040           char *yyp = yyresult;
01041           int yyi = 0;
01042           while ((*yyp = *yyf) != '\0')
01043             {
01044               if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01045                 {
01046                   yyp += yytnamerr (yyp, yyarg[yyi++]);
01047                   yyf += 2;
01048                 }
01049               else
01050                 {
01051                   yyp++;
01052                   yyf++;
01053                 }
01054             }
01055         }
01056       return yysize;
01057     }
01058 }
01059 #endif /* YYERROR_VERBOSE */
01060 
01061 
01062 /*-----------------------------------------------.
01063 | Release the memory associated to this symbol.  |
01064 `-----------------------------------------------*/
01065 
01066 /*ARGSUSED*/
01067 #if (defined __STDC__ || defined __C99__FUNC__ \
01068      || defined __cplusplus || defined _MSC_VER)
01069 static void
01070 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, yyscan_t yyscanner, jsgf_t *jsgf)
01071 #else
01072 static void
01073 yydestruct (yymsg, yytype, yyvaluep, yyscanner, jsgf)
01074     const char *yymsg;
01075     int yytype;
01076     YYSTYPE *yyvaluep;
01077     yyscan_t yyscanner;
01078     jsgf_t *jsgf;
01079 #endif
01080 {
01081   YYUSE (yyvaluep);
01082   YYUSE (yyscanner);
01083   YYUSE (jsgf);
01084 
01085   if (!yymsg)
01086     yymsg = "Deleting";
01087   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01088 
01089   switch (yytype)
01090     {
01091 
01092       default:
01093         break;
01094     }
01095 }
01096 
01097 
01098 /* Prevent warnings from -Wmissing-prototypes.  */
01099 
01100 #ifdef YYPARSE_PARAM
01101 #if defined __STDC__ || defined __cplusplus
01102 int yyparse (void *YYPARSE_PARAM);
01103 #else
01104 int yyparse ();
01105 #endif
01106 #else /* ! YYPARSE_PARAM */
01107 #if defined __STDC__ || defined __cplusplus
01108 int yyparse (yyscan_t yyscanner, jsgf_t *jsgf);
01109 #else
01110 int yyparse ();
01111 #endif
01112 #endif /* ! YYPARSE_PARAM */
01113 
01114 
01115 
01116 
01117 
01118 
01119 /*----------.
01120 | yyparse.  |
01121 `----------*/
01122 
01123 #ifdef YYPARSE_PARAM
01124 #if (defined __STDC__ || defined __C99__FUNC__ \
01125      || defined __cplusplus || defined _MSC_VER)
01126 int
01127 yyparse (void *YYPARSE_PARAM)
01128 #else
01129 int
01130 yyparse (YYPARSE_PARAM)
01131     void *YYPARSE_PARAM;
01132 #endif
01133 #else /* ! YYPARSE_PARAM */
01134 #if (defined __STDC__ || defined __C99__FUNC__ \
01135      || defined __cplusplus || defined _MSC_VER)
01136 int
01137 yyparse (yyscan_t yyscanner, jsgf_t *jsgf)
01138 #else
01139 int
01140 yyparse (yyscanner, jsgf)
01141     yyscan_t yyscanner;
01142     jsgf_t *jsgf;
01143 #endif
01144 #endif
01145 {
01146   /* The look-ahead symbol.  */
01147 int yychar;
01148 
01149 /* The semantic value of the look-ahead symbol.  */
01150 YYSTYPE yylval;
01151 
01152 /* Number of syntax errors so far.  */
01153 int yynerrs;
01154 
01155   int yystate;
01156   int yyn;
01157   int yyresult;
01158   /* Number of tokens to shift before error messages enabled.  */
01159   int yyerrstatus;
01160   /* Look-ahead token as an internal (translated) token number.  */
01161   int yytoken = 0;
01162 #if YYERROR_VERBOSE
01163   /* Buffer for error messages, and its allocated size.  */
01164   char yymsgbuf[128];
01165   char *yymsg = yymsgbuf;
01166   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01167 #endif
01168 
01169   /* Three stacks and their tools:
01170      `yyss': related to states,
01171      `yyvs': related to semantic values,
01172      `yyls': related to locations.
01173 
01174      Refer to the stacks thru separate pointers, to allow yyoverflow
01175      to reallocate them elsewhere.  */
01176 
01177   /* The state stack.  */
01178   yytype_int16 yyssa[YYINITDEPTH];
01179   yytype_int16 *yyss = yyssa;
01180   yytype_int16 *yyssp;
01181 
01182   /* The semantic value stack.  */
01183   YYSTYPE yyvsa[YYINITDEPTH];
01184   YYSTYPE *yyvs = yyvsa;
01185   YYSTYPE *yyvsp;
01186 
01187 
01188 
01189 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
01190 
01191   YYSIZE_T yystacksize = YYINITDEPTH;
01192 
01193   /* The variables used to return semantic value and location from the
01194      action routines.  */
01195   YYSTYPE yyval;
01196 
01197 
01198   /* The number of symbols on the RHS of the reduced rule.
01199      Keep to zero when no symbol should be popped.  */
01200   int yylen = 0;
01201 
01202   YYDPRINTF ((stderr, "Starting parse\n"));
01203 
01204   yystate = 0;
01205   yyerrstatus = 0;
01206   yynerrs = 0;
01207   yychar = YYEMPTY;             /* Cause a token to be read.  */
01208 
01209   /* Initialize stack pointers.
01210      Waste one element of value and location stack
01211      so that they stay on the same level as the state stack.
01212      The wasted elements are never initialized.  */
01213 
01214   yyssp = yyss;
01215   yyvsp = yyvs;
01216 
01217   goto yysetstate;
01218 
01219 /*------------------------------------------------------------.
01220 | yynewstate -- Push a new state, which is found in yystate.  |
01221 `------------------------------------------------------------*/
01222  yynewstate:
01223   /* In all cases, when you get here, the value and location stacks
01224      have just been pushed.  So pushing a state here evens the stacks.  */
01225   yyssp++;
01226 
01227  yysetstate:
01228   *yyssp = yystate;
01229 
01230   if (yyss + yystacksize - 1 <= yyssp)
01231     {
01232       /* Get the current used size of the three stacks, in elements.  */
01233       YYSIZE_T yysize = yyssp - yyss + 1;
01234 
01235 #ifdef yyoverflow
01236       {
01237         /* Give user a chance to reallocate the stack.  Use copies of
01238            these so that the &'s don't force the real ones into
01239            memory.  */
01240         YYSTYPE *yyvs1 = yyvs;
01241         yytype_int16 *yyss1 = yyss;
01242 
01243 
01244         /* Each stack pointer address is followed by the size of the
01245            data in use in that stack, in bytes.  This used to be a
01246            conditional around just the two extra args, but that might
01247            be undefined if yyoverflow is a macro.  */
01248         yyoverflow (YY_("memory exhausted"),
01249                     &yyss1, yysize * sizeof (*yyssp),
01250                     &yyvs1, yysize * sizeof (*yyvsp),
01251 
01252                     &yystacksize);
01253 
01254         yyss = yyss1;
01255         yyvs = yyvs1;
01256       }
01257 #else /* no yyoverflow */
01258 # ifndef YYSTACK_RELOCATE
01259       goto yyexhaustedlab;
01260 # else
01261       /* Extend the stack our own way.  */
01262       if (YYMAXDEPTH <= yystacksize)
01263         goto yyexhaustedlab;
01264       yystacksize *= 2;
01265       if (YYMAXDEPTH < yystacksize)
01266         yystacksize = YYMAXDEPTH;
01267 
01268       {
01269         yytype_int16 *yyss1 = yyss;
01270         union yyalloc *yyptr =
01271           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01272         if (! yyptr)
01273           goto yyexhaustedlab;
01274         YYSTACK_RELOCATE (yyss);
01275         YYSTACK_RELOCATE (yyvs);
01276 
01277 #  undef YYSTACK_RELOCATE
01278         if (yyss1 != yyssa)
01279           YYSTACK_FREE (yyss1);
01280       }
01281 # endif
01282 #endif /* no yyoverflow */
01283 
01284       yyssp = yyss + yysize - 1;
01285       yyvsp = yyvs + yysize - 1;
01286 
01287 
01288       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01289                   (unsigned long int) yystacksize));
01290 
01291       if (yyss + yystacksize - 1 <= yyssp)
01292         YYABORT;
01293     }
01294 
01295   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01296 
01297   goto yybackup;
01298 
01299 /*-----------.
01300 | yybackup.  |
01301 `-----------*/
01302 yybackup:
01303 
01304   /* Do appropriate processing given the current state.  Read a
01305      look-ahead token if we need one and don't already have one.  */
01306 
01307   /* First try to decide what to do without reference to look-ahead token.  */
01308   yyn = yypact[yystate];
01309   if (yyn == YYPACT_NINF)
01310     goto yydefault;
01311 
01312   /* Not known => get a look-ahead token if don't already have one.  */
01313 
01314   /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
01315   if (yychar == YYEMPTY)
01316     {
01317       YYDPRINTF ((stderr, "Reading a token: "));
01318       yychar = YYLEX;
01319     }
01320 
01321   if (yychar <= YYEOF)
01322     {
01323       yychar = yytoken = YYEOF;
01324       YYDPRINTF ((stderr, "Now at end of input.\n"));
01325     }
01326   else
01327     {
01328       yytoken = YYTRANSLATE (yychar);
01329       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01330     }
01331 
01332   /* If the proper action on seeing token YYTOKEN is to reduce or to
01333      detect an error, take that action.  */
01334   yyn += yytoken;
01335   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01336     goto yydefault;
01337   yyn = yytable[yyn];
01338   if (yyn <= 0)
01339     {
01340       if (yyn == 0 || yyn == YYTABLE_NINF)
01341         goto yyerrlab;
01342       yyn = -yyn;
01343       goto yyreduce;
01344     }
01345 
01346   if (yyn == YYFINAL)
01347     YYACCEPT;
01348 
01349   /* Count tokens shifted since error; after three, turn off error
01350      status.  */
01351   if (yyerrstatus)
01352     yyerrstatus--;
01353 
01354   /* Shift the look-ahead token.  */
01355   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01356 
01357   /* Discard the shifted token unless it is eof.  */
01358   if (yychar != YYEOF)
01359     yychar = YYEMPTY;
01360 
01361   yystate = yyn;
01362   *++yyvsp = yylval;
01363 
01364   goto yynewstate;
01365 
01366 
01367 /*-----------------------------------------------------------.
01368 | yydefault -- do the default action for the current state.  |
01369 `-----------------------------------------------------------*/
01370 yydefault:
01371   yyn = yydefact[yystate];
01372   if (yyn == 0)
01373     goto yyerrlab;
01374   goto yyreduce;
01375 
01376 
01377 /*-----------------------------.
01378 | yyreduce -- Do a reduction.  |
01379 `-----------------------------*/
01380 yyreduce:
01381   /* yyn is the number of a rule to reduce with.  */
01382   yylen = yyr2[yyn];
01383 
01384   /* If YYLEN is nonzero, implement the default value of the action:
01385      `$$ = $1'.
01386 
01387      Otherwise, the following line sets YYVAL to garbage.
01388      This behavior is undocumented and Bison
01389      users should not rely upon it.  Assigning to YYVAL
01390      unconditionally makes the parser a bit smaller, and it avoids a
01391      GCC warning that YYVAL may be used uninitialized.  */
01392   yyval = yyvsp[1-yylen];
01393 
01394 
01395   YY_REDUCE_PRINT (yyn);
01396   switch (yyn)
01397     {
01398         case 5:
01399 #line 80 "jsgf_parser.y"
01400     { jsgf->name = (yyvsp[(2) - (2)].name); }
01401     break;
01402 
01403   case 7:
01404 #line 84 "jsgf_parser.y"
01405     { jsgf->version = (yyvsp[(2) - (3)].name); }
01406     break;
01407 
01408   case 8:
01409 #line 85 "jsgf_parser.y"
01410     { jsgf->version = (yyvsp[(2) - (4)].name); jsgf->charset = (yyvsp[(3) - (4)].name); }
01411     break;
01412 
01413   case 9:
01414 #line 86 "jsgf_parser.y"
01415     { jsgf->version = (yyvsp[(2) - (5)].name); jsgf->charset = (yyvsp[(3) - (5)].name);
01416                                          jsgf->locale = (yyvsp[(4) - (5)].name); }
01417     break;
01418 
01419   case 10:
01420 #line 90 "jsgf_parser.y"
01421     { (yyval.name) = (yyvsp[(2) - (3)].name); }
01422     break;
01423 
01424   case 13:
01425 #line 97 "jsgf_parser.y"
01426     { jsgf_import_rule(jsgf, (yyvsp[(2) - (3)].name)); ckd_free((yyvsp[(2) - (3)].name)); }
01427     break;
01428 
01429   case 16:
01430 #line 104 "jsgf_parser.y"
01431     { jsgf_define_rule(jsgf, (yyvsp[(1) - (4)].name), (yyvsp[(3) - (4)].rhs), 0); ckd_free((yyvsp[(1) - (4)].name)); }
01432     break;
01433 
01434   case 17:
01435 #line 105 "jsgf_parser.y"
01436     { jsgf_define_rule(jsgf, (yyvsp[(2) - (5)].name), (yyvsp[(4) - (5)].rhs), 1); ckd_free((yyvsp[(2) - (5)].name)); }
01437     break;
01438 
01439   case 18:
01440 #line 108 "jsgf_parser.y"
01441     { (yyval.rhs) = (yyvsp[(1) - (1)].rhs); (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms); }
01442     break;
01443 
01444   case 19:
01445 #line 109 "jsgf_parser.y"
01446     { (yyval.rhs) = (yyvsp[(3) - (3)].rhs);
01447                                               (yyval.rhs)->atoms = glist_reverse((yyval.rhs)->atoms);
01448                                               (yyval.rhs)->alt = (yyvsp[(1) - (3)].rhs); }
01449     break;
01450 
01451   case 20:
01452 #line 114 "jsgf_parser.y"
01453     { (yyval.rhs) = ckd_calloc(1, sizeof(*(yyval.rhs)));
01454                                    (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(1) - (1)].atom)); }
01455     break;
01456 
01457   case 21:
01458 #line 116 "jsgf_parser.y"
01459     { (yyval.rhs) = (yyvsp[(1) - (2)].rhs);
01460                                             (yyval.rhs)->atoms = glist_add_ptr((yyval.rhs)->atoms, (yyvsp[(2) - (2)].atom)); }
01461     break;
01462 
01463   case 23:
01464 #line 121 "jsgf_parser.y"
01465     { (yyval.atom) = (yyvsp[(1) - (2)].atom);
01466                                  (yyval.atom)->tags = glist_add_ptr((yyval.atom)->tags, (yyvsp[(2) - (2)].name)); }
01467     break;
01468 
01469   case 25:
01470 #line 126 "jsgf_parser.y"
01471     { (yyval.atom) = (yyvsp[(2) - (2)].atom); (yyval.atom)->weight = (yyvsp[(1) - (2)].weight); }
01472     break;
01473 
01474   case 26:
01475 #line 129 "jsgf_parser.y"
01476     { (yyval.rule) = jsgf_define_rule(jsgf, NULL, (yyvsp[(2) - (3)].rhs), 0); }
01477     break;
01478 
01479   case 27:
01480 #line 132 "jsgf_parser.y"
01481     { (yyval.rule) = jsgf_optional_new(jsgf, (yyvsp[(2) - (3)].rhs)); }
01482     break;
01483 
01484   case 28:
01485 #line 135 "jsgf_parser.y"
01486     { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); }
01487     break;
01488 
01489   case 29:
01490 #line 136 "jsgf_parser.y"
01491     { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].name), 1.0); ckd_free((yyvsp[(1) - (1)].name)); }
01492     break;
01493 
01494   case 30:
01495 #line 137 "jsgf_parser.y"
01496     { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
01497     break;
01498 
01499   case 31:
01500 #line 138 "jsgf_parser.y"
01501     { (yyval.atom) = jsgf_atom_new((yyvsp[(1) - (1)].rule)->name, 1.0); }
01502     break;
01503 
01504   case 32:
01505 #line 139 "jsgf_parser.y"
01506     { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 0); }
01507     break;
01508 
01509   case 33:
01510 #line 140 "jsgf_parser.y"
01511     { (yyval.atom) = jsgf_kleene_new(jsgf, (yyvsp[(1) - (2)].atom), 1); }
01512     break;
01513 
01514 
01515 /* Line 1267 of yacc.c.  */
01516 #line 1517 "jsgf_parser.c"
01517       default: break;
01518     }
01519   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01520 
01521   YYPOPSTACK (yylen);
01522   yylen = 0;
01523   YY_STACK_PRINT (yyss, yyssp);
01524 
01525   *++yyvsp = yyval;
01526 
01527 
01528   /* Now `shift' the result of the reduction.  Determine what state
01529      that goes to, based on the state we popped back to and the rule
01530      number reduced by.  */
01531 
01532   yyn = yyr1[yyn];
01533 
01534   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01535   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01536     yystate = yytable[yystate];
01537   else
01538     yystate = yydefgoto[yyn - YYNTOKENS];
01539 
01540   goto yynewstate;
01541 
01542 
01543 /*------------------------------------.
01544 | yyerrlab -- here on detecting error |
01545 `------------------------------------*/
01546 yyerrlab:
01547   /* If not already recovering from an error, report this error.  */
01548   if (!yyerrstatus)
01549     {
01550       ++yynerrs;
01551 #if ! YYERROR_VERBOSE
01552       yyerror (yyscanner, jsgf, YY_("syntax error"));
01553 #else
01554       {
01555         YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01556         if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01557           {
01558             YYSIZE_T yyalloc = 2 * yysize;
01559             if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01560               yyalloc = YYSTACK_ALLOC_MAXIMUM;
01561             if (yymsg != yymsgbuf)
01562               YYSTACK_FREE (yymsg);
01563             yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01564             if (yymsg)
01565               yymsg_alloc = yyalloc;
01566             else
01567               {
01568                 yymsg = yymsgbuf;
01569                 yymsg_alloc = sizeof yymsgbuf;
01570               }
01571           }
01572 
01573         if (0 < yysize && yysize <= yymsg_alloc)
01574           {
01575             (void) yysyntax_error (yymsg, yystate, yychar);
01576             yyerror (yyscanner, jsgf, yymsg);
01577           }
01578         else
01579           {
01580             yyerror (yyscanner, jsgf, YY_("syntax error"));
01581             if (yysize != 0)
01582               goto yyexhaustedlab;
01583           }
01584       }
01585 #endif
01586     }
01587 
01588 
01589 
01590   if (yyerrstatus == 3)
01591     {
01592       /* If just tried and failed to reuse look-ahead token after an
01593          error, discard it.  */
01594 
01595       if (yychar <= YYEOF)
01596         {
01597           /* Return failure if at end of input.  */
01598           if (yychar == YYEOF)
01599             YYABORT;
01600         }
01601       else
01602         {
01603           yydestruct ("Error: discarding",
01604                       yytoken, &yylval, yyscanner, jsgf);
01605           yychar = YYEMPTY;
01606         }
01607     }
01608 
01609   /* Else will try to reuse look-ahead token after shifting the error
01610      token.  */
01611   goto yyerrlab1;
01612 
01613 
01614 /*---------------------------------------------------.
01615 | yyerrorlab -- error raised explicitly by YYERROR.  |
01616 `---------------------------------------------------*/
01617 yyerrorlab:
01618 
01619   /* Pacify compilers like GCC when the user code never invokes
01620      YYERROR and the label yyerrorlab therefore never appears in user
01621      code.  */
01622   if (/*CONSTCOND*/ 0)
01623      goto yyerrorlab;
01624 
01625   /* Do not reclaim the symbols of the rule which action triggered
01626      this YYERROR.  */
01627   YYPOPSTACK (yylen);
01628   yylen = 0;
01629   YY_STACK_PRINT (yyss, yyssp);
01630   yystate = *yyssp;
01631   goto yyerrlab1;
01632 
01633 
01634 /*-------------------------------------------------------------.
01635 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
01636 `-------------------------------------------------------------*/
01637 yyerrlab1:
01638   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
01639 
01640   for (;;)
01641     {
01642       yyn = yypact[yystate];
01643       if (yyn != YYPACT_NINF)
01644         {
01645           yyn += YYTERROR;
01646           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01647             {
01648               yyn = yytable[yyn];
01649               if (0 < yyn)
01650                 break;
01651             }
01652         }
01653 
01654       /* Pop the current state because it cannot handle the error token.  */
01655       if (yyssp == yyss)
01656         YYABORT;
01657 
01658 
01659       yydestruct ("Error: popping",
01660                   yystos[yystate], yyvsp, yyscanner, jsgf);
01661       YYPOPSTACK (1);
01662       yystate = *yyssp;
01663       YY_STACK_PRINT (yyss, yyssp);
01664     }
01665 
01666   if (yyn == YYFINAL)
01667     YYACCEPT;
01668 
01669   *++yyvsp = yylval;
01670 
01671 
01672   /* Shift the error token.  */
01673   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01674 
01675   yystate = yyn;
01676   goto yynewstate;
01677 
01678 
01679 /*-------------------------------------.
01680 | yyacceptlab -- YYACCEPT comes here.  |
01681 `-------------------------------------*/
01682 yyacceptlab:
01683   yyresult = 0;
01684   goto yyreturn;
01685 
01686 /*-----------------------------------.
01687 | yyabortlab -- YYABORT comes here.  |
01688 `-----------------------------------*/
01689 yyabortlab:
01690   yyresult = 1;
01691   goto yyreturn;
01692 
01693 #ifndef yyoverflow
01694 /*-------------------------------------------------.
01695 | yyexhaustedlab -- memory exhaustion comes here.  |
01696 `-------------------------------------------------*/
01697 yyexhaustedlab:
01698   yyerror (yyscanner, jsgf, YY_("memory exhausted"));
01699   yyresult = 2;
01700   /* Fall through.  */
01701 #endif
01702 
01703 yyreturn:
01704   if (yychar != YYEOF && yychar != YYEMPTY)
01705      yydestruct ("Cleanup: discarding lookahead",
01706                  yytoken, &yylval, yyscanner, jsgf);
01707   /* Do not reclaim the symbols of the rule which action triggered
01708      this YYABORT or YYACCEPT.  */
01709   YYPOPSTACK (yylen);
01710   YY_STACK_PRINT (yyss, yyssp);
01711   while (yyssp != yyss)
01712     {
01713       yydestruct ("Cleanup: popping",
01714                   yystos[*yyssp], yyvsp, yyscanner, jsgf);
01715       YYPOPSTACK (1);
01716     }
01717 #ifndef yyoverflow
01718   if (yyss != yyssa)
01719     YYSTACK_FREE (yyss);
01720 #endif
01721 #if YYERROR_VERBOSE
01722   if (yymsg != yymsgbuf)
01723     YYSTACK_FREE (yymsg);
01724 #endif
01725   /* Make sure YYID is used.  */
01726   return YYID (yyresult);
01727 }
01728 
01729 
01730 #line 143 "jsgf_parser.y"
01731 
01732 
01733 void
01734 yyerror(yyscan_t lex, jsgf_t *jsgf, const char *s)
01735 {
01736     fprintf(stderr, "ERROR: %s\n", s);
01737 }
01738 

Generated on Fri Jan 14 2011 for SphinxBase by  doxygen 1.7.1