Logo Search packages:      
Sourcecode: yasm version File versions  Download package

nasm-bison.c

/* A Bison parser, made from modules/parsers/nasm/nasm-bison.y, by GNU bison 1.75.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

/* Identify Bison output.  */
#define YYBISON   1

/* Pure parsers.  */
#define YYPURE    1

/* Using locations.  */
#define YYLSP_NEEDED 0



/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     INTNUM = 258,
     FLTNUM = 259,
     DIRECTIVE_NAME = 260,
     STRING = 261,
     FILENAME = 262,
     SIZE_OVERRIDE = 263,
     DECLARE_DATA = 264,
     RESERVE_SPACE = 265,
     INCBIN = 266,
     EQU = 267,
     TIMES = 268,
     SEG = 269,
     WRT = 270,
     NOSPLIT = 271,
     INSN = 272,
     PREFIX = 273,
     REG = 274,
     SEGREG = 275,
     TARGETMOD = 276,
     LEFT_OP = 277,
     RIGHT_OP = 278,
     SIGNDIV = 279,
     SIGNMOD = 280,
     START_SECTION_ID = 281,
     ID = 282,
     LOCAL_ID = 283,
     SPECIAL_ID = 284,
     LINE = 285,
     UNARYOP = 286
   };
#endif
#define INTNUM 258
#define FLTNUM 259
#define DIRECTIVE_NAME 260
#define STRING 261
#define FILENAME 262
#define SIZE_OVERRIDE 263
#define DECLARE_DATA 264
#define RESERVE_SPACE 265
#define INCBIN 266
#define EQU 267
#define TIMES 268
#define SEG 269
#define WRT 270
#define NOSPLIT 271
#define INSN 272
#define PREFIX 273
#define REG 274
#define SEGREG 275
#define TARGETMOD 276
#define LEFT_OP 277
#define RIGHT_OP 278
#define SIGNDIV 279
#define SIGNMOD 280
#define START_SECTION_ID 281
#define ID 282
#define LOCAL_ID 283
#define SPECIAL_ID 284
#define LINE 285
#define UNARYOP 286




/* Copy the first part of user declarations.  */
#line 27 "modules/parsers/nasm/nasm-bison.y"

#include <util.h>
RCSID("$Id: nasm-bison.y 1168 2004-10-31 01:07:52Z peter $");

#define YASM_LIB_INTERNAL
#define YASM_EXPR_INTERNAL
#include <libyasm.h>

#ifdef STDC_HEADERS
# include <math.h>
#endif

#include "modules/parsers/nasm/nasm-parser.h"
#include "modules/parsers/nasm/nasm-defs.h"

static void nasm_parser_directive
    (yasm_parser_nasm *parser_nasm, const char *name,
     yasm_valparamhead *valparams,
     /*@null@*/ yasm_valparamhead *objext_valparams);
static int fix_directive_symrec(/*@null@*/ yasm_expr__item *ei,
                        /*@null@*/ void *d);
static void define_label(yasm_parser_nasm *parser_nasm, /*@only@*/ char *name,
                   int local);

#define nasm_parser_error(s)  yasm__parser_error(cur_line, s)
#define YYPARSE_PARAM   parser_nasm_arg
#define YYLEX_PARAM     parser_nasm_arg
#define parser_nasm     ((yasm_parser_nasm *)parser_nasm_arg)
#define nasm_parser_debug   (parser_nasm->debug)

/*@-usedef -nullassign -memtrans -usereleased -compdef -mustfree@*/


/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#ifndef YYSTYPE
#line 62 "modules/parsers/nasm/nasm-bison.y"
typedef union {
    unsigned int int_info;
    char *str_val;
    yasm_intnum *intn;
    yasm_floatnum *flt;
    yasm_symrec *sym;
    unsigned long arch_data[4];
    yasm_effaddr *ea;
    yasm_expr *exp;
    yasm_datavalhead datahead;
    yasm_dataval *data;
    yasm_bytecode *bc;
    yasm_valparamhead dir_valparams;
    yasm_valparam *dir_valparam;
    struct {
      yasm_insn_operands operands;
      int num_operands;
    } insn_operands;
    yasm_insn_operand *insn_operand;
    struct {
      char *name;
      int local;
    } label;
} yystype;
/* Line 193 of /usr/local/share/bison/yacc.c.  */
#line 193 "nasm-bison.c"
# define YYSTYPE yystype
# define YYSTYPE_IS_TRIVIAL 1
#endif

#ifndef YYLTYPE
typedef struct yyltype
{
  int first_line;
  int first_column;
  int last_line;
  int last_column;
} yyltype;
# define YYLTYPE yyltype
# define YYLTYPE_IS_TRIVIAL 1
#endif

/* Copy the second part of user declarations.  */


/* Line 213 of /usr/local/share/bison/yacc.c.  */
#line 214 "nasm-bison.c"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# if YYSTACK_USE_ALLOCA
#  define YYSTACK_ALLOC alloca
# else
#  ifndef YYSTACK_USE_ALLOCA
#   if defined (alloca) || defined (_ALLOCA_H)
#    define YYSTACK_ALLOC alloca
#   else
#    ifdef __GNUC__
#     define YYSTACK_ALLOC __builtin_alloca
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC malloc
#  define YYSTACK_FREE free
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
       || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short) + sizeof (YYSTYPE))                   \
      + YYSTACK_GAP_MAX)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)        \
      do                            \
      {                             \
        register YYSIZE_T yyi;            \
        for (yyi = 0; yyi < (Count); yyi++)     \
          (To)[yyi] = (From)[yyi];  \
      }                             \
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)                            \
    do                                                      \
      {                                                     \
      YYSIZE_T yynewbytes;                                  \
      YYCOPY (&yyptr->Stack, Stack, yysize);                      \
      Stack = &yyptr->Stack;                                \
      yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;     \
      yyptr += yynewbytes / sizeof (*yyptr);                      \
      }                                                     \
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  2
#define YYLAST   769

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  50
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  22
/* YYNRULES -- Number of rules. */
#define YYNRULES  127
/* YYNRULES -- Number of states. */
#define YYNSTATES  215

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   286

#define YYTRANSLATE(X) \
  ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned char yytranslate[] =
{
       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      41,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,    49,    39,    34,     2,
      47,    48,    37,    36,    44,    35,     2,    38,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    31,     2,
       2,    45,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,    42,     2,    43,    33,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,    32,     2,    46,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      25,    26,    27,    28,    29,    30,    40
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned short yyprhs[] =
{
       0,     0,     3,     4,     7,     9,    12,    19,    20,    26,
      29,    31,    35,    37,    40,    43,    48,    52,    54,    57,
      60,    63,    67,    72,    78,    85,    87,    90,    93,    96,
      99,   101,   105,   108,   110,   112,   114,   116,   119,   121,
     123,   125,   128,   131,   133,   137,   139,   142,   146,   148,
     150,   154,   156,   160,   163,   166,   168,   172,   176,   178,
     180,   183,   186,   188,   190,   194,   198,   202,   206,   210,
     214,   218,   222,   226,   230,   234,   238,   241,   245,   247,
     249,   251,   255,   259,   263,   267,   271,   275,   279,   283,
     287,   291,   295,   299,   302,   305,   308,   311,   315,   319,
     321,   323,   325,   327,   329,   333,   337,   341,   345,   349,
     353,   357,   361,   365,   369,   373,   377,   380,   383,   386,
     389,   393,   397,   401,   403,   405,   407,   409
};

/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yysigned_char yyrhs[] =
{
      51,     0,    -1,    -1,    51,    52,    -1,    41,    -1,    54,
      41,    -1,    30,     3,    36,     3,     7,    41,    -1,    -1,
      42,    53,    61,    43,    41,    -1,     1,    41,    -1,    55,
      -1,    13,    70,    55,    -1,    60,    -1,    60,    31,    -1,
      59,    55,    -1,    59,    13,    70,    55,    -1,    59,    12,
      70,    -1,    56,    -1,     9,    57,    -1,    10,    70,    -1,
      11,     6,    -1,    11,     6,    44,    -1,    11,     6,    44,
      70,    -1,    11,     6,    44,    70,    44,    -1,    11,     6,
      44,    70,    44,    70,    -1,    17,    -1,    17,    66,    -1,
      17,     1,    -1,    18,    56,    -1,    20,    56,    -1,    58,
      -1,    57,    44,    58,    -1,    57,    44,    -1,    69,    -1,
       6,    -1,     1,    -1,    60,    -1,    60,    31,    -1,    27,
      -1,    29,    -1,    28,    -1,     5,    62,    -1,     5,     1,
      -1,    63,    -1,    63,    31,    63,    -1,    64,    -1,    63,
      64,    -1,    63,    44,    64,    -1,    68,    -1,     6,    -1,
      27,    45,    68,    -1,    70,    -1,    20,    31,    65,    -1,
       8,    65,    -1,    16,    65,    -1,    67,    -1,    66,    44,
      67,    -1,    42,    65,    43,    -1,    70,    -1,    20,    -1,
       8,    67,    -1,    21,    67,    -1,     3,    -1,    27,    -1,
      68,    32,    68,    -1,    68,    33,    68,    -1,    68,    34,
      68,    -1,    68,    22,    68,    -1,    68,    23,    68,    -1,
      68,    36,    68,    -1,    68,    35,    68,    -1,    68,    37,
      68,    -1,    68,    38,    68,    -1,    68,    24,    68,    -1,
      68,    39,    68,    -1,    68,    25,    68,    -1,    46,    68,
      -1,    47,    68,    48,    -1,     3,    -1,     4,    -1,    71,
      -1,    69,    32,    69,    -1,    69,    33,    69,    -1,    69,
      34,    69,    -1,    69,    22,    69,    -1,    69,    23,    69,
      -1,    69,    36,    69,    -1,    69,    35,    69,    -1,    69,
      37,    69,    -1,    69,    38,    69,    -1,    69,    24,    69,
      -1,    69,    39,    69,    -1,    69,    25,    69,    -1,    36,
      69,    -1,    35,    69,    -1,    46,    69,    -1,    14,    69,
      -1,    69,    15,    69,    -1,    47,    69,    48,    -1,     3,
      -1,     4,    -1,    19,    -1,     6,    -1,    71,    -1,    70,
      32,    70,    -1,    70,    33,    70,    -1,    70,    34,    70,
      -1,    70,    22,    70,    -1,    70,    23,    70,    -1,    70,
      36,    70,    -1,    70,    35,    70,    -1,    70,    37,    70,
      -1,    70,    38,    70,    -1,    70,    24,    70,    -1,    70,
      39,    70,    -1,    70,    25,    70,    -1,    36,    70,    -1,
      35,    70,    -1,    46,    70,    -1,    14,    70,    -1,    70,
      15,    70,    -1,    70,    31,    70,    -1,    47,    70,    48,
      -1,    27,    -1,    29,    -1,    28,    -1,    49,    -1,    26,
      -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short yyrline[] =
{
       0,   125,   125,   126,   139,   140,   141,   153,   153,   156,
     164,   165,   166,   172,   176,   180,   185,   192,   193,   196,
     199,   202,   205,   208,   211,   216,   220,   226,   230,   234,
     240,   244,   245,   248,   249,   250,   256,   257,   260,   261,
     262,   266,   269,   277,   280,   285,   289,   293,   299,   315,
     316,   323,   326,   330,   331,   335,   340,   347,   348,   349,
     350,   358,   364,   365,   372,   373,   374,   375,   376,   377,
     378,   379,   380,   381,   382,   383,   385,   386,   389,   390,
     391,   393,   394,   396,   403,   404,   405,   406,   407,   408,
     409,   410,   411,   412,   413,   415,   416,   417,   418,   425,
     426,   427,   428,   433,   435,   436,   438,   445,   446,   447,
     448,   449,   450,   451,   452,   453,   454,   455,   457,   458,
     459,   460,   461,   464,   468,   472,   476,   481
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "INTNUM", "FLTNUM", "DIRECTIVE_NAME", 
  "STRING", "FILENAME", "SIZE_OVERRIDE", "DECLARE_DATA", "RESERVE_SPACE", 
  "INCBIN", "EQU", "TIMES", "SEG", "WRT", "NOSPLIT", "INSN", "PREFIX", 
  "REG", "SEGREG", "TARGETMOD", "LEFT_OP", "RIGHT_OP", "SIGNDIV", 
  "SIGNMOD", "START_SECTION_ID", "ID", "LOCAL_ID", "SPECIAL_ID", "LINE", 
  "':'", "'|'", "'^'", "'&'", "'-'", "'+'", "'*'", "'/'", "'%'", 
  "UNARYOP", "'\\n'", "'['", "']'", "','", "'='", "'~'", "'('", "')'", 
  "'$'", "$accept", "input", "line", "@1", "lineexp", "exp", "instr", 
  "datavals", "dataval", "label", "label_id", "directive", 
  "directive_val", "directive_valparams", "directive_valparam", "memaddr", 
  "operands", "operand", "direxpr", "dvexpr", "expr", "explabel", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,    58,   124,    94,    38,    45,    43,    42,    47,    37,
     286,    10,    91,    93,    44,    61,   126,    40,    41,    36
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,    50,    51,    51,    52,    52,    52,    53,    52,    52,
      54,    54,    54,    54,    54,    54,    54,    55,    55,    55,
      55,    55,    55,    55,    55,    56,    56,    56,    56,    56,
      57,    57,    57,    58,    58,    58,    59,    59,    60,    60,
      60,    61,    61,    62,    62,    63,    63,    63,    64,    64,
      64,    65,    65,    65,    65,    66,    66,    67,    67,    67,
      67,    67,    68,    68,    68,    68,    68,    68,    68,    68,
      68,    68,    68,    68,    68,    68,    68,    68,    69,    69,
      69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
      69,    69,    69,    69,    69,    69,    69,    69,    69,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    71,    71,    71,    71,    71
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     0,     2,     1,     2,     6,     0,     5,     2,
       1,     3,     1,     2,     2,     4,     3,     1,     2,     2,
       2,     3,     4,     5,     6,     1,     2,     2,     2,     2,
       1,     3,     2,     1,     1,     1,     1,     2,     1,     1,
       1,     2,     2,     1,     3,     1,     2,     3,     1,     1,
       3,     1,     3,     2,     2,     1,     3,     3,     1,     1,
       2,     2,     1,     1,     3,     3,     3,     3,     3,     3,
       3,     3,     3,     3,     3,     3,     2,     3,     1,     1,
       1,     3,     3,     3,     3,     3,     3,     3,     3,     3,
       3,     3,     3,     2,     2,     2,     2,     3,     3,     1,
       1,     1,     1,     1,     3,     3,     3,     3,     3,     3,
       3,     3,     3,     3,     3,     3,     2,     2,     2,     2,
       3,     3,     3,     1,     1,     1,     1,     1
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned char yydefact[] =
{
       2,     0,     1,     0,     0,     0,     0,     0,     0,     0,
       0,    38,    40,    39,     0,     4,     7,     3,     0,    10,
      17,     0,    36,     9,    35,    78,    79,    34,     0,   127,
     123,   125,   124,     0,     0,     0,     0,   126,    18,    30,
      33,    80,    99,   100,   102,     0,   101,     0,     0,     0,
       0,    19,   103,    20,     0,    27,     0,    59,     0,     0,
      26,    55,    58,    28,    29,     0,     0,     5,     0,     0,
      14,    37,    96,    94,    93,    95,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,   119,   117,   116,   118,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      21,    11,    60,    61,     0,     0,     0,     0,    51,     0,
       0,     0,     0,    16,     0,    98,    31,    97,    84,    85,
      90,    92,    81,    82,    83,    87,    86,    88,    89,    91,
     122,   120,   107,   108,   113,   115,   121,   104,   105,   106,
     110,   109,   111,   112,   114,    22,    53,    54,     0,    57,
      56,     0,    42,    62,    49,    63,     0,     0,    41,    43,
      45,    48,     0,    15,    23,    52,     0,     0,    63,    76,
       0,     0,     0,    46,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     8,    24,     6,    50,
      77,    44,    47,    67,    68,    73,    75,    64,    65,    66,
      70,    69,    71,    72,    74
};

/* YYDEFGOTO[NTERM-NUM]. */
static const short yydefgoto[] =
{
      -1,     1,    17,    66,    18,    19,    20,    38,    39,    21,
      22,   122,   168,   169,   170,   117,    60,    61,   171,    40,
      62,    52
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -136
static const short yypact[] =
{
    -136,   348,  -136,   -34,   180,   298,     8,   298,   129,     3,
       3,  -136,  -136,  -136,    16,  -136,  -136,  -136,   -17,  -136,
    -136,   749,   -19,  -136,  -136,  -136,  -136,  -136,   293,  -136,
    -136,  -136,  -136,   293,   293,   293,   293,  -136,   -16,  -136,
     522,  -136,  -136,  -136,  -136,   298,  -136,   298,   298,   298,
     298,   497,  -136,    -9,   408,  -136,   227,  -136,   227,   264,
      -6,  -136,   497,  -136,  -136,    15,    45,  -136,   298,   298,
    -136,    11,  -136,  -136,  -136,  -136,   376,   176,   293,   293,
     293,   293,   293,   293,   293,   293,   293,   293,   293,   293,
     293,  -136,  -136,  -136,  -136,   349,   298,   298,   298,   298,
     298,   298,   298,   298,   298,   298,   298,   298,   298,   298,
     298,  -136,  -136,  -136,   264,   264,    24,    19,   497,   227,
      65,    10,    26,   497,   408,  -136,  -136,   565,   368,   368,
    -136,  -136,   619,   650,   528,   212,   212,  -136,  -136,  -136,
    -136,   583,   713,   713,  -136,  -136,   547,   626,   668,   692,
     220,   220,  -136,  -136,  -136,   433,  -136,  -136,   264,  -136,
    -136,    81,  -136,  -136,  -136,    44,    14,    14,  -136,   141,
    -136,   601,    49,  -136,   298,  -136,    66,    14,  -136,  -136,
     470,    12,    12,  -136,    14,    14,    14,    14,    14,    14,
      14,    14,    14,    14,    14,    14,  -136,   497,  -136,   601,
    -136,     2,  -136,   718,   718,  -136,  -136,   644,   674,   697,
     313,   313,  -136,  -136,  -136
};

/* YYPGOTO[NTERM-NUM].  */
static const short yypgoto[] =
{
    -136,  -136,  -136,  -136,  -136,   -18,    17,  -136,    31,  -136,
    -136,  -136,  -136,   -70,  -135,  -105,  -136,   -52,   296,    37,
      -5,    -3
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, parse error.  */
#define YYTABLE_NINF -33
static const short yytable[] =
{
      51,    41,    54,    70,   112,   163,   113,    23,   164,   156,
     157,   162,    71,   163,    53,   163,   164,   163,   164,    65,
       8,     9,   -12,    10,    67,    41,    63,    64,    77,   165,
      41,    41,    41,    41,   183,   110,   111,   165,   119,   165,
      91,   178,    92,    93,    94,    95,   182,   202,   166,   167,
     121,   120,   -13,   175,   118,   158,   166,   167,   166,   167,
     166,   167,   159,   123,   124,    72,   183,   160,   161,   172,
      73,    74,    75,    76,    41,    41,    41,    41,    41,    41,
      41,    41,    41,    41,    41,    41,    41,    41,   176,   177,
     196,   141,   142,   143,   144,   145,   146,   147,   148,   149,
     150,   151,   152,   153,   154,   155,   173,   198,   126,   118,
     118,   201,     0,     0,     0,   127,   128,   129,   130,   131,
     132,   133,   134,   135,   136,   137,   138,   139,     0,     0,
      55,     0,    42,    43,     0,    44,     0,    56,     0,     0,
       0,     0,     0,    45,   163,     0,     0,   164,    46,    57,
      58,     0,     0,   118,     0,    29,    30,    31,    32,     0,
       0,     0,     0,     0,    47,    48,     0,     0,   165,   197,
     -25,    59,   181,     0,     0,    49,    50,    24,    37,    25,
      26,    24,    27,    25,    26,   182,    27,   166,   167,     0,
      28,     0,     0,     0,    28,     0,     0,     0,     0,     0,
       0,     0,    29,    30,    31,    32,    29,    30,    31,    32,
       0,    33,    34,     0,     0,    33,    34,   -32,     0,     0,
     -32,     0,    35,    36,     0,    37,    35,    36,     0,    37,
      42,    43,     0,    44,     0,    56,    81,    82,     0,     0,
       0,    45,     0,     0,    99,   100,    46,    57,    58,    88,
      89,    90,     0,    29,    30,    31,    32,   107,   108,   109,
       0,     0,    47,    48,     0,     0,     0,    42,    43,    59,
      44,     0,   114,    49,    50,     0,    37,     0,    45,     0,
     115,     0,     0,    46,   116,     0,     0,     0,     0,     0,
      29,    30,    31,    32,     0,     0,    25,    26,     0,    47,
      48,    42,    43,     0,    44,     0,     0,    28,     0,     0,
      49,    50,    45,    37,     0,     0,     0,    46,     0,    29,
      30,    31,    32,     0,    29,    30,    31,    32,    33,    34,
       0,     0,     0,    47,    48,     0,     0,   186,   187,    35,
      36,     0,    37,     0,    49,    50,     0,    37,     2,     3,
     193,   194,   195,     0,     0,     0,     0,     4,     5,     6,
       0,     7,     0,     0,    96,     8,     9,     0,    10,     0,
       0,    97,    98,    99,   100,    11,    12,    13,    14,     0,
     101,   102,   103,   104,   105,   106,   107,   108,   109,    15,
      16,    78,    81,    82,     0,     0,     0,   140,    79,    80,
      81,    82,     0,    86,    87,    88,    89,    90,    83,    84,
      85,    86,    87,    88,    89,    90,     0,     4,     5,     6,
       0,     0,     0,    96,   125,     8,     9,     0,    10,     0,
      97,    98,    99,   100,     0,     0,     0,     0,     0,   101,
     102,   103,   104,   105,   106,   107,   108,   109,    96,     0,
       0,     0,     0,     0,     0,    97,    98,    99,   100,     0,
       0,     0,   179,   180,   101,   102,   103,   104,   105,   106,
     107,   108,   109,   199,     0,     0,     0,   174,     0,     0,
     203,   204,   205,   206,   207,   208,   209,   210,   211,   212,
     213,   214,   184,   185,   186,   187,     0,     0,     0,     0,
       0,     0,   188,   189,   190,   191,   192,   193,   194,   195,
       0,     0,    96,     0,     0,     0,     0,     0,   200,    97,
      98,    99,   100,     0,     0,     0,     0,     0,   101,   102,
     103,   104,   105,   106,   107,   108,   109,    78,     0,     0,
       0,     0,     0,     0,    79,    80,    81,    82,     0,     0,
      79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
      89,    90,    96,    86,    87,    88,    89,    90,     0,    97,
      98,    99,   100,     0,     0,     0,     0,     0,     0,   102,
     103,   104,   105,   106,   107,   108,   109,    79,    80,    81,
      82,     0,     0,     0,     0,     0,     0,    83,    84,    85,
      86,    87,    88,    89,    90,    97,    98,    99,   100,     0,
       0,     0,     0,     0,     0,   102,   103,   104,   105,   106,
     107,   108,   109,   184,   185,   186,   187,     0,     0,     0,
       0,     0,     0,   188,   189,   190,   191,   192,   193,   194,
     195,    79,    80,    81,    82,     0,     0,     0,    97,    98,
      99,   100,    84,    85,    86,    87,    88,    89,    90,   103,
     104,   105,   106,   107,   108,   109,   184,   185,   186,   187,
       0,     0,    79,    80,    81,    82,     0,   189,   190,   191,
     192,   193,   194,   195,    85,    86,    87,    88,    89,    90,
      97,    98,    99,   100,     0,     0,   184,   185,   186,   187,
       0,     0,   104,   105,   106,   107,   108,   109,   190,   191,
     192,   193,   194,   195,    97,    98,    99,   100,     0,   184,
     185,   186,   187,     0,     0,     0,     0,   105,   106,   107,
     108,   109,   191,   192,   193,   194,   195,    99,   100,     0,
       0,     0,   186,   187,     0,     0,     0,     0,   105,   106,
     107,   108,   109,   191,   192,   193,   194,   195,     4,     5,
       6,    68,    69,     0,     0,     0,     8,     9,     0,    10
};

static const short yycheck[] =
{
       5,     4,     7,    21,    56,     3,    58,    41,     6,   114,
     115,     1,    31,     3,     6,     3,     6,     3,     6,     3,
      17,    18,    41,    20,    41,    28,     9,    10,    44,    27,
      33,    34,    35,    36,   169,    44,    54,    27,    44,    27,
      45,    27,    47,    48,    49,    50,    44,   182,    46,    47,
       5,    36,    41,   158,    59,    31,    46,    47,    46,    47,
      46,    47,    43,    68,    69,    28,   201,   119,     3,    43,
      33,    34,    35,    36,    77,    78,    79,    80,    81,    82,
      83,    84,    85,    86,    87,    88,    89,    90,     7,    45,
      41,    96,    97,    98,    99,   100,   101,   102,   103,   104,
     105,   106,   107,   108,   109,   110,   124,    41,    77,   114,
     115,   181,    -1,    -1,    -1,    78,    79,    80,    81,    82,
      83,    84,    85,    86,    87,    88,    89,    90,    -1,    -1,
       1,    -1,     3,     4,    -1,     6,    -1,     8,    -1,    -1,
      -1,    -1,    -1,    14,     3,    -1,    -1,     6,    19,    20,
      21,    -1,    -1,   158,    -1,    26,    27,    28,    29,    -1,
      -1,    -1,    -1,    -1,    35,    36,    -1,    -1,    27,   174,
      41,    42,    31,    -1,    -1,    46,    47,     1,    49,     3,
       4,     1,     6,     3,     4,    44,     6,    46,    47,    -1,
      14,    -1,    -1,    -1,    14,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    26,    27,    28,    29,    26,    27,    28,    29,
      -1,    35,    36,    -1,    -1,    35,    36,    41,    -1,    -1,
      44,    -1,    46,    47,    -1,    49,    46,    47,    -1,    49,
       3,     4,    -1,     6,    -1,     8,    24,    25,    -1,    -1,
      -1,    14,    -1,    -1,    24,    25,    19,    20,    21,    37,
      38,    39,    -1,    26,    27,    28,    29,    37,    38,    39,
      -1,    -1,    35,    36,    -1,    -1,    -1,     3,     4,    42,
       6,    -1,     8,    46,    47,    -1,    49,    -1,    14,    -1,
      16,    -1,    -1,    19,    20,    -1,    -1,    -1,    -1,    -1,
      26,    27,    28,    29,    -1,    -1,     3,     4,    -1,    35,
      36,     3,     4,    -1,     6,    -1,    -1,    14,    -1,    -1,
      46,    47,    14,    49,    -1,    -1,    -1,    19,    -1,    26,
      27,    28,    29,    -1,    26,    27,    28,    29,    35,    36,
      -1,    -1,    -1,    35,    36,    -1,    -1,    24,    25,    46,
      47,    -1,    49,    -1,    46,    47,    -1,    49,     0,     1,
      37,    38,    39,    -1,    -1,    -1,    -1,     9,    10,    11,
      -1,    13,    -1,    -1,    15,    17,    18,    -1,    20,    -1,
      -1,    22,    23,    24,    25,    27,    28,    29,    30,    -1,
      31,    32,    33,    34,    35,    36,    37,    38,    39,    41,
      42,    15,    24,    25,    -1,    -1,    -1,    48,    22,    23,
      24,    25,    -1,    35,    36,    37,    38,    39,    32,    33,
      34,    35,    36,    37,    38,    39,    -1,     9,    10,    11,
      -1,    -1,    -1,    15,    48,    17,    18,    -1,    20,    -1,
      22,    23,    24,    25,    -1,    -1,    -1,    -1,    -1,    31,
      32,    33,    34,    35,    36,    37,    38,    39,    15,    -1,
      -1,    -1,    -1,    -1,    -1,    22,    23,    24,    25,    -1,
      -1,    -1,   166,   167,    31,    32,    33,    34,    35,    36,
      37,    38,    39,   177,    -1,    -1,    -1,    44,    -1,    -1,
     184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
     194,   195,    22,    23,    24,    25,    -1,    -1,    -1,    -1,
      -1,    -1,    32,    33,    34,    35,    36,    37,    38,    39,
      -1,    -1,    15,    -1,    -1,    -1,    -1,    -1,    48,    22,
      23,    24,    25,    -1,    -1,    -1,    -1,    -1,    31,    32,
      33,    34,    35,    36,    37,    38,    39,    15,    -1,    -1,
      -1,    -1,    -1,    -1,    22,    23,    24,    25,    -1,    -1,
      22,    23,    24,    25,    32,    33,    34,    35,    36,    37,
      38,    39,    15,    35,    36,    37,    38,    39,    -1,    22,
      23,    24,    25,    -1,    -1,    -1,    -1,    -1,    -1,    32,
      33,    34,    35,    36,    37,    38,    39,    22,    23,    24,
      25,    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    34,
      35,    36,    37,    38,    39,    22,    23,    24,    25,    -1,
      -1,    -1,    -1,    -1,    -1,    32,    33,    34,    35,    36,
      37,    38,    39,    22,    23,    24,    25,    -1,    -1,    -1,
      -1,    -1,    -1,    32,    33,    34,    35,    36,    37,    38,
      39,    22,    23,    24,    25,    -1,    -1,    -1,    22,    23,
      24,    25,    33,    34,    35,    36,    37,    38,    39,    33,
      34,    35,    36,    37,    38,    39,    22,    23,    24,    25,
      -1,    -1,    22,    23,    24,    25,    -1,    33,    34,    35,
      36,    37,    38,    39,    34,    35,    36,    37,    38,    39,
      22,    23,    24,    25,    -1,    -1,    22,    23,    24,    25,
      -1,    -1,    34,    35,    36,    37,    38,    39,    34,    35,
      36,    37,    38,    39,    22,    23,    24,    25,    -1,    22,
      23,    24,    25,    -1,    -1,    -1,    -1,    35,    36,    37,
      38,    39,    35,    36,    37,    38,    39,    24,    25,    -1,
      -1,    -1,    24,    25,    -1,    -1,    -1,    -1,    35,    36,
      37,    38,    39,    35,    36,    37,    38,    39,     9,    10,
      11,    12,    13,    -1,    -1,    -1,    17,    18,    -1,    20
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const unsigned char yystos[] =
{
       0,    51,     0,     1,     9,    10,    11,    13,    17,    18,
      20,    27,    28,    29,    30,    41,    42,    52,    54,    55,
      56,    59,    60,    41,     1,     3,     4,     6,    14,    26,
      27,    28,    29,    35,    36,    46,    47,    49,    57,    58,
      69,    71,     3,     4,     6,    14,    19,    35,    36,    46,
      47,    70,    71,     6,    70,     1,     8,    20,    21,    42,
      66,    67,    70,    56,    56,     3,    53,    41,    12,    13,
      55,    31,    69,    69,    69,    69,    69,    44,    15,    22,
      23,    24,    25,    32,    33,    34,    35,    36,    37,    38,
      39,    70,    70,    70,    70,    70,    15,    22,    23,    24,
      25,    31,    32,    33,    34,    35,    36,    37,    38,    39,
      44,    55,    67,    67,     8,    16,    20,    65,    70,    44,
      36,     5,    61,    70,    70,    48,    58,    69,    69,    69,
      69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
      48,    70,    70,    70,    70,    70,    70,    70,    70,    70,
      70,    70,    70,    70,    70,    70,    65,    65,    31,    43,
      67,     3,     1,     3,     6,    27,    46,    47,    62,    63,
      64,    68,    43,    55,    44,    65,     7,    45,    27,    68,
      68,    31,    44,    64,    22,    23,    24,    25,    32,    33,
      34,    35,    36,    37,    38,    39,    41,    70,    41,    68,
      48,    63,    64,    68,    68,    68,    68,    68,    68,    68,
      68,    68,    68,    68,    68
};

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok         (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY         -2
#define YYEOF           0

#define YYACCEPT  goto yyacceptlab
#define YYABORT         goto yyabortlab
#define YYERROR         goto yyerrlab1

/* Like YYERROR except do call yyerror.  This remains here temporarily
   to ease the transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */

#define YYFAIL          goto yyerrlab

#define YYRECOVERING()  (!!yyerrstatus)

#define YYBACKUP(Token, Value)                              \
do                                              \
  if (yychar == YYEMPTY && yylen == 1)                      \
    {                                           \
      yychar = (Token);                               \
      yylval = (Value);                               \
      yychar1 = YYTRANSLATE (yychar);                       \
      YYPOPSTACK;                               \
      goto yybackup;                                  \
    }                                           \
  else                                                \
    {                                                 \
      yyerror ("syntax error: cannot back up");             \
      YYERROR;                                        \
    }                                           \
while (0)

#define YYTERROR  1
#define YYERRCODE 256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)           \
  Current.first_line   = Rhs[1].first_line;      \
  Current.first_column = Rhs[1].first_column;    \
  Current.last_line    = Rhs[N].last_line;       \
  Current.last_column  = Rhs[N].last_column;
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX    yylex (&yylval, YYLEX_PARAM)
#else
# define YYLEX    yylex (&yylval)
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)                  \
do {                                \
  if (yydebug)                            \
    YYFPRINTF Args;                       \
} while (0)
# define YYDSYMPRINT(Args)                \
do {                                \
  if (yydebug)                            \
    yysymprint Args;                      \
} while (0)
/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
#endif /* !YYDEBUG */

/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef     YYINITDEPTH
# define YYINITDEPTH 200
#endif

/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
   if the built-in stack extension method is used).

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*-----------------------------.
| Print this symbol on YYOUT.  |
`-----------------------------*/

static void
#if defined (__STDC__) || defined (__cplusplus)
yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
#else
yysymprint (yyout, yytype, yyvalue)
    FILE* yyout;
    int yytype;
    YYSTYPE yyvalue;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvalue;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyout, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyout, yytoknum[yytype], yyvalue);
# endif
    }
  else
    YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyout, ")");
}
#endif /* YYDEBUG. */


/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

static void
#if defined (__STDC__) || defined (__cplusplus)
yydestruct (int yytype, YYSTYPE yyvalue)
#else
yydestruct (yytype, yyvalue)
    int yytype;
    YYSTYPE yyvalue;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvalue;

  switch (yytype)
    {
      default:
        break;
    }
}



/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
#  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#  define YYPARSE_PARAM_DECL
# else
#  define YYPARSE_PARAM_ARG YYPARSE_PARAM
#  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
#else /* !YYPARSE_PARAM */
# define YYPARSE_PARAM_ARG
# define YYPARSE_PARAM_DECL
#endif /* !YYPARSE_PARAM */

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
# ifdef YYPARSE_PARAM
int yyparse (void *);
# else
int yyparse (void);
# endif
#endif




int
yyparse (YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  /* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of parse errors so far.  */
int yynerrs;

  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yychar1 = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short     yyssa[YYINITDEPTH];
  short *yyss = yyssa;
  register short *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;           /* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss;
  yyvsp = yyvs;

  goto yysetstate;

/*------------------------------------------------------------.
| yynewstate -- Push a new state, which is found in yystate.  |
`------------------------------------------------------------*/
 yynewstate:
  /* In all cases, when you get here, the value and location stacks
     have just been pushed. so pushing a state here evens the stacks.
     */
  yyssp++;

 yysetstate:
  *yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
      /* Give user a chance to reallocate the stack. Use copies of
         these so that the &'s don't force the real ones into
         memory.  */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;


      /* Each stack pointer address is followed by the size of the
         data in use in that stack, in bytes.  This used to be a
         conditional around just the two extra args, but that might
         be undefined if yyoverflow is a macro.  */
      yyoverflow ("parser stack overflow",
                &yyss1, yysize * sizeof (*yyssp),
                &yyvs1, yysize * sizeof (*yyvsp),

                &yystacksize);

      yyss = yyss1;
      yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
      goto yyoverflowlab;
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
      yystacksize = YYMAXDEPTH;

      {
      short *yyss1 = yyss;
      union yyalloc *yyptr =
        (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
      if (! yyptr)
        goto yyoverflowlab;
      YYSTACK_RELOCATE (yyss);
      YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
      if (yyss1 != yyssa)
        YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
              (unsigned long int) yystacksize));

      if (yyssp >= yyss + yystacksize - 1)
      YYABORT;
    }

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| yybackup.  |
`-----------*/
yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYPACT_NINF)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with.  */

  if (yychar <= 0)            /* This means end of input.  */
    {
      yychar1 = 0;
      yychar = YYEOF;         /* Don't call YYLEX any more.  */

      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yychar1 = YYTRANSLATE (yychar);

      /* We have to keep this `#if YYDEBUG', since we use variables
       which are defined only if `YYDEBUG' is set.  */
      YYDPRINTF ((stderr, "Next token is "));
      YYDSYMPRINT ((stderr, yychar1, yylval));
      YYDPRINTF ((stderr, "\n"));
    }

  /* If the proper action on seeing token YYCHAR1 is to reduce or to
     detect an error, take that action.  */
  yyn += yychar1;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
      goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %d (%s), ",
            yychar, yytname[yychar1]));

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;


  /* Count tokens shifted since error; after three, turn off error
     status.  */
  if (yyerrstatus)
    yyerrstatus--;

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];



#if YYDEBUG
  /* We have to keep this `#if YYDEBUG', since we use variables which
     are defined only if `YYDEBUG' is set.  */
  if (yydebug)
    {
      int yyi;

      YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
             yyn - 1, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
      YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
      YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif
  switch (yyn)
    {
        case 3:
#line 126 "modules/parsers/nasm/nasm-bison.y"
    {
      parser_nasm->temp_bc =
          yasm_section_bcs_append(parser_nasm->cur_section, yyvsp[0].bc);
      if (parser_nasm->temp_bc)
          parser_nasm->prev_bc = parser_nasm->temp_bc;
      if (parser_nasm->save_input)
          yasm_linemap_add_source(parser_nasm->linemap,
            parser_nasm->temp_bc,
            parser_nasm->save_line[parser_nasm->save_last ^ 1]);
      yasm_linemap_goto_next(parser_nasm->linemap);
    }
    break;

  case 4:
#line 139 "modules/parsers/nasm/nasm-bison.y"
    { yyval.bc = (yasm_bytecode *)NULL; }
    break;

  case 6:
#line 141 "modules/parsers/nasm/nasm-bison.y"
    {
      /* %line indicates the line number of the *next* line, so subtract out
       * the increment when setting the line number.
       */
      yasm_linemap_set(parser_nasm->linemap, yyvsp[-1].str_val,
          yasm_intnum_get_uint(yyvsp[-4].intn) - yasm_intnum_get_uint(yyvsp[-2].intn),
          yasm_intnum_get_uint(yyvsp[-2].intn));
      yasm_intnum_destroy(yyvsp[-4].intn);
      yasm_intnum_destroy(yyvsp[-2].intn);
      yasm_xfree(yyvsp[-1].str_val);
      yyval.bc = (yasm_bytecode *)NULL;
    }
    break;

  case 7:
#line 153 "modules/parsers/nasm/nasm-bison.y"
    { parser_nasm->state = DIRECTIVE; }
    break;

  case 8:
#line 153 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = (yasm_bytecode *)NULL;
    }
    break;

  case 9:
#line 156 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm__error(cur_line,
                N_("label or instruction expected at start of line"));
      yyval.bc = (yasm_bytecode *)NULL;
      yyerrok;
    }
    break;

  case 11:
#line 165 "modules/parsers/nasm/nasm-bison.y"
    { yyval.bc = yyvsp[0].bc; yasm_bc_set_multiple(yyval.bc, yyvsp[-1].exp); }
    break;

  case 12:
#line 166 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm__warning(YASM_WARN_ORPHAN_LABEL, cur_line,
                  N_("label alone on a line without a colon might be in error"));
      yyval.bc = (yasm_bytecode *)NULL;
      define_label(parser_nasm, yyvsp[0].label.name, yyvsp[0].label.local);
    }
    break;

  case 13:
#line 172 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = (yasm_bytecode *)NULL;
      define_label(parser_nasm, yyvsp[-1].label.name, yyvsp[-1].label.local);
    }
    break;

  case 14:
#line 176 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yyvsp[0].bc;
      define_label(parser_nasm, yyvsp[-1].label.name, yyvsp[-1].label.local);
    }
    break;

  case 15:
#line 180 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yyvsp[0].bc;
      yasm_bc_set_multiple(yyval.bc, yyvsp[-1].exp);
      define_label(parser_nasm, yyvsp[-3].label.name, yyvsp[-3].label.local);
    }
    break;

  case 16:
#line 185 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = (yasm_bytecode *)NULL;
      yasm_symtab_define_equ(p_symtab, yyvsp[-2].label.name, yyvsp[0].exp, cur_line);
      yasm_xfree(yyvsp[-2].label.name);
    }
    break;

  case 18:
#line 193 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_data(&yyvsp[0].datahead, yyvsp[-1].int_info, cur_line);
    }
    break;

  case 19:
#line 196 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_reserve(yyvsp[0].exp, yyvsp[-1].int_info, cur_line);
    }
    break;

  case 20:
#line 199 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_incbin(yyvsp[0].str_val, NULL, NULL, cur_line);
    }
    break;

  case 21:
#line 202 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_incbin(yyvsp[-1].str_val, NULL, NULL, cur_line);
    }
    break;

  case 22:
#line 205 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_incbin(yyvsp[-2].str_val, yyvsp[0].exp, NULL, cur_line);
    }
    break;

  case 23:
#line 208 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_incbin(yyvsp[-3].str_val, yyvsp[-1].exp, NULL, cur_line);
    }
    break;

  case 24:
#line 211 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_bc_create_incbin(yyvsp[-4].str_val, yyvsp[-2].exp, yyvsp[0].exp, cur_line);
    }
    break;

  case 25:
#line 216 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_arch_parse_insn(parser_nasm->arch, yyvsp[0].arch_data, 0, NULL,
                          parser_nasm->prev_bc, cur_line);
    }
    break;

  case 26:
#line 220 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yasm_arch_parse_insn(parser_nasm->arch, yyvsp[-1].arch_data, yyvsp[0].insn_operands.num_operands,
                          &yyvsp[0].insn_operands.operands, parser_nasm->prev_bc,
                          cur_line);
      yasm_ops_delete(&yyvsp[0].insn_operands.operands, 0);
    }
    break;

  case 27:
#line 226 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm__error(cur_line, N_("expression syntax error"));
      yyval.bc = NULL;
    }
    break;

  case 28:
#line 230 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yyvsp[0].bc;
      yasm_arch_parse_prefix(parser_nasm->arch, yyval.bc, yyvsp[-1].arch_data, cur_line);
    }
    break;

  case 29:
#line 234 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.bc = yyvsp[0].bc;
      yasm_arch_parse_seg_prefix(parser_nasm->arch, yyval.bc, yyvsp[-1].arch_data[0], cur_line);
    }
    break;

  case 30:
#line 240 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_dvs_initialize(&yyval.datahead);
      yasm_dvs_append(&yyval.datahead, yyvsp[0].data);
    }
    break;

  case 31:
#line 244 "modules/parsers/nasm/nasm-bison.y"
    { yasm_dvs_append(&yyvsp[-2].datahead, yyvsp[0].data); yyval.datahead = yyvsp[-2].datahead; }
    break;

  case 32:
#line 245 "modules/parsers/nasm/nasm-bison.y"
    { yyval.datahead = yyvsp[-1].datahead; }
    break;

  case 33:
#line 248 "modules/parsers/nasm/nasm-bison.y"
    { yyval.data = yasm_dv_create_expr(yyvsp[0].exp); }
    break;

  case 34:
#line 249 "modules/parsers/nasm/nasm-bison.y"
    { yyval.data = yasm_dv_create_string(yyvsp[0].str_val); }
    break;

  case 35:
#line 250 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm__error(cur_line, N_("expression syntax error"));
      yyval.data = (yasm_dataval *)NULL;
    }
    break;

  case 37:
#line 257 "modules/parsers/nasm/nasm-bison.y"
    { yyval.label = yyvsp[-1].label; }
    break;

  case 38:
#line 260 "modules/parsers/nasm/nasm-bison.y"
    { yyval.label.name = yyvsp[0].str_val; yyval.label.local = 0; }
    break;

  case 39:
#line 261 "modules/parsers/nasm/nasm-bison.y"
    { yyval.label.name = yyvsp[0].str_val; yyval.label.local = 1; }
    break;

  case 40:
#line 262 "modules/parsers/nasm/nasm-bison.y"
    { yyval.label.name = yyvsp[0].str_val; yyval.label.local = 1; }
    break;

  case 41:
#line 266 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_xfree(yyvsp[-1].str_val);
    }
    break;

  case 42:
#line 269 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm__error(cur_line, N_("invalid arguments to [%s]"), yyvsp[-1].str_val);
      yasm_xfree(yyvsp[-1].str_val);
    }
    break;

  case 43:
#line 277 "modules/parsers/nasm/nasm-bison.y"
    {
      nasm_parser_directive(parser_nasm, yyvsp[-1].str_val, &yyvsp[0].dir_valparams, NULL);
    }
    break;

  case 44:
#line 280 "modules/parsers/nasm/nasm-bison.y"
    {
      nasm_parser_directive(parser_nasm, yyvsp[-3].str_val, &yyvsp[-2].dir_valparams, &yyvsp[0].dir_valparams);
    }
    break;

  case 45:
#line 285 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_vps_initialize(&yyval.dir_valparams);
      yasm_vps_append(&yyval.dir_valparams, yyvsp[0].dir_valparam);
    }
    break;

  case 46:
#line 289 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_vps_append(&yyvsp[-1].dir_valparams, yyvsp[0].dir_valparam);
      yyval.dir_valparams = yyvsp[-1].dir_valparams;
    }
    break;

  case 47:
#line 293 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_vps_append(&yyvsp[-2].dir_valparams, yyvsp[0].dir_valparam);
      yyval.dir_valparams = yyvsp[-2].dir_valparams;
    }
    break;

  case 48:
#line 299 "modules/parsers/nasm/nasm-bison.y"
    {
      /* If direxpr is just an ID, put it in val and delete the expr.
       * Otherwise, we need to go through the expr and replace the current
       * (local) symrecs with the use of global ones.
       */
      const /*@null@*/ yasm_symrec *vp_symrec;
      if ((vp_symrec = yasm_expr_get_symrec(&yyvsp[0].exp, 0))) {
          yyval.dir_valparam = yasm_vp_create(yasm__xstrdup(yasm_symrec_get_name(vp_symrec)),
                        NULL);
          yasm_expr_destroy(yyvsp[0].exp);
      } else {
          yasm_expr__traverse_leaves_in(yyvsp[0].exp, parser_nasm,
                                fix_directive_symrec);
          yyval.dir_valparam = yasm_vp_create(NULL, yyvsp[0].exp);
      }
    }
    break;

  case 49:
#line 315 "modules/parsers/nasm/nasm-bison.y"
    { yyval.dir_valparam = yasm_vp_create(yyvsp[0].str_val, NULL); }
    break;

  case 50:
#line 316 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_expr__traverse_leaves_in(yyvsp[0].exp, parser_nasm, fix_directive_symrec);
      yyval.dir_valparam = yasm_vp_create(yyvsp[-2].str_val, yyvsp[0].exp);
    }
    break;

  case 51:
#line 323 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.ea = yasm_arch_ea_create(parser_nasm->arch, yyvsp[0].exp);
    }
    break;

  case 52:
#line 326 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.ea = yyvsp[0].ea;
      yasm_arch_parse_seg_override(parser_nasm->arch, yyval.ea, yyvsp[-2].arch_data[0], cur_line);
    }
    break;

  case 53:
#line 330 "modules/parsers/nasm/nasm-bison.y"
    { yyval.ea = yyvsp[0].ea; yasm_ea_set_len(yyval.ea, yyvsp[-1].int_info); }
    break;

  case 54:
#line 331 "modules/parsers/nasm/nasm-bison.y"
    { yyval.ea = yyvsp[0].ea; yasm_ea_set_nosplit(yyval.ea, 1); }
    break;

  case 55:
#line 335 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_ops_initialize(&yyval.insn_operands.operands);
      yasm_ops_append(&yyval.insn_operands.operands, yyvsp[0].insn_operand);
      yyval.insn_operands.num_operands = 1;
    }
    break;

  case 56:
#line 340 "modules/parsers/nasm/nasm-bison.y"
    {
      yasm_ops_append(&yyvsp[-2].insn_operands.operands, yyvsp[0].insn_operand);
      yyval.insn_operands.operands = yyvsp[-2].insn_operands.operands;
      yyval.insn_operands.num_operands = yyvsp[-2].insn_operands.num_operands+1;
    }
    break;

  case 57:
#line 347 "modules/parsers/nasm/nasm-bison.y"
    { yyval.insn_operand = yasm_operand_create_mem(yyvsp[-1].ea); }
    break;

  case 58:
#line 348 "modules/parsers/nasm/nasm-bison.y"
    { yyval.insn_operand = yasm_operand_create_imm(yyvsp[0].exp); }
    break;

  case 59:
#line 349 "modules/parsers/nasm/nasm-bison.y"
    { yyval.insn_operand = yasm_operand_create_segreg(yyvsp[0].arch_data[0]); }
    break;

  case 60:
#line 350 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.insn_operand = yyvsp[0].insn_operand;
      if (yyval.insn_operand->type == YASM_INSN__OPERAND_REG &&
          yasm_arch_get_reg_size(parser_nasm->arch, yyval.insn_operand->data.reg) != yyvsp[-1].int_info)
          yasm__error(cur_line, N_("cannot override register size"));
      else
          yyval.insn_operand->size = yyvsp[-1].int_info;
    }
    break;

  case 61:
#line 358 "modules/parsers/nasm/nasm-bison.y"
    { yyval.insn_operand = yyvsp[0].insn_operand; yyval.insn_operand->targetmod = yyvsp[-1].arch_data[0]; }
    break;

  case 62:
#line 364 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_int(yyvsp[0].intn)); }
    break;

  case 63:
#line 365 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.exp = p_expr_new_ident(yasm_expr_sym(
          yasm_symtab_define_label(p_symtab, yyvsp[0].str_val,
            yasm_section_bcs_first(parser_nasm->cur_section), 0,
            cur_line)));
      yasm_xfree(yyvsp[0].str_val);
    }
    break;

  case 64:
#line 372 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_OR, yyvsp[0].exp); }
    break;

  case 65:
#line 373 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_XOR, yyvsp[0].exp); }
    break;

  case 66:
#line 374 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_AND, yyvsp[0].exp); }
    break;

  case 67:
#line 375 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHL, yyvsp[0].exp); }
    break;

  case 68:
#line 376 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHR, yyvsp[0].exp); }
    break;

  case 69:
#line 377 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_ADD, yyvsp[0].exp); }
    break;

  case 70:
#line 378 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SUB, yyvsp[0].exp); }
    break;

  case 71:
#line 379 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MUL, yyvsp[0].exp); }
    break;

  case 72:
#line 380 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_DIV, yyvsp[0].exp); }
    break;

  case 73:
#line 381 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNDIV, yyvsp[0].exp); }
    break;

  case 74:
#line 382 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MOD, yyvsp[0].exp); }
    break;

  case 75:
#line 383 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNMOD, yyvsp[0].exp); }
    break;

  case 76:
#line 385 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_NOT, yyvsp[0].exp); }
    break;

  case 77:
#line 386 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = yyvsp[-1].exp; }
    break;

  case 78:
#line 389 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_int(yyvsp[0].intn)); }
    break;

  case 79:
#line 390 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_float(yyvsp[0].flt)); }
    break;

  case 80:
#line 391 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_sym(yyvsp[0].sym)); }
    break;

  case 81:
#line 393 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_OR, yyvsp[0].exp); }
    break;

  case 82:
#line 394 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_XOR, yyvsp[0].exp); }
    break;

  case 83:
#line 396 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_AND, yyvsp[0].exp); }
    break;

  case 84:
#line 403 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHL, yyvsp[0].exp); }
    break;

  case 85:
#line 404 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHR, yyvsp[0].exp); }
    break;

  case 86:
#line 405 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_ADD, yyvsp[0].exp); }
    break;

  case 87:
#line 406 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SUB, yyvsp[0].exp); }
    break;

  case 88:
#line 407 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MUL, yyvsp[0].exp); }
    break;

  case 89:
#line 408 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_DIV, yyvsp[0].exp); }
    break;

  case 90:
#line 409 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNDIV, yyvsp[0].exp); }
    break;

  case 91:
#line 410 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MOD, yyvsp[0].exp); }
    break;

  case 92:
#line 411 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNMOD, yyvsp[0].exp); }
    break;

  case 93:
#line 412 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = yyvsp[0].exp; }
    break;

  case 94:
#line 413 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_NEG, yyvsp[0].exp); }
    break;

  case 95:
#line 415 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_NOT, yyvsp[0].exp); }
    break;

  case 96:
#line 416 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_SEG, yyvsp[0].exp); }
    break;

  case 97:
#line 417 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_WRT, yyvsp[0].exp); }
    break;

  case 98:
#line 418 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = yyvsp[-1].exp; }
    break;

  case 99:
#line 425 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_int(yyvsp[0].intn)); }
    break;

  case 100:
#line 426 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_float(yyvsp[0].flt)); }
    break;

  case 101:
#line 427 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_reg(yyvsp[0].arch_data[0])); }
    break;

  case 102:
#line 428 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.exp = p_expr_new_ident(yasm_expr_int(
          yasm_intnum_create_charconst_nasm(yyvsp[0].str_val, cur_line)));
      yasm_xfree(yyvsp[0].str_val);
    }
    break;

  case 103:
#line 433 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_ident(yasm_expr_sym(yyvsp[0].sym)); }
    break;

  case 104:
#line 435 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_OR, yyvsp[0].exp); }
    break;

  case 105:
#line 436 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_XOR, yyvsp[0].exp); }
    break;

  case 106:
#line 438 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_AND, yyvsp[0].exp); }
    break;

  case 107:
#line 445 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHL, yyvsp[0].exp); }
    break;

  case 108:
#line 446 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SHR, yyvsp[0].exp); }
    break;

  case 109:
#line 447 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_ADD, yyvsp[0].exp); }
    break;

  case 110:
#line 448 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SUB, yyvsp[0].exp); }
    break;

  case 111:
#line 449 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MUL, yyvsp[0].exp); }
    break;

  case 112:
#line 450 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_DIV, yyvsp[0].exp); }
    break;

  case 113:
#line 451 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNDIV, yyvsp[0].exp); }
    break;

  case 114:
#line 452 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_MOD, yyvsp[0].exp); }
    break;

  case 115:
#line 453 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SIGNMOD, yyvsp[0].exp); }
    break;

  case 116:
#line 454 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = yyvsp[0].exp; }
    break;

  case 117:
#line 455 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_NEG, yyvsp[0].exp); }
    break;

  case 118:
#line 457 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_NOT, yyvsp[0].exp); }
    break;

  case 119:
#line 458 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_branch(YASM_EXPR_SEG, yyvsp[0].exp); }
    break;

  case 120:
#line 459 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_WRT, yyvsp[0].exp); }
    break;

  case 121:
#line 460 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = p_expr_new_tree(yyvsp[-2].exp, YASM_EXPR_SEGOFF, yyvsp[0].exp); }
    break;

  case 122:
#line 461 "modules/parsers/nasm/nasm-bison.y"
    { yyval.exp = yyvsp[-1].exp; }
    break;

  case 123:
#line 464 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.sym = yasm_symtab_use(p_symtab, yyvsp[0].str_val, cur_line);
      yasm_xfree(yyvsp[0].str_val);
    }
    break;

  case 124:
#line 468 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.sym = yasm_symtab_use(p_symtab, yyvsp[0].str_val, cur_line);
      yasm_xfree(yyvsp[0].str_val);
    }
    break;

  case 125:
#line 472 "modules/parsers/nasm/nasm-bison.y"
    {
      yyval.sym = yasm_symtab_use(p_symtab, yyvsp[0].str_val, cur_line);
      yasm_xfree(yyvsp[0].str_val);
    }
    break;

  case 126:
#line 476 "modules/parsers/nasm/nasm-bison.y"
    {
      /* "$" references the current assembly position */
      yyval.sym = yasm_symtab_define_label(p_symtab, "$", parser_nasm->prev_bc, 0,
                              cur_line);
    }
    break;

  case 127:
#line 481 "modules/parsers/nasm/nasm-bison.y"
    {
      /* "$$" references the start of the current section */
      yyval.sym = yasm_symtab_define_label(p_symtab, "$$",
          yasm_section_bcs_first(parser_nasm->cur_section), 0, cur_line);
    }
    break;


    }

/* Line 1016 of /usr/local/share/bison/yacc.c.  */
#line 2114 "nasm-bison.c"

  yyvsp -= yylen;
  yyssp -= yylen;


#if YYDEBUG
  if (yydebug)
    {
      short *yyssp1 = yyss - 1;
      YYFPRINTF (stderr, "state stack now");
      while (yyssp1 != yyssp)
      YYFPRINTF (stderr, " %d", *++yyssp1);
      YYFPRINTF (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;


  /* Now `shift' the result of the reduction.  Determine what state
     that goes to, based on the state we popped back to and the rule
     number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
      {
        YYSIZE_T yysize = 0;
        int yytype = YYTRANSLATE (yychar);
        char *yymsg;
        int yyx, yycount;

        yycount = 0;
        /* Start YYX at -YYN if negative to avoid negative indexes in
           YYCHECK.  */
        for (yyx = yyn < 0 ? -yyn : 0;
             yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
          if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
            yysize += yystrlen (yytname[yyx]) + 15, yycount++;
        yysize += yystrlen ("parse error, unexpected ") + 1;
        yysize += yystrlen (yytname[yytype]);
        yymsg = (char *) YYSTACK_ALLOC (yysize);
        if (yymsg != 0)
          {
            char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
            yyp = yystpcpy (yyp, yytname[yytype]);

            if (yycount < 5)
            {
              yycount = 0;
              for (yyx = yyn < 0 ? -yyn : 0;
                   yyx < (int) (sizeof (yytname) / sizeof (char *));
                   yyx++)
                if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
                  {
                  const char *yyq = ! yycount ? ", expecting " : " or ";
                  yyp = yystpcpy (yyp, yyq);
                  yyp = yystpcpy (yyp, yytname[yyx]);
                  yycount++;
                  }
            }
            yyerror (yymsg);
            YYSTACK_FREE (yymsg);
          }
        else
          yyerror ("parse error; also virtual memory exhausted");
      }
      else
#endif /* YYERROR_VERBOSE */
      yyerror ("parse error");
    }
  goto yyerrlab1;


/*----------------------------------------------------.
| yyerrlab1 -- error raised explicitly by an action.  |
`----------------------------------------------------*/
yyerrlab1:
  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
       error, discard it.  */

      /* Return failure if at end of input.  */
      if (yychar == YYEOF)
        {
        /* Pop the error token.  */
          YYPOPSTACK;
        /* Pop the rest of the stack.  */
        while (yyssp > yyss)
          {
            YYDPRINTF ((stderr, "Error: popping "));
            YYDSYMPRINT ((stderr,
                      yystos[*yyssp],
                      *yyvsp));
            YYDPRINTF ((stderr, "\n"));
            yydestruct (yystos[*yyssp], *yyvsp);
            YYPOPSTACK;
          }
        YYABORT;
        }

      YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
              yychar, yytname[yychar1]));
      yydestruct (yychar1, yylval);
      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token after shifting the error
     token.  */

  yyerrstatus = 3;      /* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
      {
        yyn += YYTERROR;
        if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
          {
            yyn = yytable[yyn];
            if (0 < yyn)
            break;
          }
      }

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
      YYABORT;

      YYDPRINTF ((stderr, "Error: popping "));
      YYDSYMPRINT ((stderr,
                yystos[*yyssp], *yyvsp));
      YYDPRINTF ((stderr, "\n"));

      yydestruct (yystos[yystate], *yyvsp);
      yyvsp--;
      yystate = *--yyssp;


#if YYDEBUG
      if (yydebug)
      {
        short *yyssp1 = yyss - 1;
        YYFPRINTF (stderr, "Error: state stack now");
        while (yyssp1 != yyssp)
          YYFPRINTF (stderr, " %d", *++yyssp1);
        YYFPRINTF (stderr, "\n");
      }
#endif
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 488 "modules/parsers/nasm/nasm-bison.y"

/*@=usedef =nullassign =memtrans =usereleased =compdef =mustfree@*/

#undef parser_nasm

static void
define_label(yasm_parser_nasm *parser_nasm, char *name, int local)
{
    if (!local) {
      if (parser_nasm->locallabel_base)
          yasm_xfree(parser_nasm->locallabel_base);
      parser_nasm->locallabel_base_len = strlen(name);
      parser_nasm->locallabel_base =
          yasm_xmalloc(parser_nasm->locallabel_base_len+1);
      strcpy(parser_nasm->locallabel_base, name);
    }

    yasm_symtab_define_label(p_symtab, name, parser_nasm->prev_bc, 1,
                       cur_line);
    yasm_xfree(name);
}

static int
fix_directive_symrec(yasm_expr__item *ei, void *d)
{
    yasm_parser_nasm *parser_nasm = (yasm_parser_nasm *)d;
    if (!ei || ei->type != YASM_EXPR_SYM)
      return 0;

    /* FIXME: Delete current symrec */
    ei->data.sym =
      yasm_symtab_use(p_symtab, yasm_symrec_get_name(ei->data.sym),
                  cur_line);

    return 0;
}

static void
nasm_parser_directive(yasm_parser_nasm *parser_nasm, const char *name,
                  yasm_valparamhead *valparams,
                  yasm_valparamhead *objext_valparams)
{
    yasm_valparam *vp, *vp2;
    unsigned long line = cur_line;

    /* Handle (mostly) output-format independent directives here */
    if (yasm__strcasecmp(name, "extern") == 0) {
      vp = yasm_vps_first(valparams);
      if (vp->val) {
          yasm_objfmt_extern_declare(parser_nasm->objfmt, vp->val,
                               objext_valparams, line);
      } else
          yasm__error(line, N_("invalid argument to [%s]"), "EXTERN");
    } else if (yasm__strcasecmp(name, "global") == 0) {
      vp = yasm_vps_first(valparams);
      if (vp->val) {
          yasm_objfmt_global_declare(parser_nasm->objfmt, vp->val,
                               objext_valparams, line);
      } else
          yasm__error(line, N_("invalid argument to [%s]"), "GLOBAL");
    } else if (yasm__strcasecmp(name, "common") == 0) {
      vp = yasm_vps_first(valparams);
      if (vp->val) {
          vp2 = yasm_vps_next(vp);
          if (!vp2 || (!vp2->val && !vp2->param))
            yasm__error(line, N_("no size specified in %s declaration"),
                      "COMMON");
          else {
            if (vp2->val) {
                yasm_objfmt_common_declare(parser_nasm->objfmt, vp->val,
                  p_expr_new_ident(yasm_expr_sym(
                      yasm_symtab_use(p_symtab, vp2->val, line))),
                  objext_valparams, line);
            } else if (vp2->param) {
                yasm_objfmt_common_declare(parser_nasm->objfmt, vp->val,
                                     vp2->param, objext_valparams,
                                     line);
                vp2->param = NULL;
            }
          }
      } else
          yasm__error(line, N_("invalid argument to [%s]"), "COMMON");
    } else if (yasm__strcasecmp(name, "section") == 0 ||
             yasm__strcasecmp(name, "segment") == 0) {
      yasm_section *new_section =
          yasm_objfmt_section_switch(parser_nasm->objfmt, valparams,
                               objext_valparams, line);
      if (new_section) {
          parser_nasm->cur_section = new_section;
          parser_nasm->prev_bc = yasm_section_bcs_last(new_section);
      } else
          yasm__error(line, N_("invalid argument to [%s]"), "SECTION");
    } else if (yasm__strcasecmp(name, "absolute") == 0) {
      /* it can be just an ID or a complete expression, so handle both. */
      vp = yasm_vps_first(valparams);
      if (vp->val)
          parser_nasm->cur_section =
            yasm_object_create_absolute(parser_nasm->object,
                p_expr_new_ident(yasm_expr_sym(
                  yasm_symtab_use(p_symtab, vp->val, line))), line);
      else if (vp->param) {
          parser_nasm->cur_section =
            yasm_object_create_absolute(parser_nasm->object, vp->param,
                                  line);
          vp->param = NULL;
      }
      parser_nasm->prev_bc = yasm_section_bcs_last(parser_nasm->cur_section);
    } else if (yasm__strcasecmp(name, "cpu") == 0) {
      yasm_vps_foreach(vp, valparams) {
          if (vp->val)
            yasm_arch_parse_cpu(parser_nasm->arch, vp->val, line);
          else if (vp->param) {
            const yasm_intnum *intcpu;
            intcpu = yasm_expr_get_intnum(&vp->param, NULL);
            if (!intcpu)
                yasm__error(line, N_("invalid argument to [%s]"), "CPU");
            else {
                char strcpu[16];
                sprintf(strcpu, "%lu", yasm_intnum_get_uint(intcpu));
                yasm_arch_parse_cpu(parser_nasm->arch, strcpu, line);
            }
          }
      }
    } else if (!yasm_arch_parse_directive(parser_nasm->arch, name, valparams,
                objext_valparams, parser_nasm->object, line)) {
      ;
    } else if (yasm_objfmt_directive(parser_nasm->objfmt, name, valparams,
                             objext_valparams, line)) {
      yasm__error(line, N_("unrecognized directive [%s]"), name);
    }

    yasm_vps_delete(valparams);
    if (objext_valparams)
      yasm_vps_delete(objext_valparams);
}


Generated by  Doxygen 1.6.0   Back to index