/* A Bison parser, made by GNU Bison 3.0.4.
Bison implementation for Yacc-like parsers in C
Copyright 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Parser for gpasm
Copyright 1998-2005 James Bowman, Craig Franklin
*/
#include "stdhdr.h"
#include "libgputils.h"
#include "gpasm.h"
#include "evaluate.h"
#include "gpmsg.h"
#include "directive.h"
#include "lst.h"
#include "macro.h"
#include "coff.h"
#include "scan.h"
#include "parse.h"
#define YYDEBUG 1
#ifdef _DEBUG
/* enable debugging */
bool yydebug = true;
#define YYPRINT(file, type, value) yyprint(file, type, value)
static void yyprint(FILE *File, int Type, YYSTYPE Value) {
switch (Type) {
case LABEL:
case IDENTIFIER:
case IDENT_BRACKET:
case DEBUG_LINE:
case ERRORLEVEL:
case FILL:
case LIST:
case PROCESSOR:
case DEFINE:
fprintf(File, "%s", Value.s);
break;
case STRING:
fprintf(File, "\"%s\"", Value.s);
break;
case NUMBER:
case UPPER:
case HIGH:
case LOW:
case LSH:
case RSH:
case GREATER_EQUAL:
case LESS_EQUAL:
case EQUAL:
case NOT_EQUAL:
case '<':
case '>':
case '&':
case '|':
case '^':
case LOGICAL_AND:
case LOGICAL_OR:
case '=':
case ASSIGN_PLUS:
case ASSIGN_MINUS:
case ASSIGN_MULTIPLY:
case ASSIGN_DIVIDE:
case ASSIGN_MODULUS:
case ASSIGN_LSH:
case ASSIGN_RSH:
case ASSIGN_AND:
case ASSIGN_OR:
case ASSIGN_XOR:
case INCREMENT:
case DECREMENT:
case POSTINCREMENT:
case POSTDECREMENT:
case INDFOFFSET:
case TBL_NO_CHANGE:
case TBL_POST_INC:
case TBL_POST_DEC:
case TBL_PRE_INC:
case '[':
case ']':
fprintf(File, "%d", Value.i);
break;
case CBLOCK:
case ENDC:
default:
break;
}
}
#else
bool yydebug;
#endif
int yylex();
/************************************************************************/
/* Some simple functions for building parse trees */
static pnode_t* mk_pnode(enum pnode_tag Tag) {
return new pnode_t(Tag);
// memset(pnew,0,sizeof*pnew);
// pnew->tag = Tag;
// return pnew;
}
pnode_t* mk_constant(int Value) {
pnode_t *pnew = mk_pnode(PTAG_CONSTANT);
PnConstant(pnew) = Value;
return pnew;
}
pnode_t* mk_offset(pnode_t *Pnode) {
pnode_t *pnew = mk_pnode(PTAG_OFFSET);
PnOffset(pnew) = Pnode;
return pnew;
}
pnode_t* mk_symbol(const char *String) {
pnode_t *pnew = mk_pnode(PTAG_SYMBOL);
PnSymbol(pnew) = String;
return pnew;
}
pnode_t* mk_string(char *String) {
pnode_t *pnew = mk_pnode(PTAG_STRING);
PnString(pnew) = String;
return pnew;
}
pnode_t* mk_list(pnode_t *Head, pnode_t *Tail) {
pnode_t *pnew = mk_pnode(PTAG_LIST);
PnListHead(pnew) = Head;
PnListTail(pnew) = Tail;
return pnew;
}
pnode_t* mk_2op(int Op, pnode_t *Pnode0, pnode_t *Pnode1) {
pnode_t *pnew = mk_pnode(PTAG_BINOP);
PnBinOpOp(pnew) = Op;
PnBinOpP0(pnew) = Pnode0;
PnBinOpP1(pnew) = Pnode1;
return pnew;
}
pnode_t* mk_1op(int Op, pnode_t *Pnode) {
pnode_t *pnew = mk_pnode(PTAG_UNOP);
PnUnOpOp(pnew) = Op;
PnUnOpP0(pnew) = Pnode;
return pnew;
}
/************************************************************************/
/* shared functions */
gpasmVal set_label(const char *Label, pnode_t *Parms) {
gpasmVal value = 0;
if (asm_enabled()) {
if ((state.mode == MODE_RELOCATABLE) && !(IN_MACRO_WHILE_DEFINITION) &&
!(SECTION_FLAGS & (STYP_TEXT | STYP_RAM_AREA | STYP_BPACK)))
gpmsg(GPE_LABEL_IN_SECTION, NULL);
value = do_or_append_insn("set", Parms);
if (!(IN_MACRO_WHILE_DEFINITION)) {
set_global(Label, value, VAL_VARIABLE, false, false);
}
}
return value;
}
int return_op(int Operation);
void next_line(int Value) {
source_context_t *ctx;
ctx = state.src_list.last;
if (state.pass==2 && state.lst.line.linetype==gpasm_state::Lst::Line::LTY_DOLIST_DIR) {
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
lst_format_line(ctx->curr_src_line.line, Value);
}
if ((IN_WHILE_EXPANSION) || (IN_MACRO_EXPANSION)) {
if (!(IN_WHILE_DEFINITION) && state.lst.expand &&
(state.pass == 2) &&
(state.lst.line.linetype != gpasm_state::Lst::Line::LTY_DOLIST_DIR) &&
(state.lst.line.linetype != gpasm_state::Lst::Line::LTY_NOLIST_DIR)) {
if (ctx->curr_src_line.line) {
/* Empty macro. */
lst_format_line(ctx->curr_src_line.line, Value);
}
preproc_emit();
}
/* While loops can be defined inside a macro or nested. */
if (IN_MACRO_WHILE_DEFINITION) {
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
if (state.mac_body) {
/* Empty macro. */
state.mac_body->src_line = GP_Strdup(ctx->mac_body->src_line);
}
}
if (ctx->mac_body) {
ctx->mac_body = ctx->mac_body->next;
}
}
else if (IN_FILE_EXPANSION) {
if (!(IN_WHILE_DEFINITION) && (state.pass == 2) &&
(state.lst.line.linetype != gpasm_state::Lst::Line::LTY_DOLIST_DIR) &&
(state.lst.line.linetype != gpasm_state::Lst::Line::LTY_NOLIST_DIR)) {
lst_format_line(ctx->curr_src_line.line, Value);
if (!(IN_MACRO_WHILE_DEFINITION)) {
preproc_emit();
}
}
if (IN_MACRO_WHILE_DEFINITION) {
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
if (state.mac_body) {
state.mac_body->src_line = GP_Strdup(ctx->curr_src_line.line);
}
}
if (state.next_state == STATE_INCLUDE) {
/* Includes have to be evaluated here and not in the following
switch statements so that the errors are reported correctly. */
++(ctx->line_number);
open_src(state.next_buffer.file, true);
free(state.next_buffer.file);
}
}
ctx = state.src_list.last;
switch (state.next_state) {
case STATE_EXITMACRO:
++(ctx->line_number);
execute_exitm();
break;
case STATE_MACRO:
++(ctx->line_number);
/* push the label for local directive */
state.stTop = macro_push_symbol_table(state.stTop);
execute_macro(state.next_buffer.macro, false);
break;
case STATE_SECTION:
++(ctx->line_number);
/* create a pnew coff section */
coff_new_section(state.obj.new_sect_name, state.obj.new_sect_addr, state.obj.new_sect_flags);
break;
case STATE_WHILE:
++(ctx->line_number);
execute_macro(state.next_buffer.macro, true);
break;
case STATE_INCLUDE:
/* already evaluated */
break;
default:
++(ctx->line_number);
break;
}
}
void yyerror(const char *Message) {
if (!(IN_MACRO_WHILE_DEFINITION)) {
/* throw error if not in macro definition */
gpmsg(GPE_PARSER, NULL, Message);
}
}
/************************************************************************/
/* Enabling verbose error messages. */
#define YYERROR_VERBOSE 1
/* In a future release of Bison, this section will be replaced
by #include "y.tab.h". */
#ifndef YY_YY_PARSE_H_INCLUDED
# define YY_YY_PARSE_H_INCLUDED
/* Debug traces. */
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_PARSE_H_INCLUDED */
/* Copy the second part of user declarations. */
#define YYSIZE_MAXIMUM ((size_t) -1)
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#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
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
/* Use EXIT_SUCCESS as a witness for stdlib.h. */
# 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 (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
void *malloc (size_t); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
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
{
int16_t 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 (int16_t) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the pnew one. The
local variables YYSIZE and YYSTACKSIZE give the old and pnew number of
elements in the stack, and YYPTR gives the pnew location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
size_t yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
__builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
size_t yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 445
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 67
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 42
/* YYNRULES -- Number of rules. */
#define YYNRULES 130
/* YYNSTATES -- Number of states. */
#define YYNSTATES 200
/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 300
#define YYTRANSLATE(YYX) \
((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, without out-of-bounds checking. */
static const uint8_t yytranslate[] = {
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
61, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 59, 2, 2, 65, 58, 27, 2,
66, 62, 56, 54, 63, 55, 2, 57, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 64, 2,
25, 32, 26, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 52, 2, 53, 29, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 28, 2, 60, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 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,
30, 31, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const uint16_t yyrline[] =
{
0, 435, 435, 439, 438, 444, 460, 470, 479, 488,
497, 587, 631, 631, 634, 646, 646, 653, 658, 658,
665, 665, 672, 677, 682, 687, 692, 697, 702, 707,
724, 742, 741, 762, 761, 781, 788, 790, 798, 800,
807, 818, 831, 831, 836, 840, 847, 855, 855, 855,
856, 856, 856, 856, 857, 857, 857, 860, 865, 870,
875, 880, 885, 890, 895, 900, 905, 912, 914, 922,
925, 927, 935, 938, 940, 948, 951, 953, 961, 961,
961, 964, 966, 974, 974, 974, 974, 974, 974, 977,
979, 987, 987, 990, 992, 1000, 1000, 1003, 1005, 1013,
1013, 1013, 1016, 1018, 1025, 1025, 1025, 1025, 1025, 1025,
1025, 1028, 1033, 1038, 1043, 1048, 1053, 1058, 1063, 1068,
1073, 1078, 1083, 1090, 1097, 1102, 1110, 1109, 1121, 1128,
1133
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
/* 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", "LABEL", "IDENTIFIER", "IDENT_BRACKET",
"CBLOCK", "DEBUG_LINE", "ENDC", "ERRORLEVEL", "FILL", "LIST", "NUMBER",
"PROCESSOR", "STRING", "DEFINE", "UPPER", "HIGH", "LOW", "LSH", "RSH",
"GREATER_EQUAL", "LESS_EQUAL", "EQUAL", "NOT_EQUAL", "'<'", "'>'", "'&'",
"'|'", "'^'", "LOGICAL_AND", "LOGICAL_OR", "'='", "ASSIGN_PLUS",
"ASSIGN_MINUS", "ASSIGN_MULTIPLY", "ASSIGN_DIVIDE", "ASSIGN_MODULUS",
"ASSIGN_LSH", "ASSIGN_RSH", "ASSIGN_AND", "ASSIGN_OR", "ASSIGN_XOR",
"INCREMENT", "DECREMENT", "POSTINCREMENT", "POSTDECREMENT", "INDFOFFSET",
"TBL_NO_CHANGE", "TBL_POST_INC", "TBL_POST_DEC", "TBL_PRE_INC", "'['",
"']'", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'~'", "'\\n'", "')'",
"','", "':'", "'$'", "'('", "$accept", "program", "$@1", "line",
"decimal_ops", "statement", "$@2", "$@3", "$@4", "$@5", "$@6",
"const_block", "const_line", "const_def_list", "$@7", "const_def",
"assign_equal_ops", "parameter_list", "expr", "e9op", "e8", "e8op", "e7",
"e7op", "e6", "e6op", "e5", "e5op", "e4", "e4op", "e3", "e3op", "e2",
"e2op", "e1", "e1op", "e0", "cidentifier", "list_block", "list_expr",
"$@8", "list_args", 0
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
static const uint16_t 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, 60, 62, 38, 124, 94,
280, 281, 61, 282, 283, 284, 285, 286, 287, 288,
289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
299, 300, 91, 93, 43, 45, 42, 47, 37, 33,
126, 10, 41, 44, 58, 36, 40
};
# endif
#define YYPACT_NINF -93
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-93)))
#define YYTABLE_NINF -127
#define yytable_value_is_error(Yytable_value) \
0
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
static const int16_t yypact[] =
{
-93, 140, -93, -48, 23, -93, 384, 58, 0, -93,
-93, 27, -16, -93, 3, -93, -93, -93, -93, 254,
-93, -93, -93, -93, -93, -93, -93, -93, -93, -93,
-14, 22, -93, 254, -93, -93, -93, -93, -93, -93,
178, 178, -93, -93, -93, 254, -93, -93, -93, -93,
-93, -93, 178, -93, 254, 84, -10, 54, 69, 68,
67, 96, 104, 73, -93, 321, -93, -93, 95, -93,
-93, -93, -26, 121, -93, 272, 101, 7, 5, -93,
178, -13, -93, -93, 8, 118, 118, -29, 118, -4,
-93, -93, -93, -93, 254, 178, 254, -93, 254, -93,
254, -93, -93, -93, 254, -93, -93, -93, -93, -93,
-93, 254, -93, -93, 254, -93, -93, 254, -93, -93,
-93, 254, -93, 59, -93, -93, 63, 36, 90, 54,
71, 79, 75, 91, -93, 100, 120, 92, 113, -93,
-93, -93, -93, 25, 118, 54, 69, 68, 67, 96,
104, 73, -93, -93, 2, -93, 254, 103, 135, -93,
272, -93, -93, 165, 117, 171, -93, -93, 196, 128,
-93, -93, -22, 175, 12, 39, 254, 254, -93, -93,
-93, 130, -93, 45, -93, -93, 175, -93, 129, 136,
-93, 50, 54, -93, -93, -93, 254, -93, -93, 135
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE does not specify something else to do. Zero
means the default is an error. */
static const uint8_t yydefact[] =
{
2, 0, 1, 0, 0, 5, 0, 0, 0, 13,
12, 0, 18, 15, 0, 14, 4, 20, 11, 0,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
0, 0, 10, 0, 123, 112, 114, 104, 105, 106,
121, 122, 118, 119, 120, 0, 110, 107, 117, 108,
109, 27, 62, 113, 0, 0, 58, 67, 70, 73,
76, 81, 89, 93, 97, 0, 102, 111, 0, 121,
122, 33, 0, 0, 17, 0, 0, 0, 0, 26,
0, 0, 9, 8, 0, 63, 64, 0, 61, 0,
65, 66, 28, 69, 0, 59, 0, 72, 0, 75,
0, 78, 79, 80, 0, 87, 88, 85, 86, 83,
84, 0, 91, 92, 0, 95, 96, 0, 99, 100,
101, 0, 103, 0, 36, 31, 0, 0, 123, 128,
0, 124, 0, 0, 25, 129, 0, 0, 0, 7,
6, 116, 115, 0, 60, 68, 71, 74, 77, 82,
90, 94, 98, 35, 42, 36, 0, 0, 0, 19,
0, 16, 22, 0, 0, 0, 21, 57, 0, 0,
38, 37, 0, 0, 42, 0, 0, 0, 125, 130,
24, 0, 40, 0, 34, 39, 0, 43, 45, 0,
29, 0, 127, 23, 41, 44, 0, 32, 30, 46
};
/* YYPGOTO[NTERM-NUM]. */
static const int16_t yypgoto[] =
{
-93, -93, -93, -93, -93, 192, -93, -93, -93, -93,
-93, 44, -93, -93, -93, 16, -93, 289, -8, 46,
-73, -93, 105, -93, 106, -93, 107, -93, 94, -93,
93, -93, 98, -93, 88, -93, 151, -92, 57, -93,
-93, 55
};
/* YYDEFGOTO[NTERM-NUM]. */
static const int16_t yydefgoto[] =
{
-1, 1, 4, 16, 17, 18, 76, 75, 80, 155,
124, 154, 171, 172, 173, 187, 33, 55, 56, 96,
57, 98, 58, 100, 59, 104, 60, 111, 61, 114,
62, 117, 63, 121, 64, 65, 66, 67, 130, 131,
158, 137
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule whose
number is the opposite. If YYTABLE_NINF, syntax error. */
static const int16_t yytable[] =
{
72, 68, 129, 93, 34, 168, 93, 77, 78, 135,
169, 81, 35, 5, 36, 168, 37, 38, 39, 93,
189, 133, 93, 145, 141, 84, 6, 7, 93, 8,
9, 73, 10, 11, 12, 125, 13, 87, 14, 185,
93, 186, 94, 69, 70, 74, 89, 82, 139, 42,
43, 44, 45, 95, 46, 47, 48, 93, 142, 49,
50, 71, 34, 170, 79, 53, 54, 136, 134, 140,
35, 93, 36, 170, 37, 38, 39, 93, 167, 90,
91, 188, 93, 83, 15, 97, 143, 129, 105, 106,
107, 108, 109, 110, 188, 101, 102, 103, 157, 99,
190, 40, 41, 123, 192, 132, 194, 42, 43, 44,
45, 198, 46, 47, 48, 112, 113, 49, 50, 51,
153, 52, -126, 53, 54, 34, 156, 90, 91, 118,
119, 120, 159, 35, 164, 36, 161, 37, 38, 39,
2, 3, 160, -3, -3, 92, -3, -3, 175, -3,
-3, -3, 162, -3, 165, -3, 90, 91, 115, 116,
183, 90, 91, 163, 40, 41, 176, 93, 191, 135,
42, 43, 44, 45, 166, 46, 47, 48, 180, 34,
49, 50, 34, 126, 52, 181, 53, 54, 199, 184,
35, 193, 36, 196, 37, 38, 39, 197, 32, 174,
34, -3, 195, 146, 177, 149, 147, 150, 35, 152,
36, 148, 37, 38, 39, 151, 122, 178, 179, 0,
0, 40, 41, 0, 0, 0, 0, 42, 43, 44,
45, 0, 46, 47, 48, 0, 0, 49, 50, 69,
70, 52, 0, 53, 54, 42, 43, 44, 45, 0,
46, 47, 48, 0, 0, 49, 50, 182, 34, 0,
0, 53, 54, 0, 0, 0, 35, 0, 36, 0,
37, 38, 39, 0, 0, 0, 128, 0, 0, 0,
0, 0, 0, 0, 35, 0, 36, 0, 37, 38,
39, 0, 0, 0, 0, 0, 0, 69, 70, 0,
0, 0, 0, 42, 43, 44, 45, 0, 46, 47,
48, 0, 0, 49, 50, 69, 70, 0, 0, 53,
54, 42, 43, 44, 45, 34, 46, 47, 48, 85,
86, 49, 50, 35, 0, 36, 0, 53, 54, 0,
0, 88, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 127, 0, 69, 70, 0, 0, 0, 138,
42, 43, 44, 45, 0, 0, 0, 48, 0, 0,
0, 0, 0, 0, 144, 0, 53, 54, 7, 0,
8, 9, 0, 10, 11, 12, 0, 13, 0, 14,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 15
};
static const int16_t yycheck[] =
{
8, 1, 75, 32, 4, 3, 32, 4, 5, 4,
8, 19, 12, 61, 14, 3, 16, 17, 18, 32,
8, 14, 32, 96, 53, 33, 3, 4, 32, 6,
7, 4, 9, 10, 11, 61, 13, 45, 15, 61,
32, 63, 52, 43, 44, 61, 54, 61, 61, 49,
50, 51, 52, 63, 54, 55, 56, 32, 62, 59,
60, 61, 4, 61, 61, 65, 66, 62, 61, 61,
12, 32, 14, 61, 16, 17, 18, 32, 53, 43,
44, 173, 32, 61, 61, 31, 94, 160, 21, 22,
23, 24, 25, 26, 186, 27, 28, 29, 62, 30,
61, 43, 44, 8, 177, 4, 61, 49, 50, 51,
52, 61, 54, 55, 56, 19, 20, 59, 60, 61,
61, 63, 32, 65, 66, 4, 63, 43, 44, 56,
57, 58, 61, 12, 14, 14, 61, 16, 17, 18,
0, 1, 63, 3, 4, 61, 6, 7, 156, 9,
10, 11, 61, 13, 62, 15, 43, 44, 54, 55,
168, 43, 44, 63, 43, 44, 63, 32, 176, 4,
49, 50, 51, 52, 61, 54, 55, 56, 61, 4,
59, 60, 4, 62, 63, 14, 65, 66, 196, 61,
12, 61, 14, 64, 16, 17, 18, 61, 6, 155,
4, 61, 186, 98, 158, 111, 100, 114, 12, 121,
14, 104, 16, 17, 18, 117, 65, 160, 163, -1,
-1, 43, 44, -1, -1, -1, -1, 49, 50, 51,
52, -1, 54, 55, 56, -1, -1, 59, 60, 43,
44, 63, -1, 65, 66, 49, 50, 51, 52, -1,
54, 55, 56, -1, -1, 59, 60, 61, 4, -1,
-1, 65, 66, -1, -1, -1, 12, -1, 14, -1,
16, 17, 18, -1, -1, -1, 4, -1, -1, -1,
-1, -1, -1, -1, 12, -1, 14, -1, 16, 17,
18, -1, -1, -1, -1, -1, -1, 43, 44, -1,
-1, -1, -1, 49, 50, 51, 52, -1, 54, 55,
56, -1, -1, 59, 60, 43, 44, -1, -1, 65,
66, 49, 50, 51, 52, 4, 54, 55, 56, 40,
41, 59, 60, 12, -1, 14, -1, 65, 66, -1,
-1, 52, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 73, -1, 43, 44, -1, -1, -1, 80,
49, 50, 51, 52, -1, -1, -1, 56, -1, -1,
-1, -1, -1, -1, 95, -1, 65, 66, 4, -1,
6, 7, -1, 9, 10, 11, -1, 13, -1, 15,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 61
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const uint8_t yystos[] =
{
0, 68, 0, 1, 69, 61, 3, 4, 6, 7,
9, 10, 11, 13, 15, 61, 70, 71, 72, 32,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
43, 44, 72, 83, 4, 12, 14, 16, 17, 18,
43, 44, 49, 50, 51, 52, 54, 55, 56, 59,
60, 61, 63, 65, 66, 84, 85, 87, 89, 91,
93, 95, 97, 99, 101, 102, 103, 104, 1, 43,
44, 61, 85, 4, 61, 74, 73, 4, 5, 61,
75, 85, 61, 61, 85, 84, 84, 85, 84, 85,
43, 44, 61, 32, 52, 63, 86, 31, 88, 30,
90, 27, 28, 29, 92, 21, 22, 23, 24, 25,
26, 94, 19, 20, 96, 54, 55, 98, 56, 57,
58, 100, 103, 8, 77, 61, 62, 84, 4, 87,
105, 106, 4, 14, 61, 4, 62, 108, 84, 61,
61, 53, 62, 85, 84, 87, 89, 91, 93, 95,
97, 99, 101, 61, 78, 76, 63, 62, 107, 61,
63, 61, 61, 63, 14, 62, 61, 53, 3, 8,
61, 79, 80, 81, 78, 85, 63, 86, 105, 108,
61, 14, 61, 85, 61, 61, 63, 82, 104, 8,
61, 85, 87, 61, 61, 82, 64, 61, 61, 85
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const uint8_t yyr1[] =
{
0, 67, 68, 69, 68, 68, 70, 70, 70, 70,
70, 70, 71, 71, 72, 73, 72, 72, 74, 72,
75, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 76, 72, 77, 72, 72, 78, 78, 79, 79,
79, 79, 81, 80, 80, 82, 82, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 84, 84, 84,
84, 84, 84, 84, 84, 84, 84, 85, 85, 86,
87, 87, 88, 89, 89, 90, 91, 91, 92, 92,
92, 93, 93, 94, 94, 94, 94, 94, 94, 95,
95, 96, 96, 97, 97, 98, 98, 99, 99, 100,
100, 100, 101, 101, 102, 102, 102, 102, 102, 102,
102, 103, 103, 103, 103, 103, 103, 103, 103, 103,
103, 103, 103, 104, 105, 105, 107, 106, 106, 108,
108
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
static const uint8_t yyr2[] =
{
0, 2, 0, 0, 3, 3, 4, 4, 3, 3,
2, 1, 1, 1, 1, 0, 4, 2, 0, 4,
0, 4, 4, 6, 5, 3, 2, 2, 3, 6,
7, 0, 7, 0, 6, 4, 0, 2, 1, 2,
2, 3, 0, 2, 3, 1, 3, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 4, 1, 2,
3, 2, 1, 2, 2, 2, 2, 1, 3, 1,
1, 3, 1, 1, 3, 1, 1, 3, 1, 1,
1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
3, 1, 1, 1, 3, 1, 1, 1, 3, 1,
1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 3, 1, 1, 1,
1, 1, 1, 1, 1, 3, 0, 4, 1, 1,
3
};
#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
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(Token, Value) \
do \
if (yychar == YYEMPTY) \
{ \
yychar = (Token); \
yylval = (Value); \
YYPOPSTACK (yylen); \
yystate = *yyssp; \
goto yybackup; \
} \
else \
{ \
yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
while (0)
/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
/* Enable debugging if requested. */
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
/* This macro is provided for backward compatibility. */
#ifndef YY_LOCATION_PRINT
# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
#endif
# 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 (0)
/*----------------------------------------.
| Print this symbol's value on YYOUTPUT. |
`----------------------------------------*/
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
if (!yyvaluep)
return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
YYUSE (yytype);
}
/*--------------------------------.
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", 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). |
`------------------------------------------------------------------*/
static void
yy_stack_print (int16_t *yybottom, int16_t *yytop)
{
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 (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
static void yy_reduce_print (int16_t *yyssp, YYSTYPE *yyvsp, int yyrule) {
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
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,
yystos[yyssp[yyi + 1 - yynrhs]],
&(yyvsp[(yyi + 1) - (yynrhs)])
);
YYFPRINTF (stderr, "\n");
}
}
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
yy_reduce_print (yyssp, yyvsp, Rule); \
} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
#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. */
static size_t
yystrlen (const char *yystr)
{
size_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. */
static char *
yystpcpy (char *yydest, const char *yysrc)
{
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 size_t
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
size_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 (size_t *yymsg_alloc, char **yymsg,
int16_t *yyssp, int yytoken)
{
size_t yysize0 = yytnamerr (0, yytname[yytoken]);
size_t yysize = yysize0;
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:
- 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];
{
size_t 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, "syntax error");
YYCASE_(1, "syntax error, unexpected %s");
YYCASE_(2, "syntax error, unexpected %s, expecting %s");
YYCASE_(3, "syntax error, unexpected %s, expecting %s or %s");
YYCASE_(4, "syntax error, unexpected %s, expecting %s or %s or %s");
YYCASE_(5, "syntax error, unexpected %s, expecting %s or %s or %s or %s");
# undef YYCASE_
}
{
size_t 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. |
`-----------------------------------------------*/
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YYUSE (yytype);
}
/* The lookahead symbol. */
int yychar;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
int yynerrs;
/*----------.
| yyparse. |
`----------*/
int yyparse(void) {
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 through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
int16_t yyssa[YYINITDEPTH];
int16_t *yyss;
int16_t *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
size_t yystacksize;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
int yytoken = 0;
/* 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;
size_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;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
/*------------------------------------------------------------.
| yynewstate -- Push a pnew 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. */
size_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;
int16_t *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 ("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;
{
int16_t *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 3:
{
state.lst.line.was_byte_addr = state.byte_addr;
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
state.next_state = STATE_NOCHANGE;
}
break;
case 5:
{
state.lst.line.was_byte_addr = state.byte_addr;
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
state.next_state = STATE_NOCHANGE;
yyerrok; /* generate multiple errors */
if (IN_MACRO_WHILE_DEFINITION) {
/* in macro definition: append the macro */
macro_append();
}
next_line(0);
}
break;
case 6:
{
pnode_t *parms;
int exp_result;
exp_result = do_insn("set", mk_list((yyvsp[-1].p), NULL));
parms = mk_list(mk_2op(return_op((yyvsp[-2].i)), mk_symbol((yyvsp[-3].s)), mk_constant(exp_result)), NULL);
next_line(set_label((yyvsp[-3].s), parms));
}
break;
case 7:
{
pnode_t *parms;
/* implements i = 6 + 1 */
parms = mk_list((yyvsp[-1].p), NULL);
next_line(set_label((yyvsp[-3].s), parms));
}
break;
case 8:
{
pnode_t *parms;
/* implements i-- */
parms = mk_list(mk_1op(DECREMENT, mk_symbol((yyvsp[-2].s))), NULL);
next_line(set_label((yyvsp[-2].s), parms));
}
break;
case 9:
{
pnode_t *parms;
/* implements i++ */
parms = mk_list(mk_1op(INCREMENT, mk_symbol((yyvsp[-2].s))), NULL);
next_line(set_label((yyvsp[-2].s), parms));
}
break;
case 10:
{
if (asm_enabled()) {
if (state.lst.line.linetype == gpasm_state::Lst::Line::LTY_NONE) {
if (IS_RAM_ORG) {
/* alias to next definition */
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_RES;
}
else {
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_INSN;
}
}
if (state.mac_head) {
/* This is a macro definition. Set it up. */
symbol_t *mac;
macro_head_t *head;
mac = gp_sym_get_symbol(state.stMacros, (yyvsp[-1].s));
head = (mac) ? (macro_head_t *)gp_sym_get_symbol_annotation(mac) : NULL;
/* It's not an error if macro was defined on pass 1 and we're in pass 2. */
if ((head) && !((head->pass == 1) && (state.pass == 2))) {
gpmsg(GPE_DUPLICATE_MACRO, NULL);
}
else {
if (mac == NULL) {
mac = gp_sym_add_symbol(state.stMacros, (yyvsp[-1].s));
}
gp_sym_annotate_symbol(mac, state.mac_head);
head = state.mac_head;
head->line_number = state.src_list.last->line_number;
head->file_symbol = state.src_list.last->file_symbol;
}
head->pass = state.pass;
/* The macro is defined so allow calls. */
if (state.pass == 2) {
head->defined = true;
}
state.mac_head = NULL;
}
else if (!(IN_MACRO_WHILE_DEFINITION)) {
/* Outside a macro definition, just define the label. */
switch (state.lst.line.linetype) {
case gpasm_state::Lst::Line::LTY_SEC:
gp_strncpy(state.obj.new_sect_name, (yyvsp[-1].s), sizeof(state.obj.new_sect_name));
break;
case gpasm_state::Lst::Line::LTY_SET:
set_global((yyvsp[-1].s), (yyvsp[0].i), VAL_VARIABLE, false, false);
break;
case gpasm_state::Lst::Line::LTY_ORG:
case gpasm_state::Lst::Line::LTY_EQU:
set_global((yyvsp[-1].s), (yyvsp[0].i), VAL_CONSTANT, false, false);
break;
case gpasm_state::Lst::Line::LTY_INSN:
case gpasm_state::Lst::Line::LTY_DATA:
case gpasm_state::Lst::Line::LTY_RES: {
if ((state.mode == MODE_RELOCATABLE) && !(IN_MACRO_WHILE_DEFINITION) &&
!(SECTION_FLAGS & (STYP_TEXT | STYP_RAM_AREA | STYP_BPACK))) {
gpmsg(GPE_LABEL_IN_SECTION, NULL);
}
if (IS_RAM_ORG) {
set_global((yyvsp[-1].s), (yyvsp[0].i), VAL_STATIC, false, false);
}
else {
set_global((yyvsp[-1].s), (yyvsp[0].i), VAL_ADDRESS, false, false);
}
break;
}
case gpasm_state::Lst::Line::LTY_DIR:
gpmsg(GPE_ILLEGAL_LABEL, NULL, (yyvsp[-1].s));
break;
default:
break;
}
}
}
next_line((yyvsp[0].i));
}
break;
case 11:
{
if (state.mac_head) {
/* This is a macro definition, but the label was missing. */
state.mac_head = NULL;
gpmsg(GPE_NO_MACRO_NAME, NULL);
}
else {
if (state.found_end) {
switch (state.src_list.last->type) {
case SRC_WHILE:
gpmsg0(GPE_EXPECTED, "Expected (ENDW)");
break;
case SRC_MACRO:
gpmsg0(GPW_EXPECTED, "Expected (ENDM)");
/* fall through */
default:
break;
}
if (state.astack) {
amode_t *old;
while (state.astack) {
old = state.astack;
state.astack = state.astack->upper;
free(old);
}
gpmsg0(GPW_EXPECTED, "Expected (ENDIF)");
}
}
next_line((yyvsp[0].i));
if (state.found_end) {
found_end();
YYACCEPT;
}
}
}
break;
case 14:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
(yyval.i) = (IS_RAM_ORG) ? state.byte_addr :
/* We want to have r as the value to assign to label. */
gp_processor_insn_from_byte_p(state.processor, state.byte_addr);
}
else {
macro_append();
}
}
break;
case 15:
{ force_ident = true; }
break;
case 16:
{
(yyval.i) = do_or_append_insn((yyvsp[-3].s), mk_list(mk_symbol((yyvsp[-1].s)), NULL));
force_ident = false;
}
break;
case 17:
{
(yyval.i) = do_or_append_insn((yyvsp[-1].s), NULL);
}
break;
case 18:
{ force_decimal = true; }
break;
case 19:
{
(yyval.i) = do_or_append_insn((yyvsp[-3].s), (yyvsp[-1].p));
force_decimal = false;
}
break;
case 20:
{ force_decimal = true; }
break;
case 21:
{
(yyval.i) = do_or_append_insn((yyvsp[-3].s), (yyvsp[-1].p));
force_decimal = false;
}
break;
case 22:
{
(yyval.i) = do_or_append_insn((yyvsp[-3].s), mk_list(mk_string((yyvsp[-2].s)), mk_list(mk_string((yyvsp[-1].s)), NULL)));
}
break;
case 23:
{
(yyval.i) = do_or_append_insn((yyvsp[-5].s), mk_list(mk_string((yyvsp[-4].s)), mk_list(mk_string((yyvsp[-1].s)), (yyvsp[-3].p))));
}
break;
case 24:
{
(yyval.i) = do_or_append_insn((yyvsp[-4].s), mk_list(mk_string((yyvsp[-3].s)), mk_list(mk_string((yyvsp[-1].s)), NULL)));
}
break;
case 25:
{
(yyval.i) = do_or_append_insn((yyvsp[-2].s), mk_list(mk_string((yyvsp[-1].s)), NULL));
}
break;
case 26:
{
(yyval.i) = do_or_append_insn((yyvsp[-1].s), NULL);
}
break;
case 27:
{
(yyval.i) = do_or_append_insn((yyvsp[-1].s), NULL);
}
break;
case 28:
{
(yyval.i) = do_or_append_insn((yyvsp[-2].s), (yyvsp[-1].p));
}
break;
case 29:
{
int number;
int i;
if (!(IN_MACRO_WHILE_DEFINITION)) {
number = eval_fill_number((yyvsp[-1].p));
for (i = 0; i < number; i++) {
(yyval.i) = do_insn((yyvsp[-4].s), NULL);
}
}
else {
macro_append();
}
}
break;
case 30:
{
int number;
int i;
if (!(IN_MACRO_WHILE_DEFINITION)) {
number = eval_fill_number((yyvsp[-1].p));
for (i = 0; i < number; i++) {
(yyval.i) = do_insn((yyvsp[-5].s), (yyvsp[-4].p));
}
}
else {
macro_append();
}
}
break;
case 31:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
begin_cblock((yyvsp[-1].p));
}
else {
macro_append();
}
next_line(0);
}
break;
case 32:
{
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
if (IN_MACRO_WHILE_DEFINITION) {
macro_append();
}
(yyval.i) = 0;
}
break;
case 33:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
continue_cblock();
}
else {
macro_append();
}
next_line(0);
}
break;
case 34:
{
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
if (IN_MACRO_WHILE_DEFINITION) {
macro_append();
}
(yyval.i) = 0;
}
break;
case 35:
{
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_NONE;
(yyval.i) = 0;
}
break;
case 37:
{
state.lst.line.linetype = gpasm_state::Lst::Line::LTY_SET;
next_line(state.lst.cblock_lst);
}
break;
case 39:
{
if (IN_MACRO_WHILE_DEFINITION) {
macro_append();
}
}
break;
case 40:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
state.lst.cblock_lst = state.cblock;
cblock_expr(mk_symbol((yyvsp[-1].s)));
}
else {
macro_append();
}
}
break;
case 41:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
state.lst.cblock_lst = state.cblock;
cblock_expr_incr(mk_symbol((yyvsp[-2].s)), (yyvsp[-1].p));
}
else {
macro_append();
}
}
break;
case 42:
{
state.lst.cblock_lst = state.cblock;
}
break;
case 45:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
cblock_expr((yyvsp[0].p));
}
}
break;
case 46:
{
if (!(IN_MACRO_WHILE_DEFINITION)) {
cblock_expr_incr((yyvsp[-2].p), (yyvsp[0].p));
}
}
break;
case 57:
{
(yyval.p) = mk_list(mk_constant(INDFOFFSET), mk_list((yyvsp[-1].p), (yyvsp[-3].p)));
}
break;
case 58:
{
(yyval.p) = mk_list((yyvsp[0].p), NULL);
}
break;
case 59:
{
(yyval.p) = mk_list((yyvsp[-1].p), mk_list(mk_symbol(""), NULL));
}
break;
case 60:
{
(yyval.p) = mk_list((yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 61:
{
(yyval.p) = mk_list(mk_symbol(""), (yyvsp[0].p));
}
break;
case 62:
{
(yyval.p) = mk_list(mk_symbol(""), mk_list(mk_symbol(""), NULL));
}
break;
case 63:
{
(yyval.p) = mk_list(mk_constant((yyvsp[-1].i)), (yyvsp[0].p));
}
break;
case 64:
{
(yyval.p) = mk_list(mk_constant((yyvsp[-1].i)), (yyvsp[0].p));
}
break;
case 65:
{
(yyval.p) = mk_list(mk_constant(POSTINCREMENT), (yyvsp[-1].p));
}
break;
case 66:
{
(yyval.p) = mk_list(mk_constant(POSTDECREMENT), (yyvsp[-1].p));
}
break;
case 68:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 71:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 74:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 77:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 82:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 90:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 94:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 98:
{
coerce_str1((yyvsp[-2].p));
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_2op((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 103:
{
coerce_str1((yyvsp[0].p));
(yyval.p) = mk_1op((yyvsp[-1].i), (yyvsp[0].p));
}
break;
case 111:
{
(yyval.p) = (yyvsp[0].p);
}
break;
case 112:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 113:
{
(yyval.p) = mk_symbol("$");
}
break;
case 114:
{
(yyval.p) = mk_string((yyvsp[0].s));
}
break;
case 115:
{
(yyval.p) = (yyvsp[-1].p);
}
break;
case 116:
{
(yyval.p) = mk_offset((yyvsp[-1].p));
}
break;
case 117:
{
(yyval.p) = mk_constant(TBL_NO_CHANGE);
}
break;
case 118:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 119:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 120:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 121:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 122:
{
(yyval.p) = mk_constant((yyvsp[0].i));
}
break;
case 123:
{
(yyval.p) = mk_symbol((yyvsp[0].s));
}
break;
case 124:
{
(yyval.p) = mk_list((yyvsp[0].p), NULL);
}
break;
case 125:
{
(yyval.p) = mk_list((yyvsp[-2].p), (yyvsp[0].p));
}
break;
case 126:
{
if ((strcasecmp((yyvsp[0].s), "p") == 0) || (strcasecmp((yyvsp[0].s), "pe") == 0)) {
force_ident = true;
}
}
break;
case 127:
{
(yyval.p) = mk_2op((yyvsp[-1].i), mk_symbol((yyvsp[-3].s)), (yyvsp[0].p));
force_ident = false;
}
break;
case 128:
{
(yyval.p) = (yyvsp[0].p);
}
break;
case 129:
{
(yyval.p) = mk_list(mk_symbol((yyvsp[0].s)), NULL);
}
break;
case 130:
{
(yyval.p) = mk_list(mk_symbol((yyvsp[-2].s)), (yyvsp[0].p));
}
break;
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
that yytoken be updated with the pnew 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 ("syntax error");
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
{
char const *yymsgp = "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 whose 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 ("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 whose 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
return yyresult;
}
int return_op(int Operation) {
/* returns an operator for the replacement of i+=1 with i=i+1*/
switch (Operation) {
case ASSIGN_PLUS: return '+';
case ASSIGN_MINUS: return '-';
case ASSIGN_MULTIPLY: return '*';
case ASSIGN_DIVIDE: return '/';
case ASSIGN_MODULUS: return '%';
case ASSIGN_LSH: return LSH;
case ASSIGN_RSH: return RSH;
case ASSIGN_AND: return '&';
case ASSIGN_OR: return '|';
case ASSIGN_XOR: return '^';
default:
assert(0); /* Unhandled operator */
}
return 0;
}
Detected encoding: UTF-8 | 0
|