/* A Bison parser, made by GNU Bison 2.5.  */

/* Bison implementation for Yacc-like parsers in C
   
      Copyright (C) 1984, 1989-1990, 2000-2011 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.  */

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.
   
   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

/* C LALR(1) parser skeleton 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

/* Bison version.  */
#define YYBISON_VERSION "2.5"

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Push parsers.  */
#define YYPUSH 0

/* Pull parsers.  */
#define YYPULL 1

/* Using locations.  */
#define YYLSP_NEEDED 0



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

/* Line 268 of yacc.c  */
#line 12 "gram.y"


/* ------------------------------------------------------------------
   Initial code (copied verbatim to the output file)
   ------------------------------------------------------------------ */

// Includes

#ifdef _WIN32 
#include <malloc.h>
#endif /* _WIN32 */
//#ifdef LINUX
//#include <malloc.h>  // _alloca is used by the parser
//#else
#include <stdlib.h>

#include <string.h>  // strcpy

#include "lex.h"	// the lexer
#include "list.h"	// list data type
#include "packet.h"	// packet data type
#include "cmd.h"	// command data type
#include "dagrandom.h"	// random numbers and statistic distributions
#include "daggen.h"	// daggen general options

// Some yacc (bison) defines
#define YYDEBUG 1	      // Generate debug code; needed for YYERROR_VERBOSE
#define YYERROR_VERBOSE // Give a more specific parse error message 

// Global variables
// Mainly are extern because we cannot initialise them here
// Check for declarations in daggen.c
extern list_t *list;			// symbol list
extern list_t *packet_list;		// packet list
extern list_t *group_list;		// traffic groups list
extern list_t *counter_list;		// counters list
extern packet_t *packet;		// the present packet
extern options_t daggen_options;	// general options
distribution_t * distr_aux;		// pointer for number distribution
char bypass = 0;			// bypass packet if already declared
list_t *payload_list;			// List of payload contents
payload_t * pload;

// Error-reporting function must be defined by the caller
void Error (char *format, ...);

// Forward references
void yyerror (char *msg);

// Own functions
//void checkPacket (char *symbol);
//void checkSend (char * symbol, unsigned long);
//int elemExists (char * str);
//void printMac (unsigned char * mac);
//unsigned char hexToChar (char c);
////void checkMac (char *mac_str, mac_t * old_mac);
//mac_t * checkMac (char *mac_str);

void checkPacketBegin (char * symbol, unsigned char type);
void checkPacketEnd (char * symbol);
cmd_t * checkSend (char * symbol, distribution_t * distr, distribution_t * snap);
list_t * checkCommand (list_t * list, cmd_t * cmd);
int elemExists (char * str);
void checkEthMac (char *mac_str, char src);
void checkEthMacVar (int);
void checkEthPayload (void);
void checkEthProtocol (unsigned long);
void checkEthFcsSize (unsigned int size);
void checkEthRxError (unsigned int rx);
mac_t * checkMac (char *mac_str);
unsigned char hexToChar (char c);
void printMac (unsigned char * mac);
void checkPosAddr (unsigned long addr);
void checkPosControl (unsigned long control);
void checkPosProtoSize (unsigned long size);
void checkPosProto (unsigned long proto);
//void checkPosPayload (distribution_t * distr);
void checkPosPayload (void);
void checkPosFcsSize (unsigned long size);
void checkPosRxError (unsigned int rx);
counter_t * getCounter (char * id);
void checkAddCounter (char * id, distribution_t * distr, unsigned int size);
void checkAtmType (unsigned char type);
void checkAtmGfc (distribution_t * distr);
void checkAtmVpi (distribution_t * distr);
void checkAtmVci (distribution_t * distr);
void checkAtmPt  (distribution_t * distr);
void checkAtmClp (distribution_t * distr);
void checkAtmPayload ();
void checkAal5Uu  (distribution_t * distr);
void checkAal5Cpi (distribution_t * distr);
void checkAal5Crc (distribution_t * distr);
void checkIBType (unsigned char type);
void checkIBVirtualLane(distribution_t *distr);
void checkIBLinkVersion(distribution_t *distr);
void checkIBServiceLevel(distribution_t *distr);
void checkIBSLID(distribution_t *distr);
void checkIBDLID(distribution_t *distr);
void checkIBOpcode(distribution_t *distr);
void checkIBTver(distribution_t *distr);
void checkIBDQP(distribution_t *distr);
void checkIBSQP(distribution_t *distr);
void checkIBPSN(distribution_t *distr);
void checkIBPayload ();
list_t * checkGroup (list_t * list, group_t * group);




/* Line 268 of yacc.c  */
#line 181 "gram.c"

/* 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

/* Enabling the token table.  */
#ifndef YYTOKEN_TABLE
# define YYTOKEN_TABLE 0
#endif


/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     SEND = 258,
     SRC_ADDR = 259,
     DST_ADDR = 260,
     LENGTH = 261,
     STEP = 262,
     NORMAL = 263,
     POISSON = 264,
     UNIFORM = 265,
     CONSTANT = 266,
     OUTPUT_FILE = 267,
     VERBOSE = 268,
     RANDOM_SEED = 269,
     ADDRESS = 270,
     CONTROL = 271,
     PROTOCOL_SIZE = 272,
     FCS_SIZE = 273,
     FORMAT_ERF = 274,
     TOKEN_SIZE = 275,
     DUMMY = 276,
     PROTOCOL = 277,
     PAYLOAD = 278,
     RX_ERROR = 279,
     FORMAT_PCAP = 280,
     ATM_GFC = 281,
     ATM_VPI = 282,
     ATM_VCI = 283,
     ATM_PT = 284,
     ATM_CLP = 285,
     AAL5_UU = 286,
     AAL5_CPI = 287,
     AAL5_CRC = 288,
     ATM_TYPE = 289,
     ATM_UNI = 290,
     ATM_NNI = 291,
     LOOP = 292,
     TOKEN_GROUP = 293,
     INTERFACE = 294,
     IB_LOCAL = 295,
     IB_GLOBAL = 296,
     IB_LRH_VL = 297,
     IB_LRH_LVER = 298,
     IB_LRH_SLEVEL = 299,
     IB_LRH_DLID = 300,
     IB_LRH_SLID = 301,
     IB_BTH_QP = 302,
     IB_SRC_QP = 303,
     IB_BTH_OPCODE = 304,
     IB_BTH_PSN = 305,
     IB_BTH_TVER = 306,
     IB_RAW = 307,
     IB_NON_IB = 308,
     EOC = 309,
     PACKET = 310,
     PACKETS = 311,
     TRAFFIC = 312,
     COLON = 313,
     TILDE = 314,
     COMMA = 315,
     OPTIONS = 316,
     PLUS = 317,
     PACKET_ETH802_3 = 318,
     PACKET_POS = 319,
     OUTPUT_FORMAT = 320,
     COUNTERS = 321,
     PACKET_ETH_II = 322,
     PACKET_ATM = 323,
     PACKET_AAL5 = 324,
     WLEN = 325,
     SNAP = 326,
     PACKET_IB = 327,
     OPEN_KEY = 328,
     CLOSE_KEY = 329,
     OPEN_PAR = 330,
     CLOSE_PAR = 331,
     OPEN_BRA = 332,
     CLOSE_BRA = 333,
     ID = 334,
     STRING = 335,
     TOKEN_MAC = 336,
     NUMBER = 337,
     HEXASTRING = 338
   };
#endif
/* Tokens.  */
#define SEND 258
#define SRC_ADDR 259
#define DST_ADDR 260
#define LENGTH 261
#define STEP 262
#define NORMAL 263
#define POISSON 264
#define UNIFORM 265
#define CONSTANT 266
#define OUTPUT_FILE 267
#define VERBOSE 268
#define RANDOM_SEED 269
#define ADDRESS 270
#define CONTROL 271
#define PROTOCOL_SIZE 272
#define FCS_SIZE 273
#define FORMAT_ERF 274
#define TOKEN_SIZE 275
#define DUMMY 276
#define PROTOCOL 277
#define PAYLOAD 278
#define RX_ERROR 279
#define FORMAT_PCAP 280
#define ATM_GFC 281
#define ATM_VPI 282
#define ATM_VCI 283
#define ATM_PT 284
#define ATM_CLP 285
#define AAL5_UU 286
#define AAL5_CPI 287
#define AAL5_CRC 288
#define ATM_TYPE 289
#define ATM_UNI 290
#define ATM_NNI 291
#define LOOP 292
#define TOKEN_GROUP 293
#define INTERFACE 294
#define IB_LOCAL 295
#define IB_GLOBAL 296
#define IB_LRH_VL 297
#define IB_LRH_LVER 298
#define IB_LRH_SLEVEL 299
#define IB_LRH_DLID 300
#define IB_LRH_SLID 301
#define IB_BTH_QP 302
#define IB_SRC_QP 303
#define IB_BTH_OPCODE 304
#define IB_BTH_PSN 305
#define IB_BTH_TVER 306
#define IB_RAW 307
#define IB_NON_IB 308
#define EOC 309
#define PACKET 310
#define PACKETS 311
#define TRAFFIC 312
#define COLON 313
#define TILDE 314
#define COMMA 315
#define OPTIONS 316
#define PLUS 317
#define PACKET_ETH802_3 318
#define PACKET_POS 319
#define OUTPUT_FORMAT 320
#define COUNTERS 321
#define PACKET_ETH_II 322
#define PACKET_ATM 323
#define PACKET_AAL5 324
#define WLEN 325
#define SNAP 326
#define PACKET_IB 327
#define OPEN_KEY 328
#define CLOSE_KEY 329
#define OPEN_PAR 330
#define CLOSE_PAR 331
#define OPEN_BRA 332
#define CLOSE_BRA 333
#define ID 334
#define STRING 335
#define TOKEN_MAC 336
#define NUMBER 337
#define HEXASTRING 338




#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{

/* Line 293 of yacc.c  */
#line 127 "gram.y"

   char *str;
   unsigned long l;
   void * distr;
   void * pload;
   void * list;
   void * command;



/* Line 293 of yacc.c  */
#line 394 "gram.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif


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


/* Line 343 of yacc.c  */
#line 406 "gram.c"

#ifdef short
# undef short
#endif

#ifdef YYTYPE_UINT8
typedef YYTYPE_UINT8 yytype_uint8;
#else
typedef unsigned char yytype_uint8;
#endif

#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
#elif (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
typedef signed char yytype_int8;
#else
typedef short int yytype_int8;
#endif

#ifdef YYTYPE_UINT16
typedef YYTYPE_UINT16 yytype_uint16;
#else
typedef unsigned short int yytype_uint16;
#endif

#ifdef YYTYPE_INT16
typedef YYTYPE_INT16 yytype_int16;
#else
typedef short int yytype_int16;
#endif

#ifndef YYSIZE_T
# ifdef __SIZE_TYPE__
#  define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
#  define YYSIZE_T size_t
# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# else
#  define YYSIZE_T unsigned int
# endif
#endif

#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)

#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
#  if ENABLE_NLS
#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
#   define YY_(msgid) dgettext ("bison-runtime", msgid)
#  endif
# endif
# ifndef YY_
#  define YY_(msgid) msgid
# endif
#endif

/* Suppress unused-variable warnings by "using" E.  */
#if ! defined lint || defined __GNUC__
# define YYUSE(e) ((void) (e))
#else
# define YYUSE(e) /* empty */
#endif

/* Identity function, used to suppress warnings about constant conditions.  */
#ifndef lint
# define YYID(n) (n)
#else
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static int
YYID (int yyi)
#else
static int
YYID (yyi)
    int yyi;
#endif
{
  return yyi;
}
#endif

#if ! defined yyoverflow || YYERROR_VERBOSE

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

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   elif defined __BUILTIN_VA_ARG_INCR
#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
#   elif defined _AIX
#    define YYSTACK_ALLOC __alloca
#   elif defined _MSC_VER
#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
#    define alloca _alloca
#   else
#    define YYSTACK_ALLOC alloca
#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#     ifndef EXIT_SUCCESS
#      define EXIT_SUCCESS 0
#     endif
#    endif
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning.  */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
#  ifndef YYSTACK_ALLOC_MAXIMUM
    /* The OS might guarantee only one guard page at the bottom of the stack,
       and a page size can be as small as 4096 bytes.  So we cannot safely
       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
       to allow for a few compiler-allocated temporary stack slots.  */
#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
#  endif
# else
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
#  ifndef YYSTACK_ALLOC_MAXIMUM
#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
#  endif
#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
       && ! ((defined YYMALLOC || defined malloc) \
	     && (defined YYFREE || defined free)))
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   ifndef EXIT_SUCCESS
#    define EXIT_SUCCESS 0
#   endif
#  endif
#  ifndef YYMALLOC
#   define YYMALLOC malloc
#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
#  ifndef YYFREE
#   define YYFREE free
#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
void free (void *); /* INFRINGES ON USER NAME SPACE */
#   endif
#  endif
# endif
#endif /* ! defined yyoverflow || YYERROR_VERBOSE */


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

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  yytype_int16 yyss_alloc;
  YYSTYPE yyvs_alloc;
};

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (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 (yytype_int16) + sizeof (YYSTYPE)) \
      + YYSTACK_GAP_MAXIMUM)

# define YYCOPY_NEEDED 1

/* 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_alloc, Stack)				\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack_alloc, Stack, yysize);			\
	Stack = &yyptr->Stack_alloc;					\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (YYID (0))

#endif

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

/* YYFINAL -- State number of the termination state.  */
#define YYFINAL  5
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   319

/* YYNTOKENS -- Number of terminals.  */
#define YYNTOKENS  84
/* YYNNTS -- Number of nonterminals.  */
#define YYNNTS  42
/* YYNRULES -- Number of rules.  */
#define YYNRULES  130
/* YYNRULES -- Number of states.  */
#define YYNSTATES  320

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

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

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const yytype_uint8 yytranslate[] =
{
       0,     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,
       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,    31,    32,    33,    34,
      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      75,    76,    77,    78,    79,    80,    81,    82,    83
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const yytype_uint16 yyprhs[] =
{
       0,     0,     3,     7,    12,    13,    16,    17,    21,    24,
      28,    32,    36,    38,    40,    46,    51,    52,    55,    56,
      62,    65,    66,    67,    75,    76,    84,    85,    93,    94,
     102,   103,   111,   112,   120,   123,   124,   128,   132,   136,
     140,   144,   148,   152,   155,   156,   160,   164,   168,   172,
     176,   180,   184,   187,   188,   192,   196,   200,   204,   208,
     212,   216,   219,   220,   224,   228,   232,   236,   240,   244,
     248,   252,   255,   256,   260,   264,   268,   272,   276,   280,
     284,   288,   292,   296,   300,   303,   304,   308,   312,   316,
     320,   324,   328,   332,   336,   340,   344,   348,   352,   356,
     360,   364,   366,   368,   374,   380,   388,   396,   401,   408,
     415,   422,   426,   428,   430,   432,   437,   442,   447,   449,
     454,   457,   458,   464,   467,   468,   473,   480,   486,   488,
     490
};

/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
static const yytype_int8 yyrhs[] =
{
      85,     0,    -1,    86,    90,   118,    -1,    61,    73,    87,
      74,    -1,    -1,    87,    88,    -1,    -1,    12,   124,    54,
      -1,    13,    54,    -1,    39,   123,    54,    -1,    14,   123,
      54,    -1,    65,    89,    54,    -1,    19,    -1,    25,    -1,
      56,    73,    91,    94,    74,    -1,    66,    73,    92,    74,
      -1,    -1,    92,    93,    -1,    -1,   125,   115,    20,   123,
      54,    -1,    94,    95,    -1,    -1,    -1,    55,    63,   125,
      96,    73,   102,    74,    -1,    -1,    55,    67,   125,    97,
      73,   104,    74,    -1,    -1,    55,    64,   125,    98,    73,
     106,    74,    -1,    -1,    55,    68,   125,    99,    73,   108,
      74,    -1,    -1,    55,    69,   125,   100,    73,   110,    74,
      -1,    -1,    55,    72,   125,   101,    73,   112,    74,    -1,
     102,   103,    -1,    -1,     4,   114,    54,    -1,     4,   116,
      54,    -1,     5,   114,    54,    -1,     5,   116,    54,    -1,
      23,   116,    54,    -1,    18,   123,    54,    -1,    24,   123,
      54,    -1,   104,   105,    -1,    -1,     4,   114,    54,    -1,
       4,   116,    54,    -1,     5,   114,    54,    -1,     5,   116,
      54,    -1,    22,   123,    54,    -1,    23,   116,    54,    -1,
      18,   123,    54,    -1,   106,   107,    -1,    -1,    15,   123,
      54,    -1,    16,   123,    54,    -1,    17,   123,    54,    -1,
      22,   123,    54,    -1,    23,   116,    54,    -1,    18,   123,
      54,    -1,    24,   123,    54,    -1,   108,   109,    -1,    -1,
      34,    35,    54,    -1,    34,    36,    54,    -1,    26,   115,
      54,    -1,    27,   115,    54,    -1,    28,   115,    54,    -1,
      29,   115,    54,    -1,    30,   115,    54,    -1,    23,   116,
      54,    -1,   110,   111,    -1,    -1,    34,    35,    54,    -1,
      34,    36,    54,    -1,    26,   115,    54,    -1,    27,   115,
      54,    -1,    28,   115,    54,    -1,    29,   115,    54,    -1,
      30,   115,    54,    -1,    23,   116,    54,    -1,    31,   115,
      54,    -1,    32,   115,    54,    -1,    33,   115,    54,    -1,
     112,   113,    -1,    -1,    34,    41,    54,    -1,    34,    40,
      54,    -1,    34,    52,    54,    -1,    34,    53,    54,    -1,
      42,   115,    54,    -1,    43,   115,    54,    -1,    46,   115,
      54,    -1,    45,   115,    54,    -1,    44,   115,    54,    -1,
      49,   115,    54,    -1,    50,   115,    54,    -1,    47,   115,
      54,    -1,    48,   115,    54,    -1,    51,   115,    54,    -1,
      23,   116,    54,    -1,    81,    -1,   123,    -1,    77,   123,
      58,   123,    78,    -1,    77,   123,    59,   123,    78,    -1,
      77,   123,    58,   123,    78,     7,   115,    -1,    77,   123,
      59,   123,    78,     7,   115,    -1,    11,    75,   123,    76,
      -1,    10,    75,   123,    60,   123,    76,    -1,     8,    75,
     123,    60,   123,    76,    -1,     9,    75,   123,    60,   123,
      76,    -1,   116,    62,   117,    -1,   117,    -1,    83,    -1,
     125,    -1,   125,    75,   115,    76,    -1,   125,    77,   115,
      78,    -1,    21,    75,   115,    76,    -1,    70,    -1,    57,
      73,   119,    74,    -1,   119,   120,    -1,    -1,    38,   125,
      73,   121,    74,    -1,   121,   122,    -1,    -1,     3,   125,
     115,    54,    -1,     3,   125,   115,    71,   115,    54,    -1,
      37,   115,    73,   121,    74,    -1,    82,    -1,    80,    -1,
      79,    -1
};

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const yytype_uint16 yyrline[] =
{
       0,   168,   168,   172,   173,   177,   178,   182,   184,   185,
     186,   187,   192,   193,   198,   202,   203,   207,   208,   212,
     217,   218,   222,   222,   224,   224,   226,   226,   228,   228,
     230,   230,   232,   232,   238,   239,   243,   244,   245,   246,
     247,   248,   249,   253,   254,   258,   259,   260,   261,   262,
     263,   264,   268,   269,   273,   274,   275,   276,   277,   278,
     279,   283,   284,   288,   289,   290,   291,   292,   293,   294,
     295,   299,   300,   304,   305,   306,   307,   308,   309,   310,
     311,   312,   313,   314,   318,   319,   322,   323,   324,   325,
     326,   327,   328,   329,   330,   331,   332,   333,   334,   335,
     336,   339,   343,   345,   347,   349,   351,   353,   355,   357,
     359,   364,   367,   374,   377,   381,   385,   389,   391,   396,
     400,   402,   406,   411,   413,   417,   419,   421,   426,   430,
     434
};
#endif

#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
/* YYTNAME[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", "SEND", "SRC_ADDR", "DST_ADDR", "LENGTH",
  "STEP", "NORMAL", "POISSON", "UNIFORM", "CONSTANT", "OUTPUT_FILE",
  "VERBOSE", "RANDOM_SEED", "ADDRESS", "CONTROL", "PROTOCOL_SIZE",
  "FCS_SIZE", "FORMAT_ERF", "TOKEN_SIZE", "DUMMY", "PROTOCOL", "PAYLOAD",
  "RX_ERROR", "FORMAT_PCAP", "ATM_GFC", "ATM_VPI", "ATM_VCI", "ATM_PT",
  "ATM_CLP", "AAL5_UU", "AAL5_CPI", "AAL5_CRC", "ATM_TYPE", "ATM_UNI",
  "ATM_NNI", "LOOP", "TOKEN_GROUP", "INTERFACE", "IB_LOCAL", "IB_GLOBAL",
  "IB_LRH_VL", "IB_LRH_LVER", "IB_LRH_SLEVEL", "IB_LRH_DLID",
  "IB_LRH_SLID", "IB_BTH_QP", "IB_SRC_QP", "IB_BTH_OPCODE", "IB_BTH_PSN",
  "IB_BTH_TVER", "IB_RAW", "IB_NON_IB", "EOC", "PACKET", "PACKETS",
  "TRAFFIC", "COLON", "TILDE", "COMMA", "OPTIONS", "PLUS",
  "PACKET_ETH802_3", "PACKET_POS", "OUTPUT_FORMAT", "COUNTERS",
  "PACKET_ETH_II", "PACKET_ATM", "PACKET_AAL5", "WLEN", "SNAP",
  "PACKET_IB", "OPEN_KEY", "CLOSE_KEY", "OPEN_PAR", "CLOSE_PAR",
  "OPEN_BRA", "CLOSE_BRA", "ID", "STRING", "TOKEN_MAC", "NUMBER",
  "HEXASTRING", "$accept", "program", "options", "option_parms", "o_parms",
  "output_formats", "packets", "counters", "counter_defs", "counter_d",
  "packet_defs", "packet", "$@1", "$@2", "$@3", "$@4", "$@5", "$@6",
  "eth802_3_parms", "eth802_3_p", "eth_II_parms", "eth_II_p", "pos_parms",
  "pos_p", "atm_parms", "atm_p", "aal5_parms", "aal5_p",
  "infiniband_parms", "infiniband_p", "mac", "distribution", "payload",
  "payload_contents", "traffic", "traffic_groups", "traffic_group",
  "traffic_commands", "t_command", "number", "string", "identifier", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const yytype_uint16 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,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
     335,   336,   337,   338
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const yytype_uint8 yyr1[] =
{
       0,    84,    85,    86,    86,    87,    87,    88,    88,    88,
      88,    88,    89,    89,    90,    91,    91,    92,    92,    93,
      94,    94,    96,    95,    97,    95,    98,    95,    99,    95,
     100,    95,   101,    95,   102,   102,   103,   103,   103,   103,
     103,   103,   103,   104,   104,   105,   105,   105,   105,   105,
     105,   105,   106,   106,   107,   107,   107,   107,   107,   107,
     107,   108,   108,   109,   109,   109,   109,   109,   109,   109,
     109,   110,   110,   111,   111,   111,   111,   111,   111,   111,
     111,   111,   111,   111,   112,   112,   113,   113,   113,   113,
     113,   113,   113,   113,   113,   113,   113,   113,   113,   113,
     113,   114,   115,   115,   115,   115,   115,   115,   115,   115,
     115,   116,   116,   117,   117,   117,   117,   117,   117,   118,
     119,   119,   120,   121,   121,   122,   122,   122,   123,   124,
     125
};

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

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

/* YYDEFGOTO[NTERM-NUM].  */
static const yytype_int16 yydefgoto[] =
{
      -1,     2,     3,     8,    18,    30,     7,    20,    38,    47,
      32,    41,    76,    78,    77,    79,    80,    81,   107,   126,
     109,   142,   108,   135,   110,   151,   111,   163,   112,   177,
     189,    61,   190,   191,    11,    33,    44,    82,    99,    62,
      23,   192
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -107
static const yytype_int16 yypact[] =
{
     -47,   -56,    33,   -35,  -107,  -107,   -45,   -11,   -10,    -1,
     -34,  -107,   -13,    29,     3,     3,   -18,  -107,  -107,    26,
    -107,  -107,  -107,    42,  -107,  -107,    47,    58,  -107,  -107,
      64,  -107,   -50,   -32,  -107,  -107,  -107,  -107,    21,   162,
    -107,  -107,    49,  -107,  -107,  -107,  -107,  -107,     2,    49,
      49,    49,    49,    49,    49,    57,    67,    78,   104,   128,
       3,   136,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
       3,     3,     3,     3,   116,     3,    91,    97,   132,   141,
     142,   143,     6,   131,   159,   160,   151,     3,     3,   174,
    -107,  -107,  -107,  -107,  -107,  -107,    49,     2,  -107,  -107,
       3,     3,     3,  -107,   154,   157,  -107,    14,    99,    18,
     118,   167,   138,     2,   163,   161,   164,   166,   231,   232,
      23,    23,     3,    24,     3,  -107,  -107,     3,     3,     3,
       3,     3,    24,     3,  -107,  -107,    23,    23,     3,     3,
      24,  -107,  -107,    24,     2,     2,     2,     2,     2,   171,
    -107,  -107,    24,     2,     2,     2,     2,     2,     2,     2,
       2,   173,  -107,  -107,    24,   170,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,  -107,  -107,   -46,  -107,
    -107,  -107,  -107,     2,     2,   168,  -107,  -107,  -107,   190,
     -28,  -107,    -9,   192,   -27,   193,    27,   194,   195,   196,
     197,   198,   199,    28,   200,   201,    43,   202,    65,   203,
     204,    75,    89,   205,   206,   207,   208,   209,   210,   211,
      95,   212,   213,   214,   215,   216,   217,   218,   219,   220,
     221,   101,   222,   223,   224,   225,   226,   227,   228,   229,
     230,   233,   234,   235,   236,   237,  -107,     2,    17,  -107,
    -107,     2,  -107,  -107,    24,     2,     2,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
     238,  -107,   239,  -107,   240,   241,  -107,  -107,  -107,  -107
};

/* YYPGOTO[NTERM-NUM].  */
static const yytype_int8 yypgoto[] =
{
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,  -107,
    -106,   -97,    81,    31,  -107,  -107,  -107,   107,  -107,    38,
    -107,    82
};

/* 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 YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -1
static const yytype_uint16 yytable[] =
{
     114,    28,    12,    13,    14,    39,    42,    29,   246,    96,
      56,    57,    58,    59,     1,   193,   178,     4,   120,   121,
      96,     6,   136,   137,    40,   247,   253,   258,     9,    15,
     205,   207,   122,     5,   254,   254,   138,   123,   124,    21,
     139,   140,    43,    97,   185,   185,    10,   213,   214,   215,
     216,   217,    26,    27,    97,    16,   221,   222,   223,   224,
     225,   226,   227,   228,    17,    19,   255,    22,   256,   236,
     237,   238,   239,   240,   241,   242,   243,   244,   245,    60,
      98,   260,   267,    24,    25,    25,   249,   250,   125,   254,
     254,   311,   141,   186,   186,    45,    34,   270,    74,    31,
      46,    35,    46,    46,   187,   254,   188,   188,    83,    84,
      85,    86,    36,    89,   127,   128,   129,   130,    37,   272,
      48,   131,   132,   133,    55,   104,   105,   254,    46,   275,
      69,    63,    64,    65,    66,    67,    68,   254,   115,   116,
     117,   143,    70,   276,   144,   145,   146,   147,   148,   284,
     310,   254,   149,    71,   312,   295,    75,   254,   314,   315,
     195,   164,   197,   254,    90,   198,   199,   200,   201,   202,
      91,   204,   165,   134,    87,    88,   209,   210,   113,    72,
     166,   167,   168,   169,   170,   171,   172,   173,   174,   175,
     152,   100,   150,   153,   154,   155,   156,   157,   158,   159,
     160,   161,   194,    73,   196,    92,   218,   219,   229,   230,
     232,   233,   176,   203,    93,    94,    95,   206,   208,   101,
     102,   211,   234,   235,   212,    49,    50,   103,   106,    51,
      52,    53,   118,   220,    54,   119,   179,   180,   183,   184,
     181,   162,   182,   251,   252,   231,   257,   259,   261,   262,
     263,   264,   265,   266,   268,   269,   271,   273,   274,   277,
     278,   279,   280,   281,   282,   283,   285,   286,   287,   288,
     289,   290,   291,   292,   293,   294,   296,   297,   298,   299,
     300,   301,   302,   303,   304,   313,   248,   305,   306,   307,
     308,   309,   316,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
       0,     0,     0,     0,     0,   317,   318,     0,     0,   319
};

#define yypact_value_is_default(yystate) \
  ((yystate) == (-107))

#define yytable_value_is_error(yytable_value) \
  YYID (0)

static const yytype_int16 yycheck[] =
{
      97,    19,    12,    13,    14,    55,    38,    25,    54,     3,
       8,     9,    10,    11,    61,   121,   113,    73,     4,     5,
       3,    56,     4,     5,    74,    71,    54,    54,    73,    39,
     136,   137,    18,     0,    62,    62,    18,    23,    24,    73,
      22,    23,    74,    37,    21,    21,    57,   144,   145,   146,
     147,   148,    14,    15,    37,    65,   153,   154,   155,   156,
     157,   158,   159,   160,    74,    66,    75,    80,    77,   166,
     167,   168,   169,   170,   171,   172,   173,   174,   175,    77,
      74,    54,    54,    54,    82,    82,   183,   184,    74,    62,
      62,    74,    74,    70,    70,    74,    54,    54,    60,    73,
      79,    54,    79,    79,    81,    62,    83,    83,    70,    71,
      72,    73,    54,    75,    15,    16,    17,    18,    54,    54,
      38,    22,    23,    24,    42,    87,    88,    62,    79,    54,
      73,    49,    50,    51,    52,    53,    54,    62,   100,   101,
     102,    23,    75,    54,    26,    27,    28,    29,    30,    54,
     247,    62,    34,    75,   251,    54,    20,    62,   255,   256,
     122,    23,   124,    62,    73,   127,   128,   129,   130,   131,
      73,   133,    34,    74,    58,    59,   138,   139,    96,    75,
      42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
      23,    60,    74,    26,    27,    28,    29,    30,    31,    32,
      33,    34,   121,    75,   123,    73,    35,    36,    35,    36,
      40,    41,    74,   132,    73,    73,    73,   136,   137,    60,
      60,   140,    52,    53,   143,    63,    64,    76,    54,    67,
      68,    69,    78,   152,    72,    78,    73,    76,     7,     7,
      76,    74,    76,    75,    54,   164,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,   254,   179,    54,    54,    54,
      54,    54,    54,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    -1,    -1,    -1,    76,    76,    -1,    -1,    78
};

/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
   symbol of state STATE-NUM.  */
static const yytype_uint8 yystos[] =
{
       0,    61,    85,    86,    73,     0,    56,    90,    87,    73,
      57,   118,    12,    13,    14,    39,    65,    74,    88,    66,
      91,    73,    80,   124,    54,    82,   123,   123,    19,    25,
      89,    73,    94,   119,    54,    54,    54,    54,    92,    55,
      74,    95,    38,    74,   120,    74,    79,    93,   125,    63,
      64,    67,    68,    69,    72,   125,     8,     9,    10,    11,
      77,   115,   123,   125,   125,   125,   125,   125,   125,    73,
      75,    75,    75,    75,   123,    20,    96,    98,    97,    99,
     100,   101,   121,   123,   123,   123,   123,    58,    59,   123,
      73,    73,    73,    73,    73,    73,     3,    37,    74,   122,
      60,    60,    60,    76,   123,   123,    54,   102,   106,   104,
     108,   110,   112,   125,   115,   123,   123,   123,    78,    78,
       4,     5,    18,    23,    24,    74,   103,    15,    16,    17,
      18,    22,    23,    24,    74,   107,     4,     5,    18,    22,
      23,    74,   105,    23,    26,    27,    28,    29,    30,    34,
      74,   109,    23,    26,    27,    28,    29,    30,    31,    32,
      33,    34,    74,   111,    23,    34,    42,    43,    44,    45,
      46,    47,    48,    49,    50,    51,    74,   113,   115,    73,
      76,    76,    76,     7,     7,    21,    70,    81,    83,   114,
     116,   117,   125,   114,   116,   123,   116,   123,   123,   123,
     123,   123,   123,   116,   123,   114,   116,   114,   116,   123,
     123,   116,   116,   115,   115,   115,   115,   115,    35,    36,
     116,   115,   115,   115,   115,   115,   115,   115,   115,    35,
      36,   116,    40,    41,    52,    53,   115,   115,   115,   115,
     115,   115,   115,   115,   115,   115,    54,    71,   121,   115,
     115,    75,    54,    54,    62,    75,    77,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
      54,    54,    54,    54,    54,    54,    54,    54,    54,    54,
     115,    74,   115,   117,   115,   115,    54,    76,    76,    78
};

#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 yyerrorlab


/* 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.  However,
   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
   discussed.  */

#define YYFAIL		goto yyerrlab
#if defined YYFAIL
  /* This is here to suppress warnings from the GCC cpp's
     -Wunused-macros.  Normally we don't worry about that warning, but
     some users do, and we want to make it easy for users to remove
     YYFAIL uses, which will produce warnings from Bison 2.5.  */
#endif

#define YYRECOVERING()  (!!yyerrstatus)

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


#define YYTERROR	1
#define YYERRCODE	256


/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
   If N is 0, then set CURRENT to the empty location which ends
   the previous symbol: RHS[0] (always defined).  */

#define YYRHSLOC(Rhs, K) ((Rhs)[K])
#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)				\
    do									\
      if (YYID (N))                                                    \
	{								\
	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
	}								\
      else								\
	{								\
	  (Current).first_line   = (Current).last_line   =		\
	    YYRHSLOC (Rhs, 0).last_line;				\
	  (Current).first_column = (Current).last_column =		\
	    YYRHSLOC (Rhs, 0).last_column;				\
	}								\
    while (YYID (0))
#endif


/* This macro is provided for backward compatibility. */

#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif


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

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#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 (YYID (0))

# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
do {									  \
  if (yydebug)								  \
    {									  \
      YYFPRINTF (stderr, "%s ", Title);					  \
      yy_symbol_print (stderr,						  \
		  Type, Value); \
      YYFPRINTF (stderr, "\n");						  \
    }									  \
} while (YYID (0))


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (!yyvaluep)
    return;
# ifdef YYPRINT
  if (yytype < YYNTOKENS)
    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
  YYUSE (yyoutput);
# endif
  switch (yytype)
    {
      default:
	break;
    }
}


/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE const * const yyvaluep;
#endif
{
  if (yytype < YYNTOKENS)
    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
  YYFPRINTF (yyoutput, ")");
}

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (yybottom, yytop)
    yytype_int16 *yybottom;
    yytype_int16 *yytop;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (; yybottom <= yytop; yybottom++)
    {
      int yybot = *yybottom;
      YYFPRINTF (stderr, " %d", yybot);
    }
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (YYID (0))


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
#else
static void
yy_reduce_print (yyvsp, yyrule)
    YYSTYPE *yyvsp;
    int yyrule;
#endif
{
  int yynrhs = yyr2[yyrule];
  int yyi;
  unsigned long int yylno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
	     yyrule - 1, yylno);
  /* The symbols being reduced.  */
  for (yyi = 0; yyi < yynrhs; yyi++)
    {
      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
		       &(yyvsp[(yyi + 1) - (yynrhs)])
		       		       );
      YYFPRINTF (stderr, "\n");
    }
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (yyvsp, Rule); \
} while (YYID (0))

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#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
   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#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.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
    const char *yystr;
#endif
{
  YYSIZE_T yylen;
  for (yylen = 0; yystr[yylen]; yylen++)
    continue;
  return yylen;
}
#  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.  */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
    char *yydest;
    const char *yysrc;
#endif
{
  char *yyd = yydest;
  const char *yys = yysrc;

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

  return yyd - 1;
}
#  endif
# endif

# ifndef yytnamerr
/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
   quotes and backslashes, so that it's suitable for yyerror.  The
   heuristic is that double-quoting is unnecessary unless the string
   contains an apostrophe, a comma, or backslash (other than
   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
   null, do not copy; instead, return the length of what the result
   would have been.  */
static YYSIZE_T
yytnamerr (char *yyres, const char *yystr)
{
  if (*yystr == '"')
    {
      YYSIZE_T yyn = 0;
      char const *yyp = yystr;

      for (;;)
	switch (*++yyp)
	  {
	  case '\'':
	  case ',':
	    goto do_not_strip_quotes;

	  case '\\':
	    if (*++yyp != '\\')
	      goto do_not_strip_quotes;
	    /* Fall through.  */
	  default:
	    if (yyres)
	      yyres[yyn] = *yyp;
	    yyn++;
	    break;

	  case '"':
	    if (yyres)
	      yyres[yyn] = '\0';
	    return yyn;
	  }
    do_not_strip_quotes: ;
    }

  if (! yyres)
    return yystrlen (yystr);

  return yystpcpy (yyres, yystr) - yyres;
}
# endif

/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
   about the unexpected token YYTOKEN for the state stack whose top is
   YYSSP.

   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
   not large enough to hold the message.  In that case, also set
   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
   required number of bytes is too large to store.  */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                yytype_int16 *yyssp, int yytoken)
{
  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
  YYSIZE_T yysize = yysize0;
  YYSIZE_T yysize1;
  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
  /* Internationalized format string. */
  const char *yyformat = 0;
  /* Arguments of yyformat. */
  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
  /* Number of reported tokens (one for the "unexpected", one per
     "expected"). */
  int yycount = 0;

  /* There are many possibilities here to consider:
     - Assume YYFAIL is not used.  It's too flawed to consider.  See
       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
       for details.  YYERROR is fine as it does not invoke this
       function.
     - If this state is a consistent state with a default action, then
       the only way this function was invoked is if the default action
       is an error action.  In that case, don't check for expected
       tokens because there are none.
     - The only way there can be no lookahead present (in yychar) is if
       this state is a consistent state with a default action.  Thus,
       detecting the absence of a lookahead is sufficient to determine
       that there is no unexpected or expected token to report.  In that
       case, just report a simple "syntax error".
     - Don't assume there isn't a lookahead just because this state is a
       consistent state with a default action.  There might have been a
       previous inconsistent state, consistent state with a non-default
       action, or user semantic action that manipulated yychar.
     - Of course, the expected token list depends on states to have
       correct lookahead information, and it depends on the parser not
       to perform extra reductions after fetching a lookahead from the
       scanner and before detecting a syntax error.  Thus, state merging
       (from LALR or IELR) and default reductions corrupt the expected
       token list.  However, the list is correct for canonical LR with
       one exception: it will still contain any token that will not be
       accepted due to an error action in a later state.
  */
  if (yytoken != YYEMPTY)
    {
      int yyn = yypact[*yyssp];
      yyarg[yycount++] = yytname[yytoken];
      if (!yypact_value_is_default (yyn))
        {
          /* Start YYX at -YYN if negative to avoid negative indexes in
             YYCHECK.  In other words, skip the first -YYN actions for
             this state because they are default actions.  */
          int yyxbegin = yyn < 0 ? -yyn : 0;
          /* Stay within bounds of both yycheck and yytname.  */
          int yychecklim = YYLAST - yyn + 1;
          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
          int yyx;

          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
                && !yytable_value_is_error (yytable[yyx + yyn]))
              {
                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
                  {
                    yycount = 1;
                    yysize = yysize0;
                    break;
                  }
                yyarg[yycount++] = yytname[yyx];
                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
                if (! (yysize <= yysize1
                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
                  return 2;
                yysize = yysize1;
              }
        }
    }

  switch (yycount)
    {
# define YYCASE_(N, S)                      \
      case N:                               \
        yyformat = S;                       \
      break
      YYCASE_(0, YY_("syntax error"));
      YYCASE_(1, YY_("syntax error, unexpected %s"));
      YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
      YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
      YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
      YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
    }

  yysize1 = yysize + yystrlen (yyformat);
  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
    return 2;
  yysize = yysize1;

  if (*yymsg_alloc < yysize)
    {
      *yymsg_alloc = 2 * yysize;
      if (! (yysize <= *yymsg_alloc
             && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
        *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
      return 1;
    }

  /* Avoid sprintf, as that infringes on the user's name space.
     Don't have undefined behavior even if the translation
     produced a string with the wrong number of "%s"s.  */
  {
    char *yyp = *yymsg;
    int yyi = 0;
    while ((*yyp = *yyformat) != '\0')
      if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
        {
          yyp += yytnamerr (yyp, yyarg[yyi++]);
          yyformat += 2;
        }
      else
        {
          yyp++;
          yyformat++;
        }
  }
  return 0;
}
#endif /* YYERROR_VERBOSE */

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

/*ARGSUSED*/
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yymsg, yytype, yyvaluep)
    const char *yymsg;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  YYUSE (yyvaluep);

  if (!yymsg)
    yymsg = "Deleting";
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

  switch (yytype)
    {

      default:
	break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
#else
int yyparse ();
#endif
#else /* ! YYPARSE_PARAM */
#if defined __STDC__ || defined __cplusplus
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */


/* The lookahead symbol.  */
int yychar;

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

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


/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
    void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
     || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
    int yystate;
    /* Number of tokens to shift before error messages enabled.  */
    int yyerrstatus;

    /* The stacks and their tools:
       `yyss': related to states.
       `yyvs': related to semantic values.

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

    /* The state stack.  */
    yytype_int16 yyssa[YYINITDEPTH];
    yytype_int16 *yyss;
    yytype_int16 *yyssp;

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

    YYSIZE_T yystacksize;

  int yyn;
  int yyresult;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken;
  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;

#if YYERROR_VERBOSE
  /* Buffer for error messages, and its allocated size.  */
  char yymsgbuf[128];
  char *yymsg = yymsgbuf;
  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif

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

  /* The number of symbols on the RHS of the reduced rule.
     Keep to zero when no symbol should be popped.  */
  int yylen = 0;

  yytoken = 0;
  yyss = yyssa;
  yyvs = yyvsa;
  yystacksize = YYINITDEPTH;

  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 (yyss + yystacksize - 1 <= yyssp)
    {
      /* 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;
	yytype_int16 *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 (YY_("memory exhausted"),
		    &yyss1, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),
		    &yystacksize);

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

      {
	yytype_int16 *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyexhaustedlab;
	YYSTACK_RELOCATE (yyss_alloc, yyss);
	YYSTACK_RELOCATE (yyvs_alloc, 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 (yyss + yystacksize - 1 <= yyssp)
	YYABORT;
    }

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

  if (yystate == YYFINAL)
    YYACCEPT;

  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.  */

  /* First try to decide what to do without reference to lookahead token.  */
  yyn = yypact[yystate];
  if (yypact_value_is_default (yyn))
    goto yydefault;

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

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
    }

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

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

  /* Shift the lookahead token.  */
  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);

  /* Discard the shifted token.  */
  yychar = YYEMPTY;

  yystate = yyn;
  *++yyvsp = yylval;

  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];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 7:

/* Line 1806 of yacc.c  */
#line 182 "gram.y"
    { strcpy (daggen_options.output_file, (yyvsp[(2) - (3)].str));
					  free((yyvsp[(2) - (3)].str)); }
    break;

  case 8:

/* Line 1806 of yacc.c  */
#line 184 "gram.y"
    { daggen_options.verbose = 1; }
    break;

  case 9:

/* Line 1806 of yacc.c  */
#line 185 "gram.y"
    { daggen_options.interface_num = (int) (yyvsp[(2) - (3)].l); }
    break;

  case 10:

/* Line 1806 of yacc.c  */
#line 186 "gram.y"
    { daggen_options.random_seed = (unsigned long) (yyvsp[(2) - (3)].l); }
    break;

  case 11:

/* Line 1806 of yacc.c  */
#line 188 "gram.y"
    { daggen_options.output_format = (unsigned char) (yyvsp[(2) - (3)].l); }
    break;

  case 12:

/* Line 1806 of yacc.c  */
#line 192 "gram.y"
    { (yyval.l) = OUTPUT_FORMAT_ERF; }
    break;

  case 13:

/* Line 1806 of yacc.c  */
#line 193 "gram.y"
    { (yyval.l) = OUTPUT_FORMAT_PCAP; }
    break;

  case 19:

/* Line 1806 of yacc.c  */
#line 213 "gram.y"
    { checkAddCounter ((yyvsp[(1) - (5)].str), (yyvsp[(2) - (5)].distr), (yyvsp[(4) - (5)].l)); }
    break;

  case 22:

/* Line 1806 of yacc.c  */
#line 222 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_ETH802_3);}
    break;

  case 23:

/* Line 1806 of yacc.c  */
#line 223 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 24:

/* Line 1806 of yacc.c  */
#line 224 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_ETH_II);}
    break;

  case 25:

/* Line 1806 of yacc.c  */
#line 225 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 26:

/* Line 1806 of yacc.c  */
#line 226 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_POS);}
    break;

  case 27:

/* Line 1806 of yacc.c  */
#line 227 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 28:

/* Line 1806 of yacc.c  */
#line 228 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_ATM);}
    break;

  case 29:

/* Line 1806 of yacc.c  */
#line 229 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 30:

/* Line 1806 of yacc.c  */
#line 230 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_AAL5);}
    break;

  case 31:

/* Line 1806 of yacc.c  */
#line 231 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 32:

/* Line 1806 of yacc.c  */
#line 232 "gram.y"
    {checkPacketBegin((yyvsp[(3) - (3)].str),PKT_IB);}
    break;

  case 33:

/* Line 1806 of yacc.c  */
#line 233 "gram.y"
    {checkPacketEnd((yyvsp[(3) - (7)].str));}
    break;

  case 36:

/* Line 1806 of yacc.c  */
#line 243 "gram.y"
    { checkEthMac ((yyvsp[(2) - (3)].str),1); }
    break;

  case 37:

/* Line 1806 of yacc.c  */
#line 244 "gram.y"
    { checkEthMacVar (1); }
    break;

  case 38:

/* Line 1806 of yacc.c  */
#line 245 "gram.y"
    { checkEthMac ((yyvsp[(2) - (3)].str),0); }
    break;

  case 39:

/* Line 1806 of yacc.c  */
#line 246 "gram.y"
    { checkEthMacVar (0); }
    break;

  case 40:

/* Line 1806 of yacc.c  */
#line 247 "gram.y"
    { checkEthPayload();  }
    break;

  case 41:

/* Line 1806 of yacc.c  */
#line 248 "gram.y"
    { checkEthFcsSize((yyvsp[(2) - (3)].l));}
    break;

  case 42:

/* Line 1806 of yacc.c  */
#line 249 "gram.y"
    { checkEthRxError((yyvsp[(2) - (3)].l));}
    break;

  case 45:

/* Line 1806 of yacc.c  */
#line 258 "gram.y"
    { checkEthMac ((yyvsp[(2) - (3)].str),1);    }
    break;

  case 46:

/* Line 1806 of yacc.c  */
#line 259 "gram.y"
    { checkEthMacVar (1);    }
    break;

  case 47:

/* Line 1806 of yacc.c  */
#line 260 "gram.y"
    { checkEthMac ((yyvsp[(2) - (3)].str),0);    }
    break;

  case 48:

/* Line 1806 of yacc.c  */
#line 261 "gram.y"
    { checkEthMacVar (0);    }
    break;

  case 49:

/* Line 1806 of yacc.c  */
#line 262 "gram.y"
    { checkEthProtocol ((yyvsp[(2) - (3)].l)); }
    break;

  case 50:

/* Line 1806 of yacc.c  */
#line 263 "gram.y"
    { checkEthPayload ();    }
    break;

  case 51:

/* Line 1806 of yacc.c  */
#line 264 "gram.y"
    { checkEthFcsSize((yyvsp[(2) - (3)].l));   }
    break;

  case 54:

/* Line 1806 of yacc.c  */
#line 273 "gram.y"
    { checkPosAddr      ((yyvsp[(2) - (3)].l)); }
    break;

  case 55:

/* Line 1806 of yacc.c  */
#line 274 "gram.y"
    { checkPosControl   ((yyvsp[(2) - (3)].l)); }
    break;

  case 56:

/* Line 1806 of yacc.c  */
#line 275 "gram.y"
    { checkPosProtoSize ((yyvsp[(2) - (3)].l)); }
    break;

  case 57:

/* Line 1806 of yacc.c  */
#line 276 "gram.y"
    { checkPosProto     ((yyvsp[(2) - (3)].l)); }
    break;

  case 58:

/* Line 1806 of yacc.c  */
#line 277 "gram.y"
    { checkPosPayload   ();   }
    break;

  case 59:

/* Line 1806 of yacc.c  */
#line 278 "gram.y"
    { checkPosFcsSize   ((yyvsp[(2) - (3)].l)); }
    break;

  case 60:

/* Line 1806 of yacc.c  */
#line 279 "gram.y"
    { checkPosRxError   ((yyvsp[(2) - (3)].l)); }
    break;

  case 63:

/* Line 1806 of yacc.c  */
#line 288 "gram.y"
    { checkAtmType (ATM_TYPE_UNI); 	}
    break;

  case 64:

/* Line 1806 of yacc.c  */
#line 289 "gram.y"
    { checkAtmType (ATM_TYPE_NNI); 	}
    break;

  case 65:

/* Line 1806 of yacc.c  */
#line 290 "gram.y"
    { checkAtmGfc ((yyvsp[(2) - (3)].distr));		}
    break;

  case 66:

/* Line 1806 of yacc.c  */
#line 291 "gram.y"
    { checkAtmVpi ((yyvsp[(2) - (3)].distr));		}
    break;

  case 67:

/* Line 1806 of yacc.c  */
#line 292 "gram.y"
    { checkAtmVci ((yyvsp[(2) - (3)].distr));		}
    break;

  case 68:

/* Line 1806 of yacc.c  */
#line 293 "gram.y"
    { checkAtmPt  ((yyvsp[(2) - (3)].distr));		}
    break;

  case 69:

/* Line 1806 of yacc.c  */
#line 294 "gram.y"
    { checkAtmClp ((yyvsp[(2) - (3)].distr));		}
    break;

  case 70:

/* Line 1806 of yacc.c  */
#line 295 "gram.y"
    { checkAtmPayload ();		}
    break;

  case 73:

/* Line 1806 of yacc.c  */
#line 304 "gram.y"
    { checkAtmType (ATM_TYPE_UNI); 	}
    break;

  case 74:

/* Line 1806 of yacc.c  */
#line 305 "gram.y"
    { checkAtmType (ATM_TYPE_NNI); 	}
    break;

  case 75:

/* Line 1806 of yacc.c  */
#line 306 "gram.y"
    { checkAtmGfc ((yyvsp[(2) - (3)].distr));		}
    break;

  case 76:

/* Line 1806 of yacc.c  */
#line 307 "gram.y"
    { checkAtmVpi ((yyvsp[(2) - (3)].distr));		}
    break;

  case 77:

/* Line 1806 of yacc.c  */
#line 308 "gram.y"
    { checkAtmVci ((yyvsp[(2) - (3)].distr));		}
    break;

  case 78:

/* Line 1806 of yacc.c  */
#line 309 "gram.y"
    { checkAtmPt  ((yyvsp[(2) - (3)].distr));		}
    break;

  case 79:

/* Line 1806 of yacc.c  */
#line 310 "gram.y"
    { checkAtmClp ((yyvsp[(2) - (3)].distr));		}
    break;

  case 80:

/* Line 1806 of yacc.c  */
#line 311 "gram.y"
    { checkAtmPayload ();		}
    break;

  case 81:

/* Line 1806 of yacc.c  */
#line 312 "gram.y"
    { checkAal5Uu  ((yyvsp[(2) - (3)].distr));		}
    break;

  case 82:

/* Line 1806 of yacc.c  */
#line 313 "gram.y"
    { checkAal5Cpi ((yyvsp[(2) - (3)].distr));		}
    break;

  case 83:

/* Line 1806 of yacc.c  */
#line 314 "gram.y"
    { checkAal5Crc ((yyvsp[(2) - (3)].distr));		}
    break;

  case 86:

/* Line 1806 of yacc.c  */
#line 322 "gram.y"
    {checkIBType(IB_TYPE_GLOBAL);}
    break;

  case 87:

/* Line 1806 of yacc.c  */
#line 323 "gram.y"
    {checkIBType(IB_TYPE_LOCAL);}
    break;

  case 88:

/* Line 1806 of yacc.c  */
#line 324 "gram.y"
    {checkIBType(IB_TYPE_RAW);}
    break;

  case 89:

/* Line 1806 of yacc.c  */
#line 325 "gram.y"
    {checkIBType(IB_TYPE_NONIB);}
    break;

  case 90:

/* Line 1806 of yacc.c  */
#line 326 "gram.y"
    {checkIBVirtualLane( (yyvsp[(2) - (3)].distr));}
    break;

  case 91:

/* Line 1806 of yacc.c  */
#line 327 "gram.y"
    {checkIBLinkVersion((yyvsp[(2) - (3)].distr));}
    break;

  case 92:

/* Line 1806 of yacc.c  */
#line 328 "gram.y"
    {checkIBSLID((yyvsp[(2) - (3)].distr));}
    break;

  case 93:

/* Line 1806 of yacc.c  */
#line 329 "gram.y"
    {checkIBDLID((yyvsp[(2) - (3)].distr));}
    break;

  case 94:

/* Line 1806 of yacc.c  */
#line 330 "gram.y"
    {checkIBServiceLevel((yyvsp[(2) - (3)].distr));}
    break;

  case 95:

/* Line 1806 of yacc.c  */
#line 331 "gram.y"
    {checkIBOpcode((yyvsp[(2) - (3)].distr));}
    break;

  case 96:

/* Line 1806 of yacc.c  */
#line 332 "gram.y"
    {checkIBPSN((yyvsp[(2) - (3)].distr));}
    break;

  case 97:

/* Line 1806 of yacc.c  */
#line 333 "gram.y"
    {checkIBDQP((yyvsp[(2) - (3)].distr));}
    break;

  case 98:

/* Line 1806 of yacc.c  */
#line 334 "gram.y"
    {checkIBSQP((yyvsp[(2) - (3)].distr));}
    break;

  case 99:

/* Line 1806 of yacc.c  */
#line 335 "gram.y"
    {checkIBTver((yyvsp[(2) - (3)].distr));}
    break;

  case 100:

/* Line 1806 of yacc.c  */
#line 336 "gram.y"
    { checkIBPayload ();}
    break;

  case 101:

/* Line 1806 of yacc.c  */
#line 339 "gram.y"
    {(yyval.str) = (yyvsp[(1) - (1)].str);}
    break;

  case 102:

/* Line 1806 of yacc.c  */
#line 344 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_CONSTANT, (unsigned int) (yyvsp[(1) - (1)].l), 0, 0, NULL);}
    break;

  case 103:

/* Line 1806 of yacc.c  */
#line 346 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_PATTERN_ROUND, (yyvsp[(2) - (5)].l), (yyvsp[(4) - (5)].l), 1, NULL);}
    break;

  case 104:

/* Line 1806 of yacc.c  */
#line 348 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_PATTERN_BOUNCE, (yyvsp[(2) - (5)].l), (yyvsp[(4) - (5)].l), 1, NULL);}
    break;

  case 105:

/* Line 1806 of yacc.c  */
#line 350 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_PATTERN_ROUND, (yyvsp[(2) - (7)].l), (yyvsp[(4) - (7)].l), 0, (yyvsp[(7) - (7)].distr));}
    break;

  case 106:

/* Line 1806 of yacc.c  */
#line 352 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_PATTERN_BOUNCE, (yyvsp[(2) - (7)].l), (yyvsp[(4) - (7)].l), 0, (yyvsp[(7) - (7)].distr));}
    break;

  case 107:

/* Line 1806 of yacc.c  */
#line 354 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_CONSTANT, (yyvsp[(3) - (4)].l), 0, 0, NULL);}
    break;

  case 108:

/* Line 1806 of yacc.c  */
#line 356 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_UNIFORM, (yyvsp[(3) - (6)].l), (yyvsp[(5) - (6)].l), 0, NULL);}
    break;

  case 109:

/* Line 1806 of yacc.c  */
#line 358 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_NORMAL, (yyvsp[(3) - (6)].l), (yyvsp[(5) - (6)].l), 0, NULL);}
    break;

  case 110:

/* Line 1806 of yacc.c  */
#line 360 "gram.y"
    {(yyval.distr) = (distribution_t *) distrNew (_POISSON, (yyvsp[(3) - (6)].l), (yyvsp[(5) - (6)].l), 0, NULL);}
    break;

  case 111:

/* Line 1806 of yacc.c  */
#line 365 "gram.y"
    { pload = (payload_t *) (yyvsp[(3) - (3)].pload);
		 listAdd (payload_list, pload, 0); }
    break;

  case 112:

/* Line 1806 of yacc.c  */
#line 368 "gram.y"
    { pload = (payload_t *) (yyvsp[(1) - (1)].pload);
		  payload_list = listNew(payload_list);
		  listAdd (payload_list, pload, 0); }
    break;

  case 113:

/* Line 1806 of yacc.c  */
#line 375 "gram.y"
    {pload = payloadNew (PLOAD_HEXASTRING, (yyvsp[(1) - (1)].str), NULL);
		 (yyval.pload) = pload;}
    break;

  case 114:

/* Line 1806 of yacc.c  */
#line 378 "gram.y"
    {pload =  payloadNew (PLOAD_COUNTER,
		(counter_t *) getCounter((yyvsp[(1) - (1)].str)), NULL);
		(yyval.pload) = pload; }
    break;

  case 115:

/* Line 1806 of yacc.c  */
#line 382 "gram.y"
    {pload =  payloadNew (PLOAD_COUNTER,
		(counter_t *) getCounter((yyvsp[(1) - (4)].str)), (yyvsp[(3) - (4)].distr));
		(yyval.pload) = pload; }
    break;

  case 116:

/* Line 1806 of yacc.c  */
#line 386 "gram.y"
    {pload = payloadNew (PLOAD_COUNTER_MASK,
		(counter_t *) getCounter((yyvsp[(1) - (4)].str)), (yyvsp[(3) - (4)].distr));
		(yyval.pload) = pload; }
    break;

  case 117:

/* Line 1806 of yacc.c  */
#line 390 "gram.y"
    {pload =  payloadNew (PLOAD_DUMMY, (yyvsp[(3) - (4)].distr), NULL); (yyval.pload) = pload;}
    break;

  case 118:

/* Line 1806 of yacc.c  */
#line 392 "gram.y"
    { (yyval.pload) = payloadNew (PLOAD_WLEN, NULL, NULL); }
    break;

  case 119:

/* Line 1806 of yacc.c  */
#line 396 "gram.y"
    { group_list = (list_t *) (yyvsp[(3) - (4)].list); }
    break;

  case 120:

/* Line 1806 of yacc.c  */
#line 401 "gram.y"
    { (yyval.list) = checkGroup ( (list_t *) (yyvsp[(1) - (2)].list), (group_t *) (yyvsp[(2) - (2)].command)); }
    break;

  case 121:

/* Line 1806 of yacc.c  */
#line 402 "gram.y"
    { (yyval.list) = NULL; }
    break;

  case 122:

/* Line 1806 of yacc.c  */
#line 407 "gram.y"
    { (yyval.command) = groupNew ( (char *) (yyvsp[(2) - (5)].str), (list_t *) (yyvsp[(4) - (5)].list) ); }
    break;

  case 123:

/* Line 1806 of yacc.c  */
#line 412 "gram.y"
    { (yyval.list) = checkCommand ((list_t *) (yyvsp[(1) - (2)].list), (cmd_t *) (yyvsp[(2) - (2)].command)); }
    break;

  case 124:

/* Line 1806 of yacc.c  */
#line 413 "gram.y"
    { (yyval.list) = NULL; }
    break;

  case 125:

/* Line 1806 of yacc.c  */
#line 418 "gram.y"
    { (yyval.command) = checkSend ((char *)(yyvsp[(2) - (4)].str), (distribution_t *)(yyvsp[(3) - (4)].distr), NULL); }
    break;

  case 126:

/* Line 1806 of yacc.c  */
#line 420 "gram.y"
    { (yyval.command) = checkSend ((char *)(yyvsp[(2) - (6)].str), (distribution_t *)(yyvsp[(3) - (6)].distr), (distribution_t *)(yyvsp[(5) - (6)].distr)); }
    break;

  case 127:

/* Line 1806 of yacc.c  */
#line 422 "gram.y"
    { (yyval.command) = cmdNew (CMDLOOP, (distribution_t *) (yyvsp[(2) - (5)].distr), (list_t *) (yyvsp[(4) - (5)].list), NULL); }
    break;

  case 128:

/* Line 1806 of yacc.c  */
#line 426 "gram.y"
    { (yyval.l) = (unsigned long) (yyvsp[(1) - (1)].str); }
    break;

  case 129:

/* Line 1806 of yacc.c  */
#line 430 "gram.y"
    { (yyval.str) = (yyvsp[(1) - (1)].str); }
    break;

  case 130:

/* Line 1806 of yacc.c  */
#line 434 "gram.y"
    { (yyval.str) = (yyvsp[(1) - (1)].str); }
    break;



/* Line 1806 of yacc.c  */
#line 2662 "gram.c"
      default: break;
    }
  /* User semantic actions sometimes alter yychar, and that requires
     that yytoken be updated with the new translation.  We take the
     approach of translating immediately before every use of yytoken.
     One alternative is translating here after every semantic action,
     but that translation would be missed if the semantic action invokes
     YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
     if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
     incorrect destructor might then be invoked immediately.  In the
     case of YYERROR or YYBACKUP, subsequent parser actions might lead
     to an incorrect destructor call or verbose syntax error message
     before the lookahead is translated.  */
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);

  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);

  *++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:
  /* Make sure we have latest lookahead translation.  See comments at
     user semantic actions for why this is necessary.  */
  yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);

  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if ! YYERROR_VERBOSE
      yyerror (YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
                                        yyssp, yytoken)
      {
        char const *yymsgp = YY_("syntax error");
        int yysyntax_error_status;
        yysyntax_error_status = YYSYNTAX_ERROR;
        if (yysyntax_error_status == 0)
          yymsgp = yymsg;
        else if (yysyntax_error_status == 1)
          {
            if (yymsg != yymsgbuf)
              YYSTACK_FREE (yymsg);
            yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
            if (!yymsg)
              {
                yymsg = yymsgbuf;
                yymsg_alloc = sizeof yymsgbuf;
                yysyntax_error_status = 2;
              }
            else
              {
                yysyntax_error_status = YYSYNTAX_ERROR;
                yymsgp = yymsg;
              }
          }
        yyerror (yymsgp);
        if (yysyntax_error_status == 2)
          goto yyexhaustedlab;
      }
# undef YYSYNTAX_ERROR
#endif
    }



  if (yyerrstatus == 3)
    {
      /* If just tried and failed to reuse lookahead token after an
	 error, discard it.  */

      if (yychar <= YYEOF)
	{
	  /* Return failure if at end of input.  */
	  if (yychar == YYEOF)
	    YYABORT;
	}
      else
	{
	  yydestruct ("Error: discarding",
		      yytoken, &yylval);
	  yychar = YYEMPTY;
	}
    }

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


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

  /* Pacify compilers like GCC when the user code never invokes
     YYERROR and the label yyerrorlab therefore never appears in user
     code.  */
  if (/*CONSTCOND*/ 0)
     goto yyerrorlab;

  /* Do not reclaim the symbols of the rule which action triggered
     this YYERROR.  */
  YYPOPSTACK (yylen);
  yylen = 0;
  YY_STACK_PRINT (yyss, yyssp);
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (!yypact_value_is_default (yyn))
	{
	  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;


      yydestruct ("Error: popping",
		  yystos[yystate], yyvsp);
      YYPOPSTACK (1);
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  *++yyvsp = yylval;


  /* Shift the error token.  */
  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);

  yystate = yyn;
  goto yynewstate;


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

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

#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here.  |
`-------------------------------------------------*/
yyexhaustedlab:
  yyerror (YY_("memory exhausted"));
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
  if (yychar != YYEMPTY)
    {
      /* Make sure we have latest lookahead translation.  See comments at
         user semantic actions for why this is necessary.  */
      yytoken = YYTRANSLATE (yychar);
      yydestruct ("Cleanup: discarding lookahead",
                  yytoken, &yylval);
    }
  /* Do not reclaim the symbols of the rule which action triggered
     this YYABORT or YYACCEPT.  */
  YYPOPSTACK (yylen);
  YY_STACK_PRINT (yyss, yyssp);
  while (yyssp != yyss)
    {
      yydestruct ("Cleanup: popping",
		  yystos[*yyssp], yyvsp);
      YYPOPSTACK (1);
    }
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
  if (yymsg != yymsgbuf)
    YYSTACK_FREE (yymsg);
#endif
  /* Make sure YYID is used.  */
  return YYID (yyresult);
}



/* Line 2067 of yacc.c  */
#line 440 "gram.y"

/* ------------------------------------------------------------------
   Additional code (again copied verbatim to the output file)
   ------------------------------------------------------------------ */

//
// Check packet construction
//

void checkPacketBegin (char * symbol, unsigned char type) {
	if (elemExists(symbol)) {
		printf ("Warning: packet '%s' already declared (omitting) at line %d\n",
			symbol, lineno);
		bypass = 1;
		free(symbol);

	} else {
		packet = packetNew (type, symbol);
		listAdd (list, symbol, 0);
		listAdd (packet_list, packet, 0);
	}
}

void checkPacketEnd (char * symbol) {
	if (!bypass) {
		//packetFree(packet);
	}
	bypass = 0;
	//free (symbol);
}

//
// Check commands
//

cmd_t * checkSend (char * symbol, distribution_t * distr, distribution_t * snap) {
	cmd_t * cmd = NULL;

	if (elemExists(symbol)) {
		cmd = cmdNew (CMDSEND, distr, strdup(symbol), snap);
		//printf("[checkSend] cmd->ptr: \"%s\"\n", (char *) cmd->ptr);
	} else {
		printf ("Warning: packet '%s' not declared (omitting) at line %d\n",
			symbol, lineno);
	}

	return cmd;
}

list_t * checkCommand (list_t * list, cmd_t * cmd) {
	if (list == NULL)
		list = listNew();

	listAdd (list, cmd, 0);
	return list;
}

list_t * checkGroup (list_t * list, group_t * group) {
	group_t * aux;
	char found = 0;

	if (list == NULL) {
		list = listNew();
		listAdd (list, group, 0);
	} else {
		listPtrBegin(list);
		while (listHasMoreElements(list) && !found) {
			aux = (group_t *) listGetPtrElem(list);
			found = !strcmp (group->id, aux->id);
			listPtrNext(list);
		}

		if(found)
			printf ("Traffic group '%s' already declared (omitting)\n",
				group->id);
		else
			listAdd (list, group, 0);
	}

	return list;
}

//
// Is the element in the symbol list? (identified by a string)
//

int elemExists (char * str) {
	int found = 0;
	char * aux;

	listPtrBegin(list);
	while (listHasMoreElements(list) && !found) {
		aux = (char *)listGetPtrElem(list);
		found = !strcmp (str, aux);
		listPtrNext(list);
	}
	return found;
}

//
// Ethernet 802.3 comprobations
//

void checkEthMac (char *mac_str, char src) {
	// Eth802.3, EthII and others are compatible
	packet_eth_t * p;

	if (!bypass) {
		p = (packet_eth_t *) packet->p;
		if (src) {
			free(p->src_addr);
			p->src_addr = checkMac (mac_str);
			p->src_addr_type = MAC_STATIC;
		} else {
			free(p->dst_addr);
			p->dst_addr = checkMac (mac_str);
			p->dst_addr_type = MAC_STATIC;
		}
	}
}

// Mac checking is done when we are generating the ERF record (toerf.c)
void checkEthMacVar (int src) {
	// Eth802.3, EthII and others are compatible
	packet_eth_t * p;

	if (!bypass) {
		p = (packet_eth_t *) packet->p;
		if (src) {
			if (p->src_addr_var != NULL) free(p->src_addr_var);
			p->src_addr_var = payload_list; // is not a payload, but a mac address
			p->src_addr_type = MAC_VARIABLE;
		} else {
			if (p->dst_addr_var != NULL) free(p->dst_addr_var);
			p->dst_addr_var = payload_list; // is not a payload, but a mac address
			p->dst_addr_type = MAC_VARIABLE;
		}
	}
}

void checkEthPayload () {
	packet_eth_t * p;

	if (!bypass) {
		p = (packet_eth_t *) packet->p;
		p->payload = payload_list;
	}
}

void checkEthProtocol (unsigned long proto) {
	packet_eth_II_t * p; //only this one has a protocol field

	if (!bypass) {
		p = (packet_eth_II_t *) packet->p;
		if (proto > 65535) {
			if (daggen_options.verbose)
				printf("Ethernet protocol field too high, kept at 65535\n");
			p->protocol = (unsigned short int) 65535;
		} else {
			p->protocol = (unsigned short int) proto;
		}
	}
}

void checkEthFcsSize (unsigned int size) {
	packet_eth_t * p;

	if (!bypass) {
		p = (packet_eth_t *) packet->p;
		if (size != 0 && size != 2 && size != 4 && size != 6) {
			if (daggen_options.verbose)
				printf ("Wrong ethernet FCS size. Should be 0, 2 or 4 bytes, 6 for wrong 4-byte CRC. Kept at 0\n");
			size = 0;
		}
		p->fcs_size = size;
	}
}

void checkEthRxError (unsigned int rx) {
	packet_eth_t * p;

	if (!bypass) {
		p = (packet_eth_t *) packet->p;
		if (rx != 0 && rx != 1) {
			if (daggen_options.verbose)
				printf ("Wrong RX ERROR. Should be 0(OFF) or 1(ON). Kept at 0\n");
			rx = 0;
		}
		p->rx_error = rx;
	}
}


//
// Check MAC
//

mac_t * checkMac (char *mac_str) {
	int i;
	mac_t * mac;

	mac = macNew();
	mac->type = MAC_STATIC;
	for (i=0; i<6; i++)
		mac->mac[i] = hexToChar(mac_str[i*3])<<4 | hexToChar(mac_str[i*3+1]);

	for (i=0; i<6; i++) {
		if(mac_str[i*3] == '*') {

			BITSET(mac->bitset,(i*2)+1);
			mac->type = MAC_WILDCARD;
		}
		if(mac_str[i*3+1] == '*') {
			BITSET(mac->bitset,(i*2)+2);
			mac->type = MAC_WILDCARD;
		}
	}

	return mac;
}

//
// Hexadecimal character to byte
//

unsigned char hexToChar (char c) {
	unsigned char res;

	res = 0;
	switch (c) {
		case '*':
		case '0': res = 0;
			break;
		case '1': res = 1;
			break;
		case '2': res = 2;
			break;
		case '3': res = 3;
			break;
		case '4': res = 4;
			break;
		case '5': res = 5;
			break;
		case '6': res = 6;
			break;
		case '7': res = 7;
			break;
		case '8': res = 8;
			break;
		case '9': res = 9;
			break;
		case 'A':
		case 'a': res = 10;
			break;
		case 'B':
		case 'b': res = 11;
			break;
		case 'C':
		case 'c': res = 12;
			break;
		case 'D':
		case 'd': res = 13;
			break;
		case 'E':
		case 'e': res = 14;
			break;
		case 'F':
		case 'f': res = 15;
			break;
	}

	return res;
}

//
// Print MAC (for debugging purposes only)
//

void printMac (unsigned char * mac) {
	printf("[MAC] %02x:%02x:%02x:%02x:%02x:%02x\n",
		mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
}

//
// POS
//

void checkPosAddr (unsigned long addr) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (addr > 0xff) {
			if (daggen_options.verbose)
				printf("POS address too high, kept at 0xff\n");
			p->address = (unsigned char) 0xff;
		} else {
			p->address = (unsigned char) addr;
		}
	}
}

void checkPosControl (unsigned long control) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (control > 0xff) {
			if (daggen_options.verbose)
				printf("POS control field too high, kept at 0xff\n");
			p->control = (unsigned char) 0xff;
		} else {
			p->control = (unsigned char) control;
		}
	}
}

void checkPosProtoSize (unsigned long size) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (size != 1 && size != 2) {
			if (daggen_options.verbose)
				printf("POS protocol field size can only be 1 or 2 bytes, kept at 2 bytes (default)\n");
			p->protocol_size = (unsigned char) 2;
		} else {
			p->protocol_size = (unsigned char) size;
		}
	}
}

void checkPosProto (unsigned long proto) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (proto > 65535) {
			if (daggen_options.verbose)
				printf("POS protocol field too high, kept at 65535\n");
			p->protocol = (unsigned short int) 65535;
		} else {
			p->protocol = (unsigned short int) proto;
		}
	}
}

void checkPosPayload () {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		p->payload = payload_list;
	}
}

void checkPosFcsSize (unsigned long size) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (size != 0 && size != 2 && size != 4 && size != 6) {
			if (daggen_options.verbose)
				printf("POS FCS field size can only be 0, 2 or 4 bytes, 6 for a wrong 4-byte CRC. Kept at 4 bytes (default)\n");
			p->fcs_size = (unsigned char) 4;
		} else {
			p->fcs_size = (unsigned char) size;
		}
	}
}

void checkPosRxError (unsigned int rx) {
	packet_pos_t * p;

	if (!bypass) {
		p = (packet_pos_t *) packet->p;
		if (rx != 0 && rx != 1) {
			if (daggen_options.verbose)
				printf ("Wrong RX ERROR. Should be 0(OFF) or 1(ON). Kept at 0\n");
			rx = 0;
		}
		p->rx_error = rx;
	}
}

//
// ATM
//

void checkAtmType (unsigned char type) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	p->type = type;
}

void checkAtmGfc (distribution_t * distr) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	free (p->gfc);
	p->gfc = distr;
}

void checkAtmVpi (distribution_t * distr) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	free (p->vpi);
	p->vpi = distr;
}

void checkAtmVci (distribution_t * distr) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	free (p->vci);
	p->vci = distr;
}

void checkAtmPt  (distribution_t * distr) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	free (p->pt);
	p->pt = distr;
}

void checkAtmClp (distribution_t * distr) {
	packet_atm_t * p;

	p = (packet_atm_t *) packet->p;
	free (p->clp);
	p->clp = distr;
}

void checkAtmPayload () {
	packet_atm_t * p;

	if (!bypass) {
		p = (packet_atm_t *) packet->p;
		p->payload = payload_list;
	}
}

void checkAal5Uu  (distribution_t * distr) {
	packet_aal5_t * p;

	p = (packet_aal5_t *) packet->p;
	free (p->uu);
	p->uu = distr;
}

void checkAal5Cpi (distribution_t * distr) {
	packet_aal5_t * p;

	p = (packet_aal5_t *) packet->p;
	free (p->cpi);
	p->cpi = distr;
}

void checkAal5Crc (distribution_t * distr) {
	packet_aal5_t * p;

	p = (packet_aal5_t *) packet->p;
	free (p->crc);
	p->crc = distr;
}

//
// Counters stuff
//

counter_t * getCounter (char * id) {
	int found = 0;
	counter_t * aux;

	aux = NULL;
	listPtrBegin(counter_list);
	while (listHasMoreElements(counter_list) && !found) {
		aux = (counter_t *)listGetPtrElem(counter_list);
		found = !strcmp (id, aux->id);
		listPtrNext(counter_list);
	}

	if (!found) {
		printf ("Warning: counter \"%s\" not declared in line %d (omitting)\n"
			, id, lineno);
		return NULL;
	} else {
		return aux;
	}

}

void checkAddCounter (char * id, distribution_t * distr, unsigned int size) {
	int found = 0;
	counter_t * aux;

	listPtrBegin(counter_list);
	while (listHasMoreElements(counter_list) && !found) {
		aux = (counter_t *)listGetPtrElem(counter_list);
		found = !strcmp (id, aux->id);
		listPtrNext(counter_list);
	}

	// BUG: Check size

	if (!found) {
		if (size != 1 && size !=2 && size != 4) {
			printf ("Warning: counter \"%s\" size can only be 1, 2 or 4 bytes (line %d)\n", id, lineno);
		} else {
			aux = counterNew (id, distr, size);
			listAdd (counter_list, aux, 0);
		}

	} else {
		printf ("Warning: counter \"%s\" already declared un line %d (omitting)\n",
			id, lineno);
	}
}
void checkIBVirtualLane(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->lrh_vl);
    p->lrh_vl = distr;
    return ;
}
void checkIBLinkVersion(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->lrh_lver);
    p->lrh_lver = distr;
    return ;

}
void checkIBSLID(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->lrh_slid);
    p->lrh_slid = distr;
    return ;
}
void checkIBDLID(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->lrh_dlid);
    p->lrh_dlid = distr;
    return ;
}


void checkIBType (unsigned char type) {
	packet_ib_t * p;

	p = (packet_ib_t *) packet->p;
	p->type = type;
}

void checkIBOpcode(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->bth_opcode);
    p->bth_opcode = distr;
    return ;
}
void checkIBTver(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->bth_tver);
    p->bth_tver = distr;
    return ;
}
void checkIBDQP(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->bth_qp);
    p->bth_qp = distr;
    return ;
}

void checkIBSQP(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->src_qp);
    p->src_qp = distr;
    return ;
}
void checkIBPSN(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->bth_psn);
    p->bth_psn = distr;
    return ;
}


void checkIBServiceLevel(distribution_t *distr)
{
    packet_ib_t *p;

    p = (packet_ib_t *) packet->p;
    free (p->lrh_slevel);
    p->lrh_slevel = distr;
    return ;
}


void checkIBPayload ()
{
packet_ib_t* p;

	if (!bypass) {
		p = (packet_ib_t *) packet->p;
		p->payload = payload_list;
	}
}

