lac : bb0ed3c03b8d8d6bbd9dd6aef39dbeaaa63ef2f0

     1: /* A Bison parser, made by GNU Bison 3.0.4.  */
     2: 
     3: /* Bison implementation for Yacc-like parsers in C
     4: 
     5:    Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
     6: 
     7:    This program is free software: you can redistribute it and/or modify
     8:    it under the terms of the GNU General Public License as published by
     9:    the Free Software Foundation, either version 3 of the License, or
    10:    (at your option) any later version.
    11: 
    12:    This program is distributed in the hope that it will be useful,
    13:    but WITHOUT ANY WARRANTY; without even the implied warranty of
    14:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    15:    GNU General Public License for more details.
    16: 
    17:    You should have received a copy of the GNU General Public License
    18:    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
    19: 
    20: /* As a special exception, you may create a larger work that contains
    21:    part or all of the Bison parser skeleton and distribute that work
    22:    under terms of your choice, so long as that work isn't itself a
    23:    parser generator using the skeleton or a modified version thereof
    24:    as a parser skeleton.  Alternatively, if you modify or redistribute
    25:    the parser skeleton itself, you may (at your option) remove this
    26:    special exception, which will cause the skeleton and the resulting
    27:    Bison output files to be licensed under the GNU General Public
    28:    License without this special exception.
    29: 
    30:    This special exception was added by the Free Software Foundation in
    31:    version 2.2 of Bison.  */
    32: 
    33: /* C LALR(1) parser skeleton written by Richard Stallman, by
    34:    simplifying the original so-called "semantic" parser.  */
    35: 
    36: /* All symbols defined below should begin with yy or YY, to avoid
    37:    infringing on user name space.  This should be done even for local
    38:    variables, as they might otherwise be expanded by user macros.
    39:    There are some unavoidable exceptions within include files to
    40:    define necessary library symbols; they are noted "INFRINGES ON
    41:    USER NAME SPACE" below.  */
    42: 
    43: /* Identify Bison output.  */
    44: #define YYBISON 1
    45: 
    46: /* Bison version.  */
    47: #define YYBISON_VERSION "3.0.4"
    48: 
    49: /* Skeleton name.  */
    50: #define YYSKELETON_NAME "yacc.c"
    51: 
    52: /* Pure parsers.  */
    53: #define YYPURE 2
    54: 
    55: /* Push parsers.  */
    56: #define YYPUSH 0
    57: 
    58: /* Pull parsers.  */
    59: #define YYPULL 1
    60: 
    61: 
    62: 
    63: 
    64: /* Copy the first part of user declarations.  */
    65: #line 20 "sexpr_parse.y" /* yacc.c:339  */
    66: 
    67: #include <stdio.h>
    68: #include <string.h>
    69: #include <gc/gc.h>
    70: #include "lac.h"
    71: #include "sexpr_parse.h"
    72: 
    73: int yylex(lreg_t *, void *);
    74: void yyerror (lreg_t *lr, void *scanner, const char *msgp)  /* Called by yyparse on error */
    75: {
    76: }
    77: 
    78: 
    79: #line 80 "sexpr_parse.c" /* yacc.c:339  */
    80: 
    81: # ifndef YY_NULLPTR
    82: #  if defined __cplusplus && 201103L <= __cplusplus
    83: #   define YY_NULLPTR nullptr
    84: #  else
    85: #   define YY_NULLPTR 0
    86: #  endif
    87: # endif
    88: 
    89: /* Enabling verbose error messages.  */
    90: #ifdef YYERROR_VERBOSE
    91: # undef YYERROR_VERBOSE
    92: # define YYERROR_VERBOSE 1
    93: #else
    94: # define YYERROR_VERBOSE 0
    95: #endif
    96: 
    97: /* In a future release of Bison, this section will be replaced
    98:    by #include "y.tab.h".  */
    99: #ifndef YY_YY_SEXPR_PARSE_H_INCLUDED
   100: # define YY_YY_SEXPR_PARSE_H_INCLUDED
   101: /* Debug traces.  */
   102: #ifndef YYDEBUG
   103: # define YYDEBUG 0
   104: #endif
   105: #if YYDEBUG
   106: extern int yydebug;
   107: #endif
   108: 
   109: /* Token type.  */
   110: #ifndef YYTOKENTYPE
   111: # define YYTOKENTYPE
   112:   enum yytokentype
   113:   {
   114:     ENDOFFILE = 258,
   115:     NIHIL = 259,
   116:     STRING = 260,
   117:     INTEGER = 261,
   118:     SYMBOL = 262,
   119:     DELIMITER = 263,
   120:     COMMA_AT = 264
   121:   };
   122: #endif
   123: /* Tokens.  */
   124: #define ENDOFFILE 258
   125: #define NIHIL 259
   126: #define STRING 260
   127: #define INTEGER 261
   128: #define SYMBOL 262
   129: #define DELIMITER 263
   130: #define COMMA_AT 264
   131: 
   132: /* Value type.  */
   133: #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
   134: typedef  lreg_t  YYSTYPE;
   135: # define YYSTYPE_IS_TRIVIAL 1
   136: # define YYSTYPE_IS_DECLARED 1
   137: #endif
   138: 
   139: 
   140: 
   141: int yyparse (lreg_t *result, void *scan);
   142: 
   143: #endif /* !YY_YY_SEXPR_PARSE_H_INCLUDED  */
   144: 
   145: /* Copy the second part of user declarations.  */
   146: 
   147: #line 148 "sexpr_parse.c" /* yacc.c:358  */
   148: 
   149: #ifdef short
   150: # undef short
   151: #endif
   152: 
   153: #ifdef YYTYPE_UINT8
   154: typedef YYTYPE_UINT8 yytype_uint8;
   155: #else
   156: typedef unsigned char yytype_uint8;
   157: #endif
   158: 
   159: #ifdef YYTYPE_INT8
   160: typedef YYTYPE_INT8 yytype_int8;
   161: #else
   162: typedef signed char yytype_int8;
   163: #endif
   164: 
   165: #ifdef YYTYPE_UINT16
   166: typedef YYTYPE_UINT16 yytype_uint16;
   167: #else
   168: typedef unsigned short int yytype_uint16;
   169: #endif
   170: 
   171: #ifdef YYTYPE_INT16
   172: typedef YYTYPE_INT16 yytype_int16;
   173: #else
   174: typedef short int yytype_int16;
   175: #endif
   176: 
   177: #ifndef YYSIZE_T
   178: # ifdef __SIZE_TYPE__
   179: #  define YYSIZE_T __SIZE_TYPE__
   180: # elif defined size_t
   181: #  define YYSIZE_T size_t
   182: # elif ! defined YYSIZE_T
   183: #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
   184: #  define YYSIZE_T size_t
   185: # else
   186: #  define YYSIZE_T unsigned int
   187: # endif
   188: #endif
   189: 
   190: #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
   191: 
   192: #ifndef YY_
   193: # if defined YYENABLE_NLS && YYENABLE_NLS
   194: #  if ENABLE_NLS
   195: #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
   196: #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
   197: #  endif
   198: # endif
   199: # ifndef YY_
   200: #  define YY_(Msgid) Msgid
   201: # endif
   202: #endif
   203: 
   204: #ifndef YY_ATTRIBUTE
   205: # if (defined __GNUC__                                               \
   206:       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
   207:      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
   208: #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
   209: # else
   210: #  define YY_ATTRIBUTE(Spec) /* empty */
   211: # endif
   212: #endif
   213: 
   214: #ifndef YY_ATTRIBUTE_PURE
   215: # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
   216: #endif
   217: 
   218: #ifndef YY_ATTRIBUTE_UNUSED
   219: # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
   220: #endif
   221: 
   222: #if !defined _Noreturn \
   223:      && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
   224: # if defined _MSC_VER && 1200 <= _MSC_VER
   225: #  define _Noreturn __declspec (noreturn)
   226: # else
   227: #  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
   228: # endif
   229: #endif
   230: 
   231: /* Suppress unused-variable warnings by "using" E.  */
   232: #if ! defined lint || defined __GNUC__
   233: # define YYUSE(E) ((void) (E))
   234: #else
   235: # define YYUSE(E) /* empty */
   236: #endif
   237: 
   238: #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
   239: /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
   240: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
   241:     _Pragma ("GCC diagnostic push") \
   242:     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
   243:     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
   244: # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
   245:     _Pragma ("GCC diagnostic pop")
   246: #else
   247: # define YY_INITIAL_VALUE(Value) Value
   248: #endif
   249: #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   250: # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   251: # define YY_IGNORE_MAYBE_UNINITIALIZED_END
   252: #endif
   253: #ifndef YY_INITIAL_VALUE
   254: # define YY_INITIAL_VALUE(Value) /* Nothing. */
   255: #endif
   256: 
   257: 
   258: #if ! defined yyoverflow || YYERROR_VERBOSE
   259: 
   260: /* The parser invokes alloca or malloc; define the necessary symbols.  */
   261: 
   262: # ifdef YYSTACK_USE_ALLOCA
   263: #  if YYSTACK_USE_ALLOCA
   264: #   ifdef __GNUC__
   265: #    define YYSTACK_ALLOC __builtin_alloca
   266: #   elif defined __BUILTIN_VA_ARG_INCR
   267: #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
   268: #   elif defined _AIX
   269: #    define YYSTACK_ALLOC __alloca
   270: #   elif defined _MSC_VER
   271: #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
   272: #    define alloca _alloca
   273: #   else
   274: #    define YYSTACK_ALLOC alloca
   275: #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
   276: #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
   277:       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
   278: #     ifndef EXIT_SUCCESS
   279: #      define EXIT_SUCCESS 0
   280: #     endif
   281: #    endif
   282: #   endif
   283: #  endif
   284: # endif
   285: 
   286: # ifdef YYSTACK_ALLOC
   287:    /* Pacify GCC's 'empty if-body' warning.  */
   288: #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
   289: #  ifndef YYSTACK_ALLOC_MAXIMUM
   290:     /* The OS might guarantee only one guard page at the bottom of the stack,
   291:        and a page size can be as small as 4096 bytes.  So we cannot safely
   292:        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
   293:        to allow for a few compiler-allocated temporary stack slots.  */
   294: #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
   295: #  endif
   296: # else
   297: #  define YYSTACK_ALLOC YYMALLOC
   298: #  define YYSTACK_FREE YYFREE
   299: #  ifndef YYSTACK_ALLOC_MAXIMUM
   300: #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
   301: #  endif
   302: #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
   303:        && ! ((defined YYMALLOC || defined malloc) \
   304:              && (defined YYFREE || defined free)))
   305: #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
   306: #   ifndef EXIT_SUCCESS
   307: #    define EXIT_SUCCESS 0
   308: #   endif
   309: #  endif
   310: #  ifndef YYMALLOC
   311: #   define YYMALLOC malloc
   312: #   if ! defined malloc && ! defined EXIT_SUCCESS
   313: void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
   314: #   endif
   315: #  endif
   316: #  ifndef YYFREE
   317: #   define YYFREE free
   318: #   if ! defined free && ! defined EXIT_SUCCESS
   319: void free (void *); /* INFRINGES ON USER NAME SPACE */
   320: #   endif
   321: #  endif
   322: # endif
   323: #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
   324: 
   325: 
   326: #if (! defined yyoverflow \
   327:      && (! defined __cplusplus \
   328:          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
   329: 
   330: /* A type that is properly aligned for any stack member.  */
   331: union yyalloc
   332: {
   333:   yytype_int16 yyss_alloc;
   334:   YYSTYPE yyvs_alloc;
   335: };
   336: 
   337: /* The size of the maximum gap between one aligned stack and the next.  */
   338: # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
   339: 
   340: /* The size of an array large to enough to hold all stacks, each with
   341:    N elements.  */
   342: # define YYSTACK_BYTES(N) \
   343:      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
   344:       + YYSTACK_GAP_MAXIMUM)
   345: 
   346: # define YYCOPY_NEEDED 1
   347: 
   348: /* Relocate STACK from its old location to the new one.  The
   349:    local variables YYSIZE and YYSTACKSIZE give the old and new number of
   350:    elements in the stack, and YYPTR gives the new location of the
   351:    stack.  Advance YYPTR to a properly aligned location for the next
   352:    stack.  */
   353: # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
   354:     do                                                                  \
   355:       {                                                                 \
   356:         YYSIZE_T yynewbytes;                                            \
   357:         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
   358:         Stack = &yyptr->Stack_alloc;                                    \
   359:         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
   360:         yyptr += yynewbytes / sizeof (*yyptr);                          \
   361:       }                                                                 \
   362:     while (0)
   363: 
   364: #endif
   365: 
   366: #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
   367: /* Copy COUNT objects from SRC to DST.  The source and destination do
   368:    not overlap.  */
   369: # ifndef YYCOPY
   370: #  if defined __GNUC__ && 1 < __GNUC__
   371: #   define YYCOPY(Dst, Src, Count) \
   372:       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
   373: #  else
   374: #   define YYCOPY(Dst, Src, Count)              \
   375:       do                                        \
   376:         {                                       \
   377:           YYSIZE_T yyi;                         \
   378:           for (yyi = 0; yyi < (Count); yyi++)   \
   379:             (Dst)[yyi] = (Src)[yyi];            \
   380:         }                                       \
   381:       while (0)
   382: #  endif
   383: # endif
   384: #endif /* !YYCOPY_NEEDED */
   385: 
   386: /* YYFINAL -- State number of the termination state.  */
   387: #define YYFINAL  2
   388: /* YYLAST -- Last index in YYTABLE.  */
   389: #define YYLAST   59
   390: 
   391: /* YYNTOKENS -- Number of terminals.  */
   392: #define YYNTOKENS  16
   393: /* YYNNTS -- Number of nonterminals.  */
   394: #define YYNNTS  6
   395: /* YYNRULES -- Number of rules.  */
   396: #define YYNRULES  19
   397: /* YYNSTATES -- Number of states.  */
   398: #define YYNSTATES  29
   399: 
   400: /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
   401:    by yylex, with out-of-bounds checking.  */
   402: #define YYUNDEFTOK  2
   403: #define YYMAXUTOK   264
   404: 
   405: #define YYTRANSLATE(YYX)                                                \
   406:   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
   407: 
   408: /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
   409:    as returned by yylex, without out-of-bounds checking.  */
   410: static const yytype_uint8 yytranslate[] =
   411: {
   412:        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   413:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   414:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   415:        2,     2,     2,     2,     2,     2,     2,     2,     2,    10,
   416:       13,    15,     2,     2,    12,     2,    14,     2,     2,     2,
   417:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   418:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   419:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   420:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   421:        2,     2,     2,     2,     2,     2,    11,     2,     2,     2,
   422:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   423:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   424:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   425:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   426:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   427:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   428:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   429:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   430:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   431:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   432:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   433:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   434:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   435:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   436:        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
   437:        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
   438:        5,     6,     7,     8,     9
   439: };
   440: 
   441: #if YYDEBUG
   442:   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
   443: static const yytype_uint8 yyrline[] =
   444: {
   445:        0,    50,    50,    50,    51,    53,    54,    55,    56,    57,
   446:       58,    59,    60,    62,    64,    65,    67,    67,    67,    67
   447: };
   448: #endif
   449: 
   450: #if YYDEBUG || YYERROR_VERBOSE || 0
   451: /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   452:    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
   453: static const char *const yytname[] =
   454: {
   455:   "$end", "error", "$undefined", "ENDOFFILE", "NIHIL", "STRING",
   456:   "INTEGER", "SYMBOL", "DELIMITER", "COMMA_AT", "'\\''", "'`'", "','",
   457:   "'('", "'.'", "')'", "$accept", "input", "sexpr", "list", "listelem",
   458:   "atom", YY_NULLPTR
   459: };
   460: #endif
   461: 
   462: # ifdef YYPRINT
   463: /* YYTOKNUM[NUM] -- (External) token number corresponding to the
   464:    (internal) symbol number NUM (which must be that of a token).  */
   465: static const yytype_uint16 yytoknum[] =
   466: {
   467:        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
   468:       39,    96,    44,    40,    46,    41
   469: };
   470: # endif
   471: 
   472: #define YYPACT_NINF -21
   473: 
   474: #define yypact_value_is_default(Yystate) \
   475:   (!!((Yystate) == (-21)))
   476: 
   477: #define YYTABLE_NINF -1
   478: 
   479: #define yytable_value_is_error(Yytable_value) \
   480:   0
   481: 
   482:   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   483:      STATE-NUM.  */
   484: static const yytype_int8 yypact[] =
   485: {
   486:      -21,    13,   -21,   -21,   -21,   -21,   -21,   -21,    46,    46,
   487:       46,    46,    23,   -21,   -21,   -21,   -21,   -21,   -21,   -21,
   488:      -21,    35,    46,    46,   -14,   -13,   -21,   -21,   -21
   489: };
   490: 
   491:   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
   492:      Performed when YYTABLE does not specify something else to do.  Zero
   493:      means the default is an error.  */
   494: static const yytype_uint8 yydefact[] =
   495: {
   496:        2,     0,     1,     3,    19,    17,    18,    16,     0,     0,
   497:        0,     0,     0,     4,    12,     5,     8,     6,     7,     9,
   498:       11,    14,     0,    14,     0,     0,    15,    13,    10
   499: };
   500: 
   501:   /* YYPGOTO[NTERM-NUM].  */
   502: static const yytype_int8 yypgoto[] =
   503: {
   504:      -21,   -21,    -1,   -21,   -20,   -21
   505: };
   506: 
   507:   /* YYDEFGOTO[NTERM-NUM].  */
   508: static const yytype_int8 yydefgoto[] =
   509: {
   510:       -1,     1,    23,    14,    24,    15
   511: };
   512: 
   513:   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
   514:      positive, shift that token.  If negative, reduce the rule whose
   515:      number is the opposite.  If YYTABLE_NINF, syntax error.  */
   516: static const yytype_uint8 yytable[] =
   517: {
   518:       13,    27,    28,    26,     0,     0,     0,    16,    17,    18,
   519:       19,    21,     0,     2,     0,     0,     3,     4,     5,     6,
   520:        7,    25,     8,     9,    10,    11,    12,     4,     5,     6,
   521:        7,     0,     8,     9,    10,    11,    12,     0,    20,     4,
   522:        5,     6,     7,     0,     8,     9,    10,    11,    12,    22,
   523:        4,     5,     6,     7,     0,     8,     9,    10,    11,    12
   524: };
   525: 
   526: static const yytype_int8 yycheck[] =
   527: {
   528:        1,    15,    15,    23,    -1,    -1,    -1,     8,     9,    10,
   529:       11,    12,    -1,     0,    -1,    -1,     3,     4,     5,     6,
   530:        7,    22,     9,    10,    11,    12,    13,     4,     5,     6,
   531:        7,    -1,     9,    10,    11,    12,    13,    -1,    15,     4,
   532:        5,     6,     7,    -1,     9,    10,    11,    12,    13,    14,
   533:        4,     5,     6,     7,    -1,     9,    10,    11,    12,    13
   534: };
   535: 
   536:   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   537:      symbol of state STATE-NUM.  */
   538: static const yytype_uint8 yystos[] =
   539: {
   540:        0,    17,     0,     3,     4,     5,     6,     7,     9,    10,
   541:       11,    12,    13,    18,    19,    21,    18,    18,    18,    18,
   542:       15,    18,    14,    18,    20,    18,    20,    15,    15
   543: };
   544: 
   545:   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
   546: static const yytype_uint8 yyr1[] =
   547: {
   548:        0,    16,    17,    17,    17,    18,    18,    18,    18,    18,
   549:       18,    18,    18,    19,    20,    20,    21,    21,    21,    21
   550: };
   551: 
   552:   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
   553: static const yytype_uint8 yyr2[] =
   554: {
   555:        0,     2,     0,     2,     2,     1,     2,     2,     2,     2,
   556:        5,     2,     1,     4,     0,     2,     1,     1,     1,     1
   557: };
   558: 
   559: 
   560: #define yyerrok         (yyerrstatus = 0)
   561: #define yyclearin       (yychar = YYEMPTY)
   562: #define YYEMPTY         (-2)
   563: #define YYEOF           0
   564: 
   565: #define YYACCEPT        goto yyacceptlab
   566: #define YYABORT         goto yyabortlab
   567: #define YYERROR         goto yyerrorlab
   568: 
   569: 
   570: #define YYRECOVERING()  (!!yyerrstatus)
   571: 
   572: #define YYBACKUP(Token, Value)                                  \
   573: do                                                              \
   574:   if (yychar == YYEMPTY)                                        \
   575:     {                                                           \
   576:       yychar = (Token);                                         \
   577:       yylval = (Value);                                         \
   578:       YYPOPSTACK (yylen);                                       \
   579:       yystate = *yyssp;                                         \
   580:       goto yybackup;                                            \
   581:     }                                                           \
   582:   else                                                          \
   583:     {                                                           \
   584:       yyerror (result, scan, YY_("syntax error: cannot back up")); \
   585:       YYERROR;                                                  \
   586:     }                                                           \
   587: while (0)
   588: 
   589: /* Error token number */
   590: #define YYTERROR        1
   591: #define YYERRCODE       256
   592: 
   593: 
   594: 
   595: /* Enable debugging if requested.  */
   596: #if YYDEBUG
   597: 
   598: # ifndef YYFPRINTF
   599: #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
   600: #  define YYFPRINTF fprintf
   601: # endif
   602: 
   603: # define YYDPRINTF(Args)                        \
   604: do {                                            \
   605:   if (yydebug)                                  \
   606:     YYFPRINTF Args;                             \
   607: } while (0)
   608: 
   609: /* This macro is provided for backward compatibility. */
   610: #ifndef YY_LOCATION_PRINT
   611: # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
   612: #endif
   613: 
   614: 
   615: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
   616: do {                                                                      \
   617:   if (yydebug)                                                            \
   618:     {                                                                     \
   619:       YYFPRINTF (stderr, "%s ", Title);                                   \
   620:       yy_symbol_print (stderr,                                            \
   621:                   Type, Value, result, scan); \
   622:       YYFPRINTF (stderr, "\n");                                           \
   623:     }                                                                     \
   624: } while (0)
   625: 
   626: 
   627: /*----------------------------------------.
   628: | Print this symbol's value on YYOUTPUT.  |
   629: `----------------------------------------*/
   630: 
   631: static void
   632: yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, lreg_t *result, void *scan)
   633: {
   634:   FILE *yyo = yyoutput;
   635:   YYUSE (yyo);
   636:   YYUSE (result);
   637:   YYUSE (scan);
   638:   if (!yyvaluep)
   639:     return;
   640: # ifdef YYPRINT
   641:   if (yytype < YYNTOKENS)
   642:     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
   643: # endif
   644:   YYUSE (yytype);
   645: }
   646: 
   647: 
   648: /*--------------------------------.
   649: | Print this symbol on YYOUTPUT.  |
   650: `--------------------------------*/
   651: 
   652: static void
   653: yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, lreg_t *result, void *scan)
   654: {
   655:   YYFPRINTF (yyoutput, "%s %s (",
   656:              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
   657: 
   658:   yy_symbol_value_print (yyoutput, yytype, yyvaluep, result, scan);
   659:   YYFPRINTF (yyoutput, ")");
   660: }
   661: 
   662: /*------------------------------------------------------------------.
   663: | yy_stack_print -- Print the state stack from its BOTTOM up to its |
   664: | TOP (included).                                                   |
   665: `------------------------------------------------------------------*/
   666: 
   667: static void
   668: yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
   669: {
   670:   YYFPRINTF (stderr, "Stack now");
   671:   for (; yybottom <= yytop; yybottom++)
   672:     {
   673:       int yybot = *yybottom;
   674:       YYFPRINTF (stderr, " %d", yybot);
   675:     }
   676:   YYFPRINTF (stderr, "\n");
   677: }
   678: 
   679: # define YY_STACK_PRINT(Bottom, Top)                            \
   680: do {                                                            \
   681:   if (yydebug)                                                  \
   682:     yy_stack_print ((Bottom), (Top));                           \
   683: } while (0)
   684: 
   685: 
   686: /*------------------------------------------------.
   687: | Report that the YYRULE is going to be reduced.  |
   688: `------------------------------------------------*/
   689: 
   690: static void
   691: yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, lreg_t *result, void *scan)
   692: {
   693:   unsigned long int yylno = yyrline[yyrule];
   694:   int yynrhs = yyr2[yyrule];
   695:   int yyi;
   696:   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
   697:              yyrule - 1, yylno);
   698:   /* The symbols being reduced.  */
   699:   for (yyi = 0; yyi < yynrhs; yyi++)
   700:     {
   701:       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
   702:       yy_symbol_print (stderr,
   703:                        yystos[yyssp[yyi + 1 - yynrhs]],
   704:                        &(yyvsp[(yyi + 1) - (yynrhs)])
   705:                                               , result, scan);
   706:       YYFPRINTF (stderr, "\n");
   707:     }
   708: }
   709: 
   710: # define YY_REDUCE_PRINT(Rule)          \
   711: do {                                    \
   712:   if (yydebug)                          \
   713:     yy_reduce_print (yyssp, yyvsp, Rule, result, scan); \
   714: } while (0)
   715: 
   716: /* Nonzero means print parse trace.  It is left uninitialized so that
   717:    multiple parsers can coexist.  */
   718: int yydebug;
   719: #else /* !YYDEBUG */
   720: # define YYDPRINTF(Args)
   721: # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
   722: # define YY_STACK_PRINT(Bottom, Top)
   723: # define YY_REDUCE_PRINT(Rule)
   724: #endif /* !YYDEBUG */
   725: 
   726: 
   727: /* YYINITDEPTH -- initial size of the parser's stacks.  */
   728: #ifndef YYINITDEPTH
   729: # define YYINITDEPTH 200
   730: #endif
   731: 
   732: /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   733:    if the built-in stack extension method is used).
   734: 
   735:    Do not make this value too large; the results are undefined if
   736:    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   737:    evaluated with infinite-precision integer arithmetic.  */
   738: 
   739: #ifndef YYMAXDEPTH
   740: # define YYMAXDEPTH 10000
   741: #endif
   742: 
   743: 
   744: #if YYERROR_VERBOSE
   745: 
   746: # ifndef yystrlen
   747: #  if defined __GLIBC__ && defined _STRING_H
   748: #   define yystrlen strlen
   749: #  else
   750: /* Return the length of YYSTR.  */
   751: static YYSIZE_T
   752: yystrlen (const char *yystr)
   753: {
   754:   YYSIZE_T yylen;
   755:   for (yylen = 0; yystr[yylen]; yylen++)
   756:     continue;
   757:   return yylen;
   758: }
   759: #  endif
   760: # endif
   761: 
   762: # ifndef yystpcpy
   763: #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
   764: #   define yystpcpy stpcpy
   765: #  else
   766: /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   767:    YYDEST.  */
   768: static char *
   769: yystpcpy (char *yydest, const char *yysrc)
   770: {
   771:   char *yyd = yydest;
   772:   const char *yys = yysrc;
   773: 
   774:   while ((*yyd++ = *yys++) != '\0')
   775:     continue;
   776: 
   777:   return yyd - 1;
   778: }
   779: #  endif
   780: # endif
   781: 
   782: # ifndef yytnamerr
   783: /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   784:    quotes and backslashes, so that it's suitable for yyerror.  The
   785:    heuristic is that double-quoting is unnecessary unless the string
   786:    contains an apostrophe, a comma, or backslash (other than
   787:    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   788:    null, do not copy; instead, return the length of what the result
   789:    would have been.  */
   790: static YYSIZE_T
   791: yytnamerr (char *yyres, const char *yystr)
   792: {
   793:   if (*yystr == '"')
   794:     {
   795:       YYSIZE_T yyn = 0;
   796:       char const *yyp = yystr;
   797: 
   798:       for (;;)
   799:         switch (*++yyp)
   800:           {
   801:           case '\'':
   802:           case ',':
   803:             goto do_not_strip_quotes;
   804: 
   805:           case '\\':
   806:             if (*++yyp != '\\')
   807:               goto do_not_strip_quotes;
   808:             /* Fall through.  */
   809:           default:
   810:             if (yyres)
   811:               yyres[yyn] = *yyp;
   812:             yyn++;
   813:             break;
   814: 
   815:           case '"':
   816:             if (yyres)
   817:               yyres[yyn] = '\0';
   818:             return yyn;
   819:           }
   820:     do_not_strip_quotes: ;
   821:     }
   822: 
   823:   if (! yyres)
   824:     return yystrlen (yystr);
   825: 
   826:   return yystpcpy (yyres, yystr) - yyres;
   827: }
   828: # endif
   829: 
   830: /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   831:    about the unexpected token YYTOKEN for the state stack whose top is
   832:    YYSSP.
   833: 
   834:    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
   835:    not large enough to hold the message.  In that case, also set
   836:    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
   837:    required number of bytes is too large to store.  */
   838: static int
   839: yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
   840:                 yytype_int16 *yyssp, int yytoken)
   841: {
   842:   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
   843:   YYSIZE_T yysize = yysize0;
   844:   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   845:   /* Internationalized format string. */
   846:   const char *yyformat = YY_NULLPTR;
   847:   /* Arguments of yyformat. */
   848:   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   849:   /* Number of reported tokens (one for the "unexpected", one per
   850:      "expected"). */
   851:   int yycount = 0;
   852: 
   853:   /* There are many possibilities here to consider:
   854:      - If this state is a consistent state with a default action, then
   855:        the only way this function was invoked is if the default action
   856:        is an error action.  In that case, don't check for expected
   857:        tokens because there are none.
   858:      - The only way there can be no lookahead present (in yychar) is if
   859:        this state is a consistent state with a default action.  Thus,
   860:        detecting the absence of a lookahead is sufficient to determine
   861:        that there is no unexpected or expected token to report.  In that
   862:        case, just report a simple "syntax error".
   863:      - Don't assume there isn't a lookahead just because this state is a
   864:        consistent state with a default action.  There might have been a
   865:        previous inconsistent state, consistent state with a non-default
   866:        action, or user semantic action that manipulated yychar.
   867:      - Of course, the expected token list depends on states to have
   868:        correct lookahead information, and it depends on the parser not
   869:        to perform extra reductions after fetching a lookahead from the
   870:        scanner and before detecting a syntax error.  Thus, state merging
   871:        (from LALR or IELR) and default reductions corrupt the expected
   872:        token list.  However, the list is correct for canonical LR with
   873:        one exception: it will still contain any token that will not be
   874:        accepted due to an error action in a later state.
   875:   */
   876:   if (yytoken != YYEMPTY)
   877:     {
   878:       int yyn = yypact[*yyssp];
   879:       yyarg[yycount++] = yytname[yytoken];
   880:       if (!yypact_value_is_default (yyn))
   881:         {
   882:           /* Start YYX at -YYN if negative to avoid negative indexes in
   883:              YYCHECK.  In other words, skip the first -YYN actions for
   884:              this state because they are default actions.  */
   885:           int yyxbegin = yyn < 0 ? -yyn : 0;
   886:           /* Stay within bounds of both yycheck and yytname.  */
   887:           int yychecklim = YYLAST - yyn + 1;
   888:           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
   889:           int yyx;
   890: 
   891:           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
   892:             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
   893:                 && !yytable_value_is_error (yytable[yyx + yyn]))
   894:               {
   895:                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
   896:                   {
   897:                     yycount = 1;
   898:                     yysize = yysize0;
   899:                     break;
   900:                   }
   901:                 yyarg[yycount++] = yytname[yyx];
   902:                 {
   903:                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
   904:                   if (! (yysize <= yysize1
   905:                          && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
   906:                     return 2;
   907:                   yysize = yysize1;
   908:                 }
   909:               }
   910:         }
   911:     }
   912: 
   913:   switch (yycount)
   914:     {
   915: # define YYCASE_(N, S)                      \
   916:       case N:                               \
   917:         yyformat = S;                       \
   918:       break
   919:       YYCASE_(0, YY_("syntax error"));
   920:       YYCASE_(1, YY_("syntax error, unexpected %s"));
   921:       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
   922:       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
   923:       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
   924:       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
   925: # undef YYCASE_
   926:     }
   927: 
   928:   {
   929:     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
   930:     if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
   931:       return 2;
   932:     yysize = yysize1;
   933:   }
   934: 
   935:   if (*yymsg_alloc < yysize)
   936:     {
   937:       *yymsg_alloc = 2 * yysize;
   938:       if (! (yysize <= *yymsg_alloc
   939:              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
   940:         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
   941:       return 1;
   942:     }
   943: 
   944:   /* Avoid sprintf, as that infringes on the user's name space.
   945:      Don't have undefined behavior even if the translation
   946:      produced a string with the wrong number of "%s"s.  */
   947:   {
   948:     char *yyp = *yymsg;
   949:     int yyi = 0;
   950:     while ((*yyp = *yyformat) != '\0')
   951:       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
   952:         {
   953:           yyp += yytnamerr (yyp, yyarg[yyi++]);
   954:           yyformat += 2;
   955:         }
   956:       else
   957:         {
   958:           yyp++;
   959:           yyformat++;
   960:         }
   961:   }
   962:   return 0;
   963: }
   964: #endif /* YYERROR_VERBOSE */
   965: 
   966: /*-----------------------------------------------.
   967: | Release the memory associated to this symbol.  |
   968: `-----------------------------------------------*/
   969: 
   970: static void
   971: yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, lreg_t *result, void *scan)
   972: {
   973:   YYUSE (yyvaluep);
   974:   YYUSE (result);
   975:   YYUSE (scan);
   976:   if (!yymsg)
   977:     yymsg = "Deleting";
   978:   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
   979: 
   980:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   981:   YYUSE (yytype);
   982:   YY_IGNORE_MAYBE_UNINITIALIZED_END
   983: }
   984: 
   985: 
   986: 
   987: 
   988: /*----------.
   989: | yyparse.  |
   990: `----------*/
   991: 
   992: int
   993: yyparse (lreg_t *result, void *scan)
   994: {
   995: /* The lookahead symbol.  */
   996: int yychar;
   997: 
   998: 
   999: /* The semantic value of the lookahead symbol.  */
  1000: /* Default value used for initialization, for pacifying older GCCs
  1001:    or non-GCC compilers.  */
  1002: YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
  1003: YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
  1004: 
  1005:     /* Number of syntax errors so far.  */
  1006:     int yynerrs;
  1007: 
  1008:     int yystate;
  1009:     /* Number of tokens to shift before error messages enabled.  */
  1010:     int yyerrstatus;
  1011: 
  1012:     /* The stacks and their tools:
  1013:        'yyss': related to states.
  1014:        'yyvs': related to semantic values.
  1015: 
  1016:        Refer to the stacks through separate pointers, to allow yyoverflow
  1017:        to reallocate them elsewhere.  */
  1018: 
  1019:     /* The state stack.  */
  1020:     yytype_int16 yyssa[YYINITDEPTH];
  1021:     yytype_int16 *yyss;
  1022:     yytype_int16 *yyssp;
  1023: 
  1024:     /* The semantic value stack.  */
  1025:     YYSTYPE yyvsa[YYINITDEPTH];
  1026:     YYSTYPE *yyvs;
  1027:     YYSTYPE *yyvsp;
  1028: 
  1029:     YYSIZE_T yystacksize;
  1030: 
  1031:   int yyn;
  1032:   int yyresult;
  1033:   /* Lookahead token as an internal (translated) token number.  */
  1034:   int yytoken = 0;
  1035:   /* The variables used to return semantic value and location from the
  1036:      action routines.  */
  1037:   YYSTYPE yyval;
  1038: 
  1039: #if YYERROR_VERBOSE
  1040:   /* Buffer for error messages, and its allocated size.  */
  1041:   char yymsgbuf[128];
  1042:   char *yymsg = yymsgbuf;
  1043:   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
  1044: #endif
  1045: 
  1046: #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
  1047: 
  1048:   /* The number of symbols on the RHS of the reduced rule.
  1049:      Keep to zero when no symbol should be popped.  */
  1050:   int yylen = 0;
  1051: 
  1052:   yyssp = yyss = yyssa;
  1053:   yyvsp = yyvs = yyvsa;
  1054:   yystacksize = YYINITDEPTH;
  1055: 
  1056:   YYDPRINTF ((stderr, "Starting parse\n"));
  1057: 
  1058:   yystate = 0;
  1059:   yyerrstatus = 0;
  1060:   yynerrs = 0;
  1061:   yychar = YYEMPTY; /* Cause a token to be read.  */
  1062:   goto yysetstate;
  1063: 
  1064: /*------------------------------------------------------------.
  1065: | yynewstate -- Push a new state, which is found in yystate.  |
  1066: `------------------------------------------------------------*/
  1067:  yynewstate:
  1068:   /* In all cases, when you get here, the value and location stacks
  1069:      have just been pushed.  So pushing a state here evens the stacks.  */
  1070:   yyssp++;
  1071: 
  1072:  yysetstate:
  1073:   *yyssp = yystate;
  1074: 
  1075:   if (yyss + yystacksize - 1 <= yyssp)
  1076:     {
  1077:       /* Get the current used size of the three stacks, in elements.  */
  1078:       YYSIZE_T yysize = yyssp - yyss + 1;
  1079: 
  1080: #ifdef yyoverflow
  1081:       {
  1082:         /* Give user a chance to reallocate the stack.  Use copies of
  1083:            these so that the &'s don't force the real ones into
  1084:            memory.  */
  1085:         YYSTYPE *yyvs1 = yyvs;
  1086:         yytype_int16 *yyss1 = yyss;
  1087: 
  1088:         /* Each stack pointer address is followed by the size of the
  1089:            data in use in that stack, in bytes.  This used to be a
  1090:            conditional around just the two extra args, but that might
  1091:            be undefined if yyoverflow is a macro.  */
  1092:         yyoverflow (YY_("memory exhausted"),
  1093:                     &yyss1, yysize * sizeof (*yyssp),
  1094:                     &yyvs1, yysize * sizeof (*yyvsp),
  1095:                     &yystacksize);
  1096: 
  1097:         yyss = yyss1;
  1098:         yyvs = yyvs1;
  1099:       }
  1100: #else /* no yyoverflow */
  1101: # ifndef YYSTACK_RELOCATE
  1102:       goto yyexhaustedlab;
  1103: # else
  1104:       /* Extend the stack our own way.  */
  1105:       if (YYMAXDEPTH <= yystacksize)
  1106:         goto yyexhaustedlab;
  1107:       yystacksize *= 2;
  1108:       if (YYMAXDEPTH < yystacksize)
  1109:         yystacksize = YYMAXDEPTH;
  1110: 
  1111:       {
  1112:         yytype_int16 *yyss1 = yyss;
  1113:         union yyalloc *yyptr =
  1114:           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  1115:         if (! yyptr)
  1116:           goto yyexhaustedlab;
  1117:         YYSTACK_RELOCATE (yyss_alloc, yyss);
  1118:         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
  1119: #  undef YYSTACK_RELOCATE
  1120:         if (yyss1 != yyssa)
  1121:           YYSTACK_FREE (yyss1);
  1122:       }
  1123: # endif
  1124: #endif /* no yyoverflow */
  1125: 
  1126:       yyssp = yyss + yysize - 1;
  1127:       yyvsp = yyvs + yysize - 1;
  1128: 
  1129:       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  1130:                   (unsigned long int) yystacksize));
  1131: 
  1132:       if (yyss + yystacksize - 1 <= yyssp)
  1133:         YYABORT;
  1134:     }
  1135: 
  1136:   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  1137: 
  1138:   if (yystate == YYFINAL)
  1139:     YYACCEPT;
  1140: 
  1141:   goto yybackup;
  1142: 
  1143: /*-----------.
  1144: | yybackup.  |
  1145: `-----------*/
  1146: yybackup:
  1147: 
  1148:   /* Do appropriate processing given the current state.  Read a
  1149:      lookahead token if we need one and don't already have one.  */
  1150: 
  1151:   /* First try to decide what to do without reference to lookahead token.  */
  1152:   yyn = yypact[yystate];
  1153:   if (yypact_value_is_default (yyn))
  1154:     goto yydefault;
  1155: 
  1156:   /* Not known => get a lookahead token if don't already have one.  */
  1157: 
  1158:   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  1159:   if (yychar == YYEMPTY)
  1160:     {
  1161:       YYDPRINTF ((stderr, "Reading a token: "));
  1162:       yychar = yylex (&yylval, scan);
  1163:     }
  1164: 
  1165:   if (yychar <= YYEOF)
  1166:     {
  1167:       yychar = yytoken = YYEOF;
  1168:       YYDPRINTF ((stderr, "Now at end of input.\n"));
  1169:     }
  1170:   else
  1171:     {
  1172:       yytoken = YYTRANSLATE (yychar);
  1173:       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
  1174:     }
  1175: 
  1176:   /* If the proper action on seeing token YYTOKEN is to reduce or to
  1177:      detect an error, take that action.  */
  1178:   yyn += yytoken;
  1179:   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
  1180:     goto yydefault;
  1181:   yyn = yytable[yyn];
  1182:   if (yyn <= 0)
  1183:     {
  1184:       if (yytable_value_is_error (yyn))
  1185:         goto yyerrlab;
  1186:       yyn = -yyn;
  1187:       goto yyreduce;
  1188:     }
  1189: 
  1190:   /* Count tokens shifted since error; after three, turn off error
  1191:      status.  */
  1192:   if (yyerrstatus)
  1193:     yyerrstatus--;
  1194: 
  1195:   /* Shift the lookahead token.  */
  1196:   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
  1197: 
  1198:   /* Discard the shifted token.  */
  1199:   yychar = YYEMPTY;
  1200: 
  1201:   yystate = yyn;
  1202:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1203:   *++yyvsp = yylval;
  1204:   YY_IGNORE_MAYBE_UNINITIALIZED_END
  1205: 
  1206:   goto yynewstate;
  1207: 
  1208: 
  1209: /*-----------------------------------------------------------.
  1210: | yydefault -- do the default action for the current state.  |
  1211: `-----------------------------------------------------------*/
  1212: yydefault:
  1213:   yyn = yydefact[yystate];
  1214:   if (yyn == 0)
  1215:     goto yyerrlab;
  1216:   goto yyreduce;
  1217: 
  1218: 
  1219: /*-----------------------------.
  1220: | yyreduce -- Do a reduction.  |
  1221: `-----------------------------*/
  1222: yyreduce:
  1223:   /* yyn is the number of a rule to reduce with.  */
  1224:   yylen = yyr2[yyn];
  1225: 
  1226:   /* If YYLEN is nonzero, implement the default value of the action:
  1227:      '$$ = $1'.
  1228: 
  1229:      Otherwise, the following line sets YYVAL to garbage.
  1230:      This behavior is undocumented and Bison
  1231:      users should not rely upon it.  Assigning to YYVAL
  1232:      unconditionally makes the parser a bit smaller, and it avoids a
  1233:      GCC warning that YYVAL may be used uninitialized.  */
  1234:   yyval = yyvsp[1-yylen];
  1235: 
  1236: 
  1237:   YY_REDUCE_PRINT (yyn);
  1238:   switch (yyn)
  1239:     {
  1240:         case 3:
  1241: #line 50 "sexpr_parse.y" /* yacc.c:1646  */
  1242:     { return -1;}
  1243: #line 1244 "sexpr_parse.c" /* yacc.c:1646  */
  1244:     break;
  1245: 
  1246:   case 4:
  1247: #line 51 "sexpr_parse.y" /* yacc.c:1646  */
  1248:     { *result = (yyvsp[0]); YYACCEPT;}
  1249: #line 1250 "sexpr_parse.c" /* yacc.c:1646  */
  1250:     break;
  1251: 
  1252:   case 6:
  1253: #line 54 "sexpr_parse.y" /* yacc.c:1646  */
  1254:     { (yyval) = cons(sym_quote, cons((yyvsp[0]), NIL)); }
  1255: #line 1256 "sexpr_parse.c" /* yacc.c:1646  */
  1256:     break;
  1257: 
  1258:   case 7:
  1259: #line 55 "sexpr_parse.y" /* yacc.c:1646  */
  1260:     { (yyval) = cons(sym_quasiquote, cons((yyvsp[0]), NIL)); }
  1261: #line 1262 "sexpr_parse.c" /* yacc.c:1646  */
  1262:     break;
  1263: 
  1264:   case 8:
  1265: #line 56 "sexpr_parse.y" /* yacc.c:1646  */
  1266:     { (yyval) = cons(sym_splice, cons((yyvsp[0]), NIL)); }
  1267: #line 1268 "sexpr_parse.c" /* yacc.c:1646  */
  1268:     break;
  1269: 
  1270:   case 9:
  1271: #line 57 "sexpr_parse.y" /* yacc.c:1646  */
  1272:     { (yyval) = cons(sym_unquote, cons((yyvsp[0]), NIL)); }
  1273: #line 1274 "sexpr_parse.c" /* yacc.c:1646  */
  1274:     break;
  1275: 
  1276:   case 10:
  1277: #line 58 "sexpr_parse.y" /* yacc.c:1646  */
  1278:     { (yyval) = cons((yyvsp[-3]),(yyvsp[-1])); }
  1279: #line 1280 "sexpr_parse.c" /* yacc.c:1646  */
  1280:     break;
  1281: 
  1282:   case 11:
  1283: #line 59 "sexpr_parse.y" /* yacc.c:1646  */
  1284:     { (yyval) = NIL; }
  1285: #line 1286 "sexpr_parse.c" /* yacc.c:1646  */
  1286:     break;
  1287: 
  1288:   case 12:
  1289: #line 60 "sexpr_parse.y" /* yacc.c:1646  */
  1290:     { (yyval) = (yyvsp[0]); }
  1291: #line 1292 "sexpr_parse.c" /* yacc.c:1646  */
  1292:     break;
  1293: 
  1294:   case 13:
  1295: #line 62 "sexpr_parse.y" /* yacc.c:1646  */
  1296:     { (yyval) = cons((yyvsp[-2]),(yyvsp[-1])); }
  1297: #line 1298 "sexpr_parse.c" /* yacc.c:1646  */
  1298:     break;
  1299: 
  1300:   case 14:
  1301: #line 64 "sexpr_parse.y" /* yacc.c:1646  */
  1302:     { (yyval) = NIL; }
  1303: #line 1304 "sexpr_parse.c" /* yacc.c:1646  */
  1304:     break;
  1305: 
  1306:   case 15:
  1307: #line 65 "sexpr_parse.y" /* yacc.c:1646  */
  1308:     { (yyval) = cons((yyvsp[-1]),(yyvsp[0])); }
  1309: #line 1310 "sexpr_parse.c" /* yacc.c:1646  */
  1310:     break;
  1311: 
  1312: 
  1313: #line 1314 "sexpr_parse.c" /* yacc.c:1646  */
  1314:       default: break;
  1315:     }
  1316:   /* User semantic actions sometimes alter yychar, and that requires
  1317:      that yytoken be updated with the new translation.  We take the
  1318:      approach of translating immediately before every use of yytoken.
  1319:      One alternative is translating here after every semantic action,
  1320:      but that translation would be missed if the semantic action invokes
  1321:      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
  1322:      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
  1323:      incorrect destructor might then be invoked immediately.  In the
  1324:      case of YYERROR or YYBACKUP, subsequent parser actions might lead
  1325:      to an incorrect destructor call or verbose syntax error message
  1326:      before the lookahead is translated.  */
  1327:   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
  1328: 
  1329:   YYPOPSTACK (yylen);
  1330:   yylen = 0;
  1331:   YY_STACK_PRINT (yyss, yyssp);
  1332: 
  1333:   *++yyvsp = yyval;
  1334: 
  1335:   /* Now 'shift' the result of the reduction.  Determine what state
  1336:      that goes to, based on the state we popped back to and the rule
  1337:      number reduced by.  */
  1338: 
  1339:   yyn = yyr1[yyn];
  1340: 
  1341:   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  1342:   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1343:     yystate = yytable[yystate];
  1344:   else
  1345:     yystate = yydefgoto[yyn - YYNTOKENS];
  1346: 
  1347:   goto yynewstate;
  1348: 
  1349: 
  1350: /*--------------------------------------.
  1351: | yyerrlab -- here on detecting error.  |
  1352: `--------------------------------------*/
  1353: yyerrlab:
  1354:   /* Make sure we have latest lookahead translation.  See comments at
  1355:      user semantic actions for why this is necessary.  */
  1356:   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
  1357: 
  1358:   /* If not already recovering from an error, report this error.  */
  1359:   if (!yyerrstatus)
  1360:     {
  1361:       ++yynerrs;
  1362: #if ! YYERROR_VERBOSE
  1363:       yyerror (result, scan, YY_("syntax error"));
  1364: #else
  1365: # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
  1366:                                         yyssp, yytoken)
  1367:       {
  1368:         char const *yymsgp = YY_("syntax error");
  1369:         int yysyntax_error_status;
  1370:         yysyntax_error_status = YYSYNTAX_ERROR;
  1371:         if (yysyntax_error_status == 0)
  1372:           yymsgp = yymsg;
  1373:         else if (yysyntax_error_status == 1)
  1374:           {
  1375:             if (yymsg != yymsgbuf)
  1376:               YYSTACK_FREE (yymsg);
  1377:             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
  1378:             if (!yymsg)
  1379:               {
  1380:                 yymsg = yymsgbuf;
  1381:                 yymsg_alloc = sizeof yymsgbuf;
  1382:                 yysyntax_error_status = 2;
  1383:               }
  1384:             else
  1385:               {
  1386:                 yysyntax_error_status = YYSYNTAX_ERROR;
  1387:                 yymsgp = yymsg;
  1388:               }
  1389:           }
  1390:         yyerror (result, scan, yymsgp);
  1391:         if (yysyntax_error_status == 2)
  1392:           goto yyexhaustedlab;
  1393:       }
  1394: # undef YYSYNTAX_ERROR
  1395: #endif
  1396:     }
  1397: 
  1398: 
  1399: 
  1400:   if (yyerrstatus == 3)
  1401:     {
  1402:       /* If just tried and failed to reuse lookahead token after an
  1403:          error, discard it.  */
  1404: 
  1405:       if (yychar <= YYEOF)
  1406:         {
  1407:           /* Return failure if at end of input.  */
  1408:           if (yychar == YYEOF)
  1409:             YYABORT;
  1410:         }
  1411:       else
  1412:         {
  1413:           yydestruct ("Error: discarding",
  1414:                       yytoken, &yylval, result, scan);
  1415:           yychar = YYEMPTY;
  1416:         }
  1417:     }
  1418: 
  1419:   /* Else will try to reuse lookahead token after shifting the error
  1420:      token.  */
  1421:   goto yyerrlab1;
  1422: 
  1423: 
  1424: /*---------------------------------------------------.
  1425: | yyerrorlab -- error raised explicitly by YYERROR.  |
  1426: `---------------------------------------------------*/
  1427: yyerrorlab:
  1428: 
  1429:   /* Pacify compilers like GCC when the user code never invokes
  1430:      YYERROR and the label yyerrorlab therefore never appears in user
  1431:      code.  */
  1432:   if (/*CONSTCOND*/ 0)
  1433:      goto yyerrorlab;
  1434: 
  1435:   /* Do not reclaim the symbols of the rule whose action triggered
  1436:      this YYERROR.  */
  1437:   YYPOPSTACK (yylen);
  1438:   yylen = 0;
  1439:   YY_STACK_PRINT (yyss, yyssp);
  1440:   yystate = *yyssp;
  1441:   goto yyerrlab1;
  1442: 
  1443: 
  1444: /*-------------------------------------------------------------.
  1445: | yyerrlab1 -- common code for both syntax error and YYERROR.  |
  1446: `-------------------------------------------------------------*/
  1447: yyerrlab1:
  1448:   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
  1449: 
  1450:   for (;;)
  1451:     {
  1452:       yyn = yypact[yystate];
  1453:       if (!yypact_value_is_default (yyn))
  1454:         {
  1455:           yyn += YYTERROR;
  1456:           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
  1457:             {
  1458:               yyn = yytable[yyn];
  1459:               if (0 < yyn)
  1460:                 break;
  1461:             }
  1462:         }
  1463: 
  1464:       /* Pop the current state because it cannot handle the error token.  */
  1465:       if (yyssp == yyss)
  1466:         YYABORT;
  1467: 
  1468: 
  1469:       yydestruct ("Error: popping",
  1470:                   yystos[yystate], yyvsp, result, scan);
  1471:       YYPOPSTACK (1);
  1472:       yystate = *yyssp;
  1473:       YY_STACK_PRINT (yyss, yyssp);
  1474:     }
  1475: 
  1476:   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  1477:   *++yyvsp = yylval;
  1478:   YY_IGNORE_MAYBE_UNINITIALIZED_END
  1479: 
  1480: 
  1481:   /* Shift the error token.  */
  1482:   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
  1483: 
  1484:   yystate = yyn;
  1485:   goto yynewstate;
  1486: 
  1487: 
  1488: /*-------------------------------------.
  1489: | yyacceptlab -- YYACCEPT comes here.  |
  1490: `-------------------------------------*/
  1491: yyacceptlab:
  1492:   yyresult = 0;
  1493:   goto yyreturn;
  1494: 
  1495: /*-----------------------------------.
  1496: | yyabortlab -- YYABORT comes here.  |
  1497: `-----------------------------------*/
  1498: yyabortlab:
  1499:   yyresult = 1;
  1500:   goto yyreturn;
  1501: 
  1502: #if !defined yyoverflow || YYERROR_VERBOSE
  1503: /*-------------------------------------------------.
  1504: | yyexhaustedlab -- memory exhaustion comes here.  |
  1505: `-------------------------------------------------*/
  1506: yyexhaustedlab:
  1507:   yyerror (result, scan, YY_("memory exhausted"));
  1508:   yyresult = 2;
  1509:   /* Fall through.  */
  1510: #endif
  1511: 
  1512: yyreturn:
  1513:   if (yychar != YYEMPTY)
  1514:     {
  1515:       /* Make sure we have latest lookahead translation.  See comments at
  1516:          user semantic actions for why this is necessary.  */
  1517:       yytoken = YYTRANSLATE (yychar);
  1518:       yydestruct ("Cleanup: discarding lookahead",
  1519:                   yytoken, &yylval, result, scan);
  1520:     }
  1521:   /* Do not reclaim the symbols of the rule whose action triggered
  1522:      this YYABORT or YYACCEPT.  */
  1523:   YYPOPSTACK (yylen);
  1524:   YY_STACK_PRINT (yyss, yyssp);
  1525:   while (yyssp != yyss)
  1526:     {
  1527:       yydestruct ("Cleanup: popping",
  1528:                   yystos[*yyssp], yyvsp, result, scan);
  1529:       YYPOPSTACK (1);
  1530:     }
  1531: #ifndef yyoverflow
  1532:   if (yyss != yyssa)
  1533:     YYSTACK_FREE (yyss);
  1534: #endif
  1535: #if YYERROR_VERBOSE
  1536:   if (yymsg != yymsgbuf)
  1537:     YYSTACK_FREE (yymsg);
  1538: #endif
  1539:   return yyresult;
  1540: }
  1541: #line 69 "sexpr_parse.y" /* yacc.c:1906  */
  1542: 
  1543: 
  1544: void yylex_init(void **);
  1545: void yyset_in(FILE *, void *);
  1546: void yylex_destroy(void *);
  1547: 
  1548: 
  1549: /*
  1550:  * Read
  1551:  */
  1552: 
  1553: void
  1554: sexpr_read_start(FILE *f, void **yyscan)
  1555: {
  1556: 
  1557:     yylex_init(yyscan);
  1558:     yyset_in(f, *yyscan);
  1559: }
  1560: 
  1561: int
  1562: sexpr_read(lreg_t *res, void *yyscan)
  1563: {
  1564:     int r;
  1565: 
  1566:     r = yyparse(res, yyscan);
  1567:     switch (r) {
  1568:     case 0:
  1569: 	return 1;
  1570:     case -1:
  1571: 	return 0;
  1572:     case 1: /* Syntax Error */
  1573:     case 2: /* Memory Exhaustion */
  1574:     default: /* Unknown */
  1575: 	raise_exception("parser error", NIL);
  1576: 	/* Not reached. */
  1577: 	return 0;
  1578:     }
  1579: }
  1580: 
  1581: void
  1582: sexpr_read_stop(void *yyscan)
  1583: {
  1584: 
  1585:     yylex_destroy(yyscan);
  1586: }
  1587: 
  1588: 
  1589: /*
  1590:  * Print
  1591:  */
  1592: 
  1593: static void sexpr_print_cons(FILE *f, lreg_t lr, const char *h)
  1594: {
  1595:   lreg_t a = car(lr);
  1596:   lreg_t d = cdr(lr);
  1597: 
  1598:   printf(h);
  1599:   sexpr_print(f, a);
  1600: 
  1601:   if (d == NIL) {
  1602:     fprintf(f, ")");
  1603:     return;
  1604:   }
  1605: 
  1606:   if (lreg_raw_type(d) == LREG_CONS)
  1607:     sexpr_print_cons(f, d, " ");
  1608:   else
  1609:     {
  1610:       fprintf(f, " . ");
  1611:       sexpr_print(f, cdr(lr));
  1612:       fprintf(f, ")");
  1613:     }
  1614: }
  1615: 
  1616: void sexpr_print(FILE *f, lreg_t lr)
  1617: {
  1618:   switch ( lreg_type(lr) )
  1619:     {
  1620:     case LREG_NIL:
  1621:       fprintf(f, "()");
  1622:       break;
  1623:     case LREG_SYMBOL:
  1624:       fprintf(f, "%s", (char *)lreg_raw_ptr(lr));
  1625:       break;
  1626:     case LREG_STRING:
  1627:       fprintf(f, "\"%s\"", (char *)lreg_raw_ptr(lr));
  1628:       break;
  1629:     case LREG_CONS:
  1630:       sexpr_print_cons(f, lr, "(");
  1631:       break;
  1632:     case LREG_MACRO:
  1633:       fprintf(f, "<#MACRO>");
  1634:       break;
  1635:     case LREG_LAMBDA:
  1636:       fprintf(f, "<#LAMBDA>");
  1637:       break;
  1638:     case LREG_LLPROC:
  1639:       fprintf(f, "<#LLPROC>");
  1640:       break;
  1641:     default:
  1642:       if ( !lac_extty_print(f, lr) )
  1643: 	fprintf(f, "<??? %d>",(int)lreg_type(lr));
  1644:     }
  1645:   return;
  1646: }

Generated by git2html.