#define YYBISON 1
#define YYBISON_VERSION "3.0.4"
#define YYSKELETON_NAME "yacc.c"
#define YYPURE 0
#define YYPUSH 0
#define YYPULL 1
#line 1 "dpas-parser.y"
#include "dpas-internal.h"
#include <jit/jit-dump.h>
#include <config.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#elif HAVE_VARARGS_H
#include <varargs.h>
#endif
extern int yylex(void);
#ifdef YYTEXT_POINTER
extern char *yytext;
#else
extern char yytext[];
#endif
int dpas_error_reported = 0;
int dpas_dump_functions = 0;
static void yyerror(char *msg)
{
char *text = yytext;
char *newmsg;
int posn, outposn;
dpas_error_reported = 1;
if(!jit_strcmp(msg, "parse error") || !jit_strcmp(msg, "syntax error"))
{
simpleError:
if(text && *text != '\0')
{
fprintf(stderr, "%s:%ld: parse error at or near `%s'\n",
dpas_filename, dpas_linenum, text);
}
else
{
fprintf(stderr, "%s:%ld: parse error\n",
dpas_filename, dpas_linenum);
}
}
else if(!jit_strncmp(msg, "parse error, expecting `", 24))
{
newmsg = jit_strdup(msg);
expectingError:
if(newmsg)
{
posn = 0;
outposn = 0;
while(newmsg[posn] != '\0')
{
if(newmsg[posn] == '`')
{
if(newmsg[posn + 1] == '"' && newmsg[posn + 2] == '`')
{
posn += 2;
newmsg[outposn++] = '`';
}
else if(newmsg[posn + 1] == '"')
{
++posn;
}
else if(newmsg[posn + 1] == '`' ||
newmsg[posn + 1] == '\'')
{
++posn;
newmsg[outposn++] = '`';
}
else
{
newmsg[outposn++] = '`';
}
}
else if(newmsg[posn] == '\\')
{
}
else if(newmsg[posn] == '"' && newmsg[posn + 1] == '\'')
{
++posn;
}
else if(newmsg[posn] == '\'' && newmsg[posn + 1] == '"' &&
newmsg[posn + 2] == '\'')
{
posn += 2;
newmsg[outposn++] = '\'';
}
else if(newmsg[posn] == '\'' && newmsg[posn + 1] == '\'')
{
++posn;
newmsg[outposn++] = '\'';
}
else if(newmsg[posn] == ' ' && newmsg[posn + 1] == '\'')
{
++posn;
newmsg[outposn++] = ' ';
newmsg[outposn++] = '`';
}
else if(newmsg[posn] == '"')
{
}
else
{
newmsg[outposn++] = newmsg[posn];
}
++posn;
}
newmsg[outposn] = '\0';
if(text && *text != '\0')
{
fprintf(stderr, "%s:%ld: %s, at or near `%s'\n",
dpas_filename, dpas_linenum, newmsg, text);
}
else
{
fprintf(stderr, "%s:%ld: %s\n",
dpas_filename, dpas_linenum, newmsg);
}
jit_free(newmsg);
}
else
{
if(text && *text != '\0')
{
fprintf(stderr, "%s:%ld: %s at or near `%s'\n",
dpas_filename, dpas_linenum, msg, text);
}
else
{
fprintf(stderr, "%s:%ld: %s\n",
dpas_filename, dpas_linenum, msg);
}
}
}
else if(!jit_strncmp(msg, "parse error, unexpected ", 24))
{
posn = 24;
while(msg[posn] != '\0' &&
jit_strncmp(msg + posn, ", expecting ", 12) != 0)
{
++posn;
}
if(msg[posn] == '\0')
{
goto simpleError;
}
newmsg = (char *)jit_malloc(jit_strlen(msg) + 1);
if(!newmsg)
{
goto defaultError;
}
jit_strcpy(newmsg, "parse error, expecting ");
jit_strcat(newmsg, msg + posn + 12);
goto expectingError;
}
else
{
defaultError:
if(text && *text != '\0')
{
fprintf(stderr, "%s:%ld: %s at or near `%s'\n",
dpas_filename, dpas_linenum, msg, text);
}
else
{
fprintf(stderr, "%s:%ld: %s\n",
dpas_filename, dpas_linenum, msg);
}
}
}
void dpas_error(const char *format, ...)
{
va_list va;
#ifdef HAVE_STDARG_H
va_start(va, format);
#else
va_start(va);
#endif
fprintf(stderr, "%s:%ld: ", dpas_filename, dpas_linenum);
vfprintf(stderr, format, va);
putc('\n', stderr);
va_end(va);
dpas_error_reported = 1;
}
void dpas_warning(const char *format, ...)
{
va_list va;
#ifdef HAVE_STDARG_H
va_start(va, format);
#else
va_start(va);
#endif
fprintf(stderr, "%s:%ld: warning: ", dpas_filename, dpas_linenum);
vfprintf(stderr, format, va);
putc('\n', stderr);
va_end(va);
}
void dpas_error_on_line(const char *filename, long linenum,
const char *format, ...)
{
va_list va;
#ifdef HAVE_STDARG_H
va_start(va, format);
#else
va_start(va);
#endif
fprintf(stderr, "%s:%ld: ", filename, linenum);
vfprintf(stderr, format, va);
putc('\n', stderr);
va_end(va);
dpas_error_reported = 1;
}
static void dpas_undeclared(const char *name)
{
dpas_error("`%s' is not declared in the current scope", name);
}
static void dpas_redeclared(const char *name, dpas_scope_item_t item)
{
dpas_error("`%s' is already declared in the current scope", name);
dpas_error_on_line(dpas_scope_item_filename(item),
dpas_scope_item_linenum(item),
"previous declaration of `%s' here", name);
}
static void identifier_list_add(char ***list, int *len, char *name)
{
char **new_list = (char **)jit_realloc(*list, sizeof(char *) * (*len + 1));
if(!new_list)
{
dpas_out_of_memory();
}
new_list[*len] = name;
++(*len);
*list = new_list;
}
static void identifier_list_free(char **list, int len)
{
int posn;
for(posn = 0; posn < len; ++posn)
{
jit_free(list[posn]);
}
jit_free(list);
}
static int identifier_list_contains(char **list, int len, const char *name)
{
int posn;
for(posn = 0; posn < len; ++posn)
{
if(list[posn] && !jit_stricmp(list[posn], name))
{
return 1;
}
}
return 0;
}
static void type_list_add(jit_type_t **list, int *len, jit_type_t type)
{
jit_type_t *new_list = (jit_type_t *)
jit_realloc(*list, sizeof(jit_type_t) * (*len + 1));
if(!new_list)
{
dpas_out_of_memory();
}
new_list[*len] = type;
++(*len);
*list = new_list;
}
static void parameter_list_init(dpas_params *list)
{
list->names = 0;
list->types = 0;
list->len = 0;
list->abi = jit_abi_cdecl;
}
static void parameter_list_add(dpas_params *list, char *name, jit_type_t type)
{
char **new_names = (char **)
jit_realloc(list->names, sizeof(char *) * (list->len + 1));
jit_type_t *new_types = (jit_type_t *)
jit_realloc(list->types, sizeof(jit_type_t) * (list->len + 1));
if(!new_names || !new_types)
{
dpas_out_of_memory();
}
new_names[list->len] = name;
new_types[list->len] = type;
++(list->len);
list->names = new_names;
list->types = new_types;
}
static void parameter_list_free(dpas_params *list)
{
int posn;
for(posn = 0; posn < list->len; ++posn)
{
jit_free(list->names[posn]);
jit_type_free(list->types[posn]);
}
jit_free(list->names);
jit_free(list->types);
}
static int parameter_list_contains(dpas_params *list, const char *name)
{
int posn;
for(posn = 0; posn < list->len; ++posn)
{
if(list->names[posn] && !jit_stricmp(list->names[posn], name))
{
return 1;
}
}
return 0;
}
static void parameter_list_create(dpas_params *list, char **names,
int num_names, jit_type_t type)
{
char **temp = names;
parameter_list_init(list);
while(num_names > 0)
{
parameter_list_add(list, temp[0], jit_type_copy(type));
--num_names;
++temp;
}
if(names)
{
jit_free(names);
}
}
static void parameter_list_merge(dpas_params *list1, dpas_params *list2)
{
int posn;
char *name;
for(posn = 0; posn < list2->len; ++posn)
{
name = list2->names[posn];
if(name && parameter_list_contains(list1, name))
{
dpas_error("`%s' used twice in a parameter or field list", name);
jit_free(name);
name = 0;
}
parameter_list_add(list1, name, list2->types[posn]);
}
jit_free(list2->names);
jit_free(list2->types);
}
static void expression_list_add
(dpas_semvalue **list, int *len, dpas_semvalue value)
{
dpas_semvalue *new_list = (dpas_semvalue *)
jit_realloc(*list, sizeof(dpas_semvalue) * (*len + 1));
if(!new_list)
{
dpas_out_of_memory();
}
new_list[*len] = value;
++(*len);
*list = new_list;
}
static void expression_list_free(dpas_semvalue *list, int len)
{
jit_free(list);
}
static dpas_semvalue invoke_procedure
(jit_function_t func_value, const char *name, jit_type_t signature,
jit_value_t indirect_value, dpas_semvalue *args, int num_args)
{
jit_function_t func = dpas_current_function();
dpas_semvalue rvalue;
jit_type_t type;
jit_value_t return_value;
jit_value_t *value_args;
jit_type_t param_type;
jit_type_t var_type;
unsigned int param;
int error;
if(num_args != (int)jit_type_num_params(signature))
{
dpas_error("incorrect number of parameters to procedure or function");
dpas_sem_set_error(rvalue);
return rvalue;
}
error = 0;
if(num_args > 0)
{
value_args = (jit_value_t *)jit_malloc(sizeof(jit_value_t) * num_args);
if(!value_args)
{
dpas_out_of_memory();
}
for(param = 0; param < (unsigned int)num_args; ++param)
{
param_type = jit_type_get_param(signature, param);
var_type = dpas_type_is_var(param_type);
if(var_type)
{
if(dpas_sem_is_lvalue_ea(args[param]))
{
value_args[param] = dpas_sem_get_value(args[param]);
}
else if(dpas_sem_is_lvalue(args[param]))
{
value_args[param] = jit_insn_address_of
(func, dpas_sem_get_value(args[param]));
if(!(value_args[param]))
{
dpas_out_of_memory();
}
}
else
{
dpas_error("invalid value for parameter %d",
(int)(param + 1));
error = 1;
}
}
else
{
if(dpas_sem_is_rvalue(args[param]))
{
value_args[param] = dpas_sem_get_value
(dpas_lvalue_to_rvalue(args[param]));
}
else
{
dpas_error("invalid value for parameter %d",
(int)(param + 1));
error = 1;
}
}
}
}
else
{
value_args = 0;
}
if(error)
{
jit_free(value_args);
dpas_sem_set_error(rvalue);
return rvalue;
}
if(func_value)
{
return_value = jit_insn_call
(func, name, func_value, signature,
value_args, (unsigned int)num_args, 0);
}
else
{
return_value = jit_insn_call_indirect
(func, indirect_value, signature,
value_args, (unsigned int)num_args, 0);
}
if(!return_value)
{
dpas_out_of_memory();
}
jit_free(value_args);
type = jit_type_get_return(signature);
if(type == jit_type_void)
{
dpas_sem_set_void(rvalue);
}
else
{
dpas_sem_set_rvalue(rvalue, type, return_value);
}
return rvalue;
}
static int throw_builtin_exception(jit_function_t func, int exception_type)
{
jit_type_t signature;
jit_type_t param_types[1];
jit_value_t param_values[1];
param_types[0] = jit_type_int;
signature = jit_type_create_signature
(jit_abi_cdecl, jit_type_void, param_types, 1, 1);
if(!signature)
{
return 0;
}
param_values[0] = jit_value_create_nint_constant(func, jit_type_int, exception_type);
if(!param_values[0])
{
return 0;
}
jit_insn_call_native
(func, "jit_exception_builtin",
(void *)jit_exception_builtin, signature, param_values, 1,
JIT_CALL_NORETURN);
jit_type_free(signature);
return 1;
}
#define handle_binary(name,func,arg1,arg2) \
do { \
if(!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_numeric(dpas_sem_get_type(arg2)) || \
!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_numeric(dpas_sem_get_type(arg2))) \
{ \
if(!dpas_sem_is_error(arg1) && !dpas_sem_is_error(arg2)) \
{ \
dpas_error("invalid operands to binary `" name "'"); \
} \
dpas_sem_set_error(yyval.semvalue); \
} \
else \
{ \
jit_value_t value; \
value = func \
(dpas_current_function(), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg1)), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg2))); \
dpas_sem_set_rvalue \
(yyval.semvalue, jit_value_get_type(value), value); \
} \
} while (0)
#define handle_integer_binary(name,func,arg1,arg2) \
do { \
if(!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_integer(dpas_sem_get_type(arg2)) || \
!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_integer(dpas_sem_get_type(arg2))) \
{ \
if(!dpas_sem_is_error(arg1) && !dpas_sem_is_error(arg2)) \
{ \
dpas_error("invalid operands to binary `" name "'"); \
} \
dpas_sem_set_error(yyval.semvalue); \
} \
else \
{ \
jit_value_t value; \
value = func \
(dpas_current_function(), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg1)), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg2))); \
dpas_sem_set_rvalue \
(yyval.semvalue, jit_value_get_type(value), value); \
} \
} while (0)
#define handle_boolean_binary(name,func,arg1,arg2) \
do { \
if(!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_numeric(dpas_sem_get_type(arg2)) || \
!dpas_sem_is_rvalue(arg1) || \
!dpas_type_is_numeric(dpas_sem_get_type(arg2))) \
{ \
if(!dpas_sem_is_error(arg1) && !dpas_sem_is_error(arg2)) \
{ \
dpas_error("invalid operands to binary `" name "'"); \
} \
dpas_sem_set_error(yyval.semvalue); \
} \
else \
{ \
jit_value_t value; \
value = func \
(dpas_current_function(), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg1)), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg2))); \
dpas_sem_set_rvalue \
(yyval.semvalue, dpas_type_boolean, value); \
} \
} while (0)
#define handle_compare_binary(name,func,arg1,arg2) \
do { \
if(dpas_sem_is_rvalue(arg1) && \
jit_type_is_pointer(dpas_sem_get_type(arg1)) && \
dpas_sem_is_rvalue(arg2) && \
jit_type_is_pointer(dpas_sem_get_type(arg2))) \
{ \
jit_value_t value; \
value = func \
(dpas_current_function(), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg1)), \
dpas_sem_get_value(dpas_lvalue_to_rvalue(arg2))); \
dpas_sem_set_rvalue \
(yyval.semvalue, dpas_type_boolean, value); \
} \
else \
{ \
handle_boolean_binary(name, func, arg1, arg2); \
} \
} while (0)
typedef struct
{
jit_label_t expr_label;
jit_label_t top_label;
jit_label_t exit_label;
} dpas_loop_info;
static dpas_loop_info *loop_stack = 0;
static int loop_stack_size = 0;
static int loop_stack_max = 0;
static void push_loop
(jit_label_t expr_label, jit_label_t top_label, jit_label_t exit_label)
{
dpas_loop_info *new_stack;
if(loop_stack_size >= loop_stack_max)
{
new_stack = (dpas_loop_info *)jit_realloc
(loop_stack, sizeof(dpas_loop_info) * (loop_stack_size + 1));
if(!new_stack)
{
dpas_out_of_memory();
}
loop_stack = new_stack;
++loop_stack_max;
}
loop_stack[loop_stack_size].expr_label = expr_label;
loop_stack[loop_stack_size].top_label = top_label;
loop_stack[loop_stack_size].exit_label = exit_label;
++loop_stack_size;
}
static jit_label_t *if_stack = 0;
static int if_stack_size = 0;
static int if_stack_max = 0;
static void push_if(jit_label_t end_label)
{
jit_label_t *new_stack;
if(if_stack_size >= if_stack_max)
{
new_stack = (jit_label_t *)jit_realloc
(if_stack, sizeof(jit_label_t) * (if_stack_size + 1));
if(!new_stack)
{
dpas_out_of_memory();
}
if_stack = new_stack;
++if_stack_max;
}
if_stack[if_stack_size] = end_label;
++if_stack_size;
}
#line 867 "dpas-parser.c"
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# endif
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif
#ifndef YY_YY_DPAS_PARSER_H_INCLUDED
# define YY_YY_DPAS_PARSER_H_INCLUDED
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int yydebug;
#endif
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
IDENTIFIER = 258,
INTEGER_CONSTANT = 259,
STRING_CONSTANT = 260,
REAL_CONSTANT = 261,
K_AND = 262,
K_ARRAY = 263,
K_BEGIN = 264,
K_CASE = 265,
K_CATCH = 266,
K_CONST = 267,
K_DIV = 268,
K_DO = 269,
K_DOWNTO = 270,
K_ELSE = 271,
K_END = 272,
K_EXIT = 273,
K_FASTCALL = 274,
K_FINALLY = 275,
K_FOR = 276,
K_FORWARD = 277,
K_FUNCTION = 278,
K_GOTO = 279,
K_IF = 280,
K_IN = 281,
K_LABEL = 282,
K_IMPORT = 283,
K_MOD = 284,
K_MODULE = 285,
K_NIL = 286,
K_NOT = 287,
K_OF = 288,
K_OR = 289,
K_PACKED = 290,
K_POW = 291,
K_PROCEDURE = 292,
K_PROGRAM = 293,
K_RECORD = 294,
K_REPEAT = 295,
K_SET = 296,
K_SHL = 297,
K_SHR = 298,
K_SIZEOF = 299,
K_STDCALL = 300,
K_THEN = 301,
K_THROW = 302,
K_TO = 303,
K_TRY = 304,
K_TYPE = 305,
K_UNTIL = 306,
K_VAR = 307,
K_VA_ARG = 308,
K_WITH = 309,
K_WHILE = 310,
K_XOR = 311,
K_NE = 312,
K_LE = 313,
K_GE = 314,
K_ASSIGN = 315,
K_DOT_DOT = 316
};
#endif
#define IDENTIFIER 258
#define INTEGER_CONSTANT 259
#define STRING_CONSTANT 260
#define REAL_CONSTANT 261
#define K_AND 262
#define K_ARRAY 263
#define K_BEGIN 264
#define K_CASE 265
#define K_CATCH 266
#define K_CONST 267
#define K_DIV 268
#define K_DO 269
#define K_DOWNTO 270
#define K_ELSE 271
#define K_END 272
#define K_EXIT 273
#define K_FASTCALL 274
#define K_FINALLY 275
#define K_FOR 276
#define K_FORWARD 277
#define K_FUNCTION 278
#define K_GOTO 279
#define K_IF 280
#define K_IN 281
#define K_LABEL 282
#define K_IMPORT 283
#define K_MOD 284
#define K_MODULE 285
#define K_NIL 286
#define K_NOT 287
#define K_OF 288
#define K_OR 289
#define K_PACKED 290
#define K_POW 291
#define K_PROCEDURE 292
#define K_PROGRAM 293
#define K_RECORD 294
#define K_REPEAT 295
#define K_SET 296
#define K_SHL 297
#define K_SHR 298
#define K_SIZEOF 299
#define K_STDCALL 300
#define K_THEN 301
#define K_THROW 302
#define K_TO 303
#define K_TRY 304
#define K_TYPE 305
#define K_UNTIL 306
#define K_VAR 307
#define K_VA_ARG 308
#define K_WITH 309
#define K_WHILE 310
#define K_XOR 311
#define K_NE 312
#define K_LE 313
#define K_GE 314
#define K_ASSIGN 315
#define K_DOT_DOT 316
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 805 "dpas-parser.y"
char *name;
struct
{
jit_ulong value;
jit_type_t type;
} int_const;
jit_nfloat real_const;
jit_constant_t const_value;
jit_type_t type;
struct
{
char **list;
int len;
} id_list;
struct
{
jit_type_t *list;
int len;
} type_list;
dpas_params parameters;
struct
{
char *name;
jit_type_t type;
} procedure;
struct
{
jit_type_t type;
dpas_params bounds;
} param_type;
dpas_semvalue semvalue;
struct
{
dpas_semvalue *exprs;
int len;
} expr_list;
int direction;
jit_abi_t abi;
#line 1070 "dpas-parser.c"
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
extern YYSTYPE yylval;
int yyparse (void);
#endif
#line 1087 "dpas-parser.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;
#else
typedef signed char 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
# include <stddef.h>
# 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>
# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
# define YY_(Msgid) Msgid
# endif
#endif
#ifndef YY_ATTRIBUTE
# if (defined __GNUC__ \
&& (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
|| defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
# else
# define YY_ATTRIBUTE(Spec)
# endif
#endif
#ifndef YY_ATTRIBUTE_PURE
# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
#endif
#if !defined _Noreturn \
&& (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
# if defined _MSC_VER && 1200 <= _MSC_VER
# define _Noreturn __declspec (noreturn)
# else
# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E)
#endif
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value)
#endif
#if ! defined yyoverflow || YYERROR_VERBOSE
# ifdef YYSTACK_USE_ALLOCA
# if YYSTACK_USE_ALLOCA
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
# elif defined __BUILTIN_VA_ARG_INCR
# include <alloca.h>
# elif defined _AIX
# define YYSTACK_ALLOC __alloca
# elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h>
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# endif
# endif
# endif
# ifdef YYSTACK_ALLOC
# define YYSTACK_FREE(Ptr) do { ; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM 4032
# 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>
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T);
# endif
# endif
# ifndef YYFREE
# define YYFREE free
# if ! defined free && ! defined EXIT_SUCCESS
void free (void *);
# endif
# endif
# endif
#endif
#if (! defined yyoverflow \
&& (! defined __cplusplus \
|| (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
};
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
# define YYSTACK_BYTES(N) \
((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
# 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 (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
# 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 \
{ \
YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
while (0)
# endif
# endif
#endif
#define YYFINAL 8
#define YYLAST 611
#define YYNTOKENS 80
#define YYNNTS 93
#define YYNRULES 212
#define YYNSTATES 415
#define YYUNDEFTOK 2
#define YYMAXUTOK 316
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
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, 77, 2,
63, 64, 75, 73, 66, 74, 62, 76, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 68, 65,
71, 67, 72, 2, 78, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 69, 2, 70, 79, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 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
};
#if YYDEBUG
static const yytype_uint16 yyrline[] =
{
0, 960, 960, 964, 968, 971, 978, 983, 985, 989,
993, 1000, 1041, 1045, 1050, 1070, 1074, 1078, 1080, 1084,
1085, 1089, 1092, 1094, 1098, 1099, 1103, 1120, 1122, 1130,
1131, 1135, 1168, 1170, 1174, 1175, 1179, 1229, 1231, 1235,
1236, 1240, 1241, 1242, 1243, 1246, 1248, 1256, 1256, 1364,
1365, 1369, 1370, 1374, 1375, 1379, 1398, 1417, 1418, 1422,
1429, 1430, 1431, 1435, 1436, 1443, 1459, 1485, 1489, 1496,
1500, 1504, 1508, 1516, 1517, 1524, 1554, 1555, 1559, 1560,
1564, 1565, 1599, 1603, 1604, 1605, 1606, 1607, 1608, 1609,
1613, 1617, 1621, 1622, 1641, 1642, 1646, 1647, 1651, 1826,
1826, 1857, 1858, 1858, 1885, 1906, 1885, 1954, 1954, 1995,
1995, 2176, 2183, 2184, 2188, 2195, 2196, 2200, 2204, 2205,
2209, 2210, 2214, 2220, 2222, 2225, 2227, 2235, 2236, 2239,
2242, 2245, 2248, 2251, 2254, 2260, 2265, 2272, 2273, 2288,
2310, 2311, 2314, 2317, 2387, 2388, 2391, 2396, 2399, 2402,
2469, 2472, 2475, 2481, 2482, 2488, 2489, 2494, 2499, 2504,
2530, 2563, 2596, 2597, 2652, 2657, 2678, 2686, 2783, 2982,
3047, 3099, 3122, 3123, 3124, 3128, 3129, 3168, 3204, 3207,
3224, 3236, 3280, 3285, 3292, 3314, 3315, 3316, 3317, 3321,
3325, 3326, 3330, 3331, 3338, 3342, 3349, 3354, 3362, 3371,
3376, 3383, 3404, 3405, 3413, 3414, 3428, 3466, 3467, 3492,
3511, 3515, 3522
};
#endif
#if YYDEBUG || YYERROR_VERBOSE || 0
static const char *const yytname[] =
{
"$end", "error", "$undefined", "\"an identifier\"",
"\"an integer value\"", "\"a string literal\"",
"\"a floating point value\"", "\"`and'\"", "\"`array'\"", "\"`begin'\"",
"\"`case'\"", "\"`catch'\"", "\"`const'\"", "\"`div'\"", "\"`do'\"",
"\"`downto'\"", "\"`else'\"", "\"`end'\"", "\"`exit'\"",
"\"`fastcall'\"", "\"`finally'\"", "\"`for'\"", "\"`forward'\"",
"\"`function'\"", "\"`goto'\"", "\"`if'\"", "\"`in'\"", "\"`label'\"",
"\"`import'\"", "\"`mod'\"", "\"`module'\"", "\"`nil'\"", "\"`not'\"",
"\"`of'\"", "\"`or'\"", "\"`packed'\"", "\"`pow'\"", "\"`procedure'\"",
"\"`program'\"", "\"`record'\"", "\"`repeat'\"", "\"`set'\"",
"\"`shl'\"", "\"`shr'\"", "\"`sizeof'\"", "\"`stdcall'\"", "\"`then'\"",
"\"`throw'\"", "\"`to'\"", "\"`try'\"", "\"`type'\"", "\"`until'\"",
"\"`var'\"", "\"`va_arg'\"", "\"`with'\"", "\"`while'\"", "\"`xor'\"",
"\"`<>'\"", "\"`<='\"", "\"`>='\"", "\"`:='\"", "\"`..'\"", "'.'", "'('",
"')'", "';'", "','", "'='", "':'", "'['", "']'", "'<'", "'>'", "'+'",
"'-'", "'*'", "'/'", "'&'", "'@'", "'^'", "$accept", "Program",
"ProgramHeading", "ImportDeclarationPart", "ImportDeclarations",
"ProgramBlock", "Identifier", "IdentifierList", "Block",
"DeclarationPart", "LabelDeclarationPart", "LabelList", "Label",
"ConstantDefinitionPart", "ConstantDefinitionList", "ConstantDefinition",
"TypeDefinitionPart", "TypeDefinitionList", "TypeDefinition",
"VariableDeclarationPart", "VariableDeclarationList",
"VariableDeclaration", "ProcedureAndFunctionDeclarationPart",
"ProcedureOrFunctionList", "StatementPart", "OptSemi",
"ProcedureOrFunctionDeclaration", "$@1", "ProcedureOrFunctionHeading",
"Body", "Directive", "ProcedureHeading", "FunctionHeading",
"FormalParameterList", "OptAbi", "FormalParameterSections",
"FormalParameterSection", "ParameterType", "ConformantArray",
"BoundSpecificationList", "BoundSpecification", "StatementSequence",
"Statement", "InnerStatement", "ActualParameters", "CompoundStatement",
"AssignmentStatement", "IfStatement", "$@2", "IfTail", "$@3",
"WhileStatement", "$@4", "$@5", "RepeatStatement", "$@6", "ForStatement",
"@7", "BooleanExpression", "Direction", "CaseStatement", "CaseLimbList",
"CaseLimb", "CaseLabelList", "VariableList", "TryStatement",
"CatchClause", "FinallyClause", "Expression", "ExpressionList",
"SimpleExpression", "AdditionExpression", "Term", "Power", "Factor",
"Variable", "TypeIdentifier", "Type", "SimpleType", "StructuredType",
"ArrayBoundsList", "BoundType", "FieldList", "FixedPart",
"RecordSection", "VariantPart", "VariantList", "VariantCaseList",
"Variant", "VariantCaseLabelList", "Constant", "ConstantValue",
"BasicConstant", YY_NULLPTR
};
#endif
# ifdef YYPRINT
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, 46, 40, 41, 59, 44, 61, 58, 91,
93, 60, 62, 43, 45, 42, 47, 38, 64, 94
};
# endif
#define YYPACT_NINF -341
#define yypact_value_is_default(Yystate) \
(!!((Yystate) == (-341)))
#define YYTABLE_NINF -209
#define yytable_value_is_error(Yytable_value) \
0
static const yytype_int16 yypact[] =
{
56, 42, 42, 37, 36, -341, 96, 138, -341, 42,
71, 42, -341, 42, -341, 114, -341, 102, 50, -341,
84, 103, -341, 134, 149, -341, 42, -341, 152, -341,
-341, 514, -341, -341, 42, 80, 101, 42, 120, -341,
-341, 102, 171, 546, 467, -341, 42, 102, 467, -341,
467, 435, 42, -341, -341, -341, 78, 180, 144, -341,
-341, -341, -341, -341, -341, -341, -341, -341, -341, 242,
127, 42, -341, 42, 176, -341, -341, -341, -341, -341,
216, 144, -341, -341, -341, -341, 221, 179, 191, 388,
423, 221, 221, 221, 221, 205, 82, 62, 135, 235,
-341, 257, -341, 28, 177, -341, 233, -341, 435, -341,
144, 25, 45, 467, 556, -341, 435, 274, 467, 42,
467, 467, -341, -341, 46, -341, 229, 42, -341, 42,
60, -341, 280, -341, 42, 42, 467, 244, -341, -341,
-22, 62, 62, -341, -341, 46, 467, 467, 467, 467,
467, 467, 467, 221, 221, 221, 221, 221, 221, 221,
221, 221, 221, 221, 221, 467, -341, -341, 467, -341,
144, 301, 435, 42, 314, -341, -341, -341, -341, -341,
195, 77, 201, 201, -341, 272, -341, -341, 373, -341,
146, 42, -341, 42, 42, -341, 60, 273, 277, -341,
-341, -341, 253, -341, 279, 299, -341, 467, -341, 281,
-341, 175, -341, -341, -341, -341, -341, -341, -341, -341,
135, 135, 135, 235, 235, 235, 235, 235, 235, 235,
235, -341, 196, 333, 435, 297, 42, 332, -341, 45,
-341, -341, -341, -341, -341, -341, 284, 34, 147, 321,
42, 42, 294, -341, 291, -341, -341, 296, 373, -341,
298, 298, 295, -341, -341, -341, -341, 467, -341, 46,
46, 435, -341, -341, 347, -341, 467, 312, 435, 348,
435, 26, -341, 12, 204, -341, 349, 318, -341, 320,
373, 222, -341, -341, 46, 322, 65, 334, -341, -341,
33, 370, -341, -341, -341, 435, -341, -341, 373, 144,
-341, -341, -341, 129, -341, 42, 335, 373, -341, 147,
-341, -341, -341, -341, -341, 42, 219, -341, -341, 57,
-341, 42, -341, 338, -341, -341, -341, 467, -341, 435,
435, -341, 26, 331, 372, 42, -341, -341, 342, 259,
148, 40, 17, -341, 405, 351, -341, 144, -341, 373,
46, 383, -341, 148, 352, 409, -341, -341, -341, -341,
-341, -341, 354, -341, 358, -341, -341, -341, -341, 359,
-341, 263, -341, 46, -341, 42, 361, -341, -341, 46,
46, 360, -341, 364, 90, -341, 42, -341, -341, 147,
42, 42, 398, 363, 371, 366, -341, 148, 404, -341,
42, -341, 42, -341, -341
};
static const yytype_uint8 yydefact[] =
{
0, 0, 0, 0, 7, 12, 0, 0, 1, 0,
17, 0, 6, 0, 4, 0, 9, 0, 0, 11,
0, 22, 13, 0, 0, 8, 0, 21, 0, 19,
2, 0, 43, 15, 0, 27, 0, 0, 0, 10,
18, 0, 0, 0, 0, 93, 0, 0, 0, 107,
91, 0, 0, 104, 46, 167, 0, 0, 45, 76,
79, 83, 80, 84, 85, 86, 87, 88, 92, 94,
0, 23, 24, 0, 32, 5, 14, 3, 20, 44,
0, 45, 209, 211, 210, 212, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 127, 137, 140, 144,
153, 155, 156, 0, 0, 82, 0, 111, 0, 90,
45, 0, 120, 0, 0, 42, 46, 0, 0, 0,
0, 0, 170, 81, 0, 25, 0, 28, 29, 0,
37, 97, 0, 159, 0, 0, 0, 0, 158, 135,
0, 138, 139, 160, 161, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 113, 112, 0, 99,
45, 123, 0, 0, 0, 78, 77, 41, 98, 169,
0, 0, 0, 0, 208, 0, 204, 207, 0, 30,
0, 33, 34, 0, 0, 16, 38, 0, 0, 49,
50, 96, 0, 171, 0, 0, 162, 0, 157, 114,
115, 0, 118, 134, 129, 132, 133, 128, 130, 131,
143, 141, 142, 149, 147, 148, 151, 152, 150, 145,
146, 154, 0, 0, 0, 0, 0, 125, 89, 121,
105, 95, 168, 205, 206, 26, 0, 0, 185, 0,
0, 0, 171, 175, 0, 172, 173, 0, 0, 35,
57, 57, 0, 39, 47, 165, 164, 0, 136, 0,
0, 0, 163, 109, 101, 100, 0, 0, 0, 0,
0, 0, 174, 0, 0, 195, 0, 186, 192, 190,
0, 0, 181, 31, 0, 0, 0, 0, 55, 40,
17, 0, 116, 119, 117, 0, 102, 108, 0, 45,
122, 106, 184, 0, 182, 0, 0, 0, 179, 187,
191, 180, 176, 177, 36, 0, 0, 67, 68, 0,
63, 0, 53, 0, 51, 48, 52, 0, 110, 0,
0, 126, 0, 0, 0, 0, 194, 193, 188, 0,
0, 60, 0, 56, 0, 0, 103, 45, 183, 0,
0, 0, 189, 0, 0, 0, 65, 70, 69, 61,
62, 58, 0, 64, 0, 166, 124, 178, 197, 198,
199, 0, 202, 0, 66, 0, 0, 59, 54, 0,
0, 0, 196, 0, 0, 73, 0, 200, 203, 185,
0, 0, 0, 0, 0, 0, 74, 0, 0, 201,
0, 72, 0, 75, 71
};
static const yytype_int16 yypgoto[] =
{
-341, -341, -341, -341, -341, -341, -1, -2, 140, -341,
-341, -341, 128, -341, -341, 377, -341, -341, 315, -341,
-341, 252, -341, -341, -341, -54, 254, -341, -125, -341,
-341, -268, -262, 188, -341, -341, 106, -340, -341, -341,
-238, -27, -109, 350, -341, -341, 417, -341, -341, -341,
-341, -341, -341, -341, -341, -341, -341, -341, -111, -341,
-341, -341, 199, -341, -341, -341, -341, -341, -31, -55,
356, 131, 19, 212, -72, -5, -129, -255, -263, 227,
-341, 136, 70, -341, 158, 160, 97, -341, 92, -341,
7, 81, -50
};
static const yytype_int16 yydefgoto[] =
{
-1, 3, 4, 10, 15, 18, 55, 284, 19, 20,
21, 28, 56, 35, 71, 72, 74, 127, 128, 130,
191, 192, 195, 196, 33, 57, 197, 300, 285, 335,
336, 199, 200, 297, 371, 329, 330, 366, 367, 394,
395, 58, 59, 60, 123, 61, 62, 63, 234, 275,
339, 64, 113, 280, 65, 108, 66, 305, 106, 168,
67, 209, 210, 211, 111, 68, 237, 279, 139, 140,
96, 97, 98, 99, 100, 101, 253, 254, 255, 256,
313, 314, 286, 287, 288, 289, 378, 379, 380, 381,
257, 186, 102
};
static const yytype_int16 yytable[] =
{
6, 7, 174, 295, 117, 198, 204, 176, 16, 23,
22, 24, 22, 95, 133, 5, 81, 107, 312, 109,
5, 143, 144, 384, 110, 39, 69, 132, 327, 5,
82, 83, 84, 70, 328, 321, 76, 8, 69, 172,
193, 104, 246, 166, 207, 5, 69, 112, 208, 5,
82, 83, 84, 340, 194, 332, 171, 85, 137, 369,
17, 333, 346, 238, 9, 180, 181, 411, 5, 325,
70, 198, 126, 248, 187, 249, 167, 85, 372, 312,
315, 170, 107, 193, 327, 370, 1, 178, 193, 250,
328, 173, 231, 31, 2, 187, 153, 194, 17, 182,
183, 32, 194, 69, 377, 205, 27, 119, 146, 69,
232, 69, 30, 251, 121, 34, 235, 325, 179, 182,
183, 351, 352, 184, 122, 274, 126, 190, 22, 202,
73, 185, 187, 187, 203, 154, 155, 233, 187, 147,
148, 149, 156, 207, 184, 29, 114, 242, 157, 150,
5, 5, 212, 151, 152, 401, 364, 283, 403, 11,
402, 12, 304, 406, 158, 307, 75, 69, 239, 78,
193, 311, 220, 221, 222, 105, 268, 159, 160, 25,
26, 184, 184, 365, 194, 77, 344, 252, 79, 190,
22, 161, 260, 261, 124, 342, 338, 115, 36, 343,
37, 13, 353, 14, 5, 82, 83, 84, 187, 116,
162, 163, 37, 38, 258, 37, 361, 40, 41, 187,
187, 368, 141, 142, 5, 82, 83, 84, 129, 69,
356, 187, 85, 131, 368, 277, 301, 118, 145, 119,
187, 270, 134, 271, 187, 107, 121, 22, 291, 22,
292, 309, 85, 86, 135, 341, 122, 252, 187, 241,
272, 207, 207, 243, 244, 87, 69, 187, 184, 184,
37, 164, 317, 69, 88, 69, 212, 303, 368, 169,
252, 413, 316, 414, 89, 37, 322, 350, 37, 252,
90, 177, 187, 184, 326, 22, 188, 201, 93, 94,
69, 323, 118, 376, 119, 120, 355, 252, 206, 187,
187, 121, 236, 357, 203, 119, 252, 265, 22, 119,
165, 122, 121, 349, 22, 37, 121, 363, 240, 390,
203, 391, 122, 187, 69, 69, 122, 245, 263, 187,
187, 252, 264, 266, 203, 267, 269, 273, 276, 203,
326, 22, 278, 281, 290, -208, 293, 294, 252, 184,
299, 296, 203, 306, 359, 310, 318, 382, 223, 224,
225, 226, 227, 228, 229, 230, 5, 82, 83, 84,
308, 246, 184, 319, 393, 320, 337, 324, 184, 184,
382, 5, 82, 83, 84, 393, 382, 398, 22, 405,
393, 354, 331, 345, 85, 360, 203, 362, 247, 203,
374, 203, 248, 136, 249, 375, 383, 386, 387, 85,
86, 385, 388, 399, 389, 400, 5, 82, 83, 84,
396, 407, 87, 408, 410, 409, 250, 412, 5, 27,
334, 88, 189, 259, 43, 44, 182, 183, 125, 298,
262, 89, 251, 45, 85, 86, 46, 90, 373, 47,
48, 91, 92, 103, 175, 93, 94, 87, 302, 404,
5, 82, 83, 84, 282, 49, 88, 347, 358, 348,
392, 397, 50, 0, 51, 0, 89, 0, 0, 52,
53, 0, 90, 138, 0, 0, 91, 92, 85, 86,
93, 94, 213, 214, 215, 216, 217, 218, 219, 0,
0, 87, 0, 0, 0, 42, 0, 5, 27, 0,
88, 0, 0, 43, 44, 0, 0, 0, 0, 0,
89, -45, 45, 0, 0, 46, 90, 0, 47, 48,
91, 92, 0, 0, 93, 94, 0, 80, 0, 5,
27, 0, 0, 0, 49, 43, 44, 0, 0, 5,
0, 50, 0, 51, 45, 43, 44, 46, 52, 53,
47, 48, 0, 0, 45, 0, 0, 46, 0, 54,
47, 48, 0, 0, 0, 0, 49, 0, 0, 0,
0, 0, 0, 50, 0, 51, 49, 0, 0, 0,
52, 53, 0, 50, 0, 51, 0, 0, 0, 0,
52, 53
};
static const yytype_int16 yycheck[] =
{
1, 2, 113, 258, 58, 130, 135, 116, 9, 11,
11, 13, 13, 44, 86, 3, 43, 48, 281, 50,
3, 93, 94, 363, 51, 26, 31, 81, 296, 3,
4, 5, 6, 34, 296, 290, 37, 0, 43, 14,
23, 46, 8, 15, 66, 3, 51, 52, 70, 3,
4, 5, 6, 308, 37, 22, 110, 31, 89, 19,
27, 28, 317, 172, 28, 120, 121, 407, 3, 52,
71, 196, 73, 39, 124, 41, 48, 31, 61, 342,
68, 108, 113, 23, 352, 45, 30, 118, 23, 63,
352, 66, 164, 9, 38, 145, 34, 37, 27, 73,
74, 17, 37, 108, 359, 136, 4, 62, 26, 114,
165, 116, 62, 79, 69, 12, 170, 52, 119, 73,
74, 64, 65, 124, 79, 234, 127, 129, 129, 134,
50, 124, 182, 183, 135, 73, 74, 168, 188, 57,
58, 59, 7, 66, 145, 17, 68, 70, 13, 67,
3, 3, 145, 71, 72, 65, 8, 10, 396, 63,
70, 65, 271, 401, 29, 276, 65, 172, 173, 41,
23, 280, 153, 154, 155, 47, 207, 42, 43, 65,
66, 182, 183, 35, 37, 65, 315, 188, 17, 191,
191, 56, 193, 194, 67, 66, 305, 17, 64, 70,
66, 63, 331, 65, 3, 4, 5, 6, 258, 65,
75, 76, 66, 64, 68, 66, 345, 65, 66, 269,
270, 350, 91, 92, 3, 4, 5, 6, 52, 234,
339, 281, 31, 17, 363, 236, 267, 60, 33, 62,
290, 66, 63, 68, 294, 276, 69, 248, 250, 250,
251, 278, 31, 32, 63, 309, 79, 258, 308, 64,
64, 66, 66, 182, 183, 44, 271, 317, 269, 270,
66, 36, 68, 278, 53, 280, 269, 270, 407, 46,
281, 410, 283, 412, 63, 66, 64, 68, 66, 290,
69, 17, 342, 294, 296, 296, 67, 17, 77, 78,
305, 294, 60, 357, 62, 63, 337, 308, 64, 359,
360, 69, 11, 340, 315, 62, 317, 64, 319, 62,
63, 79, 69, 325, 325, 66, 69, 68, 14, 66,
331, 68, 79, 383, 339, 340, 79, 65, 65, 389,
390, 342, 65, 64, 345, 46, 65, 14, 51, 350,
352, 352, 20, 69, 33, 61, 65, 61, 359, 360,
65, 63, 363, 16, 33, 17, 17, 360, 156, 157,
158, 159, 160, 161, 162, 163, 3, 4, 5, 6,
68, 8, 383, 65, 385, 65, 16, 65, 389, 390,
383, 3, 4, 5, 6, 396, 389, 390, 399, 400,
401, 63, 68, 68, 31, 33, 407, 65, 35, 410,
5, 412, 39, 25, 41, 64, 33, 8, 64, 31,
32, 69, 64, 63, 65, 61, 3, 4, 5, 6,
69, 33, 44, 70, 68, 64, 63, 33, 3, 4,
300, 53, 127, 191, 9, 10, 73, 74, 71, 261,
196, 63, 79, 18, 31, 32, 21, 69, 352, 24,
25, 73, 74, 46, 114, 77, 78, 44, 269, 399,
3, 4, 5, 6, 247, 40, 53, 319, 342, 319,
383, 389, 47, -1, 49, -1, 63, -1, -1, 54,
55, -1, 69, 70, -1, -1, 73, 74, 31, 32,
77, 78, 146, 147, 148, 149, 150, 151, 152, -1,
-1, 44, -1, -1, -1, 1, -1, 3, 4, -1,
53, -1, -1, 9, 10, -1, -1, -1, -1, -1,
63, 17, 18, -1, -1, 21, 69, -1, 24, 25,
73, 74, -1, -1, 77, 78, -1, 1, -1, 3,
4, -1, -1, -1, 40, 9, 10, -1, -1, 3,
-1, 47, -1, 49, 18, 9, 10, 21, 54, 55,
24, 25, -1, -1, 18, -1, -1, 21, -1, 65,
24, 25, -1, -1, -1, -1, 40, -1, -1, -1,
-1, -1, -1, 47, -1, 49, 40, -1, -1, -1,
54, 55, -1, 47, -1, 49, -1, -1, -1, -1,
54, 55
};
static const yytype_uint8 yystos[] =
{
0, 30, 38, 81, 82, 3, 86, 86, 0, 28,
83, 63, 65, 63, 65, 84, 86, 27, 85, 88,
89, 90, 86, 87, 87, 65, 66, 4, 91, 92,
62, 9, 17, 104, 12, 93, 64, 66, 64, 86,
65, 66, 1, 9, 10, 18, 21, 24, 25, 40,
47, 49, 54, 55, 65, 86, 92, 105, 121, 122,
123, 125, 126, 127, 131, 134, 136, 140, 145, 155,
86, 94, 95, 50, 96, 65, 86, 65, 92, 17,
1, 121, 4, 5, 6, 31, 32, 44, 53, 63,
69, 73, 74, 77, 78, 148, 150, 151, 152, 153,
154, 155, 172, 126, 155, 92, 138, 148, 135, 148,
121, 144, 155, 132, 68, 17, 65, 105, 60, 62,
63, 69, 79, 124, 67, 95, 86, 97, 98, 52,
99, 17, 105, 154, 63, 63, 25, 148, 70, 148,
149, 151, 151, 154, 154, 33, 26, 57, 58, 59,
67, 71, 72, 34, 73, 74, 7, 13, 29, 42,
43, 56, 75, 76, 36, 63, 15, 48, 139, 46,
121, 105, 14, 66, 138, 123, 122, 17, 148, 86,
149, 149, 73, 74, 86, 170, 171, 172, 67, 98,
87, 100, 101, 23, 37, 102, 103, 106, 108, 111,
112, 17, 155, 86, 156, 148, 64, 66, 70, 141,
142, 143, 170, 150, 150, 150, 150, 150, 150, 150,
152, 152, 152, 153, 153, 153, 153, 153, 153, 153,
153, 154, 149, 148, 128, 105, 11, 146, 122, 155,
14, 64, 70, 171, 171, 65, 8, 35, 39, 41,
63, 79, 86, 156, 157, 158, 159, 170, 68, 101,
86, 86, 106, 65, 65, 64, 64, 46, 148, 65,
66, 68, 64, 14, 122, 129, 51, 86, 20, 147,
133, 69, 159, 10, 87, 108, 162, 163, 164, 165,
33, 87, 86, 65, 61, 157, 63, 113, 113, 65,
107, 148, 142, 170, 122, 137, 16, 138, 68, 121,
17, 122, 158, 160, 161, 68, 86, 68, 17, 65,
65, 157, 64, 170, 65, 52, 87, 111, 112, 115,
116, 68, 22, 28, 88, 109, 110, 16, 122, 130,
157, 105, 66, 70, 156, 68, 157, 164, 165, 87,
68, 64, 65, 156, 63, 148, 122, 121, 161, 33,
33, 156, 65, 68, 8, 35, 117, 118, 156, 19,
45, 114, 61, 116, 5, 64, 105, 157, 166, 167,
168, 169, 170, 33, 117, 69, 8, 64, 64, 65,
66, 68, 166, 86, 119, 120, 69, 168, 170, 63,
61, 65, 70, 120, 162, 86, 120, 33, 70, 64,
68, 117, 33, 156, 156
};
static const yytype_uint8 yyr1[] =
{
0, 80, 81, 82, 82, 82, 82, 83, 83, 84,
84, 85, 86, 87, 87, 88, 89, 90, 90, 91,
91, 92, 93, 93, 94, 94, 95, 96, 96, 97,
97, 98, 99, 99, 100, 100, 101, 102, 102, 103,
103, 104, 104, 104, 104, 105, 105, 107, 106, 108,
108, 109, 109, 110, 110, 111, 112, 113, 113, 113,
114, 114, 114, 115, 115, 116, 116, 116, 116, 117,
117, 118, 118, 119, 119, 120, 121, 121, 122, 122,
123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
123, 123, 123, 123, 124, 124, 125, 125, 126, 128,
127, 129, 130, 129, 132, 133, 131, 135, 134, 137,
136, 138, 139, 139, 140, 141, 141, 142, 143, 143,
144, 144, 145, 146, 146, 147, 147, 148, 148, 148,
148, 148, 148, 148, 148, 149, 149, 150, 150, 150,
151, 151, 151, 151, 152, 152, 152, 152, 152, 152,
152, 152, 152, 153, 153, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 155, 155, 155,
155, 156, 157, 157, 157, 158, 158, 158, 159, 159,
159, 159, 160, 160, 161, 162, 162, 162, 162, 162,
162, 162, 163, 163, 164, 164, 165, 165, 166, 167,
167, 168, 169, 169, 170, 170, 170, 171, 171, 172,
172, 172, 172
};
static const yytype_uint8 yyr2[] =
{
0, 2, 4, 6, 3, 6, 3, 0, 3, 1,
3, 1, 1, 1, 3, 2, 5, 0, 3, 1,
3, 1, 0, 2, 1, 2, 4, 0, 2, 1,
2, 4, 0, 2, 1, 2, 4, 0, 1, 2,
3, 4, 3, 1, 3, 0, 1, 0, 4, 1,
1, 1, 1, 1, 4, 3, 5, 0, 4, 5,
0, 1, 1, 1, 3, 3, 4, 1, 1, 1,
1, 7, 6, 1, 3, 5, 1, 3, 3, 1,
1, 2, 2, 1, 1, 1, 1, 1, 1, 4,
2, 1, 1, 1, 0, 3, 4, 3, 3, 0,
5, 1, 0, 4, 0, 0, 6, 0, 6, 0,
7, 1, 1, 1, 4, 1, 3, 3, 1, 3,
1, 3, 6, 0, 6, 0, 3, 1, 3, 3,
3, 3, 3, 3, 3, 1, 3, 1, 2, 2,
1, 3, 3, 3, 1, 3, 3, 3, 3, 3,
3, 3, 3, 1, 3, 1, 1, 3, 2, 2,
2, 2, 3, 4, 4, 4, 8, 1, 4, 3,
2, 1, 1, 1, 2, 1, 3, 3, 6, 3,
3, 2, 1, 3, 1, 0, 1, 2, 3, 4,
1, 2, 1, 3, 3, 1, 6, 5, 1, 1,
3, 5, 1, 3, 1, 2, 2, 1, 1, 1,
1, 1, 1
};
#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 (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#if YYDEBUG
# ifndef YYFPRINTF
# include <stdio.h>
# define YYFPRINTF fprintf
# endif
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
YYFPRINTF Args; \
} while (0)
#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)
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);
}
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, ")");
}
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *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)
static void
yy_reduce_print (yytype_int16 *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);
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)
int yydebug;
#else
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
#if YYERROR_VERBOSE
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
# define yystrlen strlen
# else
static YYSIZE_T
yystrlen (const char *yystr)
{
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
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
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;
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
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
const char *yyformat = YY_NULLPTR;
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
int yycount = 0;
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
int yyxbegin = yyn < 0 ? -yyn : 0;
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];
{
YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, 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_
}
{
YYSIZE_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;
}
{
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
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
{
YYUSE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
YYUSE (yytype);
YY_IGNORE_MAYBE_UNINITIALIZED_END
}
int yychar;
YYSTYPE yylval;
int yynerrs;
int
yyparse (void)
{
int yystate;
int yyerrstatus;
yytype_int16 yyssa[YYINITDEPTH];
yytype_int16 *yyss;
yytype_int16 *yyssp;
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
YYSIZE_T yystacksize;
int yyn;
int yyresult;
int yytoken = 0;
YYSTYPE yyval;
#if YYERROR_VERBOSE
char yymsgbuf[128];
char *yymsg = yymsgbuf;
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
int yylen = 0;
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY;
goto yysetstate;
yynewstate:
yyssp++;
yysetstate:
*yyssp = yystate;
if (yyss + yystacksize - 1 <= yyssp)
{
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
}
#else
# ifndef YYSTACK_RELOCATE
goto yyexhaustedlab;
# else
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
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:
yyn = yypact[yystate];
if (yypact_value_is_default (yyn))
goto yydefault;
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);
}
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;
}
if (yyerrstatus)
yyerrstatus--;
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
yychar = YYEMPTY;
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
goto yyreduce;
yyreduce:
yylen = yyr2[yyn];
yyval = yyvsp[1-yylen];
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 3:
#line 964 "dpas-parser.y"
{
jit_free((yyvsp[-4].name));
identifier_list_free((yyvsp[-2].id_list).list, (yyvsp[-2].id_list).len);
}
#line 2533 "dpas-parser.c"
break;
case 4:
#line 968 "dpas-parser.y"
{
jit_free((yyvsp[-1].name));
}
#line 2541 "dpas-parser.c"
break;
case 5:
#line 971 "dpas-parser.y"
{
jit_free((yyvsp[-4].name));
identifier_list_free((yyvsp[-2].id_list).list, (yyvsp[-2].id_list).len);
}
#line 2553 "dpas-parser.c"
break;
case 6:
#line 978 "dpas-parser.y"
{
jit_free((yyvsp[-1].name));
}
#line 2561 "dpas-parser.c"
break;
case 9:
#line 989 "dpas-parser.y"
{
dpas_import((yyvsp[0].name));
jit_free((yyvsp[0].name));
}
#line 2570 "dpas-parser.c"
break;
case 10:
#line 993 "dpas-parser.y"
{
dpas_import((yyvsp[0].name));
jit_free((yyvsp[0].name));
}
#line 2579 "dpas-parser.c"
break;
case 11:
#line 1000 "dpas-parser.y"
{
jit_function_t func = dpas_current_function();
if(!jit_insn_default_return(func))
{
dpas_out_of_memory();
}
if(dpas_dump_functions)
{
jit_dump_function(stdout, func, "main");
}
if(!jit_function_compile(func))
{
dpas_out_of_memory();
}
if(dpas_dump_functions > 1)
{
jit_dump_function(stdout, func, "main");
}
dpas_add_main_function(func);
dpas_pop_function();
}
#line 2618 "dpas-parser.c"
break;
case 12:
#line 1041 "dpas-parser.y"
{ (yyval.name) = (yyvsp[0].name); }
#line 2624 "dpas-parser.c"
break;
case 13:
#line 1045 "dpas-parser.y"
{
(yyval.id_list).list = 0;
(yyval.id_list).len = 0;
identifier_list_add(&((yyval.id_list).list), &((yyval.id_list).len), (yyvsp[0].name));
}
#line 2634 "dpas-parser.c"
break;
case 14:
#line 1050 "dpas-parser.y"
{
(yyval.id_list) = (yyvsp[-2].id_list);
if(identifier_list_contains((yyval.id_list).list, (yyval.id_list).len, (yyvsp[0].name)))
{
dpas_error("`%s' declared twice in an identifier list", (yyvsp[0].name));
identifier_list_add(&((yyval.id_list).list), &((yyval.id_list).len), 0);
jit_free((yyvsp[0].name));
}
else
{
identifier_list_add(&((yyval.id_list).list), &((yyval.id_list).len), (yyvsp[0].name));
}
}
#line 2652 "dpas-parser.c"
break;
case 21:
#line 1089 "dpas-parser.y"
{ }
#line 2658 "dpas-parser.c"
break;
case 26:
#line 1103 "dpas-parser.y"
{
dpas_scope_item_t item;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[-3].name), 0);
if(item)
{
dpas_redeclared((yyvsp[-3].name), item);
}
else
{
dpas_scope_add_const(dpas_scope_current(), (yyvsp[-3].name), &((yyvsp[-1].const_value)),
dpas_filename, dpas_linenum);
}
jit_free((yyvsp[-3].name));
jit_type_free((yyvsp[-1].const_value).type);
}
#line 2678 "dpas-parser.c"
break;
case 28:
#line 1122 "dpas-parser.y"
{
dpas_scope_check_undefined(dpas_scope_current());
}
#line 2688 "dpas-parser.c"
break;
case 31:
#line 1135 "dpas-parser.y"
{
dpas_scope_item_t item;
jit_type_t type;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[-3].name), 0);
type = (item ? dpas_scope_item_type(item) : 0);
if(!item)
{
dpas_type_set_name((yyvsp[-1].type), (yyvsp[-3].name));
dpas_scope_add(dpas_scope_current(), (yyvsp[-3].name), (yyvsp[-1].type),
DPAS_ITEM_TYPE, 0, 0,
dpas_filename, dpas_linenum);
}
else if(dpas_scope_item_kind(item) == DPAS_ITEM_TYPE &&
jit_type_get_tagged_kind(type) == DPAS_TAG_NAME &&
jit_type_get_tagged_type(type) == 0 &&
jit_type_get_tagged_kind((yyvsp[-1].type)) == DPAS_TAG_NAME)
{
jit_type_set_tagged_type
(type, jit_type_get_tagged_type((yyvsp[-1].type)), 1);
}
else
{
dpas_redeclared((yyvsp[-3].name), item);
}
jit_free((yyvsp[-3].name));
jit_type_free((yyvsp[-1].type));
}
#line 2724 "dpas-parser.c"
break;
case 36:
#line 1179 "dpas-parser.y"
{
int posn;
dpas_scope_item_t item;
for(posn = 0; posn < (yyvsp[-3].id_list).len; ++posn)
{
item = dpas_scope_lookup(dpas_scope_current(),
(yyvsp[-3].id_list).list[posn], 0);
if(item)
{
dpas_redeclared((yyvsp[-3].id_list).list[posn], item);
}
else
{
if(!dpas_scope_is_module())
{
jit_value_t value;
value = jit_value_create
(dpas_current_function(), (yyvsp[-1].type));
if(!value)
{
dpas_out_of_memory();
}
dpas_scope_add(dpas_scope_current(),
(yyvsp[-3].id_list).list[posn], (yyvsp[-1].type),
DPAS_ITEM_VARIABLE, value, 0,
dpas_filename, dpas_linenum);
}
else
{
void *space = jit_calloc(1, jit_type_get_size((yyvsp[-1].type)));
if(!space)
{
dpas_out_of_memory();
}
dpas_scope_add(dpas_scope_current(),
(yyvsp[-3].id_list).list[posn], (yyvsp[-1].type),
DPAS_ITEM_GLOBAL_VARIABLE, space, 0,
dpas_filename, dpas_linenum);
}
}
}
identifier_list_free((yyvsp[-3].id_list).list, (yyvsp[-3].id_list).len);
jit_type_free((yyvsp[-1].type));
}
#line 2777 "dpas-parser.c"
break;
case 47:
#line 1256 "dpas-parser.y"
{
unsigned int num_params;
unsigned int param;
jit_type_t type;
const char *name;
dpas_scope_item_t item;
jit_function_t func;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[-1].procedure).name, 0);
if(item)
{
dpas_redeclared((yyvsp[-1].procedure).name, item);
item = 0;
}
else
{
dpas_scope_add(dpas_scope_current(), (yyvsp[-1].procedure).name, (yyvsp[-1].procedure).type,
DPAS_ITEM_PROCEDURE, 0, 0,
dpas_filename, dpas_linenum);
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[-1].procedure).name, 0);
}
dpas_scope_push();
func = dpas_new_function((yyvsp[-1].procedure).type);
if(item)
{
dpas_scope_item_set_info(item, func);
}
num_params = jit_type_num_params((yyvsp[-1].procedure).type);
for(param = 0; param < num_params; ++param)
{
name = jit_type_get_name((yyvsp[-1].procedure).type, param);
if(name)
{
jit_value_t value;
value = jit_value_get_param(func, param);
if(!value)
{
dpas_out_of_memory();
}
dpas_scope_add(dpas_scope_current(), name,
jit_type_get_param((yyvsp[-1].procedure).type, param),
DPAS_ITEM_VARIABLE, value, 0,
dpas_filename, dpas_linenum);
}
}
type = jit_type_get_return((yyvsp[-1].procedure).type);
if(type != jit_type_void)
{
if(dpas_scope_lookup(dpas_scope_current(), (yyvsp[-1].procedure).name, 0))
{
dpas_error("`%s' is declared as both a parameter "
"and a function name", (yyvsp[-1].procedure).name);
}
}
}
#line 2846 "dpas-parser.c"
break;
case 48:
#line 1319 "dpas-parser.y"
{
jit_function_t func = dpas_current_function();
int result;
result = jit_insn_default_return(func);
if(!result)
{
dpas_out_of_memory();
}
else if(result == 1 &&
jit_type_get_return((yyvsp[-3].procedure).type) != jit_type_void)
{
dpas_error("control reached the end of a function");
}
dpas_pop_function();
dpas_scope_pop();
if(dpas_dump_functions)
{
jit_dump_function(stdout, func, (yyvsp[-3].procedure).name);
}
if(!jit_function_compile(func))
{
dpas_out_of_memory();
}
if(dpas_dump_functions > 1)
{
jit_dump_function(stdout, func, (yyvsp[-3].procedure).name);
}
jit_free((yyvsp[-3].procedure).name);
jit_type_free((yyvsp[-3].procedure).type);
}
#line 2893 "dpas-parser.c"
break;
case 49:
#line 1364 "dpas-parser.y"
{ (yyval.procedure) = (yyvsp[0].procedure); }
#line 2899 "dpas-parser.c"
break;
case 50:
#line 1365 "dpas-parser.y"
{ (yyval.procedure) = (yyvsp[0].procedure); }
#line 2905 "dpas-parser.c"
break;
case 51:
#line 1369 "dpas-parser.y"
{}
#line 2911 "dpas-parser.c"
break;
case 52:
#line 1370 "dpas-parser.y"
{}
#line 2917 "dpas-parser.c"
break;
case 53:
#line 1374 "dpas-parser.y"
{ (yyval.name) = 0; }
#line 2923 "dpas-parser.c"
break;
case 54:
#line 1375 "dpas-parser.y"
{ (yyval.name) = (yyvsp[-1].name); }
#line 2929 "dpas-parser.c"
break;
case 55:
#line 1379 "dpas-parser.y"
{
(yyval.procedure).name = (yyvsp[-1].name);
(yyval.procedure).type = jit_type_create_signature
((yyvsp[0].parameters).abi, jit_type_void,
(yyvsp[0].parameters).types, (unsigned int)((yyvsp[0].parameters).len), 1);
if(!((yyval.procedure).type))
{
dpas_out_of_memory();
}
if(!jit_type_set_names((yyval.procedure).type, (yyvsp[0].parameters).names,
(unsigned int)((yyvsp[0].parameters).len)))
{
dpas_out_of_memory();
}
parameter_list_free(&((yyvsp[0].parameters)));
}
#line 2950 "dpas-parser.c"
break;
case 56:
#line 1398 "dpas-parser.y"
{
(yyval.procedure).name = (yyvsp[-3].name);
(yyval.procedure).type = jit_type_create_signature
((yyvsp[-2].parameters).abi, (yyvsp[0].type), (yyvsp[-2].parameters).types, (unsigned int)((yyvsp[-2].parameters).len), 1);
if(!((yyval.procedure).type))
{
dpas_out_of_memory();
}
if(!jit_type_set_names((yyval.procedure).type, (yyvsp[-2].parameters).names,
(unsigned int)((yyvsp[-2].parameters).len)))
{
dpas_out_of_memory();
}
parameter_list_free(&((yyvsp[-2].parameters)));
jit_type_free((yyvsp[0].type));
}
#line 2971 "dpas-parser.c"
break;
case 57:
#line 1417 "dpas-parser.y"
{ parameter_list_init(&((yyval.parameters))); }
#line 2977 "dpas-parser.c"
break;
case 58:
#line 1418 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-2].parameters);
(yyval.parameters).abi = (yyvsp[0].abi);
}
#line 2986 "dpas-parser.c"
break;
case 59:
#line 1422 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-3].parameters);
(yyval.parameters).abi = jit_abi_vararg;
}
#line 2995 "dpas-parser.c"
break;
case 60:
#line 1429 "dpas-parser.y"
{ (yyval.abi) = jit_abi_cdecl; }
#line 3001 "dpas-parser.c"
break;
case 61:
#line 1430 "dpas-parser.y"
{ (yyval.abi) = jit_abi_fastcall; }
#line 3007 "dpas-parser.c"
break;
case 62:
#line 1431 "dpas-parser.y"
{ (yyval.abi) = jit_abi_stdcall; }
#line 3013 "dpas-parser.c"
break;
case 63:
#line 1435 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[0].parameters); }
#line 3019 "dpas-parser.c"
break;
case 64:
#line 1436 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-2].parameters);
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].parameters)));
}
#line 3028 "dpas-parser.c"
break;
case 65:
#line 1443 "dpas-parser.y"
{
parameter_list_create(&((yyval.parameters)), (yyvsp[-2].id_list).list, (yyvsp[-2].id_list).len, (yyvsp[0].param_type).type);
if((yyvsp[0].param_type).bounds.len > 0)
{
dpas_warning("`%s' should be declared as `var'",
(yyvsp[-2].id_list).list[0]);
if((yyvsp[-2].id_list).len > 1)
{
dpas_error("too many parameter names for "
"conformant array specification");
}
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].param_type).bounds));
}
jit_type_free((yyvsp[0].param_type).type);
}
#line 3049 "dpas-parser.c"
break;
case 66:
#line 1459 "dpas-parser.y"
{
jit_type_t type = jit_type_create_pointer((yyvsp[0].param_type).type, 0);
if(!type)
{
dpas_out_of_memory();
}
if((yyvsp[0].param_type).bounds.len == 0)
{
type = jit_type_create_tagged(type, DPAS_TAG_VAR, 0, 0, 0);
if(!type)
{
dpas_out_of_memory();
}
}
parameter_list_create(&((yyval.parameters)), (yyvsp[-2].id_list).list, (yyvsp[-2].id_list).len, type);
if((yyvsp[0].param_type).bounds.len > 0)
{
if((yyvsp[-2].id_list).len > 1)
{
dpas_error("too many parameter names for "
"conformant array specification");
}
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].param_type).bounds));
}
jit_type_free(type);
}
#line 3080 "dpas-parser.c"
break;
case 67:
#line 1485 "dpas-parser.y"
{
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), (yyvsp[0].procedure).name, (yyvsp[0].procedure).type);
}
#line 3089 "dpas-parser.c"
break;
case 68:
#line 1489 "dpas-parser.y"
{
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), (yyvsp[0].procedure).name, (yyvsp[0].procedure).type);
}
#line 3098 "dpas-parser.c"
break;
case 69:
#line 1496 "dpas-parser.y"
{
(yyval.param_type).type = (yyvsp[0].type);
parameter_list_init(&((yyval.param_type).bounds));
}
#line 3107 "dpas-parser.c"
break;
case 70:
#line 1500 "dpas-parser.y"
{ (yyval.param_type) = (yyvsp[0].param_type); }
#line 3113 "dpas-parser.c"
break;
case 71:
#line 1504 "dpas-parser.y"
{
(yyval.param_type).type = dpas_create_conformant_array((yyvsp[0].type), (yyvsp[-3].parameters).len, 1);
(yyval.param_type).bounds = (yyvsp[-3].parameters);
}
#line 3122 "dpas-parser.c"
break;
case 72:
#line 1508 "dpas-parser.y"
{
(yyval.param_type).type = dpas_create_conformant_array((yyvsp[0].param_type).type, (yyvsp[-3].parameters).len, 0);
(yyval.param_type).bounds = (yyvsp[-3].parameters);
parameter_list_merge(&((yyval.param_type).bounds), &((yyvsp[0].param_type).bounds));
}
#line 3132 "dpas-parser.c"
break;
case 73:
#line 1516 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[0].parameters); }
#line 3138 "dpas-parser.c"
break;
case 74:
#line 1517 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-2].parameters);
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].parameters)));
}
#line 3147 "dpas-parser.c"
break;
case 75:
#line 1524 "dpas-parser.y"
{
if((yyvsp[0].type) != jit_type_int)
{
char *name = dpas_type_name((yyvsp[0].type));
dpas_error("`%s' cannot be used for array bounds; "
"must be `Integer'", name);
jit_free(name);
}
jit_type_free((yyvsp[0].type));
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), (yyvsp[-4].name), jit_type_int);
if(jit_strcmp((yyvsp[-4].name), (yyvsp[-2].name)) != 0)
{
parameter_list_add(&((yyval.parameters)), (yyvsp[-2].name), jit_type_int);
}
else
{
dpas_error("`%s' used twice in a parameter or "
"field list", (yyvsp[-4].name));
parameter_list_add(&((yyval.parameters)), 0, jit_type_int);
jit_free((yyvsp[-2].name));
}
}
#line 3175 "dpas-parser.c"
break;
case 80:
#line 1564 "dpas-parser.y"
{ }
#line 3181 "dpas-parser.c"
break;
case 81:
#line 1565 "dpas-parser.y"
{
if(dpas_sem_is_builtin((yyvsp[-1].semvalue)))
{
dpas_expand_builtin
(dpas_sem_get_builtin((yyvsp[-1].semvalue)), (yyvsp[0].expr_list).exprs, (yyvsp[0].expr_list).len);
}
else if(dpas_sem_is_procedure((yyvsp[-1].semvalue)))
{
dpas_scope_item_t item = dpas_sem_get_procedure((yyvsp[-1].semvalue));
invoke_procedure
((jit_function_t)dpas_scope_item_info(item),
dpas_scope_item_name(item),
dpas_scope_item_type(item), 0, (yyvsp[0].expr_list).exprs, (yyvsp[0].expr_list).len);
}
else if(dpas_sem_is_rvalue((yyvsp[-1].semvalue)) &&
jit_type_is_signature(dpas_sem_get_type((yyvsp[-1].semvalue))))
{
invoke_procedure
(0, 0, dpas_sem_get_type((yyvsp[-1].semvalue)), dpas_sem_get_value((yyvsp[-1].semvalue)),
(yyvsp[0].expr_list).exprs, (yyvsp[0].expr_list).len);
}
else
{
if(!dpas_sem_is_error((yyvsp[-1].semvalue)))
{
dpas_error("invalid function or procedure name");
}
}
expression_list_free((yyvsp[0].expr_list).exprs, (yyvsp[0].expr_list).len);
}
#line 3220 "dpas-parser.c"
break;
case 82:
#line 1599 "dpas-parser.y"
{
dpas_error("`goto' statements not yet implemented");
}
#line 3229 "dpas-parser.c"
break;
case 89:
#line 1609 "dpas-parser.y"
{
dpas_error("`with' statements not yet implemented");
}
#line 3238 "dpas-parser.c"
break;
case 90:
#line 1613 "dpas-parser.y"
{
dpas_error("`throw' statements not yet implemented");
}
#line 3247 "dpas-parser.c"
break;
case 91:
#line 1617 "dpas-parser.y"
{
dpas_error("`throw' statements not yet implemented");
}
#line 3256 "dpas-parser.c"
break;
case 93:
#line 1622 "dpas-parser.y"
{
if(loop_stack_size > 0)
{
if(!jit_insn_branch
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].exit_label)))
{
dpas_out_of_memory();
}
}
else
{
dpas_error("`exit' used outside loop");
}
}
#line 3277 "dpas-parser.c"
break;
case 94:
#line 1641 "dpas-parser.y"
{ (yyval.expr_list).exprs = 0; (yyval.expr_list).len = 0; }
#line 3283 "dpas-parser.c"
break;
case 95:
#line 1642 "dpas-parser.y"
{ (yyval.expr_list) = (yyvsp[-1].expr_list); }
#line 3289 "dpas-parser.c"
break;
case 98:
#line 1651 "dpas-parser.y"
{
jit_type_t ltype;
jit_type_t rtype;
jit_value_t dest;
jit_value_t value;
if(dpas_sem_is_procedure((yyvsp[-2].semvalue)) &&
((jit_function_t)dpas_scope_item_info
(dpas_sem_get_procedure((yyvsp[-2].semvalue)))) ==
dpas_current_function())
{
dpas_sem_set_return
((yyvsp[-2].semvalue), jit_type_get_return(dpas_sem_get_type((yyvsp[-2].semvalue))));
}
if(!dpas_sem_is_lvalue((yyvsp[-2].semvalue)) && !dpas_sem_is_lvalue_ea((yyvsp[-2].semvalue)) &&
!dpas_sem_is_return((yyvsp[-2].semvalue)))
{
if(!dpas_sem_is_error((yyvsp[-2].semvalue)))
{
dpas_error("invalid l-value in assignment statement");
}
ltype = jit_type_void;
}
else
{
ltype = dpas_sem_get_type((yyvsp[-2].semvalue));
}
if(!dpas_sem_is_rvalue((yyvsp[0].semvalue)))
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("invalid r-value in assignment statement");
}
rtype = jit_type_void;
}
else
{
rtype = dpas_sem_get_type((yyvsp[0].semvalue));
}
value = dpas_sem_get_value((yyvsp[0].semvalue));
if(dpas_sem_is_return((yyvsp[-2].semvalue)) && rtype != jit_type_void)
{
if(dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
if(!jit_insn_return_ptr
(dpas_current_function(), value, ltype))
{
dpas_out_of_memory();
}
}
else
{
if(!jit_insn_return
(dpas_current_function(), value))
{
dpas_out_of_memory();
}
}
}
else if(dpas_sem_is_lvalue_ea((yyvsp[-2].semvalue)) && rtype != jit_type_void)
{
dest = dpas_sem_get_value((yyvsp[-2].semvalue));
if(dpas_type_is_record(ltype))
{
if(!dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
value = jit_insn_address_of
(dpas_current_function(), value);
if(!value)
{
dpas_out_of_memory();
}
}
if(!jit_insn_memcpy
(dpas_current_function(), dest, value,
jit_value_create_nint_constant
(dpas_current_function(), jit_type_nint,
(jit_nint)jit_type_get_size(rtype))))
{
dpas_out_of_memory();
}
}
else
{
if(dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
value = jit_insn_load_relative
(dpas_current_function(), value, 0, rtype);
if(!value)
{
dpas_out_of_memory();
}
}
if(!jit_insn_store_relative
(dpas_current_function(), dest, 0, value))
{
dpas_out_of_memory();
}
}
}
else if(dpas_sem_is_lvalue((yyvsp[-2].semvalue)) && rtype != jit_type_void)
{
dest = dpas_sem_get_value((yyvsp[-2].semvalue));
if(dpas_type_is_record(ltype))
{
if(!dpas_sem_is_lvalue_ea((yyvsp[-2].semvalue)))
{
dest = jit_insn_address_of
(dpas_current_function(), dest);
if(!dest)
{
dpas_out_of_memory();
}
}
if(!dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
value = jit_insn_address_of
(dpas_current_function(), value);
if(!value)
{
dpas_out_of_memory();
}
}
if(!jit_insn_memcpy
(dpas_current_function(), dest, value,
jit_value_create_nint_constant
(dpas_current_function(), jit_type_nint,
(jit_nint)jit_type_get_size(rtype))))
{
dpas_out_of_memory();
}
}
else
{
if(dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
value = jit_insn_load_relative
(dpas_current_function(), value, 0, rtype);
if(!value)
{
dpas_out_of_memory();
}
}
if(!jit_insn_store
(dpas_current_function(), dest, value))
{
dpas_out_of_memory();
}
}
}
(yyval.semvalue) = (yyvsp[-2].semvalue);
}
#line 3466 "dpas-parser.c"
break;
case 99:
#line 1826 "dpas-parser.y"
{
jit_label_t label = jit_label_undefined;
if(!jit_insn_branch_if_not
(dpas_current_function(),
dpas_sem_get_value((yyvsp[-1].semvalue)), &label))
{
dpas_out_of_memory();
}
push_if(label);
}
#line 3486 "dpas-parser.c"
break;
case 100:
#line 1840 "dpas-parser.y"
{
if(if_stack[if_stack_size - 1] != jit_label_undefined)
{
if(!jit_insn_label
(dpas_current_function(),
&(if_stack[if_stack_size - 1])))
{
dpas_out_of_memory();
}
}
--if_stack_size;
}
#line 3505 "dpas-parser.c"
break;
case 102:
#line 1858 "dpas-parser.y"
{
jit_label_t label = jit_label_undefined;
if(!jit_block_current_is_dead(dpas_current_function()))
{
if(!jit_insn_branch(dpas_current_function(), &label))
{
dpas_out_of_memory();
}
}
if(!jit_insn_label
(dpas_current_function(),
&(if_stack[if_stack_size - 1])))
{
dpas_out_of_memory();
}
if_stack[if_stack_size - 1] = label;
}
#line 3534 "dpas-parser.c"
break;
case 104:
#line 1885 "dpas-parser.y"
{
jit_label_t label = jit_label_undefined;
if(!jit_insn_branch(dpas_current_function(), &label))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label))
{
dpas_out_of_memory();
}
push_loop(label, jit_label_undefined, jit_label_undefined);
}
#line 3561 "dpas-parser.c"
break;
case 105:
#line 1906 "dpas-parser.y"
{
if(!dpas_sem_is_error((yyvsp[-1].semvalue)))
{
if(!jit_insn_branch_if
(dpas_current_function(),
dpas_sem_get_value((yyvsp[-1].semvalue)),
&(loop_stack[loop_stack_size - 1].top_label)))
{
dpas_out_of_memory();
}
}
if(!jit_insn_label
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].top_label)))
{
dpas_out_of_memory();
}
}
#line 3589 "dpas-parser.c"
break;
case 106:
#line 1928 "dpas-parser.y"
{
jit_insn_move_blocks_to_end
(dpas_current_function(),
loop_stack[loop_stack_size - 1].expr_label,
loop_stack[loop_stack_size - 1].top_label);
if(loop_stack[loop_stack_size - 1].exit_label
!= jit_label_undefined)
{
if(!jit_insn_label
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].exit_label)))
{
dpas_out_of_memory();
}
}
--loop_stack_size;
}
#line 3617 "dpas-parser.c"
break;
case 107:
#line 1954 "dpas-parser.y"
{
jit_label_t label = jit_label_undefined;
if(!jit_insn_label(dpas_current_function(), &label))
{
dpas_out_of_memory();
}
push_loop(jit_label_undefined, label, jit_label_undefined);
}
#line 3635 "dpas-parser.c"
break;
case 108:
#line 1966 "dpas-parser.y"
{
if(!jit_insn_branch_if_not
(dpas_current_function(),
dpas_sem_get_value((yyvsp[0].semvalue)),
&(loop_stack[loop_stack_size - 1].top_label)))
{
dpas_out_of_memory();
}
if(loop_stack[loop_stack_size - 1].exit_label
!= jit_label_undefined)
{
if(!jit_insn_label
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].exit_label)))
{
dpas_out_of_memory();
}
}
--loop_stack_size;
}
#line 3666 "dpas-parser.c"
break;
case 109:
#line 1995 "dpas-parser.y"
{
jit_type_t loop_type = jit_type_int;
jit_value_t end_value;
jit_label_t label = jit_label_undefined;
jit_label_t label2 = jit_label_undefined;
if(dpas_sem_is_lvalue((yyvsp[-3].semvalue)) || dpas_sem_is_lvalue_ea((yyvsp[-3].semvalue)))
{
loop_type = dpas_sem_get_type((yyvsp[-3].semvalue));
if(!dpas_type_is_integer(loop_type))
{
dpas_error("`for' variables must be integer");
loop_type = jit_type_int;
}
}
else if(!dpas_sem_is_error((yyvsp[-3].semvalue)))
{
dpas_error("invalid l-value in `for' statement");
}
(yyvsp[-1].semvalue) = dpas_lvalue_to_rvalue((yyvsp[-1].semvalue));
if(dpas_sem_is_rvalue((yyvsp[-1].semvalue)))
{
if(jit_value_is_constant(dpas_sem_get_value((yyvsp[-1].semvalue))))
{
end_value = dpas_sem_get_value((yyvsp[-1].semvalue));
}
else
{
end_value = jit_value_create
(dpas_current_function(), loop_type);
if(!end_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store
(dpas_current_function(), end_value,
dpas_sem_get_value((yyvsp[-1].semvalue))))
{
dpas_out_of_memory();
}
}
}
else
{
end_value = 0;
}
dpas_sem_set_rvalue((yyval.semvalue), loop_type, end_value);
if(!jit_insn_branch(dpas_current_function(), &label))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label2))
{
dpas_out_of_memory();
}
push_loop(label, label2, jit_label_undefined);
}
#line 3740 "dpas-parser.c"
break;
case 110:
#line 2063 "dpas-parser.y"
{
jit_value_t var_value;
jit_value_t var2_value;
jit_value_t test_value;
test_value = jit_value_create_nint_constant
(dpas_current_function(), jit_type_int, (jit_nint)((yyvsp[-4].direction)));
if(!test_value)
{
dpas_out_of_memory();
}
if(dpas_sem_is_lvalue((yyvsp[-5].semvalue)))
{
var_value = dpas_sem_get_value((yyvsp[-5].semvalue));
if(!jit_insn_store
(dpas_current_function(), var_value,
jit_insn_add
(dpas_current_function(),
var_value, test_value)))
{
dpas_out_of_memory();
}
}
else if(dpas_sem_is_lvalue_ea((yyvsp[-5].semvalue)))
{
var2_value = dpas_sem_get_value((yyvsp[-5].semvalue));
var_value = jit_insn_load_relative
(dpas_current_function(), var2_value, 0,
dpas_sem_get_type((yyvsp[-5].semvalue)));
var_value = jit_insn_add
(dpas_current_function(), var_value, test_value);
if(!var_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store_relative
(dpas_current_function(), var2_value, 0,
jit_insn_convert
(dpas_current_function(), var_value,
dpas_sem_get_type((yyvsp[-5].semvalue)), 0)))
{
dpas_out_of_memory();
}
}
else
{
var_value = 0;
}
if(!jit_insn_label
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].expr_label)))
{
dpas_out_of_memory();
}
if(dpas_sem_is_lvalue_ea((yyvsp[-5].semvalue)))
{
var_value = jit_insn_load_relative
(dpas_current_function(), dpas_sem_get_value((yyvsp[-5].semvalue)), 0,
dpas_sem_get_type((yyvsp[-5].semvalue)));
}
if(var_value)
{
if((yyvsp[-4].direction) < 0)
{
test_value = jit_insn_ge
(dpas_current_function(),
var_value, dpas_sem_get_value((yyvsp[-1].semvalue)));
}
else
{
test_value = jit_insn_le
(dpas_current_function(),
var_value, dpas_sem_get_value((yyvsp[-1].semvalue)));
}
if(!test_value)
{
dpas_out_of_memory();
}
if(!jit_insn_branch_if
(dpas_current_function(), test_value,
&(loop_stack[loop_stack_size - 1].top_label)))
{
dpas_out_of_memory();
}
}
if(loop_stack[loop_stack_size - 1].exit_label
!= jit_label_undefined)
{
if(!jit_insn_label
(dpas_current_function(),
&(loop_stack[loop_stack_size - 1].exit_label)))
{
dpas_out_of_memory();
}
}
--loop_stack_size;
}
#line 3855 "dpas-parser.c"
break;
case 111:
#line 2176 "dpas-parser.y"
{
(yyval.semvalue) = dpas_lvalue_to_rvalue((yyvsp[0].semvalue));
}
#line 3864 "dpas-parser.c"
break;
case 112:
#line 2183 "dpas-parser.y"
{ (yyval.direction) = 1; }
#line 3870 "dpas-parser.c"
break;
case 113:
#line 2184 "dpas-parser.y"
{ (yyval.direction) = -1; }
#line 3876 "dpas-parser.c"
break;
case 114:
#line 2188 "dpas-parser.y"
{
dpas_error("`case' statements not yet implemented");
}
#line 3885 "dpas-parser.c"
break;
case 118:
#line 2204 "dpas-parser.y"
{}
#line 3891 "dpas-parser.c"
break;
case 119:
#line 2205 "dpas-parser.y"
{}
#line 3897 "dpas-parser.c"
break;
case 120:
#line 2209 "dpas-parser.y"
{}
#line 3903 "dpas-parser.c"
break;
case 121:
#line 2210 "dpas-parser.y"
{}
#line 3909 "dpas-parser.c"
break;
case 122:
#line 2214 "dpas-parser.y"
{
dpas_error("`try' statements not yet implemented");
}
#line 3918 "dpas-parser.c"
break;
case 127:
#line 2235 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 3924 "dpas-parser.c"
break;
case 128:
#line 2236 "dpas-parser.y"
{
handle_compare_binary("=", jit_insn_eq, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3932 "dpas-parser.c"
break;
case 129:
#line 2239 "dpas-parser.y"
{
handle_compare_binary("<>", jit_insn_ne, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3940 "dpas-parser.c"
break;
case 130:
#line 2242 "dpas-parser.y"
{
handle_compare_binary("<", jit_insn_lt, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3948 "dpas-parser.c"
break;
case 131:
#line 2245 "dpas-parser.y"
{
handle_compare_binary(">", jit_insn_gt, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3956 "dpas-parser.c"
break;
case 132:
#line 2248 "dpas-parser.y"
{
handle_compare_binary("<=", jit_insn_le, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3964 "dpas-parser.c"
break;
case 133:
#line 2251 "dpas-parser.y"
{
handle_compare_binary(">=", jit_insn_ge, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 3972 "dpas-parser.c"
break;
case 134:
#line 2254 "dpas-parser.y"
{
}
#line 3980 "dpas-parser.c"
break;
case 135:
#line 2260 "dpas-parser.y"
{
(yyval.expr_list).exprs = 0;
(yyval.expr_list).len = 0;
expression_list_add(&((yyval.expr_list).exprs), &((yyval.expr_list).len), (yyvsp[0].semvalue));
}
#line 3990 "dpas-parser.c"
break;
case 136:
#line 2265 "dpas-parser.y"
{
(yyval.expr_list) = (yyvsp[-2].expr_list);
expression_list_add(&((yyval.expr_list).exprs), &((yyval.expr_list).len), (yyvsp[0].semvalue));
}
#line 3999 "dpas-parser.c"
break;
case 137:
#line 2272 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 4005 "dpas-parser.c"
break;
case 138:
#line 2273 "dpas-parser.y"
{
if(!dpas_sem_is_rvalue((yyvsp[0].semvalue)) ||
!dpas_type_is_numeric(dpas_sem_get_type((yyvsp[0].semvalue))))
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("invalid operand to unary `+'");
}
dpas_sem_set_error((yyval.semvalue));
}
else
{
(yyval.semvalue) = (yyvsp[0].semvalue);
}
}
#line 4025 "dpas-parser.c"
break;
case 139:
#line 2288 "dpas-parser.y"
{
if(!dpas_sem_is_rvalue((yyvsp[0].semvalue)) ||
!dpas_type_is_numeric(dpas_sem_get_type((yyvsp[0].semvalue))))
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("invalid operand to unary `-'");
}
dpas_sem_set_error((yyval.semvalue));
}
else
{
jit_value_t value;
value = jit_insn_neg
(dpas_current_function(),
dpas_sem_get_value(dpas_lvalue_to_rvalue((yyvsp[0].semvalue))));
dpas_sem_set_rvalue((yyval.semvalue), jit_value_get_type(value), value);
}
}
#line 4049 "dpas-parser.c"
break;
case 140:
#line 2310 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 4055 "dpas-parser.c"
break;
case 141:
#line 2311 "dpas-parser.y"
{
handle_binary("+", jit_insn_add, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4063 "dpas-parser.c"
break;
case 142:
#line 2314 "dpas-parser.y"
{
handle_binary("-", jit_insn_sub, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4071 "dpas-parser.c"
break;
case 143:
#line 2317 "dpas-parser.y"
{
if(dpas_sem_is_rvalue((yyvsp[-2].semvalue)) &&
dpas_type_is_boolean(dpas_sem_get_type((yyvsp[-2].semvalue))) &&
dpas_sem_is_rvalue((yyvsp[0].semvalue)) &&
dpas_type_is_boolean(dpas_sem_get_type((yyvsp[0].semvalue))))
{
jit_label_t label1 = jit_label_undefined;
jit_label_t label2 = jit_label_undefined;
jit_value_t value, const_value;
(yyvsp[-2].semvalue) = dpas_lvalue_to_rvalue((yyvsp[-2].semvalue));
(yyvsp[0].semvalue) = dpas_lvalue_to_rvalue((yyvsp[0].semvalue));
if(!jit_insn_branch_if
(dpas_current_function(),
dpas_sem_get_value((yyvsp[-2].semvalue)), &label1))
{
dpas_out_of_memory();
}
if(!jit_insn_branch_if
(dpas_current_function(),
dpas_sem_get_value((yyvsp[0].semvalue)), &label1))
{
dpas_out_of_memory();
}
value = jit_value_create
(dpas_current_function(), jit_type_int);
const_value = jit_value_create_nint_constant
(dpas_current_function(), jit_type_int, 0);
if(!value || !const_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store(dpas_current_function(),
value, const_value))
{
dpas_out_of_memory();
}
if(!jit_insn_branch(dpas_current_function(), &label2))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label1))
{
dpas_out_of_memory();
}
const_value = jit_value_create_nint_constant
(dpas_current_function(), jit_type_int, 1);
if(!const_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store(dpas_current_function(),
value, const_value))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label2))
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), dpas_type_boolean, value);
}
else
{
handle_integer_binary("or", jit_insn_or, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
}
#line 4143 "dpas-parser.c"
break;
case 144:
#line 2387 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 4149 "dpas-parser.c"
break;
case 145:
#line 2388 "dpas-parser.y"
{
handle_binary("*", jit_insn_mul, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4157 "dpas-parser.c"
break;
case 146:
#line 2391 "dpas-parser.y"
{
handle_binary("/", jit_insn_div, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4167 "dpas-parser.c"
break;
case 147:
#line 2396 "dpas-parser.y"
{
handle_binary("div", jit_insn_div, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4175 "dpas-parser.c"
break;
case 148:
#line 2399 "dpas-parser.y"
{
handle_binary("mod", jit_insn_rem, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4183 "dpas-parser.c"
break;
case 149:
#line 2402 "dpas-parser.y"
{
if(dpas_sem_is_rvalue((yyvsp[-2].semvalue)) &&
dpas_type_is_boolean(dpas_sem_get_type((yyvsp[-2].semvalue))) &&
dpas_sem_is_rvalue((yyvsp[0].semvalue)) &&
dpas_type_is_boolean(dpas_sem_get_type((yyvsp[0].semvalue))))
{
jit_label_t label1 = jit_label_undefined;
jit_label_t label2 = jit_label_undefined;
jit_value_t value, const_value;
(yyvsp[-2].semvalue) = dpas_lvalue_to_rvalue((yyvsp[-2].semvalue));
(yyvsp[0].semvalue) = dpas_lvalue_to_rvalue((yyvsp[0].semvalue));
if(!jit_insn_branch_if_not
(dpas_current_function(),
dpas_sem_get_value((yyvsp[-2].semvalue)), &label1))
{
dpas_out_of_memory();
}
if(!jit_insn_branch_if_not
(dpas_current_function(),
dpas_sem_get_value((yyvsp[0].semvalue)), &label1))
{
dpas_out_of_memory();
}
value = jit_value_create
(dpas_current_function(), jit_type_int);
const_value = jit_value_create_nint_constant
(dpas_current_function(), jit_type_int, 1);
if(!value || !const_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store(dpas_current_function(),
value, const_value))
{
dpas_out_of_memory();
}
if(!jit_insn_branch(dpas_current_function(), &label2))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label1))
{
dpas_out_of_memory();
}
const_value = jit_value_create_nint_constant
(dpas_current_function(), jit_type_int, 0);
if(!const_value)
{
dpas_out_of_memory();
}
if(!jit_insn_store(dpas_current_function(),
value, const_value))
{
dpas_out_of_memory();
}
if(!jit_insn_label(dpas_current_function(), &label2))
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), dpas_type_boolean, value);
}
else
{
handle_integer_binary("and", jit_insn_and, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
}
#line 4255 "dpas-parser.c"
break;
case 150:
#line 2469 "dpas-parser.y"
{
handle_integer_binary("xor", jit_insn_xor, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4263 "dpas-parser.c"
break;
case 151:
#line 2472 "dpas-parser.y"
{
handle_integer_binary("shl", jit_insn_shl, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4271 "dpas-parser.c"
break;
case 152:
#line 2475 "dpas-parser.y"
{
handle_integer_binary("shr", jit_insn_shr, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4279 "dpas-parser.c"
break;
case 153:
#line 2481 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 4285 "dpas-parser.c"
break;
case 154:
#line 2482 "dpas-parser.y"
{
handle_binary("pow", jit_insn_pow, (yyvsp[-2].semvalue), (yyvsp[0].semvalue));
}
#line 4293 "dpas-parser.c"
break;
case 155:
#line 2488 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[0].semvalue); }
#line 4299 "dpas-parser.c"
break;
case 156:
#line 2489 "dpas-parser.y"
{
jit_value_t value = jit_value_create_constant
(dpas_current_function(), &((yyvsp[0].const_value)));
dpas_sem_set_rvalue((yyval.semvalue), (yyvsp[0].const_value).type, value);
}
#line 4309 "dpas-parser.c"
break;
case 157:
#line 2494 "dpas-parser.y"
{
dpas_error("set expressions not yet implemented");
dpas_sem_set_error((yyval.semvalue));
}
#line 4319 "dpas-parser.c"
break;
case 158:
#line 2499 "dpas-parser.y"
{
dpas_error("set expressions not yet implemented");
dpas_sem_set_error((yyval.semvalue));
}
#line 4329 "dpas-parser.c"
break;
case 159:
#line 2504 "dpas-parser.y"
{
jit_value_t value;
(yyvsp[0].semvalue) = dpas_lvalue_to_rvalue((yyvsp[0].semvalue));
if(dpas_sem_is_rvalue((yyvsp[0].semvalue)) &&
dpas_type_is_boolean(dpas_sem_get_type((yyvsp[0].semvalue))))
{
value = jit_insn_to_not_bool
(dpas_current_function(), dpas_sem_get_value((yyvsp[0].semvalue)));
dpas_sem_set_rvalue((yyval.semvalue), dpas_type_boolean, value);
}
else if(dpas_sem_is_rvalue((yyvsp[0].semvalue)) &&
dpas_type_is_integer(dpas_sem_get_type((yyvsp[0].semvalue))))
{
value = jit_insn_not
(dpas_current_function(), dpas_sem_get_value((yyvsp[0].semvalue)));
dpas_sem_set_rvalue((yyval.semvalue), jit_value_get_type(value), value);
}
else
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("invalid operand to unary `not'");
}
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4360 "dpas-parser.c"
break;
case 160:
#line 2530 "dpas-parser.y"
{
jit_type_t type;
if(dpas_sem_is_lvalue((yyvsp[0].semvalue)))
{
jit_value_t value;
value = jit_insn_address_of
(dpas_current_function(), dpas_sem_get_value((yyvsp[0].semvalue)));
type = jit_type_create_pointer(dpas_sem_get_type((yyvsp[0].semvalue)), 1);
if(!type)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), type, value);
}
else if(dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
type = jit_type_create_pointer(dpas_sem_get_type((yyvsp[0].semvalue)), 1);
if(!type)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), type, dpas_sem_get_value((yyvsp[0].semvalue)));
}
else
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("l-value required for address-of operator");
}
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4398 "dpas-parser.c"
break;
case 161:
#line 2563 "dpas-parser.y"
{
jit_type_t type;
if(dpas_sem_is_lvalue((yyvsp[0].semvalue)))
{
jit_value_t value;
value = jit_insn_address_of
(dpas_current_function(), dpas_sem_get_value((yyvsp[0].semvalue)));
type = jit_type_create_pointer(dpas_sem_get_type((yyvsp[0].semvalue)), 1);
if(!type)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), jit_value_get_type(value), value);
}
else if(dpas_sem_is_lvalue_ea((yyvsp[0].semvalue)))
{
type = jit_type_create_pointer(dpas_sem_get_type((yyvsp[0].semvalue)), 1);
if(!type)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), type, dpas_sem_get_value((yyvsp[0].semvalue)));
}
else
{
if(!dpas_sem_is_error((yyvsp[0].semvalue)))
{
dpas_error("l-value required for address-of operator");
}
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4436 "dpas-parser.c"
break;
case 162:
#line 2596 "dpas-parser.y"
{ (yyval.semvalue) = (yyvsp[-1].semvalue); }
#line 4442 "dpas-parser.c"
break;
case 163:
#line 2597 "dpas-parser.y"
{
if(dpas_sem_is_builtin((yyvsp[-3].semvalue)))
{
(yyval.semvalue) = dpas_expand_builtin
(dpas_sem_get_builtin((yyvsp[-3].semvalue)), (yyvsp[-1].expr_list).exprs, (yyvsp[-1].expr_list).len);
}
else if(dpas_sem_is_procedure((yyvsp[-3].semvalue)))
{
dpas_scope_item_t item = dpas_sem_get_procedure((yyvsp[-3].semvalue));
(yyval.semvalue) = invoke_procedure
((jit_function_t)dpas_scope_item_info(item),
dpas_scope_item_name(item),
dpas_scope_item_type(item), 0, (yyvsp[-1].expr_list).exprs, (yyvsp[-1].expr_list).len);
}
else if(dpas_sem_is_rvalue((yyvsp[-3].semvalue)) &&
jit_type_is_signature(dpas_sem_get_type((yyvsp[-3].semvalue))))
{
(yyval.semvalue) = invoke_procedure
(0, 0, dpas_sem_get_type((yyvsp[-3].semvalue)), dpas_sem_get_value((yyvsp[-3].semvalue)),
(yyvsp[-1].expr_list).exprs, (yyvsp[-1].expr_list).len);
}
else if(dpas_sem_is_type((yyvsp[-3].semvalue)) && (yyvsp[-1].expr_list).len == 1 &&
dpas_sem_is_rvalue((yyvsp[-1].expr_list).exprs[0]))
{
jit_value_t conv;
conv = jit_insn_convert
(dpas_current_function(),
dpas_sem_get_value(dpas_lvalue_to_rvalue((yyvsp[-1].expr_list).exprs[0])),
dpas_sem_get_type((yyvsp[-3].semvalue)), 0);
if(!conv)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), dpas_sem_get_type((yyvsp[-3].semvalue)), conv);
}
else
{
if(!dpas_sem_is_error((yyvsp[-3].semvalue)))
{
dpas_error("invalid function name");
}
dpas_sem_set_error((yyval.semvalue));
}
expression_list_free((yyvsp[-1].expr_list).exprs, (yyvsp[-1].expr_list).len);
if(dpas_sem_is_void((yyval.semvalue)))
{
dpas_error("cannot use a procedure in this context");
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4502 "dpas-parser.c"
break;
case 164:
#line 2652 "dpas-parser.y"
{
dpas_error("`va_arg' not yet implemented");
dpas_sem_set_error((yyval.semvalue));
}
#line 4512 "dpas-parser.c"
break;
case 165:
#line 2657 "dpas-parser.y"
{
jit_nuint size;
jit_value_t value;
if(dpas_sem_is_rvalue((yyvsp[-1].semvalue)) || dpas_sem_is_type((yyvsp[-1].semvalue)))
{
size = jit_type_get_size(dpas_sem_get_type((yyvsp[-1].semvalue)));
value = jit_value_create_nint_constant
(dpas_current_function(), dpas_type_size_t,
(jit_nint)size);
if(!value)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue((yyval.semvalue), dpas_type_size_t, value);
}
else
{
dpas_error("invalid operand to `sizeof'");
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4538 "dpas-parser.c"
break;
case 166:
#line 2678 "dpas-parser.y"
{
dpas_error("ternary `if' not yet implemented");
dpas_sem_set_error((yyval.semvalue));
}
#line 4548 "dpas-parser.c"
break;
case 167:
#line 2686 "dpas-parser.y"
{
dpas_scope_item_t item;
int builtin;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[0].name), 1);
if(!item)
{
builtin = dpas_is_builtin((yyvsp[0].name));
if(!builtin)
{
dpas_error
("`%s' is not declared in the current scope", (yyvsp[0].name));
dpas_sem_set_error((yyval.semvalue));
}
else
{
dpas_sem_set_builtin((yyval.semvalue), builtin);
}
}
else
{
switch(dpas_scope_item_kind(item))
{
case DPAS_ITEM_TYPE:
{
dpas_sem_set_type((yyval.semvalue), dpas_scope_item_type(item));
}
break;
case DPAS_ITEM_VARIABLE:
{
dpas_sem_set_lvalue
((yyval.semvalue), dpas_scope_item_type(item),
(jit_value_t)dpas_scope_item_info(item));
}
break;
case DPAS_ITEM_GLOBAL_VARIABLE:
{
jit_value_t value;
void *address = dpas_scope_item_info(item);
value = jit_value_create_nint_constant
(dpas_current_function(),
jit_type_void_ptr, (jit_nint)address);
if(!value)
{
dpas_out_of_memory();
}
dpas_sem_set_lvalue_ea
((yyval.semvalue), dpas_scope_item_type(item), value);
}
break;
case DPAS_ITEM_CONSTANT:
{
jit_value_t const_value;
const_value = jit_value_create_constant
(dpas_current_function(),
(jit_constant_t *)dpas_scope_item_info(item));
if(!const_value)
{
dpas_out_of_memory();
}
dpas_sem_set_rvalue
((yyval.semvalue), dpas_scope_item_type(item), const_value);
}
break;
case DPAS_ITEM_PROCEDURE:
{
dpas_sem_set_procedure
((yyval.semvalue), dpas_scope_item_type(item), item);
}
break;
case DPAS_ITEM_WITH:
{
dpas_sem_set_error((yyval.semvalue));
}
break;
case DPAS_ITEM_FUNC_RETURN:
{
dpas_sem_set_return
((yyval.semvalue), dpas_scope_item_type(item));
}
break;
default:
{
dpas_sem_set_error((yyval.semvalue));
}
break;
}
}
jit_free((yyvsp[0].name));
}
#line 4650 "dpas-parser.c"
break;
case 168:
#line 2783 "dpas-parser.y"
{
jit_value_t array = 0;
jit_type_t array_type = 0;
jit_type_t elem_type = 0;
int rank = (yyvsp[-1].expr_list).len;
if(dpas_sem_is_lvalue((yyvsp[-3].semvalue)) || dpas_sem_is_lvalue_ea((yyvsp[-3].semvalue)))
{
elem_type = dpas_sem_get_type((yyvsp[-3].semvalue));
if(dpas_sem_is_lvalue_ea((yyvsp[-3].semvalue)))
{
if(dpas_type_is_array(elem_type))
{
array_type = elem_type;
array = dpas_sem_get_value((yyvsp[-3].semvalue));
rank = dpas_type_get_rank(elem_type);
elem_type = dpas_type_get_elem(elem_type);
}
else if(dpas_type_is_conformant_array(elem_type))
{
array_type = elem_type;
array = dpas_sem_get_value
(dpas_lvalue_to_rvalue((yyvsp[-3].semvalue)));
rank = dpas_type_get_rank(elem_type);
elem_type = dpas_type_get_elem(elem_type);
}
else if(jit_type_is_pointer(elem_type))
{
array = dpas_sem_get_value
(dpas_lvalue_to_rvalue((yyvsp[-3].semvalue)));
rank = 1;
elem_type = jit_type_get_ref(elem_type);
}
else
{
dpas_error("value is not an array");
}
}
else
{
if(dpas_type_is_array(elem_type))
{
array_type = elem_type;
array = jit_insn_address_of
(dpas_current_function(),
dpas_sem_get_value((yyvsp[-3].semvalue)));
if(!array)
{
dpas_out_of_memory();
}
rank = dpas_type_get_rank(elem_type);
elem_type = dpas_type_get_elem(elem_type);
}
else if(dpas_type_is_conformant_array(elem_type))
{
array_type = elem_type;
array = dpas_sem_get_value((yyvsp[-3].semvalue));
rank = dpas_type_get_rank(elem_type);
elem_type = dpas_type_get_elem(elem_type);
}
else if(jit_type_is_pointer(elem_type))
{
array = dpas_sem_get_value((yyvsp[-3].semvalue));
rank = 1;
elem_type = jit_type_get_ref(elem_type);
}
else
{
dpas_error("value is not an array");
}
}
}
if(rank != (yyvsp[-1].expr_list).len)
{
dpas_error("incorrect number of indices for array");
dpas_sem_set_error((yyval.semvalue));
}
else if(array)
{
jit_nint i = 0;
jit_function_t func = dpas_current_function();
jit_value_t total_offset = 0;
jit_value_t lvalue_ea = 0;
jit_value_t index = 0;
jit_value_t lower_bound = 0;
jit_value_t upper_bound = 0;
jit_value_t difference = 0;
jit_value_t factor = 0;
jit_value_t offset = 0;
jit_value_t temp1 = 0;
jit_value_t temp2 = 0;
jit_value_t zero = 0;
jit_label_t out_of_bounds = jit_label_undefined;
jit_label_t all_is_well = jit_label_undefined;
jit_nuint range_size = 1;
dpas_array *info = 0;
jit_type_t *bounds = 0;
info = jit_type_get_tagged_data(array_type);
if (info)
{
bounds = info->bounds;
}
zero = jit_value_create_nint_constant(func,jit_type_uint,0);
total_offset = jit_value_create(func,jit_type_uint);
jit_insn_store(func,total_offset,zero);
for ( i = 0 ; i < rank ; i++ )
{
index = dpas_sem_get_value((yyvsp[-1].expr_list).exprs[i]);
if ( bounds )
{
if ( jit_type_get_tagged_kind(bounds[i]) == DPAS_TAG_SUBRANGE )
{
upper_bound = jit_value_create_nint_constant(func,jit_type_int,
((dpas_subrange *)jit_type_get_tagged_data(bounds[i]))->last.un.int_value);
lower_bound = jit_value_create_nint_constant(func,jit_type_int,
((dpas_subrange *)jit_type_get_tagged_data(bounds[i]))->first.un.int_value);
}
else if ( jit_type_get_tagged_kind(bounds[i]) == DPAS_TAG_ENUM )
{
upper_bound = jit_value_create_nint_constant(func,jit_type_int,
((dpas_enum *)jit_type_get_tagged_data(bounds[i]))->num_elems-1);
lower_bound = jit_value_create_nint_constant(func,jit_type_int,0);
}
temp1 = jit_insn_le(func,index,upper_bound);
jit_insn_branch_if_not(func,temp1,&out_of_bounds);
difference = jit_insn_sub(func,index,lower_bound);
temp2 = jit_insn_ge(func,difference,zero);
jit_insn_branch_if_not(func,temp2,&out_of_bounds);
factor = jit_value_create_nint_constant(func,jit_type_uint,range_size);
offset = jit_insn_mul(func,difference,factor);
total_offset = jit_insn_add(func,total_offset,offset);
range_size *= (jit_value_get_nint_constant(upper_bound) -
(jit_value_get_nint_constant(lower_bound) -1));
}
else
{
jit_insn_store(func,total_offset,index);
}
}
if ( bounds )
{
jit_insn_branch(func,&all_is_well);
jit_insn_label(func,&out_of_bounds);
throw_builtin_exception(func, JIT_RESULT_OUT_OF_BOUNDS);
jit_insn_label(func,&all_is_well);
}
lvalue_ea = jit_insn_load_elem_address(func,array,total_offset,elem_type);
dpas_sem_set_lvalue_ea((yyval.semvalue),elem_type,lvalue_ea);
}
else
{
dpas_error("invalid l-value supplied to array expression");
dpas_sem_set_error((yyval.semvalue));
}
expression_list_free((yyvsp[-1].expr_list).exprs, (yyvsp[-1].expr_list).len);
}
#line 4854 "dpas-parser.c"
break;
case 169:
#line 2982 "dpas-parser.y"
{
jit_type_t type = dpas_sem_get_type((yyvsp[-2].semvalue));
jit_type_t field_type;
jit_value_t address;
jit_nint offset;
if(dpas_sem_is_lvalue_ea((yyvsp[-2].semvalue)))
{
address = dpas_sem_get_value((yyvsp[-2].semvalue));
}
else if(dpas_sem_is_lvalue((yyvsp[-2].semvalue)))
{
address = jit_insn_address_of
(dpas_current_function(), dpas_sem_get_value((yyvsp[-2].semvalue)));
if(!address)
{
dpas_out_of_memory();
}
}
else
{
if(!dpas_sem_is_error((yyvsp[-2].semvalue)))
{
dpas_error("invalid left hand side for `.'");
}
type = 0;
address = 0;
}
if(type && dpas_type_is_record(type))
{
field_type = dpas_type_get_field(type, (yyvsp[0].name), &offset);
if(field_type)
{
if(offset != 0)
{
address = jit_insn_add_relative
(dpas_current_function(), address, offset);
if(!address)
{
dpas_out_of_memory();
}
}
dpas_sem_set_lvalue_ea((yyval.semvalue), field_type, address);
}
else
{
char *name = dpas_type_name(type);
dpas_error("`%s' is not a member of `%s'", (yyvsp[0].name), name);
jit_free(name);
dpas_sem_set_error((yyval.semvalue));
}
}
else if(type)
{
char *name = dpas_type_name(type);
dpas_error("`%s' is not a record type", name);
jit_free(name);
dpas_sem_set_error((yyval.semvalue));
}
else
{
dpas_sem_set_error((yyval.semvalue));
}
jit_free((yyvsp[0].name));
}
#line 4924 "dpas-parser.c"
break;
case 170:
#line 3047 "dpas-parser.y"
{
jit_value_t value;
if(!jit_type_is_pointer(dpas_sem_get_type((yyvsp[-1].semvalue))))
{
if(!dpas_sem_is_error((yyvsp[-1].semvalue)))
{
dpas_error("invalid operand to unary `^'");
}
dpas_sem_set_error((yyval.semvalue));
}
else if(dpas_sem_is_lvalue((yyvsp[-1].semvalue)) || dpas_sem_is_rvalue((yyvsp[-1].semvalue)))
{
value = jit_insn_add_relative
(dpas_current_function(), dpas_sem_get_value((yyvsp[-1].semvalue)), 0);
if(!value)
{
dpas_out_of_memory();
}
dpas_sem_set_lvalue_ea
((yyval.semvalue), jit_type_get_ref(dpas_sem_get_type((yyvsp[-1].semvalue))), value);
}
else if(dpas_sem_is_lvalue_ea((yyvsp[-1].semvalue)))
{
value = jit_insn_load_relative
(dpas_current_function(), dpas_sem_get_value((yyvsp[-1].semvalue)),
0, jit_type_void_ptr);
if(!value)
{
dpas_out_of_memory();
}
dpas_sem_set_lvalue_ea
((yyval.semvalue), jit_type_get_ref(dpas_sem_get_type((yyvsp[-1].semvalue))), value);
}
else
{
if(!dpas_sem_is_error((yyvsp[-1].semvalue)))
{
dpas_error("invalid operand to unary `^'");
}
dpas_sem_set_error((yyval.semvalue));
}
}
#line 4974 "dpas-parser.c"
break;
case 171:
#line 3099 "dpas-parser.y"
{
dpas_scope_item_t item;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[0].name), 1);
if(!item)
{
dpas_undeclared((yyvsp[0].name));
(yyval.type) = jit_type_void;
}
else if(dpas_scope_item_kind(item) != DPAS_ITEM_TYPE)
{
dpas_error("`%s' does not refer to a type in the "
"current scope", (yyvsp[0].name));
(yyval.type) = jit_type_void;
}
else
{
(yyval.type) = jit_type_copy(dpas_scope_item_type(item));
}
jit_free((yyvsp[0].name));
}
#line 4999 "dpas-parser.c"
break;
case 172:
#line 3122 "dpas-parser.y"
{ (yyval.type) = (yyvsp[0].type); }
#line 5005 "dpas-parser.c"
break;
case 173:
#line 3123 "dpas-parser.y"
{ (yyval.type) = (yyvsp[0].type); }
#line 5011 "dpas-parser.c"
break;
case 174:
#line 3124 "dpas-parser.y"
{ (yyval.type) = (yyvsp[0].type); }
#line 5017 "dpas-parser.c"
break;
case 175:
#line 3128 "dpas-parser.y"
{ (yyval.type) = (yyvsp[0].type); }
#line 5023 "dpas-parser.c"
break;
case 176:
#line 3129 "dpas-parser.y"
{
jit_type_t type;
int posn;
dpas_scope_item_t item;
jit_constant_t value;
type = dpas_create_enum(jit_type_int, (yyvsp[-1].id_list).len);
for(posn = 0; posn < (yyvsp[-1].id_list).len; ++posn)
{
if(!((yyvsp[-1].id_list).list[posn]))
{
continue;
}
item = dpas_scope_lookup(dpas_scope_current(),
(yyvsp[-1].id_list).list[posn], 0);
if(item)
{
dpas_redeclared((yyvsp[-1].id_list).list[posn], item);
continue;
}
value.type = type;
value.un.int_value = (jit_int)posn;
dpas_scope_add_const(dpas_scope_current(),
(yyvsp[-1].id_list).list[posn], &value,
dpas_filename, dpas_linenum);
}
identifier_list_free((yyvsp[-1].id_list).list, (yyvsp[-1].id_list).len);
(yyval.type) = type;
}
#line 5067 "dpas-parser.c"
break;
case 177:
#line 3168 "dpas-parser.y"
{
jit_type_t type = dpas_common_type((yyvsp[-2].const_value).type, (yyvsp[0].const_value).type, 1);
if(type)
{
dpas_subrange range;
dpas_convert_constant(&(range.first), &((yyvsp[-2].const_value)), type);
dpas_convert_constant(&(range.last), &((yyvsp[0].const_value)), type);
(yyval.type) = dpas_create_subrange(type, &range);
jit_type_free((yyvsp[-2].const_value).type);
jit_type_free((yyvsp[0].const_value).type);
}
else
{
char *name1 = dpas_type_name((yyvsp[-2].const_value).type);
char *name2 = dpas_type_name((yyvsp[0].const_value).type);
if(!jit_strcmp(name1, name2))
{
dpas_error("cannot declare a subrange within `%s'",
name1);
}
else
{
dpas_error("cannot declare a subrange within "
"`%s' or `%s'", name1, name2);
}
jit_free(name1);
jit_free(name2);
(yyval.type) = (yyvsp[-2].const_value).type;
jit_type_free((yyvsp[0].const_value).type);
}
}
#line 5105 "dpas-parser.c"
break;
case 178:
#line 3204 "dpas-parser.y"
{
(yyval.type) = dpas_create_array((yyvsp[-3].type_list).list, (yyvsp[-3].type_list).len, (yyvsp[0].type));
}
#line 5113 "dpas-parser.c"
break;
case 179:
#line 3207 "dpas-parser.y"
{
jit_type_t type;
type = jit_type_create_struct
((yyvsp[-1].parameters).types, (unsigned int)((yyvsp[-1].parameters).len), 1);
if(!type)
{
dpas_out_of_memory();
}
if(!jit_type_set_names
(type, (yyvsp[-1].parameters).names, (unsigned int)((yyvsp[-1].parameters).len)))
{
dpas_out_of_memory();
}
type = jit_type_create_tagged(type, DPAS_TAG_NAME, 0, 0, 0);
parameter_list_free(&((yyvsp[-1].parameters)));
(yyval.type) = type;
}
#line 5135 "dpas-parser.c"
break;
case 180:
#line 3224 "dpas-parser.y"
{
if(!dpas_is_set_compatible((yyvsp[0].type)))
{
char *name = dpas_type_name((yyvsp[0].type));
dpas_error("`%s' cannot be used as the member type "
"for a set", name);
jit_free(name);
}
(yyval.type) = jit_type_create_tagged
(jit_type_uint, DPAS_TAG_SET,
(yyvsp[0].type), (jit_meta_free_func)jit_type_free, 0);
}
#line 5152 "dpas-parser.c"
break;
case 181:
#line 3236 "dpas-parser.y"
{
dpas_scope_item_t item;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[0].name), 1);
if(!item)
{
char *name;
name = jit_strdup((yyvsp[0].name));
if(!name)
{
dpas_out_of_memory();
}
(yyval.type) = jit_type_create_tagged(0, DPAS_TAG_NAME,
name, jit_free, 0);
if(!((yyval.type)))
{
dpas_out_of_memory();
}
dpas_scope_add(dpas_scope_current(), (yyvsp[0].name), (yyval.type),
DPAS_ITEM_TYPE, 0, 0,
dpas_filename, dpas_linenum);
}
else if(dpas_scope_item_kind(item) != DPAS_ITEM_TYPE)
{
dpas_error("`%s' does not refer to a type in the "
"current scope", (yyvsp[0].name));
(yyval.type) = jit_type_void;
}
else
{
(yyval.type) = jit_type_copy(dpas_scope_item_type(item));
}
(yyval.type) = jit_type_create_pointer((yyval.type), 0);
if(!((yyval.type)))
{
dpas_out_of_memory();
}
jit_free((yyvsp[0].name));
}
#line 5198 "dpas-parser.c"
break;
case 182:
#line 3280 "dpas-parser.y"
{
(yyval.type_list).list = 0;
(yyval.type_list).len = 0;
type_list_add(&((yyval.type_list).list), &((yyval.type_list).len), (yyvsp[0].type));
}
#line 5208 "dpas-parser.c"
break;
case 183:
#line 3285 "dpas-parser.y"
{
(yyval.type_list) = (yyvsp[-2].type_list);
type_list_add(&((yyval.type_list).list), &((yyval.type_list).len), (yyvsp[0].type));
}
#line 5217 "dpas-parser.c"
break;
case 184:
#line 3292 "dpas-parser.y"
{
if(jit_type_get_tagged_kind((yyvsp[0].type)) == DPAS_TAG_ENUM)
{
(yyval.type) = (yyvsp[0].type);
}
else if(jit_type_get_tagged_kind((yyvsp[0].type)) == DPAS_TAG_SUBRANGE &&
jit_type_get_tagged_type((yyvsp[0].type)) == jit_type_int)
{
(yyval.type) = (yyvsp[0].type);
}
else
{
char *name = dpas_type_name((yyvsp[0].type));
dpas_error("`%s' cannot be used as an array bound", name);
jit_free(name);
(yyval.type) = 0;
}
}
#line 5241 "dpas-parser.c"
break;
case 185:
#line 3314 "dpas-parser.y"
{ parameter_list_init(&((yyval.parameters))); }
#line 5247 "dpas-parser.c"
break;
case 186:
#line 3315 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[0].parameters); }
#line 5253 "dpas-parser.c"
break;
case 187:
#line 3316 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[-1].parameters); }
#line 5259 "dpas-parser.c"
break;
case 188:
#line 3317 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-2].parameters);
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].parameters)));
}
#line 5268 "dpas-parser.c"
break;
case 189:
#line 3321 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-3].parameters);
parameter_list_merge(&((yyval.parameters)), &((yyvsp[-1].parameters)));
}
#line 5277 "dpas-parser.c"
break;
case 190:
#line 3325 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[0].parameters); }
#line 5283 "dpas-parser.c"
break;
case 191:
#line 3326 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[-1].parameters); }
#line 5289 "dpas-parser.c"
break;
case 192:
#line 3330 "dpas-parser.y"
{ (yyval.parameters) = (yyvsp[0].parameters); }
#line 5295 "dpas-parser.c"
break;
case 193:
#line 3331 "dpas-parser.y"
{
(yyval.parameters) = (yyvsp[-2].parameters);
parameter_list_merge(&((yyval.parameters)), &((yyvsp[0].parameters)));
}
#line 5304 "dpas-parser.c"
break;
case 194:
#line 3338 "dpas-parser.y"
{
parameter_list_create(&((yyval.parameters)), (yyvsp[-2].id_list).list, (yyvsp[-2].id_list).len, (yyvsp[0].type));
jit_type_free((yyvsp[0].type));
}
#line 5313 "dpas-parser.c"
break;
case 195:
#line 3342 "dpas-parser.y"
{
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), (yyvsp[0].procedure).name, (yyvsp[0].procedure).type);
}
#line 5322 "dpas-parser.c"
break;
case 196:
#line 3349 "dpas-parser.y"
{
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), (yyvsp[-4].name), (yyvsp[-2].type));
parameter_list_add(&((yyval.parameters)), 0, (yyvsp[0].type));
}
#line 5332 "dpas-parser.c"
break;
case 197:
#line 3354 "dpas-parser.y"
{
parameter_list_init(&((yyval.parameters)));
parameter_list_add(&((yyval.parameters)), 0, (yyvsp[0].type));
jit_type_free((yyvsp[-2].type));
}
#line 5342 "dpas-parser.c"
break;
case 198:
#line 3362 "dpas-parser.y"
{
(yyval.type) = jit_type_create_union
((yyvsp[0].type_list).list, (unsigned int)((yyvsp[0].type_list).len), 0);
jit_free((yyvsp[0].type_list).list);
}
#line 5353 "dpas-parser.c"
break;
case 199:
#line 3371 "dpas-parser.y"
{
(yyval.type_list).list = 0;
(yyval.type_list).len = 0;
type_list_add(&((yyval.type_list).list), &((yyval.type_list).len), (yyvsp[0].type));
}
#line 5363 "dpas-parser.c"
break;
case 200:
#line 3376 "dpas-parser.y"
{
(yyval.type_list) = (yyvsp[-2].type_list);
type_list_add(&((yyval.type_list).list), &((yyval.type_list).len), (yyvsp[0].type));
}
#line 5372 "dpas-parser.c"
break;
case 201:
#line 3383 "dpas-parser.y"
{
jit_type_t type;
type = jit_type_create_struct
((yyvsp[-1].parameters).types, (unsigned int)((yyvsp[-1].parameters).len), 1);
if(!type)
{
dpas_out_of_memory();
}
if(!jit_type_set_names
(type, (yyvsp[-1].parameters).names, (unsigned int)((yyvsp[-1].parameters).len)))
{
dpas_out_of_memory();
}
parameter_list_free(&((yyvsp[-1].parameters)));
(yyval.type) = type;
}
#line 5393 "dpas-parser.c"
break;
case 202:
#line 3404 "dpas-parser.y"
{}
#line 5399 "dpas-parser.c"
break;
case 203:
#line 3405 "dpas-parser.y"
{}
#line 5405 "dpas-parser.c"
break;
case 204:
#line 3413 "dpas-parser.y"
{ (yyval.const_value) = (yyvsp[0].const_value); }
#line 5411 "dpas-parser.c"
break;
case 205:
#line 3414 "dpas-parser.y"
{
if((yyvsp[0].const_value).type != jit_type_int &&
(yyvsp[0].const_value).type != jit_type_uint &&
(yyvsp[0].const_value).type != jit_type_long &&
(yyvsp[0].const_value).type != jit_type_ulong &&
(yyvsp[0].const_value).type != jit_type_nfloat)
{
char *name = dpas_type_name((yyvsp[0].const_value).type);
dpas_error("unary `+' cannot be applied to a constant "
"of type `%s'", name);
jit_free(name);
}
(yyval.const_value) = (yyvsp[0].const_value);
}
#line 5430 "dpas-parser.c"
break;
case 206:
#line 3428 "dpas-parser.y"
{
if((yyvsp[0].const_value).type == jit_type_int)
{
(yyval.const_value).type = (yyvsp[0].const_value).type;
(yyval.const_value).un.int_value = -((yyvsp[0].const_value).un.int_value);
}
else if((yyvsp[0].const_value).type == jit_type_uint)
{
(yyval.const_value).type = jit_type_long;
(yyval.const_value).un.long_value = -((jit_long)((yyvsp[0].const_value).un.uint_value));
}
else if((yyvsp[0].const_value).type == jit_type_long)
{
(yyval.const_value).type = jit_type_long;
(yyval.const_value).un.long_value = -((yyvsp[0].const_value).un.long_value);
}
else if((yyvsp[0].const_value).type == jit_type_ulong)
{
(yyval.const_value).type = jit_type_long;
(yyval.const_value).un.long_value = -((jit_long)((yyvsp[0].const_value).un.ulong_value));
}
else if((yyvsp[0].const_value).type == jit_type_nfloat)
{
(yyval.const_value).type = jit_type_nfloat;
(yyval.const_value).un.nfloat_value = -((yyvsp[0].const_value).un.nfloat_value);
}
else
{
char *name = dpas_type_name((yyvsp[0].const_value).type);
dpas_error("unary `-' cannot be applied to a constant "
"of type `%s'", name);
jit_free(name);
(yyval.const_value) = (yyvsp[0].const_value);
}
}
#line 5470 "dpas-parser.c"
break;
case 207:
#line 3466 "dpas-parser.y"
{ (yyval.const_value) = (yyvsp[0].const_value); }
#line 5476 "dpas-parser.c"
break;
case 208:
#line 3467 "dpas-parser.y"
{
dpas_scope_item_t item;
item = dpas_scope_lookup(dpas_scope_current(), (yyvsp[0].name), 1);
if(!item)
{
dpas_error("`%s' is not declared in the current scope", (yyvsp[0].name));
(yyval.const_value).type = jit_type_int;
(yyval.const_value).un.int_value = 0;
}
else if(dpas_scope_item_kind(item) != DPAS_ITEM_CONSTANT)
{
dpas_error("`%s' is not declared as a constant "
"in the current scope", (yyvsp[0].name));
(yyval.const_value).type = jit_type_int;
(yyval.const_value).un.int_value = 0;
}
else
{
(yyval.const_value) = *((jit_constant_t *)(dpas_scope_item_info(item)));
}
jit_free((yyvsp[0].name));
}
#line 5503 "dpas-parser.c"
break;
case 209:
#line 3492 "dpas-parser.y"
{
(yyval.const_value).type = (yyvsp[0].int_const).type;
if((yyvsp[0].int_const).type == jit_type_int)
{
(yyval.const_value).un.int_value = (jit_int)((yyvsp[0].int_const).value);
}
else if((yyvsp[0].int_const).type == jit_type_uint)
{
(yyval.const_value).un.uint_value = (jit_uint)((yyvsp[0].int_const).value);
}
else if((yyvsp[0].int_const).type == jit_type_long)
{
(yyval.const_value).un.long_value = (jit_long)((yyvsp[0].int_const).value);
}
else
{
(yyval.const_value).un.ulong_value = (yyvsp[0].int_const).value;
}
}
#line 5527 "dpas-parser.c"
break;
case 210:
#line 3511 "dpas-parser.y"
{
(yyval.const_value).type = jit_type_nfloat;
(yyval.const_value).un.nfloat_value = (yyvsp[0].real_const);
}
#line 5536 "dpas-parser.c"
break;
case 211:
#line 3515 "dpas-parser.y"
{
(yyval.const_value).type = dpas_type_string;
(yyval.const_value).un.ptr_value = (yyvsp[0].name);
}
#line 5548 "dpas-parser.c"
break;
case 212:
#line 3522 "dpas-parser.y"
{
(yyval.const_value).type = dpas_type_nil;
(yyval.const_value).un.ptr_value = 0;
}
#line 5557 "dpas-parser.c"
break;
#line 5561 "dpas-parser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
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:
yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
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 (yychar <= YYEOF)
{
if (yychar == YYEOF)
YYABORT;
}
else
{
yydestruct ("Error: discarding",
yytoken, &yylval);
yychar = YYEMPTY;
}
}
goto yyerrlab1;
yyerrorlab:
if ( 0)
goto yyerrorlab;
YYPOPSTACK (yylen);
yylen = 0;
YY_STACK_PRINT (yyss, yyssp);
yystate = *yyssp;
goto yyerrlab1;
yyerrlab1:
yyerrstatus = 3;
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;
}
}
if (yyssp == yyss)
YYABORT;
yydestruct ("Error: popping",
yystos[yystate], yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
yyacceptlab:
yyresult = 0;
goto yyreturn;
yyabortlab:
yyresult = 1;
goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
#endif
yyreturn:
if (yychar != YYEMPTY)
{
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval);
}
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;
}