diff options
Diffstat (limited to 'mrbgems/mruby-compiler/core')
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 1217 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/keywords | 8 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/lex.def | 118 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/node.h | 1 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 1819 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/y.tab.c | 13969 |
6 files changed, 16138 insertions, 994 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 8ab1b9bc3..5b779b63d 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -5,15 +5,17 @@ */ #include <ctype.h> -#include <limits.h> #include <stdlib.h> #include <string.h> +#include <math.h> #include <mruby.h> #include <mruby/compile.h> #include <mruby/proc.h> +#include <mruby/dump.h> #include <mruby/numeric.h> #include <mruby/string.h> #include <mruby/debug.h> +#include <mruby/presym.h> #include "node.h" #include <mruby/opcode.h> #include <mruby/re.h> @@ -38,8 +40,8 @@ enum looptype { struct loopinfo { enum looptype type; - int pc0, pc1, pc2, pc3, acc; - int ensure_level; + uint32_t pc0, pc1, pc2, pc3; + int acc; struct loopinfo *prev; }; @@ -53,15 +55,14 @@ typedef struct scope { node *lv; uint16_t sp; - uint16_t pc; - uint16_t lastpc; - uint16_t lastlabel; + uint32_t pc; + uint32_t lastpc; + uint32_t lastlabel; int ainfo:15; mrb_bool mscope:1; struct loopinfo *loop; - int ensure_level; - char const *filename; + mrb_sym filename_sym; uint16_t lineno; mrb_code *iseq; @@ -69,6 +70,10 @@ typedef struct scope { uint32_t icapa; mrb_irep *irep; + mrb_pool_value *pool; + mrb_sym *syms; + mrb_irep **reps; + struct mrb_irep_catch_handler *catch_table; uint32_t pcapa, scapa, rcapa; uint16_t nlocals; @@ -88,6 +93,15 @@ static struct loopinfo *loop_push(codegen_scope *s, enum looptype t); static void loop_break(codegen_scope *s, node *tree); static void loop_pop(codegen_scope *s, int val); +/* + * The search for catch handlers starts at the end of the table in mrb_vm_run(). + * Therefore, the next handler to be added must meet one of the following conditions. + * - Larger start position + * - Same start position but smaller end position + */ +static int catch_handler_new(codegen_scope *s); +static void catch_handler_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target); + static void gen_assignment(codegen_scope *s, node *tree, int sp, int val); static void gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val); @@ -100,16 +114,37 @@ codegen_error(codegen_scope *s, const char *message) if (!s) return; while (s->prev) { codegen_scope *tmp = s->prev; - mrb_free(s->mrb, s->iseq); + if (s->irep) { + mrb_free(s->mrb, s->iseq); + for (int i=0; i<s->irep->plen; i++) { + mrb_pool_value *pv = &s->pool[i]; + if ((pv->tt & 0x3) == IREP_TT_STR || pv->tt == IREP_TT_BIGINT) { + mrb_free(s->mrb, (void*)pv->u.str); + } + } + mrb_free(s->mrb, s->pool); + mrb_free(s->mrb, s->syms); + mrb_free(s->mrb, s->catch_table); + if (s->reps) { + /* copied from mrb_irep_free() in state.c */ + for (int i=0; i<s->irep->rlen; i++) { + if (s->reps[i]) + mrb_irep_decref(s->mrb, (mrb_irep*)s->reps[i]); + } + mrb_free(s->mrb, s->reps); + } + mrb_free(s->mrb, s->lines); + } mrb_pool_close(s->mpool); s = tmp; } -#ifndef MRB_DISABLE_STDIO - if (s->filename && s->lineno) { - fprintf(stderr, "codegen error:%s:%d: %s\n", s->filename, s->lineno, message); +#ifndef MRB_NO_STDIO + if (s->filename_sym && s->lineno) { + const char *filename = mrb_sym_name_len(s->mrb, s->filename_sym, NULL); + fprintf(stderr, "%s:%d: %s\n", filename, s->lineno, message); } else { - fprintf(stderr, "codegen error: %s\n", message); + fprintf(stderr, "%s\n", message); } #endif MRB_THROW(&s->jmp); @@ -125,15 +160,6 @@ codegen_palloc(codegen_scope *s, size_t len) } static void* -codegen_malloc(codegen_scope *s, size_t len) -{ - void *p = mrb_malloc_simple(s->mrb, len); - - if (!p) codegen_error(s, "mrb_malloc"); - return p; -} - -static void* codegen_realloc(codegen_scope *s, void *p, size_t len) { p = mrb_realloc_simple(s->mrb, p, len); @@ -151,22 +177,26 @@ new_label(codegen_scope *s) static void emit_B(codegen_scope *s, uint32_t pc, uint8_t i) { - if (pc >= MAXARG_S || s->icapa >= MAXARG_S) { - codegen_error(s, "too big code block"); - } if (pc >= s->icapa) { - s->icapa *= 2; - if (s->icapa > MAXARG_S) { - s->icapa = MAXARG_S; + if (pc == UINT32_MAX) { + codegen_error(s, "too big code block"); + } + if (pc >= UINT32_MAX / 2) { + pc = UINT32_MAX; + } + else { + s->icapa *= 2; } s->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->icapa); if (s->lines) { s->lines = (uint16_t*)codegen_realloc(s, s->lines, sizeof(uint16_t)*s->icapa); - s->irep->lines = s->lines; } } if (s->lines) { - s->lines[pc] = s->lineno; + if (s->lineno > 0 || pc == 0) + s->lines[pc] = s->lineno; + else + s->lines[pc] = s->lines[pc-1]; } s->iseq[pc] = i; } @@ -261,6 +291,14 @@ genop_2S(codegen_scope *s, mrb_code i, uint16_t a, uint16_t b) } static void +genop_2SS(codegen_scope *s, mrb_code i, uint16_t a, uint32_t b) +{ + genop_1(s, i, a); + gen_S(s, b>>16); + gen_S(s, b&0xffff); +} + +static void genop_W(codegen_scope *s, mrb_code i, uint32_t a) { uint8_t a1 = (a>>16) & 0xff; @@ -277,8 +315,7 @@ genop_W(codegen_scope *s, mrb_code i, uint32_t a) #define NOVAL 0 #define VAL 1 -//static -mrb_bool +static mrb_bool no_optimize(codegen_scope *s) { if (s && s->parser && s->parser->no_optimize) @@ -286,23 +323,14 @@ no_optimize(codegen_scope *s) return FALSE; } -static -mrb_bool -on_eval(codegen_scope *s) -{ - if (s && s->parser && s->parser->on_eval) - return TRUE; - return FALSE; -} - struct mrb_insn_data -mrb_decode_insn(mrb_code *pc) +mrb_decode_insn(const mrb_code *pc) { struct mrb_insn_data data = { 0 }; mrb_code insn = READ_B(); uint16_t a = 0; uint16_t b = 0; - uint8_t c = 0; + uint16_t c = 0; switch (insn) { #define FETCH_Z() /* empty */ @@ -363,22 +391,44 @@ no_peephole(codegen_scope *s) return no_optimize(s) || s->lastlabel == s->pc || s->pc == 0 || s->pc == s->lastpc; } -static uint16_t -genjmp(codegen_scope *s, mrb_code i, uint16_t pc) +#define JMPLINK_START UINT32_MAX + +static void +gen_jmpdst(codegen_scope *s, uint32_t pc) +{ + + if (pc == JMPLINK_START) { + gen_S(s, 0); + } + else { + uint32_t pos2 = s->pc+2; + int32_t off = pc - pos2; + + if (off > INT16_MAX || INT16_MIN > off) { + codegen_error(s, "too big jump offset"); + } + gen_S(s, (uint16_t)off); + } +} + +static uint32_t +genjmp(codegen_scope *s, mrb_code i, uint32_t pc) { - uint16_t pos; + uint32_t pos; s->lastpc = s->pc; gen_B(s, i); pos = s->pc; - gen_S(s, pc); + gen_jmpdst(s, pc); return pos; } -static uint16_t -genjmp2(codegen_scope *s, mrb_code i, uint16_t a, int pc, int val) +#define genjmp_0(s,i) genjmp(s,i,JMPLINK_START) + +static uint32_t +genjmp2(codegen_scope *s, mrb_code i, uint16_t a, uint32_t pc, int val) { - uint16_t pos; + uint32_t pos; if (!no_peephole(s) && !val) { struct mrb_insn_data data = mrb_last_insn(s); @@ -394,27 +444,24 @@ genjmp2(codegen_scope *s, mrb_code i, uint16_t a, int pc, int val) gen_B(s, OP_EXT1); gen_B(s, i); gen_S(s, a); - pos = s->pc; - gen_S(s, pc); } else { gen_B(s, i); gen_B(s, (uint8_t)a); - pos = s->pc; - gen_S(s, pc); } + pos = s->pc; + gen_jmpdst(s, pc); return pos; } +#define genjmp2_0(s,i,a,val) genjmp2(s,i,a,JMPLINK_START,val) + static void gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep) { if (no_peephole(s)) { normal: genop_2(s, OP_MOVE, dst, src); - if (on_eval(s)) { - genop_0(s, OP_NOP); - } return; } else { @@ -434,7 +481,8 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep) s->pc = s->lastpc; genop_1(s, data.insn, dst); break; - case OP_LOADI: case OP_LOADINEG: case OP_LOADL: case OP_LOADSYM: + case OP_LOADI: case OP_LOADINEG: + case OP_LOADL: case OP_LOADSYM: case OP_GETGV: case OP_GETSV: case OP_GETIV: case OP_GETCV: case OP_GETCONST: case OP_STRING: case OP_LAMBDA: case OP_BLOCK: case OP_METHOD: case OP_BLKPUSH: @@ -468,11 +516,11 @@ gen_return(codegen_scope *s, uint8_t op, uint16_t src) } static void -gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst, uint16_t idx) +gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst) { if (no_peephole(s)) { normal: - genop_2(s, op, dst, idx); + genop_1(s, op, dst); return; } else { @@ -493,10 +541,10 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst, uint16_t idx) if (data.b >= 128) goto normal; s->pc = s->lastpc; if (op == OP_ADD) { - genop_3(s, OP_ADDI, dst, idx, (uint8_t)data.b); + genop_2(s, OP_ADDI, dst, (uint8_t)data.b); } else { - genop_3(s, OP_SUBI, dst, idx, (uint8_t)data.b); + genop_2(s, OP_SUBI, dst, (uint8_t)data.b); } break; default: @@ -505,21 +553,31 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst, uint16_t idx) } } -static int -dispatch(codegen_scope *s, uint16_t pos0) +static uint32_t +dispatch(codegen_scope *s, uint32_t pos0) { - uint16_t newpos; + int32_t pos1; + int32_t offset; + int16_t newpos; + + if (pos0 == JMPLINK_START) return 0; + pos1 = pos0 + 2; + offset = s->pc - pos1; + if (offset > INT16_MAX) { + codegen_error(s, "too big jmp offset"); + } s->lastlabel = s->pc; - newpos = PEEK_S(s->iseq+pos0); - emit_S(s, pos0, s->pc); - return newpos; + newpos = (int16_t)PEEK_S(s->iseq+pos0); + emit_S(s, pos0, (uint16_t)offset); + if (newpos == 0) return 0; + return pos1+newpos; } static void -dispatch_linked(codegen_scope *s, uint16_t pos) +dispatch_linked(codegen_scope *s, uint32_t pos) { - if (pos==0) return; + if (pos==JMPLINK_START) return; for (;;) { pos = dispatch(s, pos); if (pos==0) break; @@ -552,38 +610,91 @@ pop_n_(codegen_scope *s, int n) #define pop_n(n) pop_n_(s,n) #define cursp() (s->sp) -static inline int +static int +new_litbn(codegen_scope *s, const char *p, int base, mrb_bool neg) +{ + int i; + size_t plen; + mrb_pool_value *pv; + + plen = strlen(p); + if (plen > 255) { + codegen_error(s, "integer too big"); + } + for (i=0; i<s->irep->plen; i++) { + size_t len; + pv = &s->pool[i]; + if (pv->tt != IREP_TT_BIGINT) continue; + len = pv->u.str[0]; + if (len == plen && pv->u.str[1] == base && memcmp(pv->u.str+2, p, len) == 0) + return i; + } + + if (s->irep->plen == s->pcapa) { + s->pcapa *= 2; + s->pool = (mrb_pool_value*)codegen_realloc(s, s->pool, sizeof(mrb_pool_value)*s->pcapa); + } + + pv = &s->pool[s->irep->plen]; + i = s->irep->plen++; + { + char *buf; + pv->tt = IREP_TT_BIGINT; + buf = (char*)codegen_realloc(s, NULL, plen+3); + buf[0] = (char)plen; + buf[1] = base; + if (neg) buf[1] = 0x80; + memcpy(buf+2, p, plen); + buf[plen+2] = '\0'; + pv->u.str = buf; + } + return i; +} + +static int new_lit(codegen_scope *s, mrb_value val) { int i; - mrb_value *pv; + mrb_pool_value *pv; switch (mrb_type(val)) { case MRB_TT_STRING: for (i=0; i<s->irep->plen; i++) { mrb_int len; - pv = &s->irep->pool[i]; - - if (mrb_type(*pv) != MRB_TT_STRING) continue; - if ((len = RSTRING_LEN(*pv)) != RSTRING_LEN(val)) continue; - if (memcmp(RSTRING_PTR(*pv), RSTRING_PTR(val), len) == 0) + pv = &s->pool[i]; + if (pv->tt & IREP_TT_NFLAG) continue; + len = pv->tt>>2; + if (RSTRING_LEN(val) != len) continue; + if (memcmp(pv->u.str, RSTRING_PTR(val), len) == 0) return i; } break; -#ifndef MRB_WITHOUT_FLOAT +#ifndef MRB_NO_FLOAT case MRB_TT_FLOAT: for (i=0; i<s->irep->plen; i++) { - pv = &s->irep->pool[i]; - if (mrb_type(*pv) != MRB_TT_FLOAT) continue; - if (mrb_float(*pv) == mrb_float(val)) return i; + mrb_float f1, f2; + pv = &s->pool[i]; + if (pv->tt != IREP_TT_FLOAT) continue; + pv = &s->pool[i]; + f1 = pv->u.f; + f2 = mrb_float(val); + if (f1 == f2 && !signbit(f1) == !signbit(f2)) return i; } break; #endif - case MRB_TT_FIXNUM: + case MRB_TT_INTEGER: for (i=0; i<s->irep->plen; i++) { - pv = &s->irep->pool[i]; - if (!mrb_fixnum_p(*pv)) continue; - if (mrb_fixnum(*pv) == mrb_fixnum(val)) return i; + mrb_int v = mrb_integer(val); + pv = &s->pool[i]; + if (pv->tt == IREP_TT_INT32) { + if (v == pv->u.i32) return i; + } +#ifdef MRB_64BIT + else if (pv->tt == IREP_TT_INT64) { + if (v == pv->u.i64) return i; + } + continue; +#endif } break; default: @@ -593,26 +704,43 @@ new_lit(codegen_scope *s, mrb_value val) if (s->irep->plen == s->pcapa) { s->pcapa *= 2; - s->irep->pool = (mrb_value *)codegen_realloc(s, s->irep->pool, sizeof(mrb_value)*s->pcapa); + s->pool = (mrb_pool_value*)codegen_realloc(s, s->pool, sizeof(mrb_pool_value)*s->pcapa); } - pv = &s->irep->pool[s->irep->plen]; + pv = &s->pool[s->irep->plen]; i = s->irep->plen++; switch (mrb_type(val)) { case MRB_TT_STRING: - *pv = mrb_str_pool(s->mrb, val); + if (RSTR_NOFREE_P(RSTRING(val))) { + pv->tt = (uint32_t)(RSTRING_LEN(val)<<2) | IREP_TT_SSTR; + pv->u.str = RSTRING_PTR(val); + } + else { + char *p; + mrb_int len = RSTRING_LEN(val); + pv->tt = (uint32_t)(len<<2) | IREP_TT_STR; + p = (char*)codegen_realloc(s, NULL, len+1); + memcpy(p, RSTRING_PTR(val), len); + p[len] = '\0'; + pv->u.str = p; + } break; -#ifndef MRB_WITHOUT_FLOAT +#ifndef MRB_NO_FLOAT case MRB_TT_FLOAT: -#ifdef MRB_WORD_BOXING - *pv = mrb_float_pool(s->mrb, mrb_float(val)); + pv->tt = IREP_TT_FLOAT; + pv->u.f = mrb_float(val); break; #endif + case MRB_TT_INTEGER: +#ifdef MRB_INT64 + pv->tt = IREP_TT_INT64; + pv->u.i64 = mrb_integer(val); +#else + pv->tt = IREP_TT_INT32; + pv->u.i32 = mrb_integer(val); #endif - case MRB_TT_FIXNUM: - *pv = val; break; default: @@ -622,9 +750,6 @@ new_lit(codegen_scope *s, mrb_value val) return i; } -/* maximum symbol numbers */ -#define MAXSYMLEN 0x10000 - static int new_sym(codegen_scope *s, mrb_sym sym) { @@ -634,13 +759,16 @@ new_sym(codegen_scope *s, mrb_sym sym) len = s->irep->slen; for (i=0; i<len; i++) { - if (s->irep->syms[i] == sym) return i; + if (s->syms[i] == sym) return i; } if (s->irep->slen >= s->scapa) { s->scapa *= 2; - s->irep->syms = (mrb_sym*)codegen_realloc(s, s->irep->syms, sizeof(mrb_sym)*s->scapa); + if (s->scapa > 0xffff) { + codegen_error(s, "too many symbols"); + } + s->syms = (mrb_sym*)codegen_realloc(s, s->syms, sizeof(mrb_sym)*s->scapa); } - s->irep->syms[s->irep->slen] = sym; + s->syms[s->irep->slen] = sym; return s->irep->slen++; } @@ -676,6 +804,47 @@ lv_idx(codegen_scope *s, mrb_sym id) return 0; } +static int +search_upvar(codegen_scope *s, mrb_sym id, int *idx) +{ + const struct RProc *u; + int lv = 0; + codegen_scope *up = s->prev; + + while (up) { + *idx = lv_idx(up, id); + if (*idx > 0) { + return lv; + } + lv ++; + up = up->prev; + } + + if (lv < 1) lv = 1; + u = s->parser->upper; + while (u && !MRB_PROC_CFUNC_P(u)) { + const struct mrb_irep *ir = u->body.irep; + uint_fast16_t n = ir->nlocals; + int i; + + const mrb_sym *v = ir->lv; + if (v) { + for (i=1; n > 1; n--, v++, i++) { + if (*v == id) { + *idx = i; + return lv - 1; + } + } + } + if (MRB_PROC_SCOPE_P(u)) break; + u = u->upper; + lv ++; + } + + codegen_error(s, "Can't found local variables"); + return -1; /* not reached */ +} + static void for_body(codegen_scope *s, node *tree) { @@ -688,9 +857,6 @@ for_body(codegen_scope *s, node *tree) codegen(s, tree->cdr->car, VAL); /* generate loop-block */ s = scope_new(s->mrb, s, NULL); - if (s == NULL) { - raise_error(prev, "unexpected scope"); - } push(); /* push for a block parameter */ @@ -717,7 +883,7 @@ for_body(codegen_scope *s, node *tree) genop_2(s, OP_BLOCK, cursp(), s->irep->rlen-1); push();pop(); /* space for a block */ pop(); - idx = new_sym(s, mrb_intern_lit(s->mrb, "each")); + idx = new_sym(s, MRB_SYM_2(s->mrb, each)); genop_3(s, OP_SENDB, cursp(), idx, 0); } @@ -726,9 +892,6 @@ lambda_body(codegen_scope *s, node *tree, int blk) { codegen_scope *parent = s; s = scope_new(s->mrb, s, tree->car); - if (s == NULL) { - raise_error(parent, "unexpected scope"); - } s->mscope = !blk; @@ -737,27 +900,30 @@ lambda_body(codegen_scope *s, node *tree, int blk) lp->pc0 = new_label(s); } tree = tree->cdr; - if (tree->car) { + if (tree->car == NULL) { + genop_W(s, OP_ENTER, 0); + s->ainfo = 0; + } + else { mrb_aspec a; int ma, oa, ra, pa, ka, kd, ba; int pos, i; - node *n, *opt; + node *opt; + node *margs, *pargs; node *tail; /* mandatory arguments */ ma = node_len(tree->car->car); - n = tree->car->car; - while (n) { - n = n->cdr; - } + margs = tree->car->car; tail = tree->car->cdr->cdr->cdr->cdr; /* optional arguments */ oa = node_len(tree->car->cdr->car); /* rest argument? */ ra = tree->car->cdr->cdr->car ? 1 : 0; - /* mandatory arugments after rest argument */ + /* mandatory arguments after rest argument */ pa = node_len(tree->car->cdr->cdr->cdr->car); + pargs = tree->car->cdr->cdr->cdr->car; /* keyword arguments */ ka = tail? node_len(tail->cdr->car) : 0; /* keyword dictionary? */ @@ -777,27 +943,34 @@ lambda_body(codegen_scope *s, node *tree, int blk) s->ainfo = (((ma+oa) & 0x3f) << 7) /* (12bits = 5:1:5:1) */ | ((ra & 0x1) << 6) | ((pa & 0x1f) << 1) - | (kd & 0x1); + | ((ka | kd) != 0 ? 0x01 : 0x00); genop_W(s, OP_ENTER, a); /* generate jump table for optional arguments initializer */ pos = new_label(s); for (i=0; i<oa; i++) { new_label(s); - genjmp(s, OP_JMP, 0); + genjmp_0(s, OP_JMP); } if (oa > 0) { - genjmp(s, OP_JMP, 0); + genjmp_0(s, OP_JMP); } opt = tree->car->cdr->car; i = 0; while (opt) { int idx; + mrb_sym id = nsym(opt->car->car); dispatch(s, pos+i*3+1); codegen(s, opt->car->cdr, VAL); pop(); - idx = lv_idx(s, nsym(opt->car->car)); - gen_move(s, idx, cursp(), 0); + idx = lv_idx(s, id); + if (idx > 0) { + gen_move(s, idx, cursp(), 0); + } + else { + int lv = search_upvar(s, id, &idx); + genop_3(s, OP_GETUPVAR, cursp(), idx, lv); + } i++; opt = opt->cdr; } @@ -805,6 +978,7 @@ lambda_body(codegen_scope *s, node *tree, int blk) dispatch(s, pos+i*3+1); } + /* keyword arguments */ if (tail) { node *kwds = tail->cdr->car; int kwrest = 0; @@ -823,12 +997,20 @@ lambda_body(codegen_scope *s, node *tree, int blk) mrb_assert(nint(kwd->car) == NODE_KW_ARG); if (def_arg) { - genop_2(s, OP_KEY_P, cursp(), new_sym(s, kwd_sym)); - jmpif_key_p = genjmp2(s, OP_JMPIF, cursp(), 0, 0); + int idx; + genop_2(s, OP_KEY_P, lv_idx(s, kwd_sym), new_sym(s, kwd_sym)); + jmpif_key_p = genjmp2_0(s, OP_JMPIF, lv_idx(s, kwd_sym), NOVAL); codegen(s, def_arg, VAL); pop(); - gen_move(s, lv_idx(s, kwd_sym), cursp(), 0); - jmp_def_set = genjmp(s, OP_JMP, 0); + idx = lv_idx(s, kwd_sym); + if (idx > 0) { + gen_move(s, idx, cursp(), 0); + } + else { + int lv = search_upvar(s, kwd_sym, &idx); + genop_3(s, OP_GETUPVAR, cursp(), idx, lv); + } + jmp_def_set = genjmp_0(s, OP_JMP); dispatch(s, jmpif_key_p); } genop_2(s, OP_KARG, lv_idx(s, kwd_sym), new_sym(s, kwd_sym)); @@ -843,7 +1025,34 @@ lambda_body(codegen_scope *s, node *tree, int blk) genop_0(s, OP_KEYEND); } } + + /* argument destructuring */ + if (margs) { + node *n = margs; + + pos = 1; + while (n) { + if (nint(n->car->car) == NODE_MASGN) { + gen_vmassignment(s, n->car->cdr->car, pos, NOVAL); + } + pos++; + n = n->cdr; + } + } + if (pargs) { + node *n = margs; + + pos = ma+oa+ra+1; + while (n) { + if (nint(n->car->car) == NODE_MASGN) { + gen_vmassignment(s, n->car->cdr->car, pos, NOVAL); + } + pos++; + n = n->cdr; + } + } } + codegen(s, tree->cdr->car, VAL); pop(); if (s->pc > 0) { @@ -860,9 +1069,6 @@ static int scope_body(codegen_scope *s, node *tree, int val) { codegen_scope *scope = scope_new(s->mrb, s, tree->car); - if (scope == NULL) { - codegen_error(s, "unexpected scope"); - } codegen(scope, tree->cdr, VAL); gen_return(scope, OP_RETURN, scope->sp-1); @@ -894,7 +1100,7 @@ attrsym(codegen_scope *s, mrb_sym a) mrb_int len; char *name2; - name = mrb_sym2name_len(s->mrb, a, &len); + name = mrb_sym_name_len(s->mrb, a, &len); name2 = (char *)codegen_palloc(s, (size_t)len + 1 /* '=' */ @@ -928,7 +1134,12 @@ gen_values(codegen_scope *s, node *t, int val, int extra) } else { pop_n(n); - genop_2(s, OP_ARRAY, cursp(), n); + if (n == 0 && is_splat) { + genop_1(s, OP_LOADNIL, cursp()); + } + else { + genop_2(s, OP_ARRAY, cursp(), n); + } push(); codegen(s, t->car, VAL); pop(); pop(); @@ -973,16 +1184,15 @@ static void gen_call(codegen_scope *s, node *tree, mrb_sym name, int sp, int val, int safe) { mrb_sym sym = name ? name : nsym(tree->cdr->car); - int idx, skip = 0; + int skip = 0; int n = 0, noop = 0, sendv = 0, blk = 0; codegen(s, tree->car, VAL); /* receiver */ if (safe) { int recv = cursp()-1; gen_move(s, cursp(), recv, 1); - skip = genjmp2(s, OP_JMPNIL, cursp(), 0, val); + skip = genjmp2_0(s, OP_JMPNIL, cursp(), val); } - idx = new_sym(s, sym); tree = tree->cdr->cdr->car; if (tree) { n = gen_values(s, tree->car, VAL, sp?1:0); @@ -1014,36 +1224,38 @@ gen_call(codegen_scope *s, node *tree, mrb_sym name, int sp, int val, int safe) pop_n(n+1); { mrb_int symlen; - const char *symname = mrb_sym2name_len(s->mrb, sym, &symlen); + const char *symname = mrb_sym_name_len(s->mrb, sym, &symlen); if (!noop && symlen == 1 && symname[0] == '+' && n == 1) { - gen_addsub(s, OP_ADD, cursp(), idx); + gen_addsub(s, OP_ADD, cursp()); } else if (!noop && symlen == 1 && symname[0] == '-' && n == 1) { - gen_addsub(s, OP_SUB, cursp(), idx); + gen_addsub(s, OP_SUB, cursp()); } else if (!noop && symlen == 1 && symname[0] == '*' && n == 1) { - genop_2(s, OP_MUL, cursp(), idx); + genop_1(s, OP_MUL, cursp()); } else if (!noop && symlen == 1 && symname[0] == '/' && n == 1) { - genop_2(s, OP_DIV, cursp(), idx); + genop_1(s, OP_DIV, cursp()); } else if (!noop && symlen == 1 && symname[0] == '<' && n == 1) { - genop_2(s, OP_LT, cursp(), idx); + genop_1(s, OP_LT, cursp()); } else if (!noop && symlen == 2 && symname[0] == '<' && symname[1] == '=' && n == 1) { - genop_2(s, OP_LE, cursp(), idx); + genop_1(s, OP_LE, cursp()); } else if (!noop && symlen == 1 && symname[0] == '>' && n == 1) { - genop_2(s, OP_GT, cursp(), idx); + genop_1(s, OP_GT, cursp()); } else if (!noop && symlen == 2 && symname[0] == '>' && symname[1] == '=' && n == 1) { - genop_2(s, OP_GE, cursp(), idx); + genop_1(s, OP_GE, cursp()); } else if (!noop && symlen == 2 && symname[0] == '=' && symname[1] == '=' && n == 1) { - genop_2(s, OP_EQ, cursp(), idx); + genop_1(s, OP_EQ, cursp()); } else { + int idx = new_sym(s, sym); + if (sendv) { genop_2(s, blk ? OP_SENDVB : OP_SENDV, cursp(), idx); } @@ -1072,30 +1284,24 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val) idx = new_sym(s, nsym(tree)); genop_2(s, OP_SETGV, sp, idx); break; + case NODE_ARG: case NODE_LVAR: idx = lv_idx(s, nsym(tree)); if (idx > 0) { if (idx != sp) { gen_move(s, idx, sp, val); - if (val && on_eval(s)) genop_0(s, OP_NOP); } break; } else { /* upvar */ - int lv = 0; - codegen_scope *up = s->prev; - - while (up) { - idx = lv_idx(up, nsym(tree)); - if (idx > 0) { - genop_3(s, OP_SETUPVAR, sp, idx, lv); - break; - } - lv++; - up = up->prev; - } + int lv = search_upvar(s, nsym(tree), &idx); + genop_3(s, OP_SETUPVAR, sp, idx, lv); } break; + case NODE_NVAR: + idx = nint(tree); + codegen_error(s, "Can't assign to numbered parameter"); + break; case NODE_IVAR: idx = new_sym(s, nsym(tree)); genop_2(s, OP_SETIV, sp, idx); @@ -1137,9 +1343,7 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val) break; default: -#ifndef MRB_DISABLE_STDIO - fprintf(stderr, "unknown lhs %d\n", type); -#endif + codegen_error(s, "unknown lhs"); break; } if (val) push(); @@ -1179,7 +1383,7 @@ gen_vmassignment(codegen_scope *s, node *tree, int rhs, int val) pop_n(post+1); genop_3(s, OP_APOST, cursp(), n, post); n = 1; - if (t->car) { /* rest */ + if (t->car && t->car != (node*)-1) { /* rest */ gen_assignment(s, t->car, cursp(), NOVAL); } if (t->cdr && t->cdr->car) { @@ -1266,70 +1470,37 @@ raise_error(codegen_scope *s, const char *msg) genop_1(s, OP_ERR, idx); } -#ifndef MRB_WITHOUT_FLOAT -static double -readint_float(codegen_scope *s, const char *p, int base) -{ - const char *e = p + strlen(p); - double f = 0; - int n; - - if (*p == '+') p++; - while (p < e) { - char c = *p; - c = tolower((unsigned char)c); - for (n=0; n<base; n++) { - if (mrb_digitmap[n] == c) { - f *= base; - f += n; - break; - } - } - if (n == base) { - codegen_error(s, "malformed readint input"); - } - p++; - } - return f; -} -#endif - static mrb_int -readint_mrb_int(codegen_scope *s, const char *p, int base, mrb_bool neg, mrb_bool *overflow) +readint(codegen_scope *s, const char *p, int base, mrb_bool *overflow) { const char *e = p + strlen(p); mrb_int result = 0; - int n; mrb_assert(base >= 2 && base <= 36); if (*p == '+') p++; while (p < e) { + int n; char c = *p; - c = tolower((unsigned char)c); - for (n=0; n<base; n++) { - if (mrb_digitmap[n] == c) { - break; - } - } - if (n == base) { + switch (c) { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + n = c - '0'; break; + case '8': case '9': + n = c - '0'; break; + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + n = c - 'a' + 10; break; + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + n = c - 'A' + 10; break; + default: codegen_error(s, "malformed readint input"); + *overflow = TRUE; + /* not reached */ + return result; } - - if (neg) { - if ((MRB_INT_MIN + n)/base > result) { - *overflow = TRUE; - return 0; - } - result *= base; - result -= n; - } - else { - if ((MRB_INT_MAX - n)/base < result) { - *overflow = TRUE; - return 0; - } - result *= base; - result += n; + if (mrb_int_mul_overflow(result, base, &result) || + mrb_int_add_overflow(result, n, &result)) { + *overflow = TRUE; + return 0; } p++; } @@ -1370,11 +1541,14 @@ codegen(codegen_scope *s, node *tree, int val) codegen_error(s, "too complex expression"); } if (s->irep && s->filename_index != tree->filename_index) { - s->irep->filename = mrb_parser_get_filename(s->parser, s->filename_index); - mrb_debug_info_append_file(s->mrb, s->irep, s->debug_start_pos, s->pc); + mrb_sym fname = mrb_parser_get_filename(s->parser, s->filename_index); + const char *filename = mrb_sym_name_len(s->mrb, fname, NULL); + + mrb_debug_info_append_file(s->mrb, s->irep->debug_info, + filename, s->lines, s->debug_start_pos, s->pc); s->debug_start_pos = s->pc; s->filename_index = tree->filename_index; - s->filename = mrb_parser_get_filename(s->parser, tree->filename_index); + s->filename_sym = mrb_parser_get_filename(s->parser, tree->filename_index); } nt = nint(tree->car); @@ -1394,21 +1568,25 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_RESCUE: { - int noexc, exend, pos1, pos2, tmp; + int noexc; + uint32_t exend, pos1, pos2, tmp; struct loopinfo *lp; + int catch_entry, begin, end; if (tree->car == NULL) goto exit; lp = loop_push(s, LOOP_BEGIN); lp->pc0 = new_label(s); - lp->pc1 = genjmp(s, OP_ONERR, 0); + catch_entry = catch_handler_new(s); + begin = s->pc; codegen(s, tree->car, VAL); pop(); lp->type = LOOP_RESCUE; - noexc = genjmp(s, OP_JMP, 0); - dispatch(s, lp->pc1); + end = s->pc; + noexc = genjmp_0(s, OP_JMP); + catch_handler_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc); tree = tree->cdr; - exend = 0; - pos1 = 0; + exend = JMPLINK_START; + pos1 = JMPLINK_START; if (tree->car) { node *n2 = tree->car; int exc = cursp(); @@ -1419,22 +1597,22 @@ codegen(codegen_scope *s, node *tree, int val) node *n3 = n2->car; node *n4 = n3->car; - if (pos1) dispatch(s, pos1); - pos2 = 0; + dispatch(s, pos1); + pos2 = JMPLINK_START; do { if (n4 && n4->car && nint(n4->car->car) == NODE_SPLAT) { codegen(s, n4->car, VAL); gen_move(s, cursp(), exc, 0); push_n(2); pop_n(2); /* space for one arg and a block */ pop(); - genop_3(s, OP_SEND, cursp(), new_sym(s, mrb_intern_lit(s->mrb, "__case_eqq")), 1); + genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_SYM_2(s->mrb, __case_eqq)), 1); } else { if (n4) { codegen(s, n4->car, VAL); } else { - genop_2(s, OP_GETCONST, cursp(), new_sym(s, mrb_intern_lit(s->mrb, "StandardError"))); + genop_2(s, OP_GETCONST, cursp(), new_sym(s, MRB_SYM_2(s->mrb, StandardError))); push(); } pop(); @@ -1446,7 +1624,7 @@ codegen(codegen_scope *s, node *tree, int val) n4 = n4->cdr; } } while (n4); - pos1 = genjmp(s, OP_JMP, 0); + pos1 = genjmp_0(s, OP_JMP); dispatch_linked(s, pos2); pop(); @@ -1462,15 +1640,14 @@ codegen(codegen_scope *s, node *tree, int val) n2 = n2->cdr; push(); } - if (pos1) { + if (pos1 != JMPLINK_START) { dispatch(s, pos1); - genop_1(s, OP_RAISE, exc); + genop_1(s, OP_RAISEIF, exc); } } pop(); tree = tree->cdr; dispatch(s, noexc); - genop_1(s, OP_POPERR, 1); if (tree->car) { codegen(s, tree->car, val); } @@ -1486,14 +1663,22 @@ codegen(codegen_scope *s, node *tree, int val) if (!tree->cdr || !tree->cdr->cdr || (nint(tree->cdr->cdr->car) == NODE_BEGIN && tree->cdr->cdr->cdr)) { + int catch_entry, begin, end, target; int idx; - s->ensure_level++; - idx = scope_body(s, tree->cdr, NOVAL); - genop_1(s, OP_EPUSH, idx); + catch_entry = catch_handler_new(s); + begin = s->pc; codegen(s, tree->car, val); - s->ensure_level--; - genop_1(s, OP_EPOP, 1); + end = target = s->pc; + push(); + idx = cursp(); + genop_1(s, OP_EXCEPT, idx); + push(); + codegen(s, tree->cdr->cdr, NOVAL); + pop(); + genop_1(s, OP_RAISEIF, idx); + pop(); + catch_handler_set(s, catch_entry, MRB_CATCH_ENSURE, begin, end, target); } else { /* empty ensure ignored */ codegen(s, tree->car, val); @@ -1520,7 +1705,7 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_IF: { - int pos1, pos2; + int pos1, pos2, nil_p = FALSE; node *elsepart = tree->cdr->cdr->car; if (!tree->car) { @@ -1537,32 +1722,59 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_NIL: codegen(s, elsepart, val); goto exit; + case NODE_CALL: + { + node *n = tree->car->cdr; + mrb_sym mid = nsym(n->cdr->car); + mrb_sym mnil = MRB_SYM_Q_2(s->mrb, nil); + if (mid == mnil && n->cdr->cdr->car == NULL) { + nil_p = TRUE; + codegen(s, n->car, VAL); + } + } + break; + } + if (!nil_p) { + codegen(s, tree->car, VAL); } - codegen(s, tree->car, VAL); pop(); - pos1 = genjmp2(s, OP_JMPNOT, cursp(), 0, val); - - codegen(s, tree->cdr->car, val); - if (elsepart) { + if (val || tree->cdr->car) { + if (nil_p) { + pos2 = genjmp2_0(s, OP_JMPNIL, cursp(), val); + pos1 = genjmp_0(s, OP_JMP); + dispatch(s, pos2); + } + else { + pos1 = genjmp2_0(s, OP_JMPNOT, cursp(), val); + } + codegen(s, tree->cdr->car, val); if (val) pop(); - pos2 = genjmp(s, OP_JMP, 0); - dispatch(s, pos1); - codegen(s, elsepart, val); - dispatch(s, pos2); - } - else { - if (val) { - pop(); - pos2 = genjmp(s, OP_JMP, 0); + if (elsepart || val) { + pos2 = genjmp_0(s, OP_JMP); dispatch(s, pos1); - genop_1(s, OP_LOADNIL, cursp()); + codegen(s, elsepart, val); dispatch(s, pos2); - push(); } else { dispatch(s, pos1); } } + else { /* empty then-part */ + if (elsepart) { + if (nil_p) { + pos1 = genjmp2_0(s, OP_JMPNIL, cursp(), val); + } + else { + pos1 = genjmp2_0(s, OP_JMPIF, cursp(), val); + } + codegen(s, elsepart, val); + dispatch(s, pos1); + } + else if (val && !nil_p) { + genop_1(s, OP_LOADNIL, cursp()); + push(); + } + } } break; @@ -1572,7 +1784,7 @@ codegen(codegen_scope *s, node *tree, int val) codegen(s, tree->car, VAL); pop(); - pos = genjmp2(s, OP_JMPNOT, cursp(), 0, val); + pos = genjmp2_0(s, OP_JMPNOT, cursp(), val); codegen(s, tree->cdr, val); dispatch(s, pos); } @@ -1584,7 +1796,7 @@ codegen(codegen_scope *s, node *tree, int val) codegen(s, tree->car, VAL); pop(); - pos = genjmp2(s, OP_JMPIF, cursp(), 0, val); + pos = genjmp2_0(s, OP_JMPIF, cursp(), val); codegen(s, tree->cdr, val); dispatch(s, pos); } @@ -1595,7 +1807,7 @@ codegen(codegen_scope *s, node *tree, int val) struct loopinfo *lp = loop_push(s, LOOP_NORMAL); lp->pc0 = new_label(s); - lp->pc1 = genjmp(s, OP_JMP, 0); + lp->pc1 = genjmp_0(s, OP_JMP); lp->pc2 = new_label(s); codegen(s, tree->cdr, NOVAL); dispatch(s, lp->pc1); @@ -1612,7 +1824,7 @@ codegen(codegen_scope *s, node *tree, int val) struct loopinfo *lp = loop_push(s, LOOP_NORMAL); lp->pc0 = new_label(s); - lp->pc1 = genjmp(s, OP_JMP, 0); + lp->pc1 = genjmp_0(s, OP_JMP); lp->pc2 = new_label(s); codegen(s, tree->cdr, NOVAL); dispatch(s, lp->pc1); @@ -1632,10 +1844,10 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_CASE: { int head = 0; - int pos1, pos2, pos3, tmp; + uint32_t pos1, pos2, pos3, tmp; node *n; - pos3 = 0; + pos3 = JMPLINK_START; if (tree->car) { head = cursp(); codegen(s, tree->car, VAL); @@ -1643,17 +1855,17 @@ codegen(codegen_scope *s, node *tree, int val) tree = tree->cdr; while (tree) { n = tree->car->car; - pos1 = pos2 = 0; + pos1 = pos2 = JMPLINK_START; while (n) { codegen(s, n->car, VAL); if (head) { gen_move(s, cursp(), head, 0); push(); push(); pop(); pop(); pop(); if (nint(n->car->car) == NODE_SPLAT) { - genop_3(s, OP_SEND, cursp(), new_sym(s, mrb_intern_lit(s->mrb, "__case_eqq")), 1); + genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_SYM_2(s->mrb, __case_eqq)), 1); } else { - genop_3(s, OP_SEND, cursp(), new_sym(s, mrb_intern_lit(s->mrb, "===")), 1); + genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_OPSYM_2(s->mrb, eqq)), 1); } } else { @@ -1664,20 +1876,20 @@ codegen(codegen_scope *s, node *tree, int val) n = n->cdr; } if (tree->car->car) { - pos1 = genjmp(s, OP_JMP, 0); + pos1 = genjmp_0(s, OP_JMP); dispatch_linked(s, pos2); } codegen(s, tree->car->cdr, val); if (val) pop(); tmp = genjmp(s, OP_JMP, pos3); pos3 = tmp; - if (pos1) dispatch(s, pos1); + dispatch(s, pos1); tree = tree->cdr; } if (val) { - int pos = cursp(); + uint32_t pos = cursp(); genop_1(s, OP_LOADNIL, cursp()); - if (pos3) dispatch_linked(s, pos3); + if (pos3 != JMPLINK_START) dispatch_linked(s, pos3); if (head) pop(); if (cursp() != pos) { gen_move(s, cursp(), pos, 0); @@ -1685,7 +1897,7 @@ codegen(codegen_scope *s, node *tree, int val) push(); } else { - if (pos3) { + if (pos3 != JMPLINK_START) { dispatch_linked(s, pos3); } if (head) { @@ -1800,7 +2012,7 @@ codegen(codegen_scope *s, node *tree, int val) len++; } tree = tree->cdr; - if (val && len == 255) { + if (val && cursp() > 127) { pop_n(len*2); if (!update) { genop_2(s, OP_HASH, cursp(), len); @@ -1922,24 +2134,26 @@ codegen(codegen_scope *s, node *tree, int val) { mrb_sym sym = nsym(tree->cdr->car); mrb_int len; - const char *name = mrb_sym2name_len(s->mrb, sym, &len); + const char *name = mrb_sym_name_len(s->mrb, sym, &len); int idx, callargs = -1, vsp = -1; if ((len == 2 && name[0] == '|' && name[1] == '|') && (nint(tree->car->car) == NODE_CONST || nint(tree->car->car) == NODE_CVAR)) { - int onerr, noexc, exc; + int catch_entry, begin, end; + int noexc, exc; struct loopinfo *lp; - onerr = genjmp(s, OP_ONERR, 0); lp = loop_push(s, LOOP_BEGIN); - lp->pc1 = onerr; + lp->pc0 = new_label(s); + catch_entry = catch_handler_new(s); + begin = s->pc; exc = cursp(); codegen(s, tree->car, VAL); + end = s->pc; + noexc = genjmp_0(s, OP_JMP); lp->type = LOOP_RESCUE; - genop_1(s, OP_POPERR, 1); - noexc = genjmp(s, OP_JMP, 0); - dispatch(s, onerr); + catch_handler_set(s, catch_entry, MRB_CATCH_RESCUE, begin, end, s->pc); genop_1(s, OP_EXCEPT, exc); genop_1(s, OP_LOADF, exc); dispatch(s, noexc); @@ -1990,10 +2204,10 @@ codegen(codegen_scope *s, node *tree, int val) if (vsp >= 0) { gen_move(s, vsp, cursp(), 1); } - pos = genjmp2(s, name[0]=='|'?OP_JMPIF:OP_JMPNOT, cursp(), 0, val); + pos = genjmp2_0(s, name[0]=='|'?OP_JMPIF:OP_JMPNOT, cursp(), val); } else { - pos = genjmp2(s, name[0]=='|'?OP_JMPIF:OP_JMPNOT, cursp(), 0, val); + pos = genjmp2_0(s, name[0]=='|'?OP_JMPIF:OP_JMPNOT, cursp(), val); } codegen(s, tree->cdr->cdr->car, VAL); pop(); @@ -2023,32 +2237,32 @@ codegen(codegen_scope *s, node *tree, int val) push(); pop(); pop(); pop(); - idx = new_sym(s, sym); if (len == 1 && name[0] == '+') { - gen_addsub(s, OP_ADD, cursp(), idx); + gen_addsub(s, OP_ADD, cursp()); } else if (len == 1 && name[0] == '-') { - gen_addsub(s, OP_SUB, cursp(), idx); + gen_addsub(s, OP_SUB, cursp()); } else if (len == 1 && name[0] == '*') { - genop_2(s, OP_MUL, cursp(), idx); + genop_1(s, OP_MUL, cursp()); } else if (len == 1 && name[0] == '/') { - genop_2(s, OP_DIV, cursp(), idx); + genop_1(s, OP_DIV, cursp()); } else if (len == 1 && name[0] == '<') { - genop_2(s, OP_LT, cursp(), idx); + genop_1(s, OP_LT, cursp()); } else if (len == 2 && name[0] == '<' && name[1] == '=') { - genop_2(s, OP_LE, cursp(), idx); + genop_1(s, OP_LE, cursp()); } else if (len == 1 && name[0] == '>') { - genop_2(s, OP_GT, cursp(), idx); + genop_1(s, OP_GT, cursp()); } else if (len == 2 && name[0] == '>' && name[1] == '=') { - genop_2(s, OP_GE, cursp(), idx); + genop_1(s, OP_GE, cursp()); } else { + idx = new_sym(s, sym); genop_3(s, OP_SEND, cursp(), idx, 1); } if (callargs < 0) { @@ -2124,7 +2338,9 @@ codegen(codegen_scope *s, node *tree, int val) s2 = s2->prev; if (!s2) break; } - if (s2) ainfo = s2->ainfo; + if (s2 && s2->ainfo > 0) { + ainfo = s2->ainfo; + } genop_2S(s, OP_ARGARY, cursp(), (ainfo<<4)|(lv & 0xf)); push(); push(); pop(); /* ARGARY pushes two values */ if (tree && tree->cdr) { @@ -2156,7 +2372,7 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_YIELD: { codegen_scope *s2 = s; - int lv = 0, ainfo = 0; + int lv = 0, ainfo = -1; int n = 0, sendv = 0; while (!s2->mscope) { @@ -2164,7 +2380,10 @@ codegen(codegen_scope *s, node *tree, int val) s2 = s2->prev; if (!s2) break; } - if (s2) ainfo = s2->ainfo; + if (s2) { + ainfo = s2->ainfo; + } + if (ainfo < 0) codegen_error(s, "invalid yield (SyntaxError)"); push(); if (tree) { n = gen_values(s, tree, VAL, 0); @@ -2177,7 +2396,7 @@ codegen(codegen_scope *s, node *tree, int val) pop_n(n+1); genop_2S(s, OP_BLKPUSH, cursp(), (ainfo<<4)|(lv & 0xf)); if (sendv) n = CALL_MAXARGS; - genop_3(s, OP_SEND, cursp(), new_sym(s, mrb_intern_lit(s->mrb, "call")), n); + genop_3(s, OP_SEND, cursp(), new_sym(s, MRB_SYM_2(s->mrb, call)), n); if (val) push(); } break; @@ -2192,11 +2411,8 @@ codegen(codegen_scope *s, node *tree, int val) raise_error(s, "unexpected next"); } else if (s->loop->type == LOOP_NORMAL) { - if (s->ensure_level > s->loop->ensure_level) { - genop_1(s, OP_EPOP, s->ensure_level - s->loop->ensure_level); - } codegen(s, tree, NOVAL); - genjmp(s, OP_JMP, s->loop->pc0); + genjmp(s, OP_JMPUW, s->loop->pc0); } else { if (tree) { @@ -2216,10 +2432,7 @@ codegen(codegen_scope *s, node *tree, int val) raise_error(s, "unexpected redo"); } else { - if (s->ensure_level > s->loop->ensure_level) { - genop_1(s, OP_EPOP, s->ensure_level - s->loop->ensure_level); - } - genjmp(s, OP_JMP, s->loop->pc2); + genjmp(s, OP_JMPUW, s->loop->pc2); } if (val) push(); break; @@ -2227,32 +2440,16 @@ codegen(codegen_scope *s, node *tree, int val) case NODE_RETRY: { const char *msg = "unexpected retry"; + const struct loopinfo *lp = s->loop; - if (!s->loop) { + while (lp && lp->type != LOOP_RESCUE) { + lp = lp->prev; + } + if (!lp) { raise_error(s, msg); } else { - struct loopinfo *lp = s->loop; - int n = 0; - - while (lp && lp->type != LOOP_RESCUE) { - if (lp->type == LOOP_BEGIN) { - n++; - } - lp = lp->prev; - } - if (!lp) { - raise_error(s, msg); - } - else { - if (n > 0) { - genop_1(s, OP_POPERR, n); - } - if (s->ensure_level > lp->ensure_level) { - genop_1(s, OP_EPOP, s->ensure_level - lp->ensure_level); - } - genjmp(s, OP_JMP, lp->pc0); - } + genjmp(s, OP_JMPUW, lp->pc0); } if (val) push(); } @@ -2264,26 +2461,25 @@ codegen(codegen_scope *s, node *tree, int val) if (idx > 0) { gen_move(s, cursp(), idx, val); - if (val && on_eval(s)) genop_0(s, OP_NOP); } else { - int lv = 0; - codegen_scope *up = s->prev; - - while (up) { - idx = lv_idx(up, nsym(tree)); - if (idx > 0) { - genop_3(s, OP_GETUPVAR, cursp(), idx, lv); - break; - } - lv++; - up = up->prev; - } + int lv = search_upvar(s, nsym(tree), &idx); + genop_3(s, OP_GETUPVAR, cursp(), idx, lv); } push(); } break; + case NODE_NVAR: + if (val) { + int idx = nint(tree); + + gen_move(s, cursp(), idx, val); + + push(); + } + break; + case NODE_GVAR: { int sym = new_sym(s, nsym(tree)); @@ -2320,19 +2516,11 @@ codegen(codegen_scope *s, node *tree, int val) } break; - case NODE_DEFINED: - codegen(s, tree, val); - break; - case NODE_BACK_REF: if (val) { - char buf[3]; - int sym; + char buf[] = {'$', nchar(tree)}; + int sym = new_sym(s, mrb_intern(s->mrb, buf, sizeof(buf))); - buf[0] = '$'; - buf[1] = nchar(tree); - buf[2] = 0; - sym = new_sym(s, mrb_intern_cstr(s->mrb, buf)); genop_2(s, OP_GETGV, cursp(), sym); push(); } @@ -2344,7 +2532,7 @@ codegen(codegen_scope *s, node *tree, int val) mrb_value str; int sym; - str = mrb_format(mrb, "$%S", mrb_fixnum_value(nint(tree))); + str = mrb_format(mrb, "$%d", nint(tree)); sym = new_sym(s, mrb_intern_str(mrb, str)); genop_2(s, OP_GETGV, cursp(), sym); push(); @@ -2366,23 +2554,27 @@ codegen(codegen_scope *s, node *tree, int val) mrb_int i; mrb_bool overflow; - i = readint_mrb_int(s, p, base, FALSE, &overflow); -#ifndef MRB_WITHOUT_FLOAT + i = readint(s, p, base, &overflow); if (overflow) { - double f = readint_float(s, p, base); - int off = new_lit(s, mrb_float_value(s->mrb, f)); - + int off = new_litbn(s, p, base, FALSE); genop_2(s, OP_LOADL, cursp(), off); } - else -#endif - { - if (i == -1) genop_1(s, OP_LOADI__1, cursp()); - else if (i < 0) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i); + else { + if (i < 0) { + if (i == -1) genop_1(s, OP_LOADI__1, cursp()); + else if (i >= -0xff) genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i); + else if (i >= INT16_MIN) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i); + else if (i >= INT32_MIN) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i); + else goto lit_int; + } else if (i < 8) genop_1(s, OP_LOADI_0 + (uint8_t)i, cursp()); - else if (i <= 0xffff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i); + else if (i <= 0xff) genop_2(s, OP_LOADI, cursp(), (uint16_t)i); + else if (i <= INT16_MAX) genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i); + else if (i <= INT32_MAX) genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i); else { - int off = new_lit(s, mrb_fixnum_value(i)); + int off; + lit_int: + off = new_lit(s, mrb_int_value(s->mrb, i)); genop_2(s, OP_LOADL, cursp(), off); } } @@ -2390,7 +2582,7 @@ codegen(codegen_scope *s, node *tree, int val) } break; -#ifndef MRB_WITHOUT_FLOAT +#ifndef MRB_NO_FLOAT case NODE_FLOAT: if (val) { char *p = (char*)tree; @@ -2407,7 +2599,7 @@ codegen(codegen_scope *s, node *tree, int val) { nt = nint(tree->car); switch (nt) { -#ifndef MRB_WITHOUT_FLOAT +#ifndef MRB_NO_FLOAT case NODE_FLOAT: if (val) { char *p = (char*)tree->cdr; @@ -2427,34 +2619,35 @@ codegen(codegen_scope *s, node *tree, int val) mrb_int i; mrb_bool overflow; - i = readint_mrb_int(s, p, base, TRUE, &overflow); -#ifndef MRB_WITHOUT_FLOAT + i = readint(s, p, base, &overflow); if (overflow) { - double f = readint_float(s, p, base); - int off = new_lit(s, mrb_float_value(s->mrb, -f)); - + int off = new_litbn(s, p, base, TRUE); genop_2(s, OP_LOADL, cursp(), off); } else { -#endif + i = -i; if (i == -1) genop_1(s, OP_LOADI__1, cursp()); - else if (i >= -0xffff) { + else if (i >= -0xff) { genop_2(s, OP_LOADINEG, cursp(), (uint16_t)-i); } + else if (i >= INT16_MIN) { + genop_2S(s, OP_LOADI16, cursp(), (uint16_t)i); + } + else if (i >= INT32_MIN) { + genop_2SS(s, OP_LOADI32, cursp(), (uint32_t)i); + } else { - int off = new_lit(s, mrb_fixnum_value(i)); + int off = new_lit(s, mrb_int_value(s->mrb, i)); genop_2(s, OP_LOADL, cursp(), off); } -#ifndef MRB_WITHOUT_FLOAT } -#endif push(); } break; default: if (val) { - int sym = new_sym(s, mrb_intern_lit(s->mrb, "-@")); + int sym = new_sym(s, MRB_OPSYM_2(s->mrb, minus)); codegen(s, tree, VAL); pop(); genop_3(s, OP_SEND, cursp(), sym, 0); @@ -2527,7 +2720,7 @@ codegen(codegen_scope *s, node *tree, int val) { node *n; int ai = mrb_gc_arena_save(s->mrb); - int sym = new_sym(s, mrb_intern_lit(s->mrb, "Kernel")); + int sym = new_sym(s, MRB_SYM_2(s->mrb, Kernel)); genop_1(s, OP_LOADSELF, cursp()); push(); @@ -2546,7 +2739,7 @@ codegen(codegen_scope *s, node *tree, int val) } push(); /* for block */ pop_n(3); - sym = new_sym(s, mrb_intern_lit(s->mrb, "`")); + sym = new_sym(s, MRB_OPSYM_2(s->mrb, tick)); /* ` */ genop_3(s, OP_SEND, cursp(), sym, 1); if (val) push(); mrb_gc_arena_restore(s->mrb, ai); @@ -2566,7 +2759,7 @@ codegen(codegen_scope *s, node *tree, int val) genop_2(s, OP_STRING, cursp(), off); push(); push(); pop_n(3); - sym = new_sym(s, mrb_intern_lit(s->mrb, "`")); + sym = new_sym(s, MRB_OPSYM_2(s->mrb, tick)); /* ` */ genop_3(s, OP_SEND, cursp(), sym, 1); if (val) push(); mrb_gc_arena_restore(s->mrb, ai); @@ -2607,7 +2800,7 @@ codegen(codegen_scope *s, node *tree, int val) } push(); /* space for a block */ pop_n(argc+2); - sym = new_sym(s, mrb_intern_lit(s->mrb, "compile")); + sym = new_sym(s, MRB_SYM_2(s->mrb, compile)); genop_3(s, OP_SEND, cursp(), sym, argc); mrb_gc_arena_restore(s->mrb, ai); push(); @@ -2661,7 +2854,7 @@ codegen(codegen_scope *s, node *tree, int val) } push(); /* space for a block */ pop_n(argc+2); - sym = new_sym(s, mrb_intern_lit(s->mrb, "compile")); + sym = new_sym(s, MRB_SYM_2(s->mrb, compile)); genop_3(s, OP_SEND, cursp(), sym, argc); mrb_gc_arena_restore(s->mrb, ai); push(); @@ -2778,7 +2971,10 @@ codegen(codegen_scope *s, node *tree, int val) idx = new_sym(s, nsym(tree->car->cdr)); genop_2(s, OP_CLASS, cursp(), idx); body = tree->cdr->cdr->car; - if (!(nint(body->cdr->car) == NODE_BEGIN && body->cdr->cdr == NULL)) { + if (nint(body->cdr->car) == NODE_BEGIN && body->cdr->cdr == NULL) { + genop_1(s, OP_LOADNIL, cursp()); + } + else { idx = scope_body(s, body, val); genop_2(s, OP_EXEC, cursp(), idx); } @@ -2806,8 +3002,11 @@ codegen(codegen_scope *s, node *tree, int val) pop(); idx = new_sym(s, nsym(tree->car->cdr)); genop_2(s, OP_MODULE, cursp(), idx); - if (!(nint(tree->cdr->car->cdr->car) == NODE_BEGIN && - tree->cdr->car->cdr->cdr == NULL)) { + if (nint(tree->cdr->car->cdr->car) == NODE_BEGIN && + tree->cdr->car->cdr->cdr == NULL) { + genop_1(s, OP_LOADNIL, cursp()); + } + else { idx = scope_body(s, tree->cdr->car, val); genop_2(s, OP_EXEC, cursp(), idx); } @@ -2824,8 +3023,11 @@ codegen(codegen_scope *s, node *tree, int val) codegen(s, tree->car, VAL); pop(); genop_1(s, OP_SCLASS, cursp()); - if (!(nint(tree->cdr->car->cdr->car) == NODE_BEGIN && - tree->cdr->car->cdr->cdr == NULL)) { + if (nint(tree->cdr->car->cdr->car) == NODE_BEGIN && + tree->cdr->car->cdr->cdr == NULL) { + genop_1(s, OP_LOADNIL, cursp()); + } + else { idx = scope_body(s, tree->cdr->car, val); genop_2(s, OP_EXEC, cursp(), idx); } @@ -2846,10 +3048,7 @@ codegen(codegen_scope *s, node *tree, int val) push(); pop(); pop(); genop_2(s, OP_DEF, cursp(), sym); - if (val) { - genop_2(s, OP_LOADSYM, cursp(), sym); - push(); - } + if (val) push(); } break; @@ -2866,10 +3065,7 @@ codegen(codegen_scope *s, node *tree, int val) genop_2(s, OP_METHOD, cursp(), idx); pop(); genop_2(s, OP_DEF, cursp(), sym); - if (val) { - genop_2(s, OP_LOADSYM, cursp(), sym); - push(); - } + if (val) push(); } break; @@ -2885,97 +3081,100 @@ codegen(codegen_scope *s, node *tree, int val) } static void -scope_add_irep(codegen_scope *s, mrb_irep *irep) +scope_add_irep(codegen_scope *s) { - if (s->irep == NULL) { - s->irep = irep; + mrb_irep *irep; + codegen_scope *prev = s->prev; + + if (prev->irep == NULL) { + irep = mrb_add_irep(s->mrb); + prev->irep = s->irep = irep; return; } - if (s->irep->rlen == s->rcapa) { - s->rcapa *= 2; - s->irep->reps = (mrb_irep**)codegen_realloc(s, s->irep->reps, sizeof(mrb_irep*)*s->rcapa); + else { + if (prev->irep->rlen == UINT16_MAX) { + codegen_error(s, "too many nested blocks/methods"); + } + s->irep = irep = mrb_add_irep(s->mrb); + if (prev->irep->rlen == prev->rcapa) { + prev->rcapa *= 2; + prev->reps = (mrb_irep**)codegen_realloc(s, prev->reps, sizeof(mrb_irep*)*prev->rcapa); + } + prev->reps[prev->irep->rlen] = irep; + prev->irep->rlen++; } - s->irep->reps[s->irep->rlen] = irep; - s->irep->rlen++; } static codegen_scope* -scope_new(mrb_state *mrb, codegen_scope *prev, node *lv) +scope_new(mrb_state *mrb, codegen_scope *prev, node *nlv) { static const codegen_scope codegen_scope_zero = { 0 }; mrb_pool *pool = mrb_pool_open(mrb); - codegen_scope *p = (codegen_scope *)mrb_pool_alloc(pool, sizeof(codegen_scope)); - - if (!p) return NULL; - *p = codegen_scope_zero; - p->mrb = mrb; - p->mpool = pool; - if (!prev) return p; - p->prev = prev; - p->ainfo = -1; - p->mscope = 0; - - p->irep = mrb_add_irep(mrb); - scope_add_irep(prev, p->irep); - - p->rcapa = 8; - p->irep->reps = (mrb_irep**)mrb_malloc(mrb, sizeof(mrb_irep*)*p->rcapa); - - p->icapa = 1024; - p->iseq = (mrb_code*)mrb_malloc(mrb, sizeof(mrb_code)*p->icapa); - p->irep->iseq = NULL; - - p->pcapa = 32; - p->irep->pool = (mrb_value*)mrb_malloc(mrb, sizeof(mrb_value)*p->pcapa); - p->irep->plen = 0; - - p->scapa = 256; - p->irep->syms = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym)*p->scapa); - p->irep->slen = 0; - - p->lv = lv; - p->sp += node_len(lv)+1; /* add self */ - p->nlocals = p->sp; - if (lv) { - node *n = lv; + codegen_scope *s = (codegen_scope *)mrb_pool_alloc(pool, sizeof(codegen_scope)); + + if (!s) { + if (prev) + codegen_error(prev, "unexpected scope"); + return NULL; + } + *s = codegen_scope_zero; + s->mrb = mrb; + s->mpool = pool; + if (!prev) return s; + s->prev = prev; + s->ainfo = -1; + s->mscope = 0; + + scope_add_irep(s); + + s->rcapa = 8; + s->reps = (mrb_irep**)mrb_malloc(mrb, sizeof(mrb_irep*)*s->rcapa); + + s->icapa = 1024; + s->iseq = (mrb_code*)mrb_malloc(mrb, sizeof(mrb_code)*s->icapa); + + s->pcapa = 32; + s->pool = (mrb_pool_value*)mrb_malloc(mrb, sizeof(mrb_pool_value)*s->pcapa); + + s->scapa = 256; + s->syms = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym)*s->scapa); + + s->lv = nlv; + s->sp += node_len(nlv)+1; /* add self */ + s->nlocals = s->sp; + if (nlv) { + mrb_sym *lv; + node *n = nlv; size_t i = 0; - p->irep->lv = (struct mrb_locals*)mrb_malloc(mrb, sizeof(struct mrb_locals) * (p->nlocals - 1)); - for (i=0, n=lv; n; i++,n=n->cdr) { - p->irep->lv[i].name = lv_name(n); - if (lv_name(n)) { - p->irep->lv[i].r = lv_idx(p, lv_name(n)); - } - else { - p->irep->lv[i].r = 0; - } + s->irep->lv = lv = (mrb_sym*)mrb_malloc(mrb, sizeof(mrb_sym)*(s->nlocals-1)); + for (i=0, n=nlv; n; i++,n=n->cdr) { + lv[i] = lv_name(n); } - mrb_assert(i + 1 == p->nlocals); + mrb_assert(i + 1 == s->nlocals); } - p->ai = mrb_gc_arena_save(mrb); + s->ai = mrb_gc_arena_save(mrb); - p->filename = prev->filename; - if (p->filename) { - p->lines = (uint16_t*)mrb_malloc(mrb, sizeof(short)*p->icapa); + s->filename_sym = prev->filename_sym; + if (s->filename_sym) { + s->lines = (uint16_t*)mrb_malloc(mrb, sizeof(short)*s->icapa); } - p->lineno = prev->lineno; + s->lineno = prev->lineno; /* debug setting */ - p->debug_start_pos = 0; - if (p->filename) { - mrb_debug_info_alloc(mrb, p->irep); - p->irep->filename = p->filename; - p->irep->lines = p->lines; + s->debug_start_pos = 0; + if (s->filename_sym) { + mrb_debug_info_alloc(mrb, s->irep); } else { - p->irep->debug_info = NULL; + s->irep->debug_info = NULL; } - p->parser = prev->parser; - p->filename_index = prev->filename_index; + s->parser = prev->parser; + s->filename_index = prev->filename_index; - p->rlev = prev->rlev+1; + s->rlev = prev->rlev+1; - return p; + return s; } static void @@ -2983,34 +3182,35 @@ scope_finish(codegen_scope *s) { mrb_state *mrb = s->mrb; mrb_irep *irep = s->irep; - size_t fname_len; - char *fname; + if (s->nlocals > 0xff) { + codegen_error(s, "too many local variables"); + } irep->flags = 0; if (s->iseq) { - irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc); + size_t catchsize = sizeof(struct mrb_irep_catch_handler) * irep->clen; + irep->iseq = (const mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc + catchsize); irep->ilen = s->pc; - if (s->lines) { - irep->lines = (uint16_t *)codegen_realloc(s, s->lines, sizeof(uint16_t)*s->pc); - } - else { - irep->lines = 0; + if (irep->clen > 0) { + memcpy((void *)(irep->iseq + irep->ilen), s->catch_table, catchsize); } } - irep->pool = (mrb_value*)codegen_realloc(s, irep->pool, sizeof(mrb_value)*irep->plen); - irep->syms = (mrb_sym*)codegen_realloc(s, irep->syms, sizeof(mrb_sym)*irep->slen); - irep->reps = (mrb_irep**)codegen_realloc(s, irep->reps, sizeof(mrb_irep*)*irep->rlen); - if (s->filename) { - irep->filename = mrb_parser_get_filename(s->parser, s->filename_index); - mrb_debug_info_append_file(mrb, irep, s->debug_start_pos, s->pc); + else { + irep->clen = 0; + } + mrb_free(s->mrb, s->catch_table); + s->catch_table = NULL; + irep->pool = (const mrb_pool_value*)codegen_realloc(s, s->pool, sizeof(mrb_pool_value)*irep->plen); + irep->syms = (const mrb_sym*)codegen_realloc(s, s->syms, sizeof(mrb_sym)*irep->slen); + irep->reps = (const mrb_irep**)codegen_realloc(s, s->reps, sizeof(mrb_irep*)*irep->rlen); + if (s->filename_sym) { + mrb_sym fname = mrb_parser_get_filename(s->parser, s->filename_index); + const char *filename = mrb_sym_name_len(s->mrb, fname, NULL); - fname_len = strlen(s->filename); - fname = (char*)codegen_malloc(s, fname_len + 1); - memcpy(fname, s->filename, fname_len); - fname[fname_len] = '\0'; - irep->filename = fname; - irep->own_filename = TRUE; + mrb_debug_info_append_file(s->mrb, s->irep->debug_info, + filename, s->lines, s->debug_start_pos, s->pc); } + mrb_free(s->mrb, s->lines); irep->nlocals = s->nlocals; irep->nregs = s->nregs; @@ -3025,9 +3225,8 @@ loop_push(codegen_scope *s, enum looptype t) struct loopinfo *p = (struct loopinfo *)codegen_palloc(s, sizeof(struct loopinfo)); p->type = t; - p->pc0 = p->pc1 = p->pc2 = p->pc3 = 0; + p->pc0 = p->pc1 = p->pc2 = p->pc3 = JMPLINK_START; p->prev = s->loop; - p->ensure_level = s->ensure_level; p->acc = cursp(); s->loop = p; @@ -3043,7 +3242,6 @@ loop_break(codegen_scope *s, node *tree) } else { struct loopinfo *loop; - int n = 0; if (tree) { gen_retval(s, tree); @@ -3052,7 +3250,6 @@ loop_break(codegen_scope *s, node *tree) loop = s->loop; while (loop) { if (loop->type == LOOP_BEGIN) { - n++; loop = loop->prev; } else if (loop->type == LOOP_RESCUE) { @@ -3066,20 +3263,14 @@ loop_break(codegen_scope *s, node *tree) raise_error(s, "unexpected break"); return; } - if (n > 0) { - genop_1(s, OP_POPERR, n); - } if (loop->type == LOOP_NORMAL) { int tmp; - if (s->ensure_level > s->loop->ensure_level) { - genop_1(s, OP_EPOP, s->ensure_level - s->loop->ensure_level); - } if (tree) { gen_move(s, loop->acc, cursp(), 0); } - tmp = genjmp(s, OP_JMP, loop->pc3); + tmp = genjmp(s, OP_JMPUW, loop->pc3); loop->pc3 = tmp; } else { @@ -3102,6 +3293,28 @@ loop_pop(codegen_scope *s, int val) if (val) push(); } +static int +catch_handler_new(codegen_scope *s) +{ + size_t newsize = sizeof(struct mrb_irep_catch_handler) * (s->irep->clen + 1); + s->catch_table = (struct mrb_irep_catch_handler *)codegen_realloc(s, (void *)s->catch_table, newsize); + return s->irep->clen ++; +} + +static void +catch_handler_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t begin, uint32_t end, uint32_t target) +{ + struct mrb_irep_catch_handler *e; + + mrb_assert(ent >= 0 && ent < s->irep->clen); + + e = &s->catch_table[ent]; + uint8_to_bin(type, &e->type); + mrb_irep_catch_handler_pack(begin, e->begin); + mrb_irep_catch_handler_pack(end, e->end); + mrb_irep_catch_handler_pack(target, e->target); +} + static struct RProc* generate_code(mrb_state *mrb, parser_state *p, int val) { @@ -3109,12 +3322,9 @@ generate_code(mrb_state *mrb, parser_state *p, int val) struct RProc *proc; struct mrb_jmpbuf *prev_jmp = mrb->jmp; - if (!scope) { - return NULL; - } scope->mrb = mrb; scope->parser = p; - scope->filename = p->filename; + scope->filename_sym = p->filename_sym; scope->filename_index = p->current_filename_index; MRB_TRY(&scope->jmp) { @@ -3151,13 +3361,14 @@ mrb_irep_remove_lv(mrb_state *mrb, mrb_irep *irep) { int i; + if (irep->flags & MRB_IREP_NO_FREE) return; if (irep->lv) { - mrb_free(mrb, irep->lv); + mrb_free(mrb, (void*)irep->lv); irep->lv = NULL; } - + if (!irep->reps) return; for (i = 0; i < irep->rlen; ++i) { - mrb_irep_remove_lv(mrb, irep->reps[i]); + mrb_irep_remove_lv(mrb, (mrb_irep*)irep->reps[i]); } } @@ -3165,21 +3376,20 @@ mrb_irep_remove_lv(mrb_state *mrb, mrb_irep *irep) #define Z 1 #define S 3 #define W 4 +#define OPCODE(_,x) x, /* instruction sizes */ uint8_t mrb_insn_size[] = { #define B 2 #define BB 3 #define BBB 4 #define BS 4 -#define SB 4 -#define OPCODE(_,x) x, +#define BSS 6 #include "mruby/ops.h" -#undef OPCODE #undef B #undef BB -#undef BS -#undef SB #undef BBB +#undef BS +#undef BSS }; /* EXT1 instruction sizes */ uint8_t mrb_insn_size1[] = { @@ -3187,29 +3397,30 @@ uint8_t mrb_insn_size1[] = { #define BB 4 #define BBB 5 #define BS 5 -#define SB 5 -#define OPCODE(_,x) x, +#define BSS 7 #include "mruby/ops.h" -#undef OPCODE #undef B +#undef BS +#undef BSS }; /* EXT2 instruction sizes */ uint8_t mrb_insn_size2[] = { #define B 2 -#define OPCODE(_,x) x, +#define BS 4 +#define BSS 6 #include "mruby/ops.h" -#undef OPCODE +#undef B #undef BB #undef BBB #undef BS -#undef SB +#undef BSS }; /* EXT3 instruction sizes */ +#define B 3 #define BB 5 #define BBB 6 -#define BS 4 -#define SB 5 +#define BS 5 +#define BSS 7 uint8_t mrb_insn_size3[] = { -#define OPCODE(_,x) x, #include "mruby/ops.h" }; diff --git a/mrbgems/mruby-compiler/core/keywords b/mrbgems/mruby-compiler/core/keywords index 9cb86608c..a5961b6b8 100644 --- a/mrbgems/mruby-compiler/core/keywords +++ b/mrbgems/mruby-compiler/core/keywords @@ -1,8 +1,10 @@ %{ +/* Workaround for `enable_cxx_exception` (#5199) */ +#if defined __cplusplus && __cplusplus >= 201103L +# define register +#endif + struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;}; -const struct kwtable *mrb_reserved_word(const char *, unsigned int); -static const struct kwtable *reserved_word(const char *, unsigned int); -#define mrb_reserved_word(str, len) reserved_word(str, len) %} struct kwtable; diff --git a/mrbgems/mruby-compiler/core/lex.def b/mrbgems/mruby-compiler/core/lex.def index 2ff266481..7c6f316f0 100644 --- a/mrbgems/mruby-compiler/core/lex.def +++ b/mrbgems/mruby-compiler/core/lex.def @@ -1,5 +1,5 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ -/* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' /home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords */ +/* ANSI-C code produced by gperf version 3.1 */ +/* Command-line: gperf -L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k'1,3,$' mrbgems/mruby-compiler/core/keywords */ #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ @@ -25,16 +25,18 @@ && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) /* The character set is not based on ISO-646. */ -#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>." +#error "gperf generated tables don't work with this execution character set. Please report a bug to <[email protected]>." #endif -#line 1 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 1 "mrbgems/mruby-compiler/core/keywords" + +/* Workaround for `enable_cxx_exception` (#5199) */ +#if defined __cplusplus && __cplusplus >= 201103L +# define register +#endif struct kwtable {const char *name; int id[2]; enum mrb_lex_state_enum state;}; -const struct kwtable *mrb_reserved_word(const char *, unsigned int); -static const struct kwtable *reserved_word(const char *, unsigned int); -#define mrb_reserved_word(str, len) reserved_word(str, len) -#line 8 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 10 "mrbgems/mruby-compiler/core/keywords" struct kwtable; #define TOTAL_KEYWORDS 40 @@ -52,7 +54,7 @@ inline #endif #endif static unsigned int -hash (const char *str, unsigned int len) +hash (register const char *str, register size_t len) { static const unsigned char asso_values[] = { @@ -83,7 +85,7 @@ hash (const char *str, unsigned int len) 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51 }; - int hval = len; + register unsigned int hval = len; switch (hval) { @@ -98,109 +100,103 @@ hash (const char *str, unsigned int len) return hval + asso_values[(unsigned char)str[len - 1]]; } -#ifdef __GNUC__ -__inline -#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif -#endif const struct kwtable * -mrb_reserved_word (const char *str, unsigned int len) +mrb_reserved_word (register const char *str, register size_t len) { static const struct kwtable wordlist[] = { {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 18 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 20 "mrbgems/mruby-compiler/core/keywords" {"break", {keyword_break, keyword_break}, EXPR_MID}, -#line 23 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 25 "mrbgems/mruby-compiler/core/keywords" {"else", {keyword_else, keyword_else}, EXPR_BEG}, -#line 33 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 35 "mrbgems/mruby-compiler/core/keywords" {"nil", {keyword_nil, keyword_nil}, EXPR_END}, -#line 26 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 28 "mrbgems/mruby-compiler/core/keywords" {"ensure", {keyword_ensure, keyword_ensure}, EXPR_BEG}, -#line 25 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 27 "mrbgems/mruby-compiler/core/keywords" {"end", {keyword_end, keyword_end}, EXPR_END}, -#line 42 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 44 "mrbgems/mruby-compiler/core/keywords" {"then", {keyword_then, keyword_then}, EXPR_BEG}, -#line 34 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 36 "mrbgems/mruby-compiler/core/keywords" {"not", {keyword_not, keyword_not}, EXPR_ARG}, -#line 27 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 29 "mrbgems/mruby-compiler/core/keywords" {"false", {keyword_false, keyword_false}, EXPR_END}, -#line 40 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 42 "mrbgems/mruby-compiler/core/keywords" {"self", {keyword_self, keyword_self}, EXPR_END}, -#line 24 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 26 "mrbgems/mruby-compiler/core/keywords" {"elsif", {keyword_elsif, keyword_elsif}, EXPR_VALUE}, -#line 37 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 39 "mrbgems/mruby-compiler/core/keywords" {"rescue", {keyword_rescue, modifier_rescue}, EXPR_MID}, -#line 43 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 45 "mrbgems/mruby-compiler/core/keywords" {"true", {keyword_true, keyword_true}, EXPR_END}, -#line 46 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 48 "mrbgems/mruby-compiler/core/keywords" {"until", {keyword_until, modifier_until}, EXPR_VALUE}, -#line 45 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 47 "mrbgems/mruby-compiler/core/keywords" {"unless", {keyword_unless, modifier_unless}, EXPR_VALUE}, -#line 39 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 41 "mrbgems/mruby-compiler/core/keywords" {"return", {keyword_return, keyword_return}, EXPR_MID}, -#line 21 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 23 "mrbgems/mruby-compiler/core/keywords" {"def", {keyword_def, keyword_def}, EXPR_FNAME}, -#line 16 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 18 "mrbgems/mruby-compiler/core/keywords" {"and", {keyword_and, keyword_and}, EXPR_VALUE}, -#line 22 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 24 "mrbgems/mruby-compiler/core/keywords" {"do", {keyword_do, keyword_do}, EXPR_BEG}, -#line 49 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 51 "mrbgems/mruby-compiler/core/keywords" {"yield", {keyword_yield, keyword_yield}, EXPR_ARG}, -#line 28 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 30 "mrbgems/mruby-compiler/core/keywords" {"for", {keyword_for, keyword_for}, EXPR_VALUE}, -#line 44 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 46 "mrbgems/mruby-compiler/core/keywords" {"undef", {keyword_undef, keyword_undef}, EXPR_FNAME}, -#line 35 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 37 "mrbgems/mruby-compiler/core/keywords" {"or", {keyword_or, keyword_or}, EXPR_VALUE}, -#line 30 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 32 "mrbgems/mruby-compiler/core/keywords" {"in", {keyword_in, keyword_in}, EXPR_VALUE}, -#line 47 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 49 "mrbgems/mruby-compiler/core/keywords" {"when", {keyword_when, keyword_when}, EXPR_VALUE}, -#line 38 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 40 "mrbgems/mruby-compiler/core/keywords" {"retry", {keyword_retry, keyword_retry}, EXPR_END}, -#line 29 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 31 "mrbgems/mruby-compiler/core/keywords" {"if", {keyword_if, modifier_if}, EXPR_VALUE}, -#line 19 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 21 "mrbgems/mruby-compiler/core/keywords" {"case", {keyword_case, keyword_case}, EXPR_VALUE}, -#line 36 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 38 "mrbgems/mruby-compiler/core/keywords" {"redo", {keyword_redo, keyword_redo}, EXPR_END}, -#line 32 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 34 "mrbgems/mruby-compiler/core/keywords" {"next", {keyword_next, keyword_next}, EXPR_MID}, -#line 41 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 43 "mrbgems/mruby-compiler/core/keywords" {"super", {keyword_super, keyword_super}, EXPR_ARG}, -#line 31 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 33 "mrbgems/mruby-compiler/core/keywords" {"module", {keyword_module, keyword_module}, EXPR_VALUE}, -#line 17 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 19 "mrbgems/mruby-compiler/core/keywords" {"begin", {keyword_begin, keyword_begin}, EXPR_BEG}, -#line 12 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 14 "mrbgems/mruby-compiler/core/keywords" {"__LINE__", {keyword__LINE__, keyword__LINE__}, EXPR_END}, -#line 11 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 13 "mrbgems/mruby-compiler/core/keywords" {"__FILE__", {keyword__FILE__, keyword__FILE__}, EXPR_END}, -#line 10 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 12 "mrbgems/mruby-compiler/core/keywords" {"__ENCODING__", {keyword__ENCODING__, keyword__ENCODING__}, EXPR_END}, -#line 14 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 16 "mrbgems/mruby-compiler/core/keywords" {"END", {keyword_END, keyword_END}, EXPR_END}, -#line 15 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 17 "mrbgems/mruby-compiler/core/keywords" {"alias", {keyword_alias, keyword_alias}, EXPR_FNAME}, -#line 13 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 15 "mrbgems/mruby-compiler/core/keywords" {"BEGIN", {keyword_BEGIN, keyword_BEGIN}, EXPR_END}, {""}, -#line 20 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 22 "mrbgems/mruby-compiler/core/keywords" {"class", {keyword_class, keyword_class}, EXPR_CLASS}, {""}, {""}, -#line 48 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 50 "mrbgems/mruby-compiler/core/keywords" {"while", {keyword_while, modifier_while}, EXPR_VALUE} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { - int key = hash (str, len); + register unsigned int key = hash (str, len); - if (key <= MAX_HASH_VALUE && key >= 0) + if (key <= MAX_HASH_VALUE) { - const char *s = wordlist[key].name; + register const char *s = wordlist[key].name; if (*str == *s && !strcmp (str + 1, s + 1)) return &wordlist[key]; @@ -208,4 +204,4 @@ mrb_reserved_word (const char *str, unsigned int len) } return 0; } -#line 50 "/home/matz/work/mruby/mrbgems/mruby-compiler/core/keywords" +#line 52 "mrbgems/mruby-compiler/core/keywords" diff --git a/mrbgems/mruby-compiler/core/node.h b/mrbgems/mruby-compiler/core/node.h index 219bddab0..a57b7bdf7 100644 --- a/mrbgems/mruby-compiler/core/node.h +++ b/mrbgems/mruby-compiler/core/node.h @@ -51,6 +51,7 @@ enum node_type { NODE_IVAR, NODE_CONST, NODE_CVAR, + NODE_NVAR, NODE_NTH_REF, NODE_BACK_REF, NODE_MATCH, diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 5e6cda236..7d9db4a2b 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -9,14 +9,7 @@ #ifdef PARSER_DEBUG # define YYDEBUG 1 #endif -#define YYERROR_VERBOSE 1 -/* - * Force yacc to use our memory management. This is a little evil because - * the macros assume that "parser_state *p" is in scope - */ -#define YYMALLOC(n) mrb_malloc(p->mrb, (n)) -#define YYFREE(o) mrb_free(p->mrb, (o)) -#define YYSTACK_USE_ALLOCA 0 +#define YYSTACK_USE_ALLOCA 1 #include <ctype.h> #include <errno.h> @@ -27,6 +20,9 @@ #include <mruby/proc.h> #include <mruby/error.h> #include <mruby/throw.h> +#include <mruby/string.h> +#include <mruby/dump.h> +#include <mruby/presym.h> #include "node.h" #define YYLEX_PARAM p @@ -75,6 +71,10 @@ typedef unsigned int stack_type; #define nsym(x) ((node*)(intptr_t)(x)) #define nint(x) ((node*)(intptr_t)(x)) #define intn(x) ((int)(intptr_t)(x)) +#define typen(x) ((enum node_type)(intptr_t)(x)) + +#define NUM_SUFFIX_R (1<<0) +#define NUM_SUFFIX_I (1<<1) static inline mrb_sym intern_cstr_gen(parser_state *p, const char *s) @@ -90,12 +90,7 @@ intern_gen(parser_state *p, const char *s, size_t len) } #define intern(s,len) intern_gen(p,(s),(len)) -static inline mrb_sym -intern_gen_c(parser_state *p, const char c) -{ - return mrb_intern(p->mrb, &c, 1); -} -#define intern_c(c) intern_gen_c(p,(c)) +#define intern_op(op) MRB_OPSYM_2(p->mrb, op) static void cons_free_gen(parser_state *p, node *cons) @@ -133,6 +128,10 @@ cons_gen(parser_state *p, node *car, node *cdr) c->cdr = cdr; c->lineno = p->lineno; c->filename_index = p->current_filename_index; + /* beginning of next partial file; need to point the previous file */ + if (p->lineno == 0 && p->current_filename_index > 0) { + c->filename_index-- ; + } return c; } #define cons(a,b) cons_gen(p,(a),(b)) @@ -185,12 +184,11 @@ append_gen(parser_state *p, node *a, node *b) node *c = a; if (!a) return b; + if (!b) return a; while (c->cdr) { c = c->cdr; } - if (b) { - c->cdr = b; - } + c->cdr = b; return a; } #define append(a,b) append_gen(p,(a),(b)) @@ -216,6 +214,26 @@ parser_strdup(parser_state *p, const char *s) #undef strdup #define strdup(s) parser_strdup(p, s) +static void +dump_int(uint16_t i, char *s) +{ + char *p = s; + char *t = s; + + while (i > 0) { + *p++ = (i % 10)+'0'; + i /= 10; + } + if (p == s) *p++ = '0'; + *p = 0; + p--; /* point the last char */ + while (t < p) { + char c = *t; + *t++ = *p; + *p-- = c; + } +} + /* xxx ----------------------------- */ static node* @@ -250,6 +268,7 @@ local_unnest(parser_state *p) static mrb_bool local_var_p(parser_state *p, mrb_sym sym) { + const struct RProc *u; node *l = p->locals; while (l) { @@ -260,6 +279,21 @@ local_var_p(parser_state *p, mrb_sym sym) } l = l->cdr; } + + u = p->upper; + while (u && !MRB_PROC_CFUNC_P(u)) { + const struct mrb_irep *ir = u->body.irep; + const mrb_sym *v = ir->lv; + int i; + + if (v) { + for (i=0; i+1 < ir->nlocals; i++) { + if (v[i] == sym) return TRUE; + } + } + if (MRB_PROC_SCOPE_P(u)) break; + u = u->upper; + } return FALSE; } @@ -279,12 +313,44 @@ local_add(parser_state *p, mrb_sym sym) } } +static void +local_add_blk(parser_state *p, mrb_sym blk) +{ + /* allocate register for block */ + local_add_f(p, blk ? blk : intern_op(and)); +} + +static void +local_add_kw(parser_state *p, mrb_sym kwd) +{ + /* allocate register for keywords hash */ + local_add_f(p, kwd ? kwd : intern_op(pow)); +} + static node* locals_node(parser_state *p) { return p->locals ? p->locals->car : NULL; } +static void +nvars_nest(parser_state *p) +{ + p->nvars = cons(nint(0), p->nvars); +} + +static void +nvars_block(parser_state *p) +{ + p->nvars = cons(nint(-2), p->nvars); +} + +static void +nvars_unnest(parser_state *p) +{ + p->nvars = p->nvars->cdr; +} + /* (:scope (vars..) (prog...)) */ static node* new_scope(parser_state *p, node *body) @@ -619,6 +685,16 @@ new_cvar(parser_state *p, mrb_sym sym) return cons((node*)NODE_CVAR, nsym(sym)); } +/* (:nvar . a) */ +static node* +new_nvar(parser_state *p, int num) +{ + int nvars = intn(p->nvars->car); + + p->nvars->car = nint(nvars > num ? nvars : num); + return cons((node*)NODE_NVAR, nint(num)); +} + /* (:const . a) */ static node* new_const(parser_state *p, mrb_sym sym) @@ -660,7 +736,19 @@ new_module(parser_state *p, node *m, node *b) static node* new_def(parser_state *p, mrb_sym m, node *a, node *b) { - return list5((node*)NODE_DEF, nsym(m), locals_node(p), a, b); + return list5((node*)NODE_DEF, nsym(m), 0, a, b); +} + +static void +defn_setup(parser_state *p, node *d, node *a, node *b) +{ + node *n = d->cdr->cdr; + + n->car = locals_node(p); + p->cmdarg_stack = intn(n->cdr->car); + n->cdr->car = a; + local_resume(p, n->cdr->cdr->car); + n->cdr->cdr->car = b; } /* (:sdef obj m lv (arg . body)) */ @@ -668,7 +756,19 @@ static node* new_sdef(parser_state *p, node *o, mrb_sym m, node *a, node *b) { void_expr_error(p, o); - return list6((node*)NODE_SDEF, o, nsym(m), locals_node(p), a, b); + return list6((node*)NODE_SDEF, o, nsym(m), 0, a, b); +} + +static void +defs_setup(parser_state *p, node *d, node *a, node *b) +{ + node *n = d->cdr->cdr->cdr; + + n->car = locals_node(p); + p->cmdarg_stack = intn(n->cdr->car); + n->cdr->car = a; + local_resume(p, n->cdr->cdr->car); + n->cdr->cdr->car = b; } /* (:arg . sym) */ @@ -678,6 +778,34 @@ new_arg(parser_state *p, mrb_sym sym) return cons((node*)NODE_ARG, nsym(sym)); } +static void +local_add_margs(parser_state *p, node *n) +{ + while (n) { + if (typen(n->car->car) == NODE_MASGN) { + node *t = n->car->cdr->cdr; + + n->car->cdr->cdr = NULL; + while (t) { + local_add_f(p, sym(t->car)); + t = t->cdr; + } + local_add_margs(p, n->car->cdr->car->car); + local_add_margs(p, n->car->cdr->car->cdr->cdr->car); + } + n = n->cdr; + } +} + +static void +local_add_lv(parser_state *p, node *lv) +{ + while (lv) { + local_add_f(p, sym(lv->car)); + lv = lv->cdr; + } +} + /* (m o r m2 tail) */ /* m: (a b c) */ /* o: ((a . e1) (b . e2)) */ @@ -689,9 +817,17 @@ new_args(parser_state *p, node *m, node *opt, mrb_sym rest, node *m2, node *tail { node *n; + local_add_margs(p, m); + local_add_margs(p, m2); n = cons(m2, tail); n = cons(nsym(rest), n); n = cons(opt, n); + while (opt) { + /* opt: (sym . (opt . lv)) -> (sym . opt) */ + local_add_lv(p, opt->car->cdr->cdr); + opt->car->cdr = opt->car->cdr->car; + opt = opt->cdr; + } return cons(m, n); } @@ -701,23 +837,23 @@ new_args_tail(parser_state *p, node *kws, node *kwrest, mrb_sym blk) { node *k; - /* allocate register for keywords hash */ if (kws || kwrest) { - local_add_f(p, (kwrest && kwrest->cdr)? sym(kwrest->cdr) : mrb_intern_lit(p->mrb, "**")); + local_add_kw(p, (kwrest && kwrest->cdr)? sym(kwrest->cdr) : 0); } - /* allocate register for block */ - local_add_f(p, blk? blk : mrb_intern_lit(p->mrb, "&")); + local_add_blk(p, blk); - // allocate register for keywords arguments - // order is for Proc#parameters + /* allocate register for keywords arguments */ + /* order is for Proc#parameters */ for (k = kws; k; k = k->cdr) { - if (!k->car->cdr->cdr->car) { // allocate required keywords + if (!k->car->cdr->cdr->car) { /* allocate required keywords */ local_add_f(p, sym(k->car->cdr->car)); } } for (k = kws; k; k = k->cdr) { - if (k->car->cdr->cdr->car) { // allocate keywords with default + if (k->car->cdr->cdr->car) { /* allocate keywords with default */ + local_add_lv(p, k->car->cdr->cdr->car->cdr); + k->car->cdr->cdr->car = k->car->cdr->cdr->car->car; local_add_f(p, sym(k->car->cdr->car)); } } @@ -733,6 +869,13 @@ new_kw_arg(parser_state *p, mrb_sym kw, node *def_arg) return list3((node*)NODE_KW_ARG, nsym(kw), def_arg); } +/* (:kw_rest_args . a) */ +static node* +new_kw_rest_args(parser_state *p, node *a) +{ + return cons((node*)NODE_KW_REST_ARGS, a); +} + /* (:block_arg . a) */ static node* new_block_arg(parser_state *p, node *a) @@ -740,10 +883,41 @@ new_block_arg(parser_state *p, node *a) return cons((node*)NODE_BLOCK_ARG, a); } +static node* +setup_numparams(parser_state *p, node *a) +{ + int nvars = intn(p->nvars->car); + if (nvars > 0) { + int i; + mrb_sym sym; + // m || opt || rest || tail + if (a && (a->car || (a->cdr && a->cdr->car) || (a->cdr->cdr && a->cdr->cdr->car) || (a->cdr->cdr->cdr->cdr && a->cdr->cdr->cdr->cdr->car))) { + yyerror(p, "ordinary parameter is defined"); + } + else if (p->locals) { + /* p->locals should not be NULL unless error happens before the point */ + node* args = 0; + for (i = nvars; i > 0; i--) { + char buf[3]; + + buf[0] = '_'; + buf[1] = i+'0'; + buf[2] = '\0'; + sym = intern_cstr(buf); + args = cons(new_arg(p, sym), args); + p->locals->car = cons(nsym(sym), p->locals->car); + } + a = new_args(p, args, 0, 0, 0, 0); + } + } + return a; +} + /* (:block arg body) */ static node* new_block(parser_state *p, node *a, node *b) { + a = setup_numparams(p, a); return list4((node*)NODE_BLOCK, locals_node(p), a, b); } @@ -770,6 +944,13 @@ new_masgn(parser_state *p, node *a, node *b) return cons((node*)NODE_MASGN, cons(a, b)); } +/* (:masgn mlhs mrhs) no check */ +static node* +new_masgn_param(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_MASGN, cons(a, b)); +} + /* (:asgn lhs rhs) */ static node* new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b) @@ -778,19 +959,45 @@ new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b) return list4((node*)NODE_OP_ASGN, a, nsym(op), b); } +static node* +new_imaginary(parser_state *p, node *imaginary) +{ + return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Complex), list1(list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary)), 1); +} + +static node* +new_rational(parser_state *p, node *rational) +{ + return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Rational), list1(list1(rational)), 1); +} + /* (:int . i) */ static node* -new_int(parser_state *p, const char *s, int base) +new_int(parser_state *p, const char *s, int base, int suffix) { - return list3((node*)NODE_INT, (node*)strdup(s), nint(base)); + node* result = list3((node*)NODE_INT, (node*)strdup(s), nint(base)); + if (suffix & NUM_SUFFIX_R) { + result = new_rational(p, result); + } + if (suffix & NUM_SUFFIX_I) { + result = new_imaginary(p, result); + } + return result; } -#ifndef MRB_WITHOUT_FLOAT +#ifndef MRB_NO_FLOAT /* (:float . i) */ static node* -new_float(parser_state *p, const char *s) +new_float(parser_state *p, const char *s, int suffix) { - return cons((node*)NODE_FLOAT, (node*)strdup(s)); + node* result = cons((node*)NODE_FLOAT, (node*)strdup(s)); + if (suffix & NUM_SUFFIX_R) { + result = new_rational(p, result); + } + if (suffix & NUM_SUFFIX_I) { + result = new_imaginary(p, result); + } + return result; } #endif @@ -808,6 +1015,86 @@ new_dstr(parser_state *p, node *a) return cons((node*)NODE_DSTR, a); } +static int +string_node_p(node *n) +{ + return (int)(typen(n->car) == NODE_STR); +} + +static node* +composite_string_node(parser_state *p, node *a, node *b) +{ + size_t newlen = (size_t)a->cdr + (size_t)b->cdr; + char *str = (char*)mrb_pool_realloc(p->pool, a->car, (size_t)a->cdr + 1, newlen + 1); + memcpy(str + (size_t)a->cdr, b->car, (size_t)b->cdr); + str[newlen] = '\0'; + a->car = (node*)str; + a->cdr = (node*)newlen; + cons_free(b); + return a; +} + +static node* +concat_string(parser_state *p, node *a, node *b) +{ + if (string_node_p(a)) { + if (string_node_p(b)) { + /* a == NODE_STR && b == NODE_STR */ + composite_string_node(p, a->cdr, b->cdr); + cons_free(b); + return a; + } + else { + /* a == NODE_STR && b == NODE_DSTR */ + + if (string_node_p(b->cdr->car)) { + /* a == NODE_STR && b->[NODE_STR, ...] */ + composite_string_node(p, a->cdr, b->cdr->car->cdr); + cons_free(b->cdr->car); + b->cdr->car = a; + return b; + } + } + } + else { + node *c; /* last node of a */ + for (c = a; c->cdr != NULL; c = c->cdr) ; + + if (string_node_p(b)) { + /* a == NODE_DSTR && b == NODE_STR */ + if (string_node_p(c->car)) { + /* a->[..., NODE_STR] && b == NODE_STR */ + composite_string_node(p, c->car->cdr, b->cdr); + cons_free(b); + return a; + } + + push(a, b); + return a; + } + else { + /* a == NODE_DSTR && b == NODE_DSTR */ + if (string_node_p(c->car) && string_node_p(b->cdr->car)) { + /* a->[..., NODE_STR] && b->[NODE_STR, ...] */ + node *d = b->cdr; + cons_free(b); + composite_string_node(p, c->car->cdr, d->car->cdr); + cons_free(d->car); + c->cdr = d->cdr; + cons_free(d); + return a; + } + else { + c->cdr = b->cdr; + cons_free(b); + return a; + } + } + } + + return new_dstr(p, list2(a, b)); +} + /* (:str . (s . len)) */ static node* new_xstr(parser_state *p, const char *s, int len) @@ -919,11 +1206,26 @@ args_with_block(parser_state *p, node *a, node *b) } static void +endless_method_name(parser_state *p, node *defn) +{ + mrb_sym sym = sym(defn->cdr->car); + mrb_int len; + const char *name = mrb_sym_name_len(p->mrb, sym, &len); + + if (len > 1 && name[len-1] == '=') { + for (int i=0; i<len-1; i++) { + if (!identchar(name[i])) return; + } + yyerror(p, "setter method cannot be defined by endless method definition"); + } +} + +static void call_with_block(parser_state *p, node *a, node *b) { node *n; - switch ((enum node_type)intn(a->car)) { + switch (typen(a->car)) { case NODE_SUPER: case NODE_ZSUPER: if (!a->cdr) a->cdr = cons(0, b); @@ -997,7 +1299,7 @@ typedef enum mrb_string_type string_type; static node* new_strterm(parser_state *p, string_type type, int term, int paren) { - return cons(nint(type), cons((node*)0, cons(nint(paren), nint(term)))); + return cons(nint(type), cons(nint(0), cons(nint(paren), nint(term)))); } static void @@ -1070,11 +1372,9 @@ heredoc_end(parser_state *p) p->parsing_heredoc = p->parsing_heredoc->cdr; if (p->parsing_heredoc == NULL) { p->lstate = EXPR_BEG; - p->cmd_start = TRUE; end_strterm(p); p->lex_strterm = p->lex_strterm_before_heredoc; p->lex_strterm_before_heredoc = NULL; - p->heredoc_end_now = TRUE; } else { /* next heredoc */ @@ -1087,7 +1387,8 @@ heredoc_end(parser_state *p) %} -%pure-parser +%define parse.error verbose +%define api.pure %parse-param {parser_state *p} %lex-param {parser_state *p} @@ -1151,14 +1452,24 @@ heredoc_end(parser_state *p) keyword__FILE__ keyword__ENCODING__ -%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL_TAG -%token <nd> tINTEGER tFLOAT tCHAR tXSTRING tREGEXP +%token <id> tIDENTIFIER "local variable or method" +%token <id> tFID "method" +%token <id> tGVAR "global variable" +%token <id> tIVAR "instance variable" +%token <id> tCONSTANT "constant" +%token <id> tCVAR "class variable" +%token <id> tLABEL_TAG "label" +%token <nd> tINTEGER "integer literal" +%token <nd> tFLOAT "float literal" +%token <nd> tCHAR "character literal" +%token <nd> tXSTRING tREGEXP %token <nd> tSTRING tSTRING_PART tSTRING_MID %token <nd> tNTH_REF tBACK_REF %token <num> tREGEXP_END +%token <num> tNUMPARAM "numbered parameter" -%type <nd> singleton string string_rep string_interp xstring regexp -%type <nd> literal numeric cpath symbol +%type <nd> singleton string string_fragment string_rep string_interp xstring regexp +%type <nd> literal numeric cpath symbol defn_head defs_head %type <nd> top_compstmt top_stmts top_stmt %type <nd> bodystmt compstmt stmts stmt expr arg primary command command_call method_call %type <nd> expr_value arg_rhs primary_value @@ -1168,7 +1479,8 @@ heredoc_end(parser_state *p) %type <nd> command_args aref_args opt_block_arg block_arg var_ref var_lhs %type <nd> command_asgn command_rhs mrhs superclass block_call block_command %type <nd> f_block_optarg f_block_opt -%type <nd> f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs +%type <nd> f_opt_arglist_paren f_arglist_paren f_arglist +%type <nd> f_args f_arg f_arg_item f_optarg f_margs %type <nd> assoc_list assocs assoc undef_list backref for_var %type <nd> block_param opt_block_param block_param_def f_opt %type <nd> bv_decls opt_bv_decl bvar f_larglist lambda_body @@ -1183,38 +1495,41 @@ heredoc_end(parser_state *p) %type <nd> f_block_kwarg f_block_kw block_args_tail opt_block_args_tail %type <id> f_label -%token tUPLUS /* unary+ */ -%token tUMINUS /* unary- */ -%token tPOW /* ** */ -%token tCMP /* <=> */ -%token tEQ /* == */ -%token tEQQ /* === */ -%token tNEQ /* != */ -%token tGEQ /* >= */ -%token tLEQ /* <= */ -%token tANDOP tOROP /* && and || */ -%token tMATCH tNMATCH /* =~ and !~ */ -%token tDOT2 tDOT3 /* .. and ... */ +%token tUPLUS "unary plus" +%token tUMINUS "unary minus" +%token tCMP "<=>" +%token tEQ "==" +%token tEQQ "===" +%token tNEQ "!=" +%token tGEQ ">=" +%token tLEQ "<=" +%token tANDOP "&&" +%token tOROP "||" +%token tMATCH "=~" +%token tNMATCH "!~" +%token tDOT2 ".." +%token tDOT3 "..." +%token tBDOT2 tBDOT3 /* (.. and (... */ %token tAREF tASET /* [] and []= */ -%token tLSHFT tRSHFT /* << and >> */ -%token tCOLON2 /* :: */ +%token tLSHFT "<<" +%token tRSHFT ">>" +%token tCOLON2 "::" %token tCOLON3 /* :: at EXPR_BEG */ %token <id> tOP_ASGN /* +=, -= etc. */ -%token tASSOC /* => */ -%token tLPAREN /* ( */ -%token tLPAREN_ARG /* ( */ -%token tRPAREN /* ) */ -%token tLBRACK /* [ */ -%token tLBRACE /* { */ -%token tLBRACE_ARG /* { */ -%token tSTAR /* * */ -%token tDSTAR /* ** */ -%token tAMPER /* & */ -%token tLAMBDA /* -> */ -%token tANDDOT /* &. */ -%token tSYMBEG tREGEXP_BEG tWORDS_BEG tSYMBOLS_BEG -%token tSTRING_BEG tXSTRING_BEG tSTRING_DVAR tLAMBEG -%token <nd> tHEREDOC_BEG /* <<, <<- */ +%token tASSOC "=>" +%token tLPAREN tLPAREN_ARG "(" +%token tRPAREN ")" +%token tLBRACK "[" +%token tLBRACE tLBRACE_ARG "{" +%token tSTAR "*" +%token tPOW tDSTAR "**" +%token tAMPER "&" +%token tLAMBDA "->" +%token tANDDOT "&." +%token tSYMBEG "symbol" +%token tSTRING_BEG "string literal" +%token tXSTRING_BEG tSTRING_DVAR tREGEXP_BEG tWORDS_BEG tSYMBOLS_BEG tLAMBEG +%token <nd> tHEREDOC_BEG "here document" %token tHEREDOC_END tLITERAL_DELIM tHD_LITERAL_DELIM %token <nd> tHD_STRING_PART tHD_STRING_MID @@ -1231,7 +1546,7 @@ heredoc_end(parser_state *p) %right '=' tOP_ASGN %left modifier_rescue %right '?' ':' tLABEL_TAG -%nonassoc tDOT2 tDOT3 +%nonassoc tDOT2 tDOT3 tBDOT2 tBDOT3 %left tOROP %left tANDOP %nonassoc tCMP tEQ tEQQ tNEQ tMATCH tNMATCH @@ -1288,11 +1603,13 @@ top_stmt : stmt | keyword_BEGIN { $<nd>$ = local_switch(p); + nvars_block(p); } '{' top_compstmt '}' { yyerror(p, "BEGIN not supported"); local_resume(p, $<nd>2); + nvars_unnest(p); $$ = 0; } ; @@ -1399,6 +1716,13 @@ stmt : keyword_alias fsym {p->lstate = EXPR_FNAME;} fsym { $$ = new_masgn(p, $1, new_array(p, $3)); } + | arg tASSOC tIDENTIFIER + { + node *lhs = new_lvar(p, $3); + void_expr_error(p, $1); + assignable(p, lhs); + $$ = new_asgn(p, lhs, $1); + } | expr ; @@ -1410,9 +1734,9 @@ command_asgn : lhs '=' command_rhs { $$ = new_op_asgn(p, $1, $2, $3); } - | primary_value '[' opt_call_args rbracket tOP_ASGN command_rhs + | primary_value '[' opt_call_args ']' tOP_ASGN command_rhs { - $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6); + $$ = new_op_asgn(p, new_call(p, $1, intern_op(aref), $3, '.'), $5, $6); } | primary_value call_op tIDENTIFIER tOP_ASGN command_rhs { @@ -1431,6 +1755,44 @@ command_asgn : lhs '=' command_rhs { $$ = new_op_asgn(p, new_call(p, $1, $3, 0, tCOLON2), $4, $5); } + | defn_head f_opt_arglist_paren '=' command + { + $$ = $1; + endless_method_name(p, $1); + void_expr_error(p, $4); + defn_setup(p, $$, $2, $4); + nvars_unnest(p); + p->in_def--; + } + | defn_head f_opt_arglist_paren '=' command modifier_rescue arg + { + $$ = $1; + endless_method_name(p, $1); + void_expr_error(p, $4); + void_expr_error(p, $6); + defn_setup(p, $$, $2, new_mod_rescue(p, $4, $6)); + nvars_unnest(p); + p->in_def--; + } + | defs_head f_opt_arglist_paren '=' command + { + $$ = $1; + void_expr_error(p, $4); + defs_setup(p, $$, $2, $4); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } + | defs_head f_opt_arglist_paren '=' command modifier_rescue arg + { + $$ = $1; + void_expr_error(p, $4); + void_expr_error(p, $6); + defs_setup(p, $$, $2, new_mod_rescue(p, $4, $6)); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } | backref tOP_ASGN command_rhs { backref_error(p, $1); @@ -1467,6 +1829,31 @@ expr : command_call | arg ; + +defn_head : keyword_def fname + { + $$ = new_def(p, $2, nint(p->cmdarg_stack), local_switch(p)); + p->cmdarg_stack = 0; + p->in_def++; + nvars_block(p); + } + ; + +defs_head : keyword_def singleton dot_or_colon + { + p->lstate = EXPR_FNAME; + } + fname + { + $$ = new_sdef(p, $2, $5, nint(p->cmdarg_stack), local_switch(p)); + p->cmdarg_stack = 0; + p->in_def++; + p->in_single++; + nvars_block(p); + p->lstate = EXPR_ENDFN; /* force for args */ + } + ; + expr_value : expr { if (!$1) $$ = new_nil(p); @@ -1490,6 +1877,7 @@ block_command : block_call cmd_brace_block : tLBRACE_ARG { local_nest(p); + nvars_nest(p); } opt_block_param compstmt @@ -1497,6 +1885,7 @@ cmd_brace_block : tLBRACE_ARG { $$ = new_block(p, $3, $4); local_unnest(p); + nvars_unnest(p); } ; @@ -1639,9 +2028,9 @@ mlhs_node : variable { assignable(p, $1); } - | primary_value '[' opt_call_args rbracket + | primary_value '[' opt_call_args ']' { - $$ = new_call(p, $1, intern("[]",2), $3, '.'); + $$ = new_call(p, $1, intern_op(aref), $3, '.'); } | primary_value call_op tIDENTIFIER { @@ -1678,9 +2067,9 @@ lhs : variable { assignable(p, $1); } - | primary_value '[' opt_call_args rbracket + | primary_value '[' opt_call_args ']' { - $$ = new_call(p, $1, intern("[]",2), $3, '.'); + $$ = new_call(p, $1, intern_op(aref), $3, '.'); } | primary_value call_op tIDENTIFIER { @@ -1711,6 +2100,10 @@ lhs : variable backref_error(p, $1); $$ = 0; } + | tNUMPARAM + { + yyerror(p, "can't assign to numbered parameter"); + } ; cname : tIDENTIFIER @@ -1722,11 +2115,11 @@ cname : tIDENTIFIER cpath : tCOLON3 cname { - $$ = cons((node*)1, nsym($2)); + $$ = cons(nint(1), nsym($2)); } | cname { - $$ = cons((node*)0, nsym($1)); + $$ = cons(nint(0), nsym($1)); } | primary_value tCOLON2 cname { @@ -1764,36 +2157,36 @@ undef_list : fsym } ; -op : '|' { $$ = intern_c('|'); } - | '^' { $$ = intern_c('^'); } - | '&' { $$ = intern_c('&'); } - | tCMP { $$ = intern("<=>",3); } - | tEQ { $$ = intern("==",2); } - | tEQQ { $$ = intern("===",3); } - | tMATCH { $$ = intern("=~",2); } - | tNMATCH { $$ = intern("!~",2); } - | '>' { $$ = intern_c('>'); } - | tGEQ { $$ = intern(">=",2); } - | '<' { $$ = intern_c('<'); } - | tLEQ { $$ = intern("<=",2); } - | tNEQ { $$ = intern("!=",2); } - | tLSHFT { $$ = intern("<<",2); } - | tRSHFT { $$ = intern(">>",2); } - | '+' { $$ = intern_c('+'); } - | '-' { $$ = intern_c('-'); } - | '*' { $$ = intern_c('*'); } - | tSTAR { $$ = intern_c('*'); } - | '/' { $$ = intern_c('/'); } - | '%' { $$ = intern_c('%'); } - | tPOW { $$ = intern("**",2); } - | tDSTAR { $$ = intern("**",2); } - | '!' { $$ = intern_c('!'); } - | '~' { $$ = intern_c('~'); } - | tUPLUS { $$ = intern("+@",2); } - | tUMINUS { $$ = intern("-@",2); } - | tAREF { $$ = intern("[]",2); } - | tASET { $$ = intern("[]=",3); } - | '`' { $$ = intern_c('`'); } +op : '|' { $$ = intern_op(or); } + | '^' { $$ = intern_op(xor); } + | '&' { $$ = intern_op(and); } + | tCMP { $$ = intern_op(cmp); } + | tEQ { $$ = intern_op(eq); } + | tEQQ { $$ = intern_op(eqq); } + | tMATCH { $$ = intern_op(match); } + | tNMATCH { $$ = intern_op(nmatch); } + | '>' { $$ = intern_op(gt); } + | tGEQ { $$ = intern_op(ge); } + | '<' { $$ = intern_op(lt); } + | tLEQ { $$ = intern_op(le); } + | tNEQ { $$ = intern_op(neq); } + | tLSHFT { $$ = intern_op(lshift); } + | tRSHFT { $$ = intern_op(rshift); } + | '+' { $$ = intern_op(add); } + | '-' { $$ = intern_op(sub); } + | '*' { $$ = intern_op(mul); } + | tSTAR { $$ = intern_op(mul); } + | '/' { $$ = intern_op(div); } + | '%' { $$ = intern_op(mod); } + | tPOW { $$ = intern_op(pow); } + | tDSTAR { $$ = intern_op(pow); } + | '!' { $$ = intern_op(not); } + | '~' { $$ = intern_op(neg); } + | tUPLUS { $$ = intern_op(plus); } + | tUMINUS { $$ = intern_op(minus); } + | tAREF { $$ = intern_op(aref); } + | tASET { $$ = intern_op(aset); } + | '`' { $$ = intern_op(tick); } ; reswords : keyword__LINE__ | keyword__FILE__ | keyword__ENCODING__ @@ -1818,9 +2211,9 @@ arg : lhs '=' arg_rhs { $$ = new_op_asgn(p, $1, $2, $3); } - | primary_value '[' opt_call_args rbracket tOP_ASGN arg_rhs + | primary_value '[' opt_call_args ']' tOP_ASGN arg_rhs { - $$ = new_op_asgn(p, new_call(p, $1, intern("[]",2), $3, '.'), $5, $6); + $$ = new_op_asgn(p, new_call(p, $1, intern_op(aref), $3, '.'), $5, $6); } | primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs { @@ -1853,10 +2246,26 @@ arg : lhs '=' arg_rhs { $$ = new_dot2(p, $1, $3); } + | arg tDOT2 + { + $$ = new_dot2(p, $1, new_nil(p)); + } + | tBDOT2 arg + { + $$ = new_dot2(p, new_nil(p), $2); + } | arg tDOT3 arg { $$ = new_dot3(p, $1, $3); } + | arg tDOT3 + { + $$ = new_dot3(p, $1, new_nil(p)); + } + | tBDOT3 arg + { + $$ = new_dot3(p, new_nil(p), $2); + } | arg '+' arg { $$ = call_bin_op(p, $1, "+", $3); @@ -1981,6 +2390,44 @@ arg : lhs '=' arg_rhs { $$ = new_if(p, cond($1), $3, $6); } + | defn_head f_opt_arglist_paren '=' arg + { + $$ = $1; + endless_method_name(p, $1); + void_expr_error(p, $4); + defn_setup(p, $$, $2, $4); + nvars_unnest(p); + p->in_def--; + } + | defn_head f_opt_arglist_paren '=' arg modifier_rescue arg + { + $$ = $1; + endless_method_name(p, $1); + void_expr_error(p, $4); + void_expr_error(p, $6); + defn_setup(p, $$, $2, new_mod_rescue(p, $4, $6)); + nvars_unnest(p); + p->in_def--; + } + | defs_head f_opt_arglist_paren '=' arg + { + $$ = $1; + void_expr_error(p, $4); + defs_setup(p, $$, $2, $4); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } + | defs_head f_opt_arglist_paren '=' arg modifier_rescue arg + { + $$ = $1; + void_expr_error(p, $4); + void_expr_error(p, $6); + defs_setup(p, $$, $2, new_mod_rescue(p, $4, $6)); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } | primary { $$ = $1; @@ -2016,10 +2463,50 @@ arg_rhs : arg %prec tOP_ASGN } ; -paren_args : '(' opt_call_args rparen +paren_args : '(' opt_call_args ')' { $$ = $2; } + | '(' args comma tBDOT3 rparen + { +#if 1 + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + $$ = cons(push($2, new_splat(p, new_lvar(p, r))), + new_block_arg(p, new_lvar(p, b))); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + $$ = cons(list2(push($2, new_splat(p, new_lvar(p, r))), + new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))), + new_block_arg(p, new_lvar(p, b))); +#endif + } + | '(' tBDOT3 rparen + { +#if 1 + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + if (local_var_p(p, r) && local_var_p(p, b)) { + $$ = cons(list1(new_splat(p, new_lvar(p, r))), + new_block_arg(p, new_lvar(p, b))); + } +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + if (local_var_p(p, r) && local_var_p(p, k) && local_var_p(p, b)) { + $$ = cons(list2(new_splat(p, new_lvar(p, r)), + new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))), + new_block_arg(p, new_lvar(p, b))); + } +#endif + else { + yyerror(p, "unexpected argument forwarding ..."); + $$ = 0; + } + } ; opt_paren_args : none @@ -2027,18 +2514,18 @@ opt_paren_args : none ; opt_call_args : none - | call_args - | args ',' + | call_args opt_terms + | args comma { $$ = cons($1,0); NODE_LINENO($$, $1); } - | args comma assocs ',' + | args comma assocs comma { $$ = cons(push($1, new_kw_hash(p, $3)), 0); NODE_LINENO($$, $1); } - | assocs ',' + | assocs comma { $$ = cons(list1(new_kw_hash(p, $1)), 0); NODE_LINENO($$, $1); @@ -2101,7 +2588,7 @@ opt_block_arg : comma block_arg ; comma : ',' - | ',' heredoc_bodies + | ',' opt_nl heredoc_bodies ; args : arg @@ -2152,6 +2639,10 @@ primary : literal | heredoc | var_ref | backref + | tNUMPARAM + { + $$ = new_nvar(p, $1); + } | tFID { $$ = new_fcall(p, $1, 0); @@ -2304,6 +2795,7 @@ primary : literal if (p->in_def || p->in_single) yyerror(p, "class definition in method body"); $<nd>$ = local_switch(p); + nvars_block(p); } bodystmt keyword_end @@ -2311,6 +2803,7 @@ primary : literal $$ = new_class(p, $2, $3, $5); SET_LINENO($$, $1); local_resume(p, $<nd>4); + nvars_unnest(p); } | keyword_class tLSHFT expr @@ -2321,6 +2814,7 @@ primary : literal term { $<nd>$ = cons(local_switch(p), nint(p->in_single)); + nvars_block(p); p->in_single = 0; } bodystmt @@ -2329,6 +2823,7 @@ primary : literal $$ = new_sclass(p, $3, $7); SET_LINENO($$, $1); local_resume(p, $<nd>6->car); + nvars_unnest(p); p->in_def = $<num>4; p->in_single = intn($<nd>6->cdr); } @@ -2338,6 +2833,7 @@ primary : literal if (p->in_def || p->in_single) yyerror(p, "module definition in method body"); $<nd>$ = local_switch(p); + nvars_block(p); } bodystmt keyword_end @@ -2345,47 +2841,28 @@ primary : literal $$ = new_module(p, $2, $4); SET_LINENO($$, $1); local_resume(p, $<nd>3); + nvars_unnest(p); } - | keyword_def fname - { - $<stack>$ = p->cmdarg_stack; - p->cmdarg_stack = 0; - } - { - p->in_def++; - $<nd>$ = local_switch(p); - } + | defn_head f_arglist bodystmt keyword_end { - $$ = new_def(p, $2, $5, $6); - SET_LINENO($$, $1); - local_resume(p, $<nd>4); + $$ = $1; + defn_setup(p, $$, $2, $3); + nvars_unnest(p); p->in_def--; - p->cmdarg_stack = $<stack>3; - } - | keyword_def singleton dot_or_colon - { - p->lstate = EXPR_FNAME; - $<stack>$ = p->cmdarg_stack; - p->cmdarg_stack = 0; - } - fname - { - p->in_single++; - p->lstate = EXPR_ENDFN; /* force for args */ - $<nd>$ = local_switch(p); } + | defs_head f_arglist bodystmt keyword_end { - $$ = new_sdef(p, $2, $5, $7, $8); - SET_LINENO($$, $1); - local_resume(p, $<nd>6); + $$ = $1; + defs_setup(p, $$, $2, $3); + nvars_unnest(p); + p->in_def--; p->in_single--; - p->cmdarg_stack = $<stack>4; } | keyword_break { @@ -2444,61 +2921,47 @@ for_var : lhs | mlhs ; -f_marg : f_norm_arg - { - $$ = new_arg(p, $1); - } - | tLPAREN f_margs rparen - { - $$ = new_masgn(p, $2, 0); - } - ; - -f_marg_list : f_marg - { - $$ = list1($1); - } - | f_marg_list ',' f_marg - { - $$ = push($1, $3); - } - ; - -f_margs : f_marg_list +f_margs : f_arg { $$ = list3($1,0,0); } - | f_marg_list ',' tSTAR f_norm_arg + | f_arg ',' tSTAR f_norm_arg { $$ = list3($1, new_arg(p, $4), 0); } - | f_marg_list ',' tSTAR f_norm_arg ',' f_marg_list + | f_arg ',' tSTAR f_norm_arg ',' f_arg { $$ = list3($1, new_arg(p, $4), $6); } - | f_marg_list ',' tSTAR + | f_arg ',' tSTAR { - $$ = list3($1, (node*)-1, 0); + local_add_f(p, 0); + $$ = list3($1, nint(-1), 0); } - | f_marg_list ',' tSTAR ',' f_marg_list + | f_arg ',' tSTAR ',' f_arg { - $$ = list3($1, (node*)-1, $5); + $$ = list3($1, nint(-1), $5); } | tSTAR f_norm_arg { $$ = list3(0, new_arg(p, $2), 0); } - | tSTAR f_norm_arg ',' f_marg_list + | tSTAR f_norm_arg ',' f_arg { $$ = list3(0, new_arg(p, $2), $4); } | tSTAR { - $$ = list3(0, (node*)-1, 0); + local_add_f(p, 0); + $$ = list3(0, nint(-1), 0); } - | tSTAR ',' f_marg_list + | tSTAR ',' { - $$ = list3(0, (node*)-1, $3); + local_add_f(p, 0); + } + f_arg + { + $$ = list3(0, nint(-1), $4); } ; @@ -2550,9 +3013,9 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail { $$ = new_args(p, $1, 0, $3, 0, $4); } - | f_arg ',' + | f_arg ',' opt_block_args_tail { - $$ = new_args(p, $1, 0, 0, 0, 0); + $$ = new_args(p, $1, 0, 0, 0, $3); } | f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail { @@ -2593,19 +3056,24 @@ block_param : f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail ; opt_block_param : none - | block_param_def { + local_add_blk(p, 0); + $$ = 0; + } + | block_param_def + { p->cmd_start = TRUE; $$ = $1; } ; -block_param_def : '|' opt_bv_decl '|' +block_param_def : '|' {local_add_blk(p, 0);} opt_bv_decl '|' { $$ = 0; } | tOROP { + local_add_blk(p, 0); $$ = 0; } | '|' block_param opt_bv_decl '|' @@ -2660,6 +3128,7 @@ lambda_body : tLAMBEG compstmt '}' do_block : keyword_do_block { local_nest(p); + nvars_nest(p); } opt_block_param bodystmt @@ -2667,12 +3136,13 @@ do_block : keyword_do_block { $$ = new_block(p,$3,$4); local_unnest(p); + nvars_unnest(p); } ; block_call : command do_block { - if ($1->car == (node*)NODE_YIELD) { + if (typen($1->car) == NODE_YIELD) { yyerror(p, "block given to yield"); } else { @@ -2714,11 +3184,11 @@ method_call : operation paren_args } | primary_value call_op paren_args { - $$ = new_call(p, $1, intern("call",4), $3, $2); + $$ = new_call(p, $1, MRB_SYM_2(p->mrb, call), $3, $2); } | primary_value tCOLON2 paren_args { - $$ = new_call(p, $1, intern("call",4), $3, tCOLON2); + $$ = new_call(p, $1, MRB_SYM_2(p->mrb, call), $3, tCOLON2); } | keyword_super paren_args { @@ -2728,15 +3198,16 @@ method_call : operation paren_args { $$ = new_zsuper(p); } - | primary_value '[' opt_call_args rbracket + | primary_value '[' opt_call_args ']' { - $$ = new_call(p, $1, intern("[]",2), $3, '.'); + $$ = new_call(p, $1, intern_op(aref), $3, '.'); } ; brace_block : '{' { local_nest(p); + nvars_nest(p); $<num>$ = p->lineno; } opt_block_param @@ -2745,10 +3216,12 @@ brace_block : '{' $$ = new_block(p,$3,$4); SET_LINENO($$, $<num>2); local_unnest(p); + nvars_unnest(p); } | keyword_do { local_nest(p); + nvars_nest(p); $<num>$ = p->lineno; } opt_block_param @@ -2757,6 +3230,7 @@ brace_block : '{' $$ = new_block(p,$3,$4); SET_LINENO($$, $<num>2); local_unnest(p); + nvars_unnest(p); } ; @@ -2818,7 +3292,14 @@ literal : numeric | symbols ; -string : tCHAR +string : string_fragment + | string string_fragment + { + $$ = concat_string(p, $1, $2); + } + ; + +string_fragment : tCHAR | tSTRING | tSTRING_BEG tSTRING { @@ -3016,6 +3497,10 @@ var_lhs : variable { assignable(p, $1); } + | tNUMPARAM + { + yyerror(p, "can't assign to numbered parameter"); + } ; var_ref : variable @@ -3040,7 +3525,7 @@ var_ref : variable } | keyword__FILE__ { - const char *fn = p->filename; + const char *fn = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); if (!fn) { fn = "(null)"; } @@ -3050,8 +3535,8 @@ var_ref : variable { char buf[16]; - snprintf(buf, sizeof(buf), "%d", p->lineno); - $$ = new_int(p, buf, 10); + dump_int(p->lineno, buf); + $$ = new_int(p, buf, 10, 0); } | keyword__ENCODING__ { @@ -3088,12 +3573,56 @@ superclass : /* term */ } */ ; -f_arglist : '(' f_args rparen +f_opt_arglist_paren + : f_arglist_paren + | none + ; + +f_arglist_paren : '(' f_args rparen { $$ = $2; p->lstate = EXPR_BEG; p->cmd_start = TRUE; } + | '(' f_arg ',' tBDOT3 rparen + { +#if 1 + /* til real keyword args implemented */ + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + local_add_f(p, r); + $$ = new_args(p, $2, 0, r, 0, + new_args_tail(p, 0, 0, b)); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + local_add_f(p, r); local_add_f(p, k); + $$ = new_args(p, $2, 0, r, 0, + new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b)); +#endif + } + | '(' tBDOT3 rparen + { +#if 1 + /* til real keyword args implemented */ + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + local_add_f(p, r); + $$ = new_args(p, 0, 0, r, 0, + new_args_tail(p, 0, 0, b)); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + local_add_f(p, r); local_add_f(p, k); + $$ = new_args(p, 0, 0, r, 0, + new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b)); +#endif + } + ; + +f_arglist : f_arglist_paren | f_args term { $$ = $1; @@ -3101,26 +3630,33 @@ f_arglist : '(' f_args rparen ; f_label : tIDENTIFIER tLABEL_TAG + { + local_nest(p); + } ; f_kw : f_label arg { void_expr_error(p, $2); - $$ = new_kw_arg(p, $1, $2); + $$ = new_kw_arg(p, $1, cons($2, locals_node(p))); + local_unnest(p); } | f_label { $$ = new_kw_arg(p, $1, 0); + local_unnest(p); } ; f_block_kw : f_label primary_value { - $$ = new_kw_arg(p, $1, $2); + $$ = new_kw_arg(p, $1, cons($2, locals_node(p))); + local_unnest(p); } | f_label { $$ = new_kw_arg(p, $1, 0); + local_unnest(p); } ; @@ -3150,11 +3686,11 @@ kwrest_mark : tPOW f_kwrest : kwrest_mark tIDENTIFIER { - $$ = cons((node*)NODE_KW_REST_ARGS, nsym($2)); + $$ = new_kw_rest_args(p, nsym($2)); } | kwrest_mark { - $$ = cons((node*)NODE_KW_REST_ARGS, 0); + $$ = new_kw_rest_args(p, 0); } ; @@ -3244,7 +3780,7 @@ f_args : f_arg ',' f_optarg ',' f_rest_arg opt_args_tail } | /* none */ { - local_add_f(p, mrb_intern_lit(p->mrb, "&")); + local_add_f(p, intern_op(and)); $$ = new_args(p, 0, 0, 0, 0, 0); } ; @@ -3269,6 +3805,11 @@ f_bad_arg : tCONSTANT yyerror(p, "formal argument cannot be a class variable"); $$ = 0; } + | tNUMPARAM + { + yyerror(p, "formal argument cannot be a numbered parameter"); + $$ = 0; + } ; f_norm_arg : f_bad_arg @@ -3286,9 +3827,15 @@ f_arg_item : f_norm_arg { $$ = new_arg(p, $1); } - | tLPAREN f_margs rparen + | tLPAREN { - $$ = new_masgn(p, $2, 0); + $<nd>$ = local_switch(p); + } + f_margs rparen + { + $$ = new_masgn_param(p, $3, p->locals->car); + local_resume(p, $<nd>2); + local_add_f(p, 0); } ; @@ -3305,6 +3852,7 @@ f_arg : f_arg_item f_opt_asgn : tIDENTIFIER '=' { local_add_f(p, $1); + local_nest(p); $$ = $1; } ; @@ -3312,14 +3860,16 @@ f_opt_asgn : tIDENTIFIER '=' f_opt : f_opt_asgn arg { void_expr_error(p, $2); - $$ = cons(nsym($1), $2); + $$ = cons(nsym($1), cons($2, locals_node(p))); + local_unnest(p); } ; f_block_opt : f_opt_asgn primary_value { void_expr_error(p, $2); - $$ = cons(nsym($1), $2); + $$ = cons(nsym($1), cons($2, locals_node(p))); + local_unnest(p); } ; @@ -3354,7 +3904,7 @@ f_rest_arg : restarg_mark tIDENTIFIER } | restarg_mark { - local_add_f(p, mrb_intern_lit(p->mrb, "*")); + local_add_f(p, intern_op(mul)); $$ = -1; } ; @@ -3390,7 +3940,7 @@ singleton : var_ref yyerror(p, "can't define singleton method for ()."); } else { - switch ((enum node_type)intn($3->car)) { + switch (typen($3->car)) { case NODE_STR: case NODE_DSTR: case NODE_XSTR: @@ -3421,27 +3971,31 @@ assocs : assoc $$ = list1($1); NODE_LINENO($$, $1); } - | assocs ',' assoc + | assocs comma assoc { $$ = push($1, $3); } ; +label_tag : tLABEL_TAG + | tLABEL_TAG heredoc_bodies + ; + assoc : arg tASSOC arg { void_expr_error(p, $1); void_expr_error(p, $3); $$ = cons($1, $3); } - | tIDENTIFIER tLABEL_TAG arg + | tIDENTIFIER label_tag arg { void_expr_error(p, $3); $$ = cons(new_sym(p, $1), $3); } - | string tLABEL_TAG arg + | string_fragment label_tag arg { void_expr_error(p, $3); - if ($1->car == (node*)NODE_DSTR) { + if (typen($1->car) == NODE_DSTR) { $$ = cons(new_dsym(p, $1), $3); } else { @@ -3451,7 +4005,7 @@ assoc : arg tASSOC arg | tDSTAR arg { void_expr_error(p, $2); - $$ = cons(cons((node*)NODE_KW_REST_ARGS, 0), $2); + $$ = cons(new_kw_rest_args(p, 0), $2); } ; @@ -3500,14 +4054,11 @@ opt_nl : /* none */ | nl ; -rparen : opt_nl ')' - ; - -rbracket : opt_nl ']' +rparen : opt_terms ')' ; trailer : /* none */ - | nl + | terms | comma ; @@ -3518,7 +4069,7 @@ term : ';' {yyerrok;} nl : '\n' { - p->lineno++; + p->lineno += $<num>1; p->column = 0; } ; @@ -3542,9 +4093,10 @@ yyerror(parser_state *p, const char *s) size_t n; if (! p->capture_errors) { -#ifndef MRB_DISABLE_STDIO - if (p->filename) { - fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s); +#ifndef MRB_NO_STDIO + if (p->filename_sym) { + const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); + fprintf(stderr, "%s:%d:%d: %s\n", filename, p->lineno, p->column, s); } else { fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s); @@ -3563,11 +4115,13 @@ yyerror(parser_state *p, const char *s) } static void -yyerror_i(parser_state *p, const char *fmt, int i) +yyerror_c(parser_state *p, const char *msg, char c) { char buf[256]; - snprintf(buf, sizeof(buf), fmt, i); + strncpy(buf, msg, sizeof(buf) - 2); + buf[sizeof(buf) - 2] = '\0'; + strncat(buf, &c, 1); yyerror(p, buf); } @@ -3578,12 +4132,13 @@ yywarn(parser_state *p, const char *s) size_t n; if (! p->capture_errors) { -#ifndef MRB_DISABLE_STDIO - if (p->filename) { - fprintf(stderr, "%s:%d:%d: %s\n", p->filename, p->lineno, p->column, s); +#ifndef MRB_NO_STDIO + if (p->filename_sym) { + const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); + fprintf(stderr, "%s:%d:%d: warning: %s\n", filename, p->lineno, p->column, s); } else { - fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s); + fprintf(stderr, "line %d:%d: warning: %s\n", p->lineno, p->column, s); } #endif } @@ -3605,11 +4160,14 @@ yywarning(parser_state *p, const char *s) } static void -yywarning_s(parser_state *p, const char *fmt, const char *s) +yywarning_s(parser_state *p, const char *msg, const char *s) { char buf[256]; - snprintf(buf, sizeof(buf), fmt, s); + strncpy(buf, msg, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; + strncat(buf, ": ", sizeof(buf) - strlen(buf) - 1); + strncat(buf, s, sizeof(buf) - strlen(buf) - 1); yywarning(p, buf); } @@ -3621,13 +4179,13 @@ backref_error(parser_state *p, node *n) c = intn(n->car); if (c == NODE_NTH_REF) { - yyerror_i(p, "can't set variable $%" MRB_PRId, intn(n->cdr)); + yyerror_c(p, "can't set variable $", (char)intn(n->cdr)+'0'); } else if (c == NODE_BACK_REF) { - yyerror_i(p, "can't set variable $%c", intn(n->cdr)); + yyerror_c(p, "can't set variable $", (char)intn(n->cdr)); } else { - mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %S", mrb_fixnum_value(c)); + mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %d", c); } } @@ -3648,8 +4206,10 @@ void_expr_error(parser_state *p, node *n) break; case NODE_AND: case NODE_OR: - void_expr_error(p, n->cdr->car); - void_expr_error(p, n->cdr->cdr); + if (n->cdr) { + void_expr_error(p, n->cdr->car); + void_expr_error(p, n->cdr->cdr); + } break; case NODE_BEGIN: if (n->cdr) { @@ -3669,6 +4229,27 @@ static mrb_bool peeks(parser_state *p, const char *s); static mrb_bool skips(parser_state *p, const char *s); static inline int +nextc0(parser_state *p) +{ + int c; + + if (p->s && p->s < p->send) { + c = (unsigned char)*p->s++; + } + else { +#ifndef MRB_NO_STDIO + if (p->f) { + c = fgetc(p->f); + if (feof(p->f)) return -1; + } + else +#endif + return -1; + } + return c; +} + +static inline int nextc(parser_state *p) { int c; @@ -3682,31 +4263,18 @@ nextc(parser_state *p) cons_free(tmp); } else { -#ifndef MRB_DISABLE_STDIO - if (p->f) { - if (feof(p->f)) goto eof; - c = fgetc(p->f); - if (c == EOF) goto eof; - } - else -#endif - if (!p->s || p->s >= p->send) { - goto eof; - } - else { - c = (unsigned char)*p->s++; - } + c = nextc0(p); + if (c < 0) goto eof; } if (c >= 0) { p->column++; } if (c == '\r') { - c = nextc(p); - if (c != '\n') { - pushback(p, c); - return '\r'; + const int lf = nextc0(p); + if (lf == '\n') { + return '\n'; } - return c; + if (lf > 0) pushback(p, lf); } return c; @@ -3753,7 +4321,7 @@ peekc_n(parser_state *p, int n) list = push(list, nint(c0)); } while(n--); if (p->pb) { - p->pb = append((node*)list, p->pb); + p->pb = append(list, p->pb); } else { p->pb = list; @@ -3773,7 +4341,7 @@ peeks(parser_state *p, const char *s) { size_t len = strlen(s); -#ifndef MRB_DISABLE_STDIO +#ifndef MRB_NO_STDIO if (p->f) { int n = 0; while (*s) { @@ -4131,6 +4699,89 @@ read_escape(parser_state *p) } } +static void +heredoc_count_indent(parser_heredoc_info *hinf, const char *str, size_t len, size_t spaces, size_t *offset) +{ + size_t indent = 0; + *offset = 0; + for (size_t i = 0; i < len; i++) { + size_t size; + if (str[i] == '\n') + break; + else if (str[i] == '\t') + size = 8; + else if (ISSPACE(str[i])) + size = 1; + else + break; + size_t nindent = indent + size; + if (nindent > spaces || nindent > hinf->indent) + break; + indent = nindent; + *offset += 1; + } +} + +static void +heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf) +{ + if (!hinf->remove_indent || hinf->indent == 0) + return; + node *indented, *n, *pair, *escaped, *nspaces; + const char *str; + size_t len, spaces, offset, start, end; + indented = hinf->indented; + while (indented) { + n = indented->car; + pair = n->car; + str = (char*)pair->car; + len = (size_t)pair->cdr; + escaped = n->cdr->car; + nspaces = n->cdr->cdr; + if (escaped) { + char *newstr = strndup(str, len); + size_t newlen = 0; + start = 0; + while (start < len) { + end = escaped ? (size_t)escaped->car : len; + if (end > len) end = len; + spaces = (size_t)nspaces->car; + size_t esclen = end - start; + heredoc_count_indent(hinf, str + start, esclen, spaces, &offset); + esclen -= offset; + memcpy(newstr + newlen, str + start + offset, esclen); + newlen += esclen; + start = end; + if (escaped) + escaped = escaped->cdr; + nspaces = nspaces->cdr; + } + if (newlen < len) + newstr[newlen] = '\0'; + pair->car = (node*)newstr; + pair->cdr = (node*)newlen; + } else { + spaces = (size_t)nspaces->car; + heredoc_count_indent(hinf, str, len, spaces, &offset); + pair->car = (node*)(str + offset); + pair->cdr = (node*)(len - offset); + } + indented = indented->cdr; + } +} + +static void +heredoc_push_indented(parser_state *p, parser_heredoc_info *hinf, node *pair, node *escaped, node *nspaces, mrb_bool empty_line) +{ + hinf->indented = push(hinf->indented, cons(pair, cons(escaped, nspaces))); + while (nspaces) { + size_t tspaces = (size_t)nspaces->car; + if ((hinf->indent == ~0U || tspaces < hinf->indent) && !empty_line) + hinf->indent = tspaces; + nspaces = nspaces->cdr; + } +} + static int parse_string(parser_state *p) { @@ -4141,10 +4792,19 @@ parse_string(parser_state *p) int end = intn(p->lex_strterm->cdr->cdr->cdr); parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL; + mrb_bool unindent = hinf && hinf->remove_indent; + mrb_bool head = hinf && hinf->line_head; + mrb_bool empty = TRUE; + size_t spaces = 0; + size_t pos = -1; + node *escaped = NULL; + node *nspaces = NULL; + if (beg == 0) beg = -3; /* should never happen */ if (end == 0) end = -3; newtok(p); while ((c = nextc(p)) != end || nest_level != 0) { + pos++; if (hinf && (c == '\n' || c < 0)) { mrb_bool line_head; tokadd(p, '\n'); @@ -4164,23 +4824,41 @@ parse_string(parser_state *p) } } if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) { - if (c < 0) { - p->parsing_heredoc = NULL; - } - else { - return tHEREDOC_END; - } + heredoc_remove_indent(p, hinf); + return tHEREDOC_END; } } if (c < 0) { char buf[256]; - snprintf(buf, sizeof(buf), "can't find heredoc delimiter \"%s\" anywhere before EOF", hinf->term); - yyerror(p, buf); + const char s1[] = "can't find heredoc delimiter \""; + const char s2[] = "\" anywhere before EOF"; + + if (sizeof(s1)+sizeof(s2)+strlen(hinf->term)+1 >= sizeof(buf)) { + yyerror(p, "can't find heredoc delimiter anywhere before EOF"); + } else { + strcpy(buf, s1); + strcat(buf, hinf->term); + strcat(buf, s2); + yyerror(p, buf); + } return 0; } - pylval.nd = new_str(p, tok(p), toklen(p)); + node *nd = new_str(p, tok(p), toklen(p)); + pylval.nd = nd; + if (unindent && head) { + nspaces = push(nspaces, nint(spaces)); + heredoc_push_indented(p, hinf, nd->cdr, escaped, nspaces, empty && line_head); + } return tHD_STRING_MID; } + if (unindent && empty) { + if (c == '\t') + spaces += 8; + else if (ISSPACE(c)) + ++spaces; + else + empty = FALSE; + } if (c < 0) { yyerror(p, "unterminated string meets end of file"); return 0; @@ -4202,6 +4880,13 @@ parse_string(parser_state *p) else if (c == '\n') { p->lineno++; p->column = 0; + if (unindent) { + nspaces = push(nspaces, nint(spaces)); + escaped = push(escaped, nint(pos)); + pos--; + empty = TRUE; + spaces = 0; + } if (type & STR_FUNC_ARRAY) { tokadd(p, '\n'); } @@ -4251,8 +4936,13 @@ parse_string(parser_state *p) tokfix(p); p->lstate = EXPR_BEG; p->cmd_start = TRUE; - pylval.nd = new_str(p, tok(p), toklen(p)); + node *nd = new_str(p, tok(p), toklen(p)); + pylval.nd = nd; if (hinf) { + if (unindent && head) { + nspaces = push(nspaces, nint(spaces)); + heredoc_push_indented(p, hinf, nd->cdr, escaped, nspaces, FALSE); + } hinf->line_head = FALSE; return tHD_STRING_PART; } @@ -4319,15 +5009,21 @@ parse_string(parser_state *p) case 'm': f |= 4; break; case 'u': f |= 16; break; case 'n': f |= 32; break; + case 'o': break; default: tokadd(p, re_opt); break; } } pushback(p, re_opt); if (toklen(p)) { char msg[128]; + + strcpy(msg, "unknown regexp option"); tokfix(p); - snprintf(msg, sizeof(msg), "unknown regexp option%s - %s", - toklen(p) > 1 ? "s" : "", tok(p)); + if (toklen(p) > 1) { + strcat(msg, "s"); + } + strcat(msg, " - "); + strncat(msg, tok(p), sizeof(msg) - strlen(msg) - 1); yyerror(p, msg); } if (f != 0) { @@ -4358,6 +5054,44 @@ parse_string(parser_state *p) return tSTRING; } +static int +number_literal_suffix(parser_state *p) +{ + int c, result = 0; + node *list = 0; + int column = p->column; + int mask = NUM_SUFFIX_R|NUM_SUFFIX_I; + + while ((c = nextc(p)) != -1) { + list = push(list, nint(c)); + + if ((mask & NUM_SUFFIX_I) && c == 'i') { + result |= (mask & NUM_SUFFIX_I); + mask &= ~NUM_SUFFIX_I; + /* r after i, rational of complex is disallowed */ + mask &= ~NUM_SUFFIX_R; + continue; + } + if ((mask & NUM_SUFFIX_R) && c == 'r') { + result |= (mask & NUM_SUFFIX_R); + mask &= ~NUM_SUFFIX_R; + continue; + } + if (!ISASCII(c) || ISALPHA(c) || c == '_') { + p->column = column; + if (p->pb) { + p->pb = append(list, p->pb); + } + else { + p->pb = list; + } + return 0; + } + pushback(p, c); + break; + } + return result; +} static int heredoc_identifier(parser_state *p) @@ -4365,6 +5099,7 @@ heredoc_identifier(parser_state *p) int c; int type = str_heredoc; mrb_bool indent = FALSE; + mrb_bool squiggly = FALSE; mrb_bool quote = FALSE; node *newnode; parser_heredoc_info *info; @@ -4374,8 +5109,11 @@ heredoc_identifier(parser_state *p) pushback(p, c); return 0; } - if (c == '-') { - indent = TRUE; + if (c == '-' || c == '~') { + if (c == '-') + indent = TRUE; + if (c == '~') + squiggly = TRUE; c = nextc(p); } if (c == '\'' || c == '"') { @@ -4402,6 +5140,7 @@ heredoc_identifier(parser_state *p) if (! identchar(c)) { pushback(p, c); if (indent) pushback(p, '-'); + if (squiggly) pushback(p, '~'); return 0; } newtok(p); @@ -4418,7 +5157,10 @@ heredoc_identifier(parser_state *p) if (! quote) type |= STR_FUNC_EXPAND; info->type = (string_type)type; - info->allow_indent = indent; + info->allow_indent = indent || squiggly; + info->remove_indent = squiggly; + info->indent = ~0U; + info->indented = NULL; info->line_head = TRUE; info->doc = NULL; p->heredocs_from_nextline = push(p->heredocs_from_nextline, newnode); @@ -4441,6 +5183,7 @@ static int parser_yylex(parser_state *p) { int32_t c; + int nlines = 1; int space_seen = 0; int cmd_state; enum mrb_lex_state_enum last_state; @@ -4478,63 +5221,79 @@ parser_yylex(parser_state *p) /* fall through */ case -2: /* end of a file */ case '\n': - maybe_heredoc: + maybe_heredoc: heredoc_treat_nextline(p); - switch (p->lstate) { - case EXPR_BEG: - case EXPR_FNAME: - case EXPR_DOT: - case EXPR_CLASS: - case EXPR_VALUE: - p->lineno++; p->column = 0; - if (p->parsing_heredoc != NULL) { - if (p->lex_strterm) { - return parse_string(p); + switch (p->lstate) { + case EXPR_BEG: + case EXPR_FNAME: + case EXPR_DOT: + case EXPR_CLASS: + case EXPR_VALUE: + p->lineno++; + if (p->parsing_heredoc != NULL) { + if (p->lex_strterm) { + return parse_string(p); + } } - } - goto retry; - default: - break; - } - if (p->parsing_heredoc != NULL) { - return '\n'; - } - while ((c = nextc(p))) { - switch (c) { - case ' ': case '\t': case '\f': case '\r': - case '\13': /* '\v' */ - space_seen = 1; + goto retry; + default: break; - case '.': - if ((c = nextc(p)) != '.') { + } + if (p->parsing_heredoc != NULL) { + pylval.num = nlines; + return '\n'; + } + while ((c = nextc(p))) { + switch (c) { + case ' ': case '\t': case '\f': case '\r': + case '\13': /* '\v' */ + space_seen = 1; + break; + case '#': /* comment as a whitespace */ + skip(p, '\n'); + nlines++; + break; + case '.': + if (!peek(p, '.')) { + pushback(p, '.'); + p->lineno+=nlines; nlines=1; + goto retry; + } pushback(p, c); - pushback(p, '.'); - goto retry; + goto normal_newline; + case '&': + if (peek(p, '.')) { + pushback(p, '&'); + p->lineno+=nlines; nlines=1; + goto retry; + } + pushback(p, c); + goto normal_newline; + case -1: /* EOF */ + case -2: /* end of a file */ + goto normal_newline; + default: + pushback(p, c); + goto normal_newline; } - case -1: /* EOF */ - case -2: /* end of a file */ - goto normal_newline; - default: - pushback(p, c); - goto normal_newline; } - } normal_newline: - p->cmd_start = TRUE; - p->lstate = EXPR_BEG; - return '\n'; + p->cmd_start = TRUE; + p->lstate = EXPR_BEG; + pylval.num = nlines; + return '\n'; case '*': if ((c = nextc(p)) == '*') { if ((c = nextc(p)) == '=') { - pylval.id = intern("**",2); + pylval.id = intern_op(pow); p->lstate = EXPR_BEG; return tOP_ASGN; } pushback(p, c); if (IS_SPCARG(c)) { - yywarning(p, "`**' interpreted as argument prefix"); + yywarning(p, "'**' interpreted as argument prefix"); c = tDSTAR; } else if (IS_BEG()) { @@ -4546,7 +5305,7 @@ parser_yylex(parser_state *p) } else { if (c == '=') { - pylval.id = intern_c('*'); + pylval.id = intern_op(mul); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4605,7 +5364,7 @@ parser_yylex(parser_state *p) c = nextc(p); } while (!(c < 0 || ISSPACE(c))); if (c != '\n') skip(p, '\n'); - p->lineno++; + p->lineno+=nlines; nlines=1; p->column = 0; goto retry; } @@ -4662,7 +5421,7 @@ parser_yylex(parser_state *p) } if (c == '<') { if ((c = nextc(p)) == '=') { - pylval.id = intern("<<",2); + pylval.id = intern_op(lshift); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4684,7 +5443,7 @@ parser_yylex(parser_state *p) } if (c == '>') { if ((c = nextc(p)) == '=') { - pylval.id = intern(">>",2); + pylval.id = intern_op(rshift); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4755,7 +5514,10 @@ parser_yylex(parser_state *p) } if (c2) { char buf[256]; - snprintf(buf, sizeof(buf), "invalid character syntax; use ?\\%c", c2); + char cc[] = { (char)c2, '\0' }; + + strcpy(buf, "invalid character syntax; use ?\\"); + strncat(buf, cc, 2); yyerror(p, buf); } } @@ -4766,10 +5528,10 @@ parser_yylex(parser_state *p) } newtok(p); /* need support UTF-8 if configured */ - if ((isalnum(c) || c == '_')) { + if ((ISALNUM(c) || c == '_')) { int c2 = nextc(p); pushback(p, c2); - if ((isalnum(c2) || c2 == '_')) { + if ((ISALNUM(c2) || c2 == '_')) { goto ternary; } } @@ -4789,7 +5551,7 @@ parser_yylex(parser_state *p) if ((c = nextc(p)) == '&') { p->lstate = EXPR_BEG; if ((c = nextc(p)) == '=') { - pylval.id = intern("&&",2); + pylval.id = intern_op(andand); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4801,7 +5563,7 @@ parser_yylex(parser_state *p) return tANDDOT; } else if (c == '=') { - pylval.id = intern_c('&'); + pylval.id = intern_op(and); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4828,7 +5590,7 @@ parser_yylex(parser_state *p) if ((c = nextc(p)) == '|') { p->lstate = EXPR_BEG; if ((c = nextc(p)) == '=') { - pylval.id = intern("||",2); + pylval.id = intern_op(oror); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4836,7 +5598,7 @@ parser_yylex(parser_state *p) return tOROP; } if (c == '=') { - pylval.id = intern_c('|'); + pylval.id = intern_op(or); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4860,7 +5622,7 @@ parser_yylex(parser_state *p) return '+'; } if (c == '=') { - pylval.id = intern_c('+'); + pylval.id = intern_op(add); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4888,7 +5650,7 @@ parser_yylex(parser_state *p) return '-'; } if (c == '=') { - pylval.id = intern_c('-'); + pylval.id = intern_op(sub); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -4909,26 +5671,30 @@ parser_yylex(parser_state *p) return '-'; case '.': - p->lstate = EXPR_BEG; - if ((c = nextc(p)) == '.') { + { + int is_beg = IS_BEG(); + p->lstate = EXPR_BEG; if ((c = nextc(p)) == '.') { - return tDOT3; + if ((c = nextc(p)) == '.') { + return is_beg ? tBDOT3 : tDOT3; + } + pushback(p, c); + return is_beg ? tBDOT2 : tDOT2; } pushback(p, c); - return tDOT2; - } - pushback(p, c); - if (c >= 0 && ISDIGIT(c)) { - yyerror(p, "no .<digit> floating literal anymore; put 0 before dot"); + if (c >= 0 && ISDIGIT(c)) { + yyerror(p, "no .<digit> floating literal anymore; put 0 before dot"); + } + p->lstate = EXPR_DOT; + return '.'; } - p->lstate = EXPR_DOT; - return '.'; start_num: case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { int is_float, seen_point, seen_e, nondigit; + int suffix = 0; is_float = seen_point = seen_e = nondigit = 0; p->lstate = EXPR_ENDARG; @@ -4962,7 +5728,8 @@ parser_yylex(parser_state *p) no_digits(); } else if (nondigit) goto trailing_uc; - pylval.nd = new_int(p, tok(p), 16); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 16, suffix); return tINTEGER; } if (c == 'b' || c == 'B') { @@ -4986,7 +5753,8 @@ parser_yylex(parser_state *p) no_digits(); } else if (nondigit) goto trailing_uc; - pylval.nd = new_int(p, tok(p), 2); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 2, suffix); return tINTEGER; } if (c == 'd' || c == 'D') { @@ -5010,7 +5778,8 @@ parser_yylex(parser_state *p) no_digits(); } else if (nondigit) goto trailing_uc; - pylval.nd = new_int(p, tok(p), 10); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 10, suffix); return tINTEGER; } if (c == '_') { @@ -5043,7 +5812,8 @@ parser_yylex(parser_state *p) pushback(p, c); tokfix(p); if (nondigit) goto trailing_uc; - pylval.nd = new_int(p, tok(p), 8); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 8, suffix); return tINTEGER; } if (nondigit) { @@ -5060,7 +5830,8 @@ parser_yylex(parser_state *p) } else { pushback(p, c); - pylval.nd = new_int(p, "0", 10); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, "0", 10, suffix); return tINTEGER; } } @@ -5128,13 +5899,13 @@ parser_yylex(parser_state *p) pushback(p, c); if (nondigit) { trailing_uc: - yyerror_i(p, "trailing '%c' in number", nondigit); + yyerror_c(p, "trailing non digit in number: ", (char)nondigit); } tokfix(p); if (is_float) { -#ifdef MRB_WITHOUT_FLOAT - yywarning_s(p, "floating point numbers are not supported", tok(p)); - pylval.nd = new_int(p, "0", 10); +#ifdef MRB_NO_FLOAT + yywarning_s(p, "floating-point numbers are not supported", tok(p)); + pylval.nd = new_int(p, "0", 10, 0); return tINTEGER; #else double d; @@ -5143,17 +5914,23 @@ parser_yylex(parser_state *p) errno = 0; d = mrb_float_read(tok(p), &endp); if (d == 0 && endp == tok(p)) { - yywarning_s(p, "corrupted float value %s", tok(p)); + yywarning_s(p, "corrupted float value", tok(p)); } else if (errno == ERANGE) { - yywarning_s(p, "float %s out of range", tok(p)); + yywarning_s(p, "float out of range", tok(p)); errno = 0; } - pylval.nd = new_float(p, tok(p)); + suffix = number_literal_suffix(p); + if (seen_e && (suffix & NUM_SUFFIX_R)) { + pushback(p, 'r'); + suffix &= ~NUM_SUFFIX_R; + } + pylval.nd = new_float(p, tok(p), suffix); return tFLOAT; #endif } - pylval.nd = new_int(p, tok(p), 10); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 10, suffix); return tINTEGER; } @@ -5185,14 +5962,14 @@ parser_yylex(parser_state *p) p->lstate = EXPR_BEG; return tLABEL_TAG; } - if (!ISSPACE(c) || IS_BEG()) { + if (IS_END() || ISSPACE(c) || c == '#') { pushback(p, c); - p->lstate = EXPR_FNAME; - return tSYMBEG; + p->lstate = EXPR_BEG; + return ':'; } pushback(p, c); - p->lstate = EXPR_BEG; - return ':'; + p->lstate = EXPR_FNAME; + return tSYMBEG; case '/': if (IS_BEG()) { @@ -5200,7 +5977,7 @@ parser_yylex(parser_state *p) return tREGEXP_BEG; } if ((c = nextc(p)) == '=') { - pylval.id = intern_c('/'); + pylval.id = intern_op(div); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -5219,7 +5996,7 @@ parser_yylex(parser_state *p) case '^': if ((c = nextc(p)) == '=') { - pylval.id = intern_c('^'); + pylval.id = intern_op(xor); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -5272,6 +6049,7 @@ parser_yylex(parser_state *p) p->paren_nest++; if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { p->lstate = EXPR_ARG; + p->paren_nest--; if ((c = nextc(p)) == ']') { if ((c = nextc(p)) == '=') { return tASET; @@ -5316,7 +6094,7 @@ parser_yylex(parser_state *p) case '\\': c = nextc(p); if (c == '\n') { - p->lineno++; + p->lineno+=nlines; nlines=1; p->column = 0; space_seen = 1; goto retry; /* skip \\n */ @@ -5337,7 +6115,7 @@ parser_yylex(parser_state *p) } else { term = nextc(p); - if (isalnum(term)) { + if (ISALNUM(term)) { yyerror(p, "unknown type of %string"); return 0; } @@ -5396,7 +6174,7 @@ parser_yylex(parser_state *p) } } if ((c = nextc(p)) == '=') { - pylval.id = intern_c('%'); + pylval.id = intern_op(mod); p->lstate = EXPR_BEG; return tOP_ASGN; } @@ -5450,7 +6228,7 @@ parser_yylex(parser_state *p) tokadd(p, '$'); tokadd(p, c); tokfix(p); - pylval.id = intern_cstr(tok(p)); + pylval.id = intern(tok(p), toklen(p)); return tGVAR; case '-': @@ -5460,7 +6238,7 @@ parser_yylex(parser_state *p) pushback(p, c); gvar: tokfix(p); - pylval.id = intern_cstr(tok(p)); + pylval.id = intern(tok(p), toklen(p)); return tGVAR; case '&': /* $&: last match */ @@ -5481,14 +6259,14 @@ parser_yylex(parser_state *p) do { tokadd(p, c); c = nextc(p); - } while (c >= 0 && isdigit(c)); + } while (c >= 0 && ISDIGIT(c)); pushback(p, c); if (last_state == EXPR_FNAME) goto gvar; tokfix(p); { unsigned long n = strtoul(tok(p), NULL, 10); if (n > INT_MAX) { - yyerror_i(p, "capture group index must be <= %d", INT_MAX); + yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX)); return 0; } pylval.nd = new_nth_ref(p, (int)n); @@ -5523,12 +6301,12 @@ parser_yylex(parser_state *p) } return 0; } - else if (isdigit(c)) { + else if (ISDIGIT(c)) { if (p->tidx == 1) { - yyerror_i(p, "'@%c' is not allowed as an instance variable name", c); + yyerror_c(p, "wrong instance variable name: @", c); } else { - yyerror_i(p, "'@@%c' is not allowed as a class variable name", c); + yyerror_c(p, "wrong class variable name: @@", c); } return 0; } @@ -5544,7 +6322,15 @@ parser_yylex(parser_state *p) default: if (!identchar(c)) { - yyerror_i(p, "Invalid char '\\x%02X' in expression", c); + char buf[36]; + const char s[] = "Invalid char in expression: 0x"; + const char hexdigits[] = "0123456789ABCDEF"; + + strcpy(buf, s); + buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4]; + buf[sizeof(s)] = hexdigits[(c & 0x0f)]; + buf[sizeof(s)+1] = 0; + yyerror(p, buf); goto retry; } @@ -5590,6 +6376,39 @@ parser_yylex(parser_state *p) result = tIVAR; break; + case '_': + if (p->lstate != EXPR_FNAME && toklen(p) == 2 && ISDIGIT(tok(p)[1]) && p->nvars) { + int n = tok(p)[1] - '0'; + int nvar; + + if (n > 0) { + node *nvars = p->nvars->cdr; + + while (nvars) { + nvar = intn(nvars->car); + if (nvar == -2) break; /* top of the scope */ + if (nvar > 0) { + yywarning(p, "numbered parameter used in outer block"); + break; + } + nvars->car = nint(-1); + nvars = nvars->cdr; + } + nvar = intn(p->nvars->car); + if (nvar == -1) { + yywarning(p, "numbered parameter used in inner block"); + } + if (nvar >= -1) { + pylval.num = n; + p->lstate = EXPR_END; + return tNUMPARAM; + } + else { + yywarning(p, "identifier for numbered parameter; consider another name"); + } + } + } + /* fall through */ default: if (toklast(p) == '!' || toklast(p) == '?') { result = tFID; @@ -5605,6 +6424,15 @@ parser_yylex(parser_state *p) else { pushback(p, c); } + if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') && + (!peek(p, '=') || (peek_n(p, '>', 1)))) { + result = tIDENTIFIER; + tokadd(p, c); + tokfix(p); + } + else { + pushback(p, c); + } } if (result == 0 && ISUPPER(tok(p)[0])) { result = tCONSTANT; @@ -5618,7 +6446,7 @@ parser_yylex(parser_state *p) if (IS_LABEL_SUFFIX(0)) { p->lstate = EXPR_END; tokfix(p); - pylval.id = intern_cstr(tok(p)); + pylval.id = intern(tok(p), toklen(p)); return tIDENTIFIER; } } @@ -5677,10 +6505,10 @@ parser_yylex(parser_state *p) } } { - mrb_sym ident = intern_cstr(tok(p)); + mrb_sym ident = intern(tok(p), toklen(p)); pylval.id = ident; - if (last_state != EXPR_DOT && islower(tok(p)[0]) && local_var_p(p, ident)) { + if (last_state != EXPR_DOT && ISLOWER(tok(p)[0]) && local_var_p(p, ident)) { p->lstate = EXPR_END; } } @@ -5711,7 +6539,7 @@ parser_init_cxt(parser_state *p, mrbc_context *cxt) } p->capture_errors = cxt->capture_errors; p->no_optimize = cxt->no_optimize; - p->on_eval = cxt->on_eval; + p->upper = cxt->upper; if (cxt->partial_hook) { p->cxt = cxt; } @@ -5810,7 +6638,7 @@ mrb_parser_new(mrb_state *mrb) p->pool = pool; p->s = p->send = NULL; -#ifndef MRB_DISABLE_STDIO +#ifndef MRB_NO_STDIO p->f = NULL; #endif @@ -5883,24 +6711,38 @@ mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*func)(struct mrb_parser } MRB_API void +mrbc_cleanup_local_variables(mrb_state *mrb, mrbc_context *c) +{ + if (c->syms) { + mrb_free(mrb, c->syms); + c->syms = NULL; + c->slen = 0; + } +} + +MRB_API void mrb_parser_set_filename(struct mrb_parser_state *p, const char *f) { mrb_sym sym; - size_t i; + uint16_t i; mrb_sym* new_table; sym = mrb_intern_cstr(p->mrb, f); - p->filename = mrb_sym2name_len(p->mrb, sym, NULL); + p->filename_sym = sym; p->lineno = (p->filename_table_length > 0)? 0 : 1; for (i = 0; i < p->filename_table_length; ++i) { if (p->filename_table[i] == sym) { - p->current_filename_index = (int)i; + p->current_filename_index = i; return; } } - p->current_filename_index = (int)p->filename_table_length++; + if (p->filename_table_length == UINT16_MAX) { + yyerror(p, "too many files to compile"); + return; + } + p->current_filename_index = p->filename_table_length++; new_table = (mrb_sym*)parser_palloc(p, sizeof(mrb_sym) * p->filename_table_length); if (p->filename_table) { @@ -5910,28 +6752,40 @@ mrb_parser_set_filename(struct mrb_parser_state *p, const char *f) p->filename_table[p->filename_table_length - 1] = sym; } -MRB_API char const* +MRB_API mrb_sym mrb_parser_get_filename(struct mrb_parser_state* p, uint16_t idx) { - if (idx >= p->filename_table_length) { return NULL; } + if (idx >= p->filename_table_length) return 0; else { - return mrb_sym2name_len(p->mrb, p->filename_table[idx], NULL); + return p->filename_table[idx]; } } -#ifndef MRB_DISABLE_STDIO -MRB_API parser_state* -mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c) +#ifndef MRB_NO_STDIO +static struct mrb_parser_state * +mrb_parse_file_continue(mrb_state *mrb, FILE *f, const void *prebuf, size_t prebufsize, mrbc_context *c) { parser_state *p; p = mrb_parser_new(mrb); if (!p) return NULL; - p->s = p->send = NULL; + if (prebuf) { + p->s = (const char *)prebuf; + p->send = (const char *)prebuf + prebufsize; + } + else { + p->s = p->send = NULL; + } p->f = f; mrb_parser_parse(p, c); return p; } + +MRB_API parser_state* +mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c) +{ + return mrb_parse_file_continue(mrb, f, NULL, 0, c); +} #endif MRB_API parser_state* @@ -5960,7 +6814,7 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) struct RClass *target = mrb->object_class; struct RProc *proc; mrb_value v; - unsigned int keep = 0; + mrb_int keep = 0; if (!p) { return mrb_undef_value(); @@ -5969,17 +6823,18 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) if (c) c->parser_nerr = p->nerr; if (p->capture_errors) { char buf[256]; - int n; - n = snprintf(buf, sizeof(buf), "line %d: %s\n", - p->error_buffer[0].lineno, p->error_buffer[0].message); - mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, n)); + strcpy(buf, "line "); + dump_int(p->error_buffer[0].lineno, buf+5); + strcat(buf, ": "); + strncat(buf, p->error_buffer[0].message, sizeof(buf) - strlen(buf) - 1); + mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, strlen(buf))); mrb_parser_free(p); return mrb_undef_value(); } else { if (mrb->exc == NULL) { - mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SYNTAX_ERROR, "syntax error")); + mrb->exc = mrb_obj_ptr(mrb_exc_new_lit(mrb, E_SYNTAX_ERROR, "syntax error")); } mrb_parser_free(p); return mrb_undef_value(); @@ -5989,7 +6844,7 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) mrb_parser_free(p); if (proc == NULL) { if (mrb->exc == NULL) { - mrb->exc = mrb_obj_ptr(mrb_exc_new_str_lit(mrb, E_SCRIPT_ERROR, "codegen error")); + mrb->exc = mrb_obj_ptr(mrb_exc_new_lit(mrb, E_SCRIPT_ERROR, "codegen error")); } return mrb_undef_value(); } @@ -6008,14 +6863,14 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) } MRB_PROC_SET_TARGET_CLASS(proc, target); if (mrb->c->ci) { - mrb->c->ci->target_class = target; + mrb_vm_ci_target_class_set(mrb->c->ci, target); } v = mrb_top_run(mrb, proc, mrb_top_self(mrb), keep); if (mrb->exc) return mrb_nil_value(); return v; } -#ifndef MRB_DISABLE_STDIO +#ifndef MRB_NO_STDIO MRB_API mrb_value mrb_load_file_cxt(mrb_state *mrb, FILE *f, mrbc_context *c) { @@ -6027,6 +6882,55 @@ mrb_load_file(mrb_state *mrb, FILE *f) { return mrb_load_file_cxt(mrb, f, NULL); } + +#define DETECT_SIZE 64 + +/* + * In order to be recognized as a `.mrb` file, the following three points must be satisfied: + * - File starts with "RITE" + * - At least `sizeof(struct rite_binary_header)` bytes can be read + * - `NUL` is included in the first 64 bytes of the file + */ +MRB_API mrb_value +mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrbc_context *c) +{ + union { + char b[DETECT_SIZE]; + struct rite_binary_header h; + } leading; + size_t bufsize; + + if (mrb == NULL || fp == NULL) { + return mrb_nil_value(); + } + + bufsize = fread(leading.b, sizeof(char), sizeof(leading), fp); + if (bufsize < sizeof(leading.h) || + memcmp(leading.h.binary_ident, RITE_BINARY_IDENT, sizeof(leading.h.binary_ident)) != 0 || + memchr(leading.b, '\0', bufsize) == NULL) { + return mrb_load_exec(mrb, mrb_parse_file_continue(mrb, fp, leading.b, bufsize, c), c); + } + else { + size_t binsize; + uint8_t *bin; + mrb_value bin_obj = mrb_nil_value(); /* temporary string object */ + mrb_value result; + + binsize = bin_to_uint32(leading.h.binary_size); + bin_obj = mrb_str_new(mrb, NULL, binsize); + bin = (uint8_t *)RSTRING_PTR(bin_obj); + memcpy(bin, leading.b, bufsize); + if (binsize > bufsize && + fread(bin + bufsize, binsize - bufsize, 1, fp) == 0) { + binsize = bufsize; + /* The error is reported by mrb_load_irep_buf_cxt() */ + } + + result = mrb_load_irep_buf_cxt(mrb, bin, binsize, c); + if (mrb_string_p(bin_obj)) mrb_str_resize(mrb, bin_obj, 0); + return result; + } +} #endif MRB_API mrb_value @@ -6053,7 +6957,7 @@ mrb_load_string(mrb_state *mrb, const char *s) return mrb_load_string_cxt(mrb, s, NULL); } -#ifndef MRB_DISABLE_STDIO +#ifndef MRB_NO_STDIO static void dump_prefix(node *tree, int offset) @@ -6091,7 +6995,7 @@ dump_args(mrb_state *mrb, node *n, int offset) while (n2) { dump_prefix(n2, offset+2); - printf("%s=\n", mrb_sym2name(mrb, sym(n2->car->car))); + printf("%s=\n", mrb_sym_name(mrb, sym(n2->car->car))); mrb_parser_dump(mrb, n2->car->cdr, offset+3); n2 = n2->cdr; } @@ -6100,7 +7004,7 @@ dump_args(mrb_state *mrb, node *n, int offset) n = n->cdr; if (n->car) { dump_prefix(n, offset+1); - printf("rest=*%s\n", mrb_sym2name(mrb, sym(n->car))); + printf("rest=*%s\n", mrb_sym_name(mrb, sym(n->car))); } n = n->cdr; if (n->car) { @@ -6116,12 +7020,34 @@ dump_args(mrb_state *mrb, node *n, int offset) } } +/* + * This function restores the GC arena on return. + * For this reason, if a process that further generates an object is + * performed at the caller, the string pointer returned as the return + * value may become invalid. + */ +static const char* +str_dump(mrb_state *mrb, const char *str, int len) +{ + int ai = mrb_gc_arena_save(mrb); + mrb_value s; +# if INT_MAX > MRB_INT_MAX / 4 + /* check maximum length with "\xNN" character */ + if (len > MRB_INT_MAX / 4) { + len = MRB_INT_MAX / 4; + } +# endif + s = mrb_str_new(mrb, str, (mrb_int)len); + s = mrb_str_dump(mrb, s); + mrb_gc_arena_restore(mrb, ai); + return RSTRING_PTR(s); +} #endif void mrb_parser_dump(mrb_state *mrb, node *tree, int offset) { -#ifndef MRB_DISABLE_STDIO +#ifndef MRB_NO_STDIO int nodetype; if (!tree) return; @@ -6319,7 +7245,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) while (n2) { if (n2->car) { if (!first_lval) printf(", "); - printf("%s", mrb_sym2name(mrb, sym(n2->car))); + printf("%s", mrb_sym_name(mrb, sym(n2->car))); first_lval = FALSE; } n2 = n2->cdr; @@ -6347,7 +7273,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) mrb_parser_dump(mrb, tree->car, offset+1); dump_prefix(tree, offset+1); printf("method='%s' (%d)\n", - mrb_sym2name(mrb, sym(tree->cdr->car)), + mrb_sym_dump(mrb, sym(tree->cdr->car)), intn(tree->cdr->car)); tree = tree->cdr->cdr->car; if (tree) { @@ -6378,11 +7304,11 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) printf("NODE_COLON2:\n"); mrb_parser_dump(mrb, tree->car, offset+1); dump_prefix(tree, offset+1); - printf("::%s\n", mrb_sym2name(mrb, sym(tree->cdr))); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->cdr))); break; case NODE_COLON3: - printf("NODE_COLON3: ::%s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_COLON3: ::%s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_ARRAY: @@ -6448,7 +7374,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) if (n2->car) { dump_prefix(n2, offset+2); printf("rest:\n"); - if (n2->car == (node*)-1) { + if (n2->car == nint(-1)) { dump_prefix(n2, offset+2); printf("(empty)\n"); } @@ -6478,7 +7404,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) mrb_parser_dump(mrb, tree->car, offset+2); tree = tree->cdr; dump_prefix(tree, offset+1); - printf("op='%s' (%d)\n", mrb_sym2name(mrb, sym(tree->car)), intn(tree->car)); + printf("op='%s' (%d)\n", mrb_sym_name(mrb, sym(tree->car)), intn(tree->car)); tree = tree->cdr; mrb_parser_dump(mrb, tree->car, offset+1); break; @@ -6530,23 +7456,27 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_LVAR: - printf("NODE_LVAR %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_LVAR %s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_GVAR: - printf("NODE_GVAR %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_GVAR %s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_IVAR: - printf("NODE_IVAR %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_IVAR %s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_CVAR: - printf("NODE_CVAR %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_CVAR %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_NVAR: + printf("NODE_NVAR %d\n", intn(tree)); break; case NODE_CONST: - printf("NODE_CONST %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_CONST %s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_MATCH: @@ -6568,7 +7498,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_ARG: - printf("NODE_ARG %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_ARG %s\n", mrb_sym_name(mrb, sym(tree))); break; case NODE_BLOCK_ARG: @@ -6585,25 +7515,25 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_NEGATE: - printf("NODE_NEGATE\n"); + printf("NODE_NEGATE:\n"); mrb_parser_dump(mrb, tree, offset+1); break; case NODE_STR: - printf("NODE_STR \"%s\" len %d\n", (char*)tree->car, intn(tree->cdr)); + printf("NODE_STR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr)); break; case NODE_DSTR: - printf("NODE_DSTR\n"); + printf("NODE_DSTR:\n"); dump_recur(mrb, tree, offset+1); break; case NODE_XSTR: - printf("NODE_XSTR \"%s\" len %d\n", (char*)tree->car, intn(tree->cdr)); + printf("NODE_XSTR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr)); break; case NODE_DXSTR: - printf("NODE_DXSTR\n"); + printf("NODE_DXSTR:\n"); dump_recur(mrb, tree, offset+1); break; @@ -6612,7 +7542,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_DREGX: - printf("NODE_DREGX\n"); + printf("NODE_DREGX:\n"); dump_recur(mrb, tree->car, offset+1); dump_prefix(tree, offset); printf("tail: %s\n", (char*)tree->cdr->cdr->car); @@ -6627,10 +7557,29 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) break; case NODE_SYM: - printf("NODE_SYM :%s (%d)\n", mrb_sym2name(mrb, sym(tree)), + printf("NODE_SYM :%s (%d)\n", mrb_sym_dump(mrb, sym(tree)), intn(tree)); break; + case NODE_DSYM: + printf("NODE_DSYM:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_WORDS: + printf("NODE_WORDS:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_SYMBOLS: + printf("NODE_SYMBOLS:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_LITERAL_DELIM: + printf("NODE_LITERAL_DELIM\n"); + break; + case NODE_SELF: printf("NODE_SELF\n"); break; @@ -6649,8 +7598,8 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) case NODE_ALIAS: printf("NODE_ALIAS %s %s:\n", - mrb_sym2name(mrb, sym(tree->car)), - mrb_sym2name(mrb, sym(tree->cdr))); + mrb_sym_dump(mrb, sym(tree->car)), + mrb_sym_dump(mrb, sym(tree->cdr))); break; case NODE_UNDEF: @@ -6658,7 +7607,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) { node *t = tree; while (t) { - printf(" %s", mrb_sym2name(mrb, sym(t->car))); + printf(" %s", mrb_sym_dump(mrb, sym(t->car))); t = t->cdr; } } @@ -6667,18 +7616,18 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) case NODE_CLASS: printf("NODE_CLASS:\n"); - if (tree->car->car == (node*)0) { + if (tree->car->car == nint(0)) { dump_prefix(tree, offset+1); - printf(":%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } - else if (tree->car->car == (node*)1) { + else if (tree->car->car == nint(1)) { dump_prefix(tree, offset+1); - printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } else { mrb_parser_dump(mrb, tree->car->car, offset+1); dump_prefix(tree, offset+1); - printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } if (tree->cdr->car) { dump_prefix(tree, offset+1); @@ -6692,18 +7641,18 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) case NODE_MODULE: printf("NODE_MODULE:\n"); - if (tree->car->car == (node*)0) { + if (tree->car->car == nint(0)) { dump_prefix(tree, offset+1); - printf(":%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } - else if (tree->car->car == (node*)1) { + else if (tree->car->car == nint(1)) { dump_prefix(tree, offset+1); - printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } else { mrb_parser_dump(mrb, tree->car->car, offset+1); dump_prefix(tree, offset+1); - printf("::%s\n", mrb_sym2name(mrb, sym(tree->car->cdr))); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); } dump_prefix(tree, offset+1); printf("body:\n"); @@ -6721,7 +7670,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) case NODE_DEF: printf("NODE_DEF:\n"); dump_prefix(tree, offset+1); - printf("%s\n", mrb_sym2name(mrb, sym(tree->car))); + printf("%s\n", mrb_sym_dump(mrb, sym(tree->car))); tree = tree->cdr; { node *n2 = tree->car; @@ -6734,7 +7683,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) while (n2) { if (n2->car) { if (!first_lval) printf(", "); - printf("%s", mrb_sym2name(mrb, sym(n2->car))); + printf("%s", mrb_sym_name(mrb, sym(n2->car))); first_lval = FALSE; } n2 = n2->cdr; @@ -6754,7 +7703,7 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) mrb_parser_dump(mrb, tree->car, offset+1); tree = tree->cdr; dump_prefix(tree, offset+1); - printf(":%s\n", mrb_sym2name(mrb, sym(tree->car))); + printf(":%s\n", mrb_sym_dump(mrb, sym(tree->car))); tree = tree->cdr->cdr; if (tree->car) { dump_args(mrb, tree->car, offset+1); @@ -6791,17 +7740,17 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) tree = tree->cdr; if (tree->car) { dump_prefix(tree, offset+1); - printf("block='%s'\n", mrb_sym2name(mrb, sym(tree->car))); + printf("block='%s'\n", mrb_sym_name(mrb, sym(tree->car))); } break; case NODE_KW_ARG: - printf("NODE_KW_ARG %s\n", mrb_sym2name(mrb, sym(tree->car))); + printf("NODE_KW_ARG %s:\n", mrb_sym_name(mrb, sym(tree->car))); mrb_parser_dump(mrb, tree->cdr->car, offset + 1); break; case NODE_KW_REST_ARGS: - printf("NODE_KW_REST_ARGS %s\n", mrb_sym2name(mrb, sym(tree))); + printf("NODE_KW_REST_ARGS %s\n", mrb_sym_name(mrb, sym(tree))); break; default: @@ -6810,3 +7759,19 @@ mrb_parser_dump(mrb_state *mrb, node *tree, int offset) } #endif } + +typedef mrb_bool mrb_parser_foreach_top_variable_func(mrb_state *mrb, mrb_sym sym, void *user); +void mrb_parser_foreach_top_variable(mrb_state *mrb, struct mrb_parser_state *p, mrb_parser_foreach_top_variable_func *func, void *user); + +void +mrb_parser_foreach_top_variable(mrb_state *mrb, struct mrb_parser_state *p, mrb_parser_foreach_top_variable_func *func, void *user) +{ + const mrb_ast_node *n = p->tree; + if ((intptr_t)n->car == NODE_SCOPE) { + n = n->cdr->car; + for (; n; n = n->cdr) { + mrb_sym sym = (intptr_t)n->car; + if (sym && !func(mrb, sym, user)) break; + } + } +} diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c new file mode 100644 index 000000000..9cd36ec7b --- /dev/null +++ b/mrbgems/mruby-compiler/core/y.tab.c @@ -0,0 +1,13969 @@ +/* A Bison parser, made by GNU Bison 3.5.1. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Undocumented macros, especially those whose name start with YY_, + are private implementation details. Do not rely on them. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.5.1" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* First part of user prologue. */ +#line 7 "mrbgems/mruby-compiler/core/parse.y" + +#undef PARSER_DEBUG +#ifdef PARSER_DEBUG +# define YYDEBUG 1 +#endif +#define YYSTACK_USE_ALLOCA 1 + +#include <ctype.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <mruby.h> +#include <mruby/compile.h> +#include <mruby/proc.h> +#include <mruby/error.h> +#include <mruby/throw.h> +#include <mruby/string.h> +#include <mruby/dump.h> +#include <mruby/presym.h> +#include "node.h" + +#define YYLEX_PARAM p + +typedef mrb_ast_node node; +typedef struct mrb_parser_state parser_state; +typedef struct mrb_parser_heredoc_info parser_heredoc_info; + +static int yyparse(parser_state *p); +static int yylex(void *lval, parser_state *p); +static void yyerror(parser_state *p, const char *s); +static void yywarn(parser_state *p, const char *s); +static void yywarning(parser_state *p, const char *s); +static void backref_error(parser_state *p, node *n); +static void void_expr_error(parser_state *p, node *n); +static void tokadd(parser_state *p, int32_t c); + +#define identchar(c) (ISALNUM(c) || (c) == '_' || !ISASCII(c)) + +typedef unsigned int stack_type; + +#define BITSTACK_PUSH(stack, n) ((stack) = ((stack)<<1)|((n)&1)) +#define BITSTACK_POP(stack) ((stack) = (stack) >> 1) +#define BITSTACK_LEXPOP(stack) ((stack) = ((stack) >> 1) | ((stack) & 1)) +#define BITSTACK_SET_P(stack) ((stack)&1) + +#define COND_PUSH(n) BITSTACK_PUSH(p->cond_stack, (n)) +#define COND_POP() BITSTACK_POP(p->cond_stack) +#define COND_LEXPOP() BITSTACK_LEXPOP(p->cond_stack) +#define COND_P() BITSTACK_SET_P(p->cond_stack) + +#define CMDARG_PUSH(n) BITSTACK_PUSH(p->cmdarg_stack, (n)) +#define CMDARG_POP() BITSTACK_POP(p->cmdarg_stack) +#define CMDARG_LEXPOP() BITSTACK_LEXPOP(p->cmdarg_stack) +#define CMDARG_P() BITSTACK_SET_P(p->cmdarg_stack) + +#define SET_LINENO(c,n) ((c)->lineno = (n)) +#define NODE_LINENO(c,n) do {\ + if (n) {\ + (c)->filename_index = (n)->filename_index;\ + (c)->lineno = (n)->lineno;\ + }\ +} while (0) + +#define sym(x) ((mrb_sym)(intptr_t)(x)) +#define nsym(x) ((node*)(intptr_t)(x)) +#define nint(x) ((node*)(intptr_t)(x)) +#define intn(x) ((int)(intptr_t)(x)) +#define typen(x) ((enum node_type)(intptr_t)(x)) + +#define NUM_SUFFIX_R (1<<0) +#define NUM_SUFFIX_I (1<<1) + +static inline mrb_sym +intern_cstr_gen(parser_state *p, const char *s) +{ + return mrb_intern_cstr(p->mrb, s); +} +#define intern_cstr(s) intern_cstr_gen(p,(s)) + +static inline mrb_sym +intern_gen(parser_state *p, const char *s, size_t len) +{ + return mrb_intern(p->mrb, s, len); +} +#define intern(s,len) intern_gen(p,(s),(len)) + +#define intern_op(op) MRB_OPSYM_2(p->mrb, op) + +static void +cons_free_gen(parser_state *p, node *cons) +{ + cons->cdr = p->cells; + p->cells = cons; +} +#define cons_free(c) cons_free_gen(p, (c)) + +static void* +parser_palloc(parser_state *p, size_t size) +{ + void *m = mrb_pool_alloc(p->pool, size); + + if (!m) { + MRB_THROW(p->jmp); + } + return m; +} + +static node* +cons_gen(parser_state *p, node *car, node *cdr) +{ + node *c; + + if (p->cells) { + c = p->cells; + p->cells = p->cells->cdr; + } + else { + c = (node *)parser_palloc(p, sizeof(mrb_ast_node)); + } + + c->car = car; + c->cdr = cdr; + c->lineno = p->lineno; + c->filename_index = p->current_filename_index; + /* beginning of next partial file; need to point the previous file */ + if (p->lineno == 0 && p->current_filename_index > 0) { + c->filename_index-- ; + } + return c; +} +#define cons(a,b) cons_gen(p,(a),(b)) + +static node* +list1_gen(parser_state *p, node *a) +{ + return cons(a, 0); +} +#define list1(a) list1_gen(p, (a)) + +static node* +list2_gen(parser_state *p, node *a, node *b) +{ + return cons(a, cons(b,0)); +} +#define list2(a,b) list2_gen(p, (a),(b)) + +static node* +list3_gen(parser_state *p, node *a, node *b, node *c) +{ + return cons(a, cons(b, cons(c,0))); +} +#define list3(a,b,c) list3_gen(p, (a),(b),(c)) + +static node* +list4_gen(parser_state *p, node *a, node *b, node *c, node *d) +{ + return cons(a, cons(b, cons(c, cons(d, 0)))); +} +#define list4(a,b,c,d) list4_gen(p, (a),(b),(c),(d)) + +static node* +list5_gen(parser_state *p, node *a, node *b, node *c, node *d, node *e) +{ + return cons(a, cons(b, cons(c, cons(d, cons(e, 0))))); +} +#define list5(a,b,c,d,e) list5_gen(p, (a),(b),(c),(d),(e)) + +static node* +list6_gen(parser_state *p, node *a, node *b, node *c, node *d, node *e, node *f) +{ + return cons(a, cons(b, cons(c, cons(d, cons(e, cons(f, 0)))))); +} +#define list6(a,b,c,d,e,f) list6_gen(p, (a),(b),(c),(d),(e),(f)) + +static node* +append_gen(parser_state *p, node *a, node *b) +{ + node *c = a; + + if (!a) return b; + if (!b) return a; + while (c->cdr) { + c = c->cdr; + } + c->cdr = b; + return a; +} +#define append(a,b) append_gen(p,(a),(b)) +#define push(a,b) append_gen(p,(a),list1(b)) + +static char* +parser_strndup(parser_state *p, const char *s, size_t len) +{ + char *b = (char *)parser_palloc(p, len+1); + + memcpy(b, s, len); + b[len] = '\0'; + return b; +} +#undef strndup +#define strndup(s,len) parser_strndup(p, s, len) + +static char* +parser_strdup(parser_state *p, const char *s) +{ + return parser_strndup(p, s, strlen(s)); +} +#undef strdup +#define strdup(s) parser_strdup(p, s) + +static void +dump_int(uint16_t i, char *s) +{ + char *p = s; + char *t = s; + + while (i > 0) { + *p++ = (i % 10)+'0'; + i /= 10; + } + if (p == s) *p++ = '0'; + *p = 0; + p--; /* point the last char */ + while (t < p) { + char c = *t; + *t++ = *p; + *p-- = c; + } +} + +/* xxx ----------------------------- */ + +static node* +local_switch(parser_state *p) +{ + node *prev = p->locals; + + p->locals = cons(0, 0); + return prev; +} + +static void +local_resume(parser_state *p, node *prev) +{ + p->locals = prev; +} + +static void +local_nest(parser_state *p) +{ + p->locals = cons(0, p->locals); +} + +static void +local_unnest(parser_state *p) +{ + if (p->locals) { + p->locals = p->locals->cdr; + } +} + +static mrb_bool +local_var_p(parser_state *p, mrb_sym sym) +{ + const struct RProc *u; + node *l = p->locals; + + while (l) { + node *n = l->car; + while (n) { + if (sym(n->car) == sym) return TRUE; + n = n->cdr; + } + l = l->cdr; + } + + u = p->upper; + while (u && !MRB_PROC_CFUNC_P(u)) { + const struct mrb_irep *ir = u->body.irep; + const mrb_sym *v = ir->lv; + int i; + + if (v) { + for (i=0; i+1 < ir->nlocals; i++) { + if (v[i] == sym) return TRUE; + } + } + if (MRB_PROC_SCOPE_P(u)) break; + u = u->upper; + } + return FALSE; +} + +static void +local_add_f(parser_state *p, mrb_sym sym) +{ + if (p->locals) { + p->locals->car = push(p->locals->car, nsym(sym)); + } +} + +static void +local_add(parser_state *p, mrb_sym sym) +{ + if (!local_var_p(p, sym)) { + local_add_f(p, sym); + } +} + +static void +local_add_blk(parser_state *p, mrb_sym blk) +{ + /* allocate register for block */ + local_add_f(p, blk ? blk : intern_op(and)); +} + +static void +local_add_kw(parser_state *p, mrb_sym kwd) +{ + /* allocate register for keywords hash */ + local_add_f(p, kwd ? kwd : intern_op(pow)); +} + +static node* +locals_node(parser_state *p) +{ + return p->locals ? p->locals->car : NULL; +} + +static void +nvars_nest(parser_state *p) +{ + p->nvars = cons(nint(0), p->nvars); +} + +static void +nvars_block(parser_state *p) +{ + p->nvars = cons(nint(-2), p->nvars); +} + +static void +nvars_unnest(parser_state *p) +{ + p->nvars = p->nvars->cdr; +} + +/* (:scope (vars..) (prog...)) */ +static node* +new_scope(parser_state *p, node *body) +{ + return cons((node*)NODE_SCOPE, cons(locals_node(p), body)); +} + +/* (:begin prog...) */ +static node* +new_begin(parser_state *p, node *body) +{ + if (body) { + return list2((node*)NODE_BEGIN, body); + } + return cons((node*)NODE_BEGIN, 0); +} + +#define newline_node(n) (n) + +/* (:rescue body rescue else) */ +static node* +new_rescue(parser_state *p, node *body, node *resq, node *els) +{ + return list4((node*)NODE_RESCUE, body, resq, els); +} + +static node* +new_mod_rescue(parser_state *p, node *body, node *resq) +{ + return new_rescue(p, body, list1(list3(0, 0, resq)), 0); +} + +/* (:ensure body ensure) */ +static node* +new_ensure(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_ENSURE, cons(a, cons(0, b))); +} + +/* (:nil) */ +static node* +new_nil(parser_state *p) +{ + return list1((node*)NODE_NIL); +} + +/* (:true) */ +static node* +new_true(parser_state *p) +{ + return list1((node*)NODE_TRUE); +} + +/* (:false) */ +static node* +new_false(parser_state *p) +{ + return list1((node*)NODE_FALSE); +} + +/* (:alias new old) */ +static node* +new_alias(parser_state *p, mrb_sym a, mrb_sym b) +{ + return cons((node*)NODE_ALIAS, cons(nsym(a), nsym(b))); +} + +/* (:if cond then else) */ +static node* +new_if(parser_state *p, node *a, node *b, node *c) +{ + void_expr_error(p, a); + return list4((node*)NODE_IF, a, b, c); +} + +/* (:unless cond then else) */ +static node* +new_unless(parser_state *p, node *a, node *b, node *c) +{ + void_expr_error(p, a); + return list4((node*)NODE_IF, a, c, b); +} + +/* (:while cond body) */ +static node* +new_while(parser_state *p, node *a, node *b) +{ + void_expr_error(p, a); + return cons((node*)NODE_WHILE, cons(a, b)); +} + +/* (:until cond body) */ +static node* +new_until(parser_state *p, node *a, node *b) +{ + void_expr_error(p, a); + return cons((node*)NODE_UNTIL, cons(a, b)); +} + +/* (:for var obj body) */ +static node* +new_for(parser_state *p, node *v, node *o, node *b) +{ + void_expr_error(p, o); + return list4((node*)NODE_FOR, v, o, b); +} + +/* (:case a ((when ...) body) ((when...) body)) */ +static node* +new_case(parser_state *p, node *a, node *b) +{ + node *n = list2((node*)NODE_CASE, a); + node *n2 = n; + + void_expr_error(p, a); + while (n2->cdr) { + n2 = n2->cdr; + } + n2->cdr = b; + return n; +} + +/* (:postexe a) */ +static node* +new_postexe(parser_state *p, node *a) +{ + return cons((node*)NODE_POSTEXE, a); +} + +/* (:self) */ +static node* +new_self(parser_state *p) +{ + return list1((node*)NODE_SELF); +} + +/* (:call a b c) */ +static node* +new_call(parser_state *p, node *a, mrb_sym b, node *c, int pass) +{ + node *n = list4(nint(pass?NODE_CALL:NODE_SCALL), a, nsym(b), c); + void_expr_error(p, a); + NODE_LINENO(n, a); + return n; +} + +/* (:fcall self mid args) */ +static node* +new_fcall(parser_state *p, mrb_sym b, node *c) +{ + node *n = new_self(p); + NODE_LINENO(n, c); + n = list4((node*)NODE_FCALL, n, nsym(b), c); + NODE_LINENO(n, c); + return n; +} + +/* (:super . c) */ +static node* +new_super(parser_state *p, node *c) +{ + return cons((node*)NODE_SUPER, c); +} + +/* (:zsuper) */ +static node* +new_zsuper(parser_state *p) +{ + return list1((node*)NODE_ZSUPER); +} + +/* (:yield . c) */ +static node* +new_yield(parser_state *p, node *c) +{ + if (c) { + if (c->cdr) { + yyerror(p, "both block arg and actual block given"); + } + return cons((node*)NODE_YIELD, c->car); + } + return cons((node*)NODE_YIELD, 0); +} + +/* (:return . c) */ +static node* +new_return(parser_state *p, node *c) +{ + return cons((node*)NODE_RETURN, c); +} + +/* (:break . c) */ +static node* +new_break(parser_state *p, node *c) +{ + return cons((node*)NODE_BREAK, c); +} + +/* (:next . c) */ +static node* +new_next(parser_state *p, node *c) +{ + return cons((node*)NODE_NEXT, c); +} + +/* (:redo) */ +static node* +new_redo(parser_state *p) +{ + return list1((node*)NODE_REDO); +} + +/* (:retry) */ +static node* +new_retry(parser_state *p) +{ + return list1((node*)NODE_RETRY); +} + +/* (:dot2 a b) */ +static node* +new_dot2(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_DOT2, cons(a, b)); +} + +/* (:dot3 a b) */ +static node* +new_dot3(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_DOT3, cons(a, b)); +} + +/* (:colon2 b c) */ +static node* +new_colon2(parser_state *p, node *b, mrb_sym c) +{ + void_expr_error(p, b); + return cons((node*)NODE_COLON2, cons(b, nsym(c))); +} + +/* (:colon3 . c) */ +static node* +new_colon3(parser_state *p, mrb_sym c) +{ + return cons((node*)NODE_COLON3, nsym(c)); +} + +/* (:and a b) */ +static node* +new_and(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_AND, cons(a, b)); +} + +/* (:or a b) */ +static node* +new_or(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_OR, cons(a, b)); +} + +/* (:array a...) */ +static node* +new_array(parser_state *p, node *a) +{ + return cons((node*)NODE_ARRAY, a); +} + +/* (:splat . a) */ +static node* +new_splat(parser_state *p, node *a) +{ + return cons((node*)NODE_SPLAT, a); +} + +/* (:hash (k . v) (k . v)...) */ +static node* +new_hash(parser_state *p, node *a) +{ + return cons((node*)NODE_HASH, a); +} + +/* (:kw_hash (k . v) (k . v)...) */ +static node* +new_kw_hash(parser_state *p, node *a) +{ + return cons((node*)NODE_KW_HASH, a); +} + +/* (:sym . a) */ +static node* +new_sym(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_SYM, nsym(sym)); +} + +static mrb_sym +new_strsym(parser_state *p, node* str) +{ + const char *s = (const char*)str->cdr->car; + size_t len = (size_t)str->cdr->cdr; + + return mrb_intern(p->mrb, s, len); +} + +/* (:lvar . a) */ +static node* +new_lvar(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_LVAR, nsym(sym)); +} + +/* (:gvar . a) */ +static node* +new_gvar(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_GVAR, nsym(sym)); +} + +/* (:ivar . a) */ +static node* +new_ivar(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_IVAR, nsym(sym)); +} + +/* (:cvar . a) */ +static node* +new_cvar(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_CVAR, nsym(sym)); +} + +/* (:nvar . a) */ +static node* +new_nvar(parser_state *p, int num) +{ + int nvars = intn(p->nvars->car); + + p->nvars->car = nint(nvars > num ? nvars : num); + return cons((node*)NODE_NVAR, nint(num)); +} + +/* (:const . a) */ +static node* +new_const(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_CONST, nsym(sym)); +} + +/* (:undef a...) */ +static node* +new_undef(parser_state *p, mrb_sym sym) +{ + return list2((node*)NODE_UNDEF, nsym(sym)); +} + +/* (:class class super body) */ +static node* +new_class(parser_state *p, node *c, node *s, node *b) +{ + void_expr_error(p, s); + return list4((node*)NODE_CLASS, c, s, cons(locals_node(p), b)); +} + +/* (:sclass obj body) */ +static node* +new_sclass(parser_state *p, node *o, node *b) +{ + void_expr_error(p, o); + return list3((node*)NODE_SCLASS, o, cons(locals_node(p), b)); +} + +/* (:module module body) */ +static node* +new_module(parser_state *p, node *m, node *b) +{ + return list3((node*)NODE_MODULE, m, cons(locals_node(p), b)); +} + +/* (:def m lv (arg . body)) */ +static node* +new_def(parser_state *p, mrb_sym m, node *a, node *b) +{ + return list5((node*)NODE_DEF, nsym(m), 0, a, b); +} + +static void +defn_setup(parser_state *p, node *d, node *a, node *b) +{ + node *n = d->cdr->cdr; + + n->car = locals_node(p); + p->cmdarg_stack = intn(n->cdr->car); + n->cdr->car = a; + local_resume(p, n->cdr->cdr->car); + n->cdr->cdr->car = b; +} + +/* (:sdef obj m lv (arg . body)) */ +static node* +new_sdef(parser_state *p, node *o, mrb_sym m, node *a, node *b) +{ + void_expr_error(p, o); + return list6((node*)NODE_SDEF, o, nsym(m), 0, a, b); +} + +static void +defs_setup(parser_state *p, node *d, node *a, node *b) +{ + node *n = d->cdr->cdr->cdr; + + n->car = locals_node(p); + p->cmdarg_stack = intn(n->cdr->car); + n->cdr->car = a; + local_resume(p, n->cdr->cdr->car); + n->cdr->cdr->car = b; +} + +/* (:arg . sym) */ +static node* +new_arg(parser_state *p, mrb_sym sym) +{ + return cons((node*)NODE_ARG, nsym(sym)); +} + +static void +local_add_margs(parser_state *p, node *n) +{ + while (n) { + if (typen(n->car->car) == NODE_MASGN) { + node *t = n->car->cdr->cdr; + + n->car->cdr->cdr = NULL; + while (t) { + local_add_f(p, sym(t->car)); + t = t->cdr; + } + local_add_margs(p, n->car->cdr->car->car); + local_add_margs(p, n->car->cdr->car->cdr->cdr->car); + } + n = n->cdr; + } +} + +static void +local_add_lv(parser_state *p, node *lv) +{ + while (lv) { + local_add_f(p, sym(lv->car)); + lv = lv->cdr; + } +} + +/* (m o r m2 tail) */ +/* m: (a b c) */ +/* o: ((a . e1) (b . e2)) */ +/* r: a */ +/* m2: (a b c) */ +/* b: a */ +static node* +new_args(parser_state *p, node *m, node *opt, mrb_sym rest, node *m2, node *tail) +{ + node *n; + + local_add_margs(p, m); + local_add_margs(p, m2); + n = cons(m2, tail); + n = cons(nsym(rest), n); + n = cons(opt, n); + while (opt) { + /* opt: (sym . (opt . lv)) -> (sym . opt) */ + local_add_lv(p, opt->car->cdr->cdr); + opt->car->cdr = opt->car->cdr->car; + opt = opt->cdr; + } + return cons(m, n); +} + +/* (:args_tail keywords rest_keywords_sym block_sym) */ +static node* +new_args_tail(parser_state *p, node *kws, node *kwrest, mrb_sym blk) +{ + node *k; + + if (kws || kwrest) { + local_add_kw(p, (kwrest && kwrest->cdr)? sym(kwrest->cdr) : 0); + } + + local_add_blk(p, blk); + + /* allocate register for keywords arguments */ + /* order is for Proc#parameters */ + for (k = kws; k; k = k->cdr) { + if (!k->car->cdr->cdr->car) { /* allocate required keywords */ + local_add_f(p, sym(k->car->cdr->car)); + } + } + for (k = kws; k; k = k->cdr) { + if (k->car->cdr->cdr->car) { /* allocate keywords with default */ + local_add_lv(p, k->car->cdr->cdr->car->cdr); + k->car->cdr->cdr->car = k->car->cdr->cdr->car->car; + local_add_f(p, sym(k->car->cdr->car)); + } + } + + return list4((node*)NODE_ARGS_TAIL, kws, kwrest, nsym(blk)); +} + +/* (:kw_arg kw_sym def_arg) */ +static node* +new_kw_arg(parser_state *p, mrb_sym kw, node *def_arg) +{ + mrb_assert(kw); + return list3((node*)NODE_KW_ARG, nsym(kw), def_arg); +} + +/* (:kw_rest_args . a) */ +static node* +new_kw_rest_args(parser_state *p, node *a) +{ + return cons((node*)NODE_KW_REST_ARGS, a); +} + +/* (:block_arg . a) */ +static node* +new_block_arg(parser_state *p, node *a) +{ + return cons((node*)NODE_BLOCK_ARG, a); +} + +static node* +setup_numparams(parser_state *p, node *a) +{ + int nvars = intn(p->nvars->car); + if (nvars > 0) { + int i; + mrb_sym sym; + // m || opt || rest || tail + if (a && (a->car || (a->cdr && a->cdr->car) || (a->cdr->cdr && a->cdr->cdr->car) || (a->cdr->cdr->cdr->cdr && a->cdr->cdr->cdr->cdr->car))) { + yyerror(p, "ordinary parameter is defined"); + } + else if (p->locals) { + /* p->locals should not be NULL unless error happens before the point */ + node* args = 0; + for (i = nvars; i > 0; i--) { + char buf[3]; + + buf[0] = '_'; + buf[1] = i+'0'; + buf[2] = '\0'; + sym = intern_cstr(buf); + args = cons(new_arg(p, sym), args); + p->locals->car = cons(nsym(sym), p->locals->car); + } + a = new_args(p, args, 0, 0, 0, 0); + } + } + return a; +} + +/* (:block arg body) */ +static node* +new_block(parser_state *p, node *a, node *b) +{ + a = setup_numparams(p, a); + return list4((node*)NODE_BLOCK, locals_node(p), a, b); +} + +/* (:lambda arg body) */ +static node* +new_lambda(parser_state *p, node *a, node *b) +{ + return list4((node*)NODE_LAMBDA, locals_node(p), a, b); +} + +/* (:asgn lhs rhs) */ +static node* +new_asgn(parser_state *p, node *a, node *b) +{ + void_expr_error(p, b); + return cons((node*)NODE_ASGN, cons(a, b)); +} + +/* (:masgn mlhs=(pre rest post) mrhs) */ +static node* +new_masgn(parser_state *p, node *a, node *b) +{ + void_expr_error(p, b); + return cons((node*)NODE_MASGN, cons(a, b)); +} + +/* (:masgn mlhs mrhs) no check */ +static node* +new_masgn_param(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_MASGN, cons(a, b)); +} + +/* (:asgn lhs rhs) */ +static node* +new_op_asgn(parser_state *p, node *a, mrb_sym op, node *b) +{ + void_expr_error(p, b); + return list4((node*)NODE_OP_ASGN, a, nsym(op), b); +} + +static node* +new_imaginary(parser_state *p, node *imaginary) +{ + return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Complex), list1(list2(list3((node*)NODE_INT, (node*)strdup("0"), nint(10)), imaginary)), 1); +} + +static node* +new_rational(parser_state *p, node *rational) +{ + return new_call(p, new_const(p, MRB_SYM_2(p->mrb, Kernel)), MRB_SYM_2(p->mrb, Rational), list1(list1(rational)), 1); +} + +/* (:int . i) */ +static node* +new_int(parser_state *p, const char *s, int base, int suffix) +{ + node* result = list3((node*)NODE_INT, (node*)strdup(s), nint(base)); + if (suffix & NUM_SUFFIX_R) { + result = new_rational(p, result); + } + if (suffix & NUM_SUFFIX_I) { + result = new_imaginary(p, result); + } + return result; +} + +#ifndef MRB_NO_FLOAT +/* (:float . i) */ +static node* +new_float(parser_state *p, const char *s, int suffix) +{ + node* result = cons((node*)NODE_FLOAT, (node*)strdup(s)); + if (suffix & NUM_SUFFIX_R) { + result = new_rational(p, result); + } + if (suffix & NUM_SUFFIX_I) { + result = new_imaginary(p, result); + } + return result; +} +#endif + +/* (:str . (s . len)) */ +static node* +new_str(parser_state *p, const char *s, size_t len) +{ + return cons((node*)NODE_STR, cons((node*)strndup(s, len), nint(len))); +} + +/* (:dstr . a) */ +static node* +new_dstr(parser_state *p, node *a) +{ + return cons((node*)NODE_DSTR, a); +} + +static int +string_node_p(node *n) +{ + return (int)(typen(n->car) == NODE_STR); +} + +static node* +composite_string_node(parser_state *p, node *a, node *b) +{ + size_t newlen = (size_t)a->cdr + (size_t)b->cdr; + char *str = (char*)mrb_pool_realloc(p->pool, a->car, (size_t)a->cdr + 1, newlen + 1); + memcpy(str + (size_t)a->cdr, b->car, (size_t)b->cdr); + str[newlen] = '\0'; + a->car = (node*)str; + a->cdr = (node*)newlen; + cons_free(b); + return a; +} + +static node* +concat_string(parser_state *p, node *a, node *b) +{ + if (string_node_p(a)) { + if (string_node_p(b)) { + /* a == NODE_STR && b == NODE_STR */ + composite_string_node(p, a->cdr, b->cdr); + cons_free(b); + return a; + } + else { + /* a == NODE_STR && b == NODE_DSTR */ + + if (string_node_p(b->cdr->car)) { + /* a == NODE_STR && b->[NODE_STR, ...] */ + composite_string_node(p, a->cdr, b->cdr->car->cdr); + cons_free(b->cdr->car); + b->cdr->car = a; + return b; + } + } + } + else { + node *c; /* last node of a */ + for (c = a; c->cdr != NULL; c = c->cdr) ; + + if (string_node_p(b)) { + /* a == NODE_DSTR && b == NODE_STR */ + if (string_node_p(c->car)) { + /* a->[..., NODE_STR] && b == NODE_STR */ + composite_string_node(p, c->car->cdr, b->cdr); + cons_free(b); + return a; + } + + push(a, b); + return a; + } + else { + /* a == NODE_DSTR && b == NODE_DSTR */ + if (string_node_p(c->car) && string_node_p(b->cdr->car)) { + /* a->[..., NODE_STR] && b->[NODE_STR, ...] */ + node *d = b->cdr; + cons_free(b); + composite_string_node(p, c->car->cdr, d->car->cdr); + cons_free(d->car); + c->cdr = d->cdr; + cons_free(d); + return a; + } + else { + c->cdr = b->cdr; + cons_free(b); + return a; + } + } + } + + return new_dstr(p, list2(a, b)); +} + +/* (:str . (s . len)) */ +static node* +new_xstr(parser_state *p, const char *s, int len) +{ + return cons((node*)NODE_XSTR, cons((node*)strndup(s, len), nint(len))); +} + +/* (:xstr . a) */ +static node* +new_dxstr(parser_state *p, node *a) +{ + return cons((node*)NODE_DXSTR, a); +} + +/* (:dsym . a) */ +static node* +new_dsym(parser_state *p, node *a) +{ + return cons((node*)NODE_DSYM, a); +} + +/* (:regx . (s . (opt . enc))) */ +static node* +new_regx(parser_state *p, const char *p1, const char* p2, const char* p3) +{ + return cons((node*)NODE_REGX, cons((node*)p1, cons((node*)p2, (node*)p3))); +} + +/* (:dregx . (a . b)) */ +static node* +new_dregx(parser_state *p, node *a, node *b) +{ + return cons((node*)NODE_DREGX, cons(a, b)); +} + +/* (:backref . n) */ +static node* +new_back_ref(parser_state *p, int n) +{ + return cons((node*)NODE_BACK_REF, nint(n)); +} + +/* (:nthref . n) */ +static node* +new_nth_ref(parser_state *p, int n) +{ + return cons((node*)NODE_NTH_REF, nint(n)); +} + +/* (:heredoc . a) */ +static node* +new_heredoc(parser_state *p) +{ + parser_heredoc_info *inf = (parser_heredoc_info *)parser_palloc(p, sizeof(parser_heredoc_info)); + return cons((node*)NODE_HEREDOC, (node*)inf); +} + +static void +new_bv(parser_state *p, mrb_sym id) +{ +} + +static node* +new_literal_delim(parser_state *p) +{ + return cons((node*)NODE_LITERAL_DELIM, 0); +} + +/* (:words . a) */ +static node* +new_words(parser_state *p, node *a) +{ + return cons((node*)NODE_WORDS, a); +} + +/* (:symbols . a) */ +static node* +new_symbols(parser_state *p, node *a) +{ + return cons((node*)NODE_SYMBOLS, a); +} + +/* xxx ----------------------------- */ + +/* (:call a op) */ +static node* +call_uni_op(parser_state *p, node *recv, const char *m) +{ + void_expr_error(p, recv); + return new_call(p, recv, intern_cstr(m), 0, 1); +} + +/* (:call a op b) */ +static node* +call_bin_op(parser_state *p, node *recv, const char *m, node *arg1) +{ + return new_call(p, recv, intern_cstr(m), list1(list1(arg1)), 1); +} + +static void +args_with_block(parser_state *p, node *a, node *b) +{ + if (b) { + if (a->cdr) { + yyerror(p, "both block arg and actual block given"); + } + a->cdr = b; + } +} + +static void +endless_method_name(parser_state *p, node *defn) +{ + mrb_sym sym = sym(defn->cdr->car); + mrb_int len; + const char *name = mrb_sym_name_len(p->mrb, sym, &len); + + if (len > 1 && name[len-1] == '=') { + for (int i=0; i<len-1; i++) { + if (!identchar(name[i])) return; + } + yyerror(p, "setter method cannot be defined by endless method definition"); + } +} + +static void +call_with_block(parser_state *p, node *a, node *b) +{ + node *n; + + switch (typen(a->car)) { + case NODE_SUPER: + case NODE_ZSUPER: + if (!a->cdr) a->cdr = cons(0, b); + else { + args_with_block(p, a->cdr, b); + } + break; + case NODE_CALL: + case NODE_FCALL: + case NODE_SCALL: + n = a->cdr->cdr->cdr; + if (!n->car) n->car = cons(0, b); + else { + args_with_block(p, n->car, b); + } + break; + default: + break; + } +} + +static node* +negate_lit(parser_state *p, node *n) +{ + return cons((node*)NODE_NEGATE, n); +} + +static node* +cond(node *n) +{ + return n; +} + +static node* +ret_args(parser_state *p, node *n) +{ + if (n->cdr) { + yyerror(p, "block argument should not be given"); + return NULL; + } + if (!n->car->cdr) return n->car->car; + return new_array(p, n->car); +} + +static void +assignable(parser_state *p, node *lhs) +{ + if (intn(lhs->car) == NODE_LVAR) { + local_add(p, sym(lhs->cdr)); + } +} + +static node* +var_reference(parser_state *p, node *lhs) +{ + node *n; + + if (intn(lhs->car) == NODE_LVAR) { + if (!local_var_p(p, sym(lhs->cdr))) { + n = new_fcall(p, sym(lhs->cdr), 0); + cons_free(lhs); + return n; + } + } + + return lhs; +} + +typedef enum mrb_string_type string_type; + +static node* +new_strterm(parser_state *p, string_type type, int term, int paren) +{ + return cons(nint(type), cons(nint(0), cons(nint(paren), nint(term)))); +} + +static void +end_strterm(parser_state *p) +{ + cons_free(p->lex_strterm->cdr->cdr); + cons_free(p->lex_strterm->cdr); + cons_free(p->lex_strterm); + p->lex_strterm = NULL; +} + +static parser_heredoc_info * +parsing_heredoc_inf(parser_state *p) +{ + node *nd = p->parsing_heredoc; + if (nd == NULL) + return NULL; + /* mrb_assert(nd->car->car == NODE_HEREDOC); */ + return (parser_heredoc_info*)nd->car->cdr; +} + +static void +heredoc_treat_nextline(parser_state *p) +{ + if (p->heredocs_from_nextline == NULL) + return; + if (p->parsing_heredoc == NULL) { + node *n; + p->parsing_heredoc = p->heredocs_from_nextline; + p->lex_strterm_before_heredoc = p->lex_strterm; + p->lex_strterm = new_strterm(p, parsing_heredoc_inf(p)->type, 0, 0); + n = p->all_heredocs; + if (n) { + while (n->cdr) + n = n->cdr; + n->cdr = p->parsing_heredoc; + } + else { + p->all_heredocs = p->parsing_heredoc; + } + } + else { + node *n, *m; + m = p->heredocs_from_nextline; + while (m->cdr) + m = m->cdr; + n = p->all_heredocs; + mrb_assert(n != NULL); + if (n == p->parsing_heredoc) { + m->cdr = n; + p->all_heredocs = p->heredocs_from_nextline; + p->parsing_heredoc = p->heredocs_from_nextline; + } + else { + while (n->cdr != p->parsing_heredoc) { + n = n->cdr; + mrb_assert(n != NULL); + } + m->cdr = n->cdr; + n->cdr = p->heredocs_from_nextline; + p->parsing_heredoc = p->heredocs_from_nextline; + } + } + p->heredocs_from_nextline = NULL; +} + +static void +heredoc_end(parser_state *p) +{ + p->parsing_heredoc = p->parsing_heredoc->cdr; + if (p->parsing_heredoc == NULL) { + p->lstate = EXPR_BEG; + end_strterm(p); + p->lex_strterm = p->lex_strterm_before_heredoc; + p->lex_strterm_before_heredoc = NULL; + } + else { + /* next heredoc */ + p->lex_strterm->car = nint(parsing_heredoc_inf(p)->type); + } +} +#define is_strterm_type(p,str_func) (intn((p)->lex_strterm->car) & (str_func)) + +/* xxx ----------------------------- */ + + +#line 1453 "mrbgems/mruby-compiler/core/y.tab.c" + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast<Type> (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + + +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token type. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + keyword_class = 258, + keyword_module = 259, + keyword_def = 260, + keyword_begin = 261, + keyword_if = 262, + keyword_unless = 263, + keyword_while = 264, + keyword_until = 265, + keyword_for = 266, + keyword_undef = 267, + keyword_rescue = 268, + keyword_ensure = 269, + keyword_end = 270, + keyword_then = 271, + keyword_elsif = 272, + keyword_else = 273, + keyword_case = 274, + keyword_when = 275, + keyword_break = 276, + keyword_next = 277, + keyword_redo = 278, + keyword_retry = 279, + keyword_in = 280, + keyword_do = 281, + keyword_do_cond = 282, + keyword_do_block = 283, + keyword_do_LAMBDA = 284, + keyword_return = 285, + keyword_yield = 286, + keyword_super = 287, + keyword_self = 288, + keyword_nil = 289, + keyword_true = 290, + keyword_false = 291, + keyword_and = 292, + keyword_or = 293, + keyword_not = 294, + modifier_if = 295, + modifier_unless = 296, + modifier_while = 297, + modifier_until = 298, + modifier_rescue = 299, + keyword_alias = 300, + keyword_BEGIN = 301, + keyword_END = 302, + keyword__LINE__ = 303, + keyword__FILE__ = 304, + keyword__ENCODING__ = 305, + tIDENTIFIER = 306, + tFID = 307, + tGVAR = 308, + tIVAR = 309, + tCONSTANT = 310, + tCVAR = 311, + tLABEL_TAG = 312, + tINTEGER = 313, + tFLOAT = 314, + tCHAR = 315, + tXSTRING = 316, + tREGEXP = 317, + tSTRING = 318, + tSTRING_PART = 319, + tSTRING_MID = 320, + tNTH_REF = 321, + tBACK_REF = 322, + tREGEXP_END = 323, + tNUMPARAM = 324, + tUPLUS = 325, + tUMINUS = 326, + tCMP = 327, + tEQ = 328, + tEQQ = 329, + tNEQ = 330, + tGEQ = 331, + tLEQ = 332, + tANDOP = 333, + tOROP = 334, + tMATCH = 335, + tNMATCH = 336, + tDOT2 = 337, + tDOT3 = 338, + tBDOT2 = 339, + tBDOT3 = 340, + tAREF = 341, + tASET = 342, + tLSHFT = 343, + tRSHFT = 344, + tCOLON2 = 345, + tCOLON3 = 346, + tOP_ASGN = 347, + tASSOC = 348, + tLPAREN = 349, + tLPAREN_ARG = 350, + tRPAREN = 351, + tLBRACK = 352, + tLBRACE = 353, + tLBRACE_ARG = 354, + tSTAR = 355, + tPOW = 356, + tDSTAR = 357, + tAMPER = 358, + tLAMBDA = 359, + tANDDOT = 360, + tSYMBEG = 361, + tSTRING_BEG = 362, + tXSTRING_BEG = 363, + tSTRING_DVAR = 364, + tREGEXP_BEG = 365, + tWORDS_BEG = 366, + tSYMBOLS_BEG = 367, + tLAMBEG = 368, + tHEREDOC_BEG = 369, + tHEREDOC_END = 370, + tLITERAL_DELIM = 371, + tHD_LITERAL_DELIM = 372, + tHD_STRING_PART = 373, + tHD_STRING_MID = 374, + tLOWEST = 375, + tUMINUS_NUM = 376, + tLAST_TOKEN = 377 + }; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ +#line 1395 "mrbgems/mruby-compiler/core/parse.y" + + node *nd; + mrb_sym id; + int num; + stack_type stack; + const struct vtable *vars; + +#line 1633 "mrbgems/mruby-compiler/core/y.tab.c" + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + + +int yyparse (parser_state *p); + + + + + +#ifdef short +# undef short +#endif + +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + <limits.h> and (if available) <stdint.h> are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include <limits.h> /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stdint.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif + +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; +#else +typedef short yytype_int16; +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; +#else +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + +/* Stored state numbers (used for stacks). */ +typedef yytype_int16 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# 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) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 13314 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 149 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 177 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 611 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 1075 + +#define YYUNDEFTOK 2 +#define YYMAXUTOK 377 + + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 148, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 135, 2, 2, 2, 133, 128, 2, + 144, 145, 131, 129, 142, 130, 147, 132, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 123, 146, + 125, 121, 124, 122, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 140, 2, 141, 127, 2, 143, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 138, 126, 139, 136, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 134, 137 +}; + +#if YYDEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = +{ + 0, 1566, 1566, 1566, 1577, 1583, 1587, 1592, 1596, 1602, + 1604, 1603, 1617, 1644, 1650, 1654, 1659, 1663, 1669, 1669, + 1673, 1677, 1681, 1685, 1689, 1693, 1697, 1702, 1703, 1707, + 1711, 1715, 1719, 1726, 1729, 1733, 1737, 1741, 1745, 1749, + 1754, 1758, 1767, 1777, 1786, 1796, 1803, 1804, 1808, 1812, + 1813, 1817, 1821, 1825, 1829, 1833, 1843, 1842, 1857, 1866, + 1867, 1870, 1871, 1878, 1877, 1892, 1896, 1901, 1905, 1910, + 1914, 1919, 1923, 1927, 1931, 1935, 1941, 1945, 1951, 1952, + 1958, 1962, 1966, 1970, 1974, 1978, 1982, 1986, 1990, 1994, + 2000, 2001, 2007, 2011, 2017, 2021, 2027, 2031, 2035, 2039, + 2043, 2047, 2053, 2059, 2066, 2070, 2074, 2078, 2082, 2086, + 2092, 2098, 2103, 2109, 2113, 2116, 2120, 2124, 2131, 2132, + 2133, 2134, 2139, 2146, 2147, 2150, 2154, 2154, 2160, 2161, + 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, + 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, + 2182, 2183, 2184, 2185, 2186, 2187, 2188, 2189, 2192, 2192, + 2192, 2193, 2193, 2194, 2194, 2194, 2195, 2195, 2195, 2195, + 2196, 2196, 2196, 2197, 2197, 2197, 2198, 2198, 2198, 2198, + 2199, 2199, 2199, 2199, 2200, 2200, 2200, 2200, 2201, 2201, + 2201, 2201, 2202, 2202, 2202, 2202, 2203, 2203, 2206, 2210, + 2214, 2218, 2222, 2226, 2230, 2235, 2240, 2245, 2249, 2253, + 2257, 2261, 2265, 2269, 2273, 2277, 2281, 2285, 2289, 2293, + 2297, 2301, 2305, 2309, 2313, 2317, 2321, 2325, 2329, 2333, + 2337, 2341, 2345, 2349, 2353, 2357, 2361, 2365, 2369, 2373, + 2377, 2381, 2385, 2389, 2393, 2402, 2412, 2421, 2431, 2437, + 2438, 2443, 2447, 2454, 2458, 2466, 2470, 2486, 2512, 2513, + 2516, 2517, 2518, 2523, 2528, 2535, 2541, 2546, 2551, 2556, + 2563, 2563, 2574, 2580, 2584, 2590, 2591, 2594, 2600, 2606, + 2611, 2618, 2623, 2628, 2635, 2636, 2637, 2638, 2639, 2640, + 2641, 2642, 2646, 2651, 2650, 2662, 2666, 2661, 2671, 2671, + 2675, 2679, 2683, 2687, 2692, 2697, 2701, 2705, 2709, 2713, + 2717, 2718, 2724, 2730, 2723, 2742, 2750, 2758, 2758, 2758, + 2765, 2765, 2765, 2772, 2778, 2783, 2785, 2782, 2794, 2792, + 2810, 2815, 2808, 2832, 2830, 2846, 2856, 2867, 2871, 2875, + 2879, 2885, 2892, 2893, 2894, 2897, 2898, 2901, 2902, 2910, + 2911, 2917, 2921, 2924, 2928, 2932, 2936, 2941, 2945, 2949, + 2953, 2959, 2958, 2968, 2972, 2976, 2980, 2986, 2991, 2996, + 3000, 3004, 3008, 3012, 3016, 3020, 3024, 3028, 3032, 3036, + 3040, 3044, 3048, 3052, 3058, 3063, 3070, 3070, 3074, 3079, + 3086, 3090, 3096, 3097, 3100, 3105, 3108, 3112, 3118, 3122, + 3129, 3128, 3143, 3153, 3157, 3162, 3169, 3173, 3177, 3181, + 3185, 3189, 3193, 3197, 3201, 3208, 3207, 3222, 3221, 3237, + 3245, 3254, 3257, 3264, 3267, 3271, 3272, 3275, 3279, 3282, + 3286, 3289, 3290, 3291, 3292, 3295, 3296, 3302, 3303, 3304, + 3308, 3314, 3315, 3321, 3326, 3325, 3336, 3340, 3346, 3350, + 3356, 3360, 3366, 3369, 3370, 3373, 3379, 3385, 3386, 3389, + 3396, 3395, 3409, 3413, 3420, 3425, 3432, 3438, 3439, 3440, + 3441, 3442, 3446, 3452, 3456, 3462, 3463, 3464, 3468, 3474, + 3478, 3482, 3486, 3490, 3496, 3500, 3506, 3510, 3514, 3518, + 3522, 3526, 3534, 3541, 3552, 3553, 3557, 3561, 3560, 3577, + 3578, 3581, 3587, 3605, 3625, 3626, 3632, 3638, 3644, 3651, + 3656, 3663, 3667, 3673, 3677, 3683, 3684, 3687, 3691, 3697, + 3701, 3705, 3709, 3715, 3720, 3725, 3729, 3733, 3737, 3741, + 3745, 3749, 3753, 3757, 3761, 3765, 3769, 3773, 3777, 3782, + 3788, 3793, 3798, 3803, 3808, 3815, 3819, 3826, 3831, 3830, + 3842, 3846, 3852, 3860, 3868, 3876, 3880, 3886, 3890, 3896, + 3897, 3900, 3905, 3912, 3913, 3916, 3922, 3926, 3932, 3937, + 3937, 3962, 3963, 3969, 3974, 3980, 3981, 3984, 3990, 3995, + 4005, 4012, 4013, 4014, 4017, 4018, 4019, 4020, 4023, 4024, + 4025, 4028, 4029, 4032, 4036, 4042, 4043, 4049, 4050, 4053, + 4054, 4057, 4060, 4061, 4062, 4065, 4066, 4067, 4070, 4077, + 4078, 4082 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || 1 +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "keyword_class", "keyword_module", + "keyword_def", "keyword_begin", "keyword_if", "keyword_unless", + "keyword_while", "keyword_until", "keyword_for", "keyword_undef", + "keyword_rescue", "keyword_ensure", "keyword_end", "keyword_then", + "keyword_elsif", "keyword_else", "keyword_case", "keyword_when", + "keyword_break", "keyword_next", "keyword_redo", "keyword_retry", + "keyword_in", "keyword_do", "keyword_do_cond", "keyword_do_block", + "keyword_do_LAMBDA", "keyword_return", "keyword_yield", "keyword_super", + "keyword_self", "keyword_nil", "keyword_true", "keyword_false", + "keyword_and", "keyword_or", "keyword_not", "modifier_if", + "modifier_unless", "modifier_while", "modifier_until", "modifier_rescue", + "keyword_alias", "keyword_BEGIN", "keyword_END", "keyword__LINE__", + "keyword__FILE__", "keyword__ENCODING__", "\"local variable or method\"", + "\"method\"", "\"global variable\"", "\"instance variable\"", + "\"constant\"", "\"class variable\"", "\"label\"", "\"integer literal\"", + "\"float literal\"", "\"character literal\"", "tXSTRING", "tREGEXP", + "tSTRING", "tSTRING_PART", "tSTRING_MID", "tNTH_REF", "tBACK_REF", + "tREGEXP_END", "\"numbered parameter\"", "\"unary plus\"", + "\"unary minus\"", "\"<=>\"", "\"==\"", "\"===\"", "\"!=\"", "\">=\"", + "\"<=\"", "\"&&\"", "\"||\"", "\"=~\"", "\"!~\"", "\"..\"", "\"...\"", + "tBDOT2", "tBDOT3", "tAREF", "tASET", "\"<<\"", "\">>\"", "\"::\"", + "tCOLON3", "tOP_ASGN", "\"=>\"", "tLPAREN", "\"(\"", "\")\"", "\"[\"", + "tLBRACE", "\"{\"", "\"*\"", "tPOW", "\"**\"", "\"&\"", "\"->\"", + "\"&.\"", "\"symbol\"", "\"string literal\"", "tXSTRING_BEG", + "tSTRING_DVAR", "tREGEXP_BEG", "tWORDS_BEG", "tSYMBOLS_BEG", "tLAMBEG", + "\"here document\"", "tHEREDOC_END", "tLITERAL_DELIM", + "tHD_LITERAL_DELIM", "tHD_STRING_PART", "tHD_STRING_MID", "tLOWEST", + "'='", "'?'", "':'", "'>'", "'<'", "'|'", "'^'", "'&'", "'+'", "'-'", + "'*'", "'/'", "'%'", "tUMINUS_NUM", "'!'", "'~'", "tLAST_TOKEN", "'{'", + "'}'", "'['", "']'", "','", "'`'", "'('", "')'", "';'", "'.'", "'\\n'", + "$accept", "program", "$@1", "top_compstmt", "top_stmts", "top_stmt", + "@2", "bodystmt", "compstmt", "stmts", "stmt", "$@3", "command_asgn", + "command_rhs", "expr", "defn_head", "defs_head", "$@4", "expr_value", + "command_call", "block_command", "cmd_brace_block", "$@5", "command", + "mlhs", "mlhs_inner", "mlhs_basic", "mlhs_item", "mlhs_list", + "mlhs_post", "mlhs_node", "lhs", "cname", "cpath", "fname", "fsym", + "undef_list", "$@6", "op", "reswords", "arg", "aref_args", "arg_rhs", + "paren_args", "opt_paren_args", "opt_call_args", "call_args", + "command_args", "@7", "block_arg", "opt_block_arg", "comma", "args", + "mrhs", "primary", "@8", "@9", "$@10", "$@11", "@12", "@13", "$@14", + "$@15", "$@16", "$@17", "$@18", "$@19", "@20", "@21", "@22", "@23", + "primary_value", "then", "do", "if_tail", "opt_else", "for_var", + "f_margs", "$@24", "block_args_tail", "opt_block_args_tail", + "block_param", "opt_block_param", "block_param_def", "$@25", + "opt_bv_decl", "bv_decls", "bvar", "f_larglist", "lambda_body", + "do_block", "$@26", "block_call", "method_call", "brace_block", "@27", + "@28", "case_body", "cases", "opt_rescue", "exc_list", "exc_var", + "opt_ensure", "literal", "string", "string_fragment", "string_rep", + "string_interp", "@29", "xstring", "regexp", "heredoc", "heredoc_bodies", + "heredoc_body", "heredoc_string_rep", "heredoc_string_interp", "@30", + "words", "symbol", "basic_symbol", "sym", "symbols", "numeric", + "variable", "var_lhs", "var_ref", "backref", "superclass", "$@31", + "f_opt_arglist_paren", "f_arglist_paren", "f_arglist", "f_label", "f_kw", + "f_block_kw", "f_block_kwarg", "f_kwarg", "kwrest_mark", "f_kwrest", + "args_tail", "opt_args_tail", "f_args", "f_bad_arg", "f_norm_arg", + "f_arg_item", "@32", "f_arg", "f_opt_asgn", "f_opt", "f_block_opt", + "f_block_optarg", "f_optarg", "restarg_mark", "f_rest_arg", + "blkarg_mark", "f_block_arg", "opt_f_block_arg", "singleton", "$@33", + "assoc_list", "assocs", "label_tag", "assoc", "operation", "operation2", + "operation3", "dot_or_colon", "call_op", "call_op2", "opt_terms", + "opt_nl", "rparen", "trailer", "term", "nl", "terms", "none", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_int16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 61, 63, 58, 62, 60, 124, 94, 38, 43, + 45, 42, 47, 37, 376, 33, 126, 377, 123, 125, + 91, 93, 44, 96, 40, 41, 59, 46, 10 +}; +# endif + +#define YYPACT_NINF (-850) + +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) + +#define YYTABLE_NINF (-612) + +#define yytable_value_is_error(Yyn) \ + ((Yyn) == YYTABLE_NINF) + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + -850, 124, 3596, -850, 8329, 10453, 10795, 6637, -850, 10099, + 10099, -850, -850, 10567, 7819, 6372, 8565, 8565, -850, -850, + 8565, 4253, 3845, -850, -850, -850, -850, 200, 7819, -850, + 37, -850, -850, -850, 6779, 3709, -850, -850, 6921, -850, + -850, -850, -850, -850, -850, -850, 34, 10217, 10217, 10217, + 10217, 106, 5631, 633, 9037, 9391, 8101, -850, 7537, 1187, + 767, 989, 1214, 1237, -850, 86, 10335, 10217, -850, 751, + -850, 1505, -850, 115, 1288, 1288, -850, -850, 176, 70, + -850, 71, 10681, -850, 118, 12995, 477, 483, 60, 84, + -850, 365, -850, -850, -850, -850, -850, -850, -850, -850, + -850, 349, 165, -850, 501, 82, -850, -850, -850, -850, + -850, 131, 131, 137, 506, 1044, -850, 10099, 314, 5750, + 268, 1266, 1266, -850, 143, -850, 599, -850, -850, 82, + -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, 49, 58, + 72, 83, -850, -850, -850, -850, -850, -850, 133, 162, + 187, 196, -850, 208, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, 241, + 4809, 233, 115, 1288, 1288, 69, 169, 13119, 628, 151, + 203, 155, 69, 10099, 10099, 659, 247, -850, -850, 732, + 329, 67, 87, -850, -850, -850, -850, -850, -850, -850, + -850, -850, 7678, -850, -850, 228, -850, -850, -850, -850, + -850, -850, 751, -850, 721, -850, 352, -850, -850, 751, + 3981, 10217, 10217, 10217, 10217, -850, 13057, -850, -850, 237, + 324, 237, -850, -850, -850, 8683, -850, -850, -850, 8565, + -850, -850, -850, 6372, 10099, -850, -850, 251, 5869, -850, + 851, 286, 13181, 13181, 544, 8447, 5631, 275, 751, 1505, + 751, 303, -850, 8447, 751, 292, 1351, 1351, -850, 13057, + 288, 1351, -850, 381, 10909, 296, 862, 905, 929, 1387, + -850, -850, -850, -850, 1282, -850, -850, -850, -850, -850, + -850, 814, 1287, -850, -850, 1021, -850, 1052, -850, 1320, + -850, 1337, 341, 350, -850, -850, -850, -850, 6134, 10099, + 10099, 10099, 10099, 8447, 10099, 10099, 61, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, 1604, + 337, 340, 4809, 10217, -850, 321, 417, 354, -850, 751, + -850, -850, -850, 387, 10217, -850, 401, 472, 403, 511, + -850, -850, 449, 4809, -850, -850, 9509, -850, 5631, 8215, + 441, 9509, 10217, 10217, 10217, 10217, 10217, 10217, 10217, 10217, + 10217, 10217, 10217, 10217, 10217, 10217, 534, 10217, 10217, 10217, + 10217, 10217, 10217, 10217, 10217, 10217, 10217, 10217, 10217, 3391, + -850, 8565, -850, 11187, -850, -850, 12391, -850, -850, -850, + -850, 10335, 10335, -850, 491, -850, 115, -850, 952, -850, + -850, -850, -850, -850, -850, 11273, 8565, 11359, 4809, 10099, + -850, -850, -850, 577, 581, 158, 474, 479, -850, 4955, + 582, 10217, 11445, 8565, 11531, 10217, 10217, 5247, 639, 639, + 94, 11617, 8565, 11703, -850, 541, -850, 5869, 352, -850, + -850, 9627, 600, -850, 814, 10217, 13119, 13119, 13119, 10217, + 1057, -850, 8801, -850, 10217, -850, 9155, 6491, 471, 751, + 237, 237, -850, -850, 885, 473, -850, -850, 7819, 5366, + 498, 11445, 11531, 10217, 1505, 751, -850, -850, 6253, 484, + 1505, -850, -850, 9273, -850, 751, 9391, -850, -850, -850, + 952, 71, 10909, -850, 10909, 11789, 8565, 11875, 1458, -850, + -850, -850, 1348, 5869, 814, -850, -850, -850, -850, -850, + -850, -850, 10217, 10217, -850, -850, -850, -850, -850, -850, + -850, -850, -850, -850, 1165, 751, 751, 497, 10335, 632, + 13119, 345, -850, -850, -850, 12, -850, -850, 1458, -850, + 13119, 1458, -850, -850, 1769, -850, -850, 10335, 644, 63, + 10217, -850, 12711, 237, -850, 751, 10909, 512, -850, -850, + -850, 604, 542, 2903, -850, -850, 956, 284, 2755, 2755, + 2755, 2755, 1752, 1752, 3456, 2669, 2755, 2755, 13181, 13181, + 1232, 1232, -850, 286, 12649, 1752, 1752, 1467, 1467, 1477, + 355, 355, 286, 286, 286, 3275, 7277, 4525, 7395, -850, + 131, -850, 523, 237, 564, -850, 588, -850, -850, 4117, + -850, -850, 2330, 63, 63, -850, 12463, -850, -850, -850, + -850, -850, 751, 10099, 4809, 1109, 192, -850, 131, 529, + 131, 658, 885, 7960, -850, 9745, 657, -850, 10217, 10217, + 487, -850, 7039, 7158, 546, 311, 338, 657, -850, -850, + -850, -850, 91, 98, 556, 103, 104, 10099, 7819, 555, + 685, 13119, 249, -850, 814, 13119, 13119, 814, 10217, 13057, + -850, 237, 13119, -850, -850, -850, -850, 8919, 9155, -850, + -850, -850, 568, -850, -850, 38, 1505, 751, 1351, 441, + -850, 1109, 192, 562, 1167, 1168, 565, 77, -850, 573, + -850, 286, 286, -850, 147, 751, 572, -850, -850, 1708, + 673, 12525, -850, 665, -850, 354, -850, -850, -850, 587, + 590, 593, -850, 596, 665, 593, 679, 12587, -850, -850, + 1458, 4809, -850, -850, 12782, 9863, -850, -850, 10909, 8447, + 10335, 10217, 11961, 8565, 12047, 76, 10335, 10335, -850, 491, + 613, 8801, 10335, 10335, -850, 491, 84, 176, 4809, 5869, + 63, -850, 751, 726, -850, -850, -850, -850, 12711, -850, + 652, -850, 5512, 742, -850, 10099, 747, -850, 10217, 10217, + 386, 10217, 10217, 750, 6015, 6015, 107, 639, -850, -850, + -850, 9981, 5101, 814, 13119, -850, 6491, 237, -850, -850, + -850, 756, 624, 640, 4809, 5869, -850, -850, -850, 646, + -850, 1485, 751, 10217, 10217, -850, 1458, -850, 1769, -850, + 1769, -850, 1769, -850, -850, 10217, 10217, -850, 565, 565, + 11023, -850, 650, 354, 653, 11023, -850, 660, 661, -850, + 755, 10217, 12853, -850, -850, 13119, 4389, 4661, 666, 414, + 426, 10217, 10217, -850, -850, -850, -850, -850, 10335, -850, + -850, -850, -850, -850, -850, -850, 759, 670, 5869, 4809, + -850, -850, 11137, 69, -850, -850, 6015, -850, -850, 69, + -850, 10217, -850, 785, 797, -850, 13119, 148, -850, 9155, + -850, 1683, 799, 676, 1630, 1630, 894, -850, 13119, 13119, + 593, 681, 593, 593, 13119, 13119, 698, 712, 786, 957, + 345, -850, -850, 1422, -850, 957, 1458, -850, 1769, -850, + -850, 12924, 486, 13119, 13119, -850, -850, -850, -850, 705, + 832, 796, -850, 968, 905, 929, 4809, -850, 4955, -850, + -850, 6015, -850, -850, -850, -850, 116, -850, -850, -850, + -850, 713, 713, 1630, 714, -850, 1769, -850, -850, -850, + -850, -850, -850, 12133, -850, 354, 345, -850, -850, 716, + 718, 722, -850, 723, 722, -850, -850, 952, 12219, 8565, + 12305, 581, 487, 870, 1683, -850, 1630, 713, 1630, 593, + 733, 743, -850, 1458, -850, 1769, -850, 1769, -850, 1769, + -850, -850, 1109, 192, 745, 553, 866, -850, -850, -850, + -850, 713, -850, 722, 753, 722, 722, 756, -850, 1769, + -850, -850, -850, 722, -850 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int16 yydefact[] = +{ + 2, 0, 0, 1, 0, 0, 0, 0, 293, 0, + 0, 317, 320, 0, 0, 597, 337, 338, 339, 340, + 305, 270, 270, 488, 487, 489, 490, 599, 0, 10, + 0, 492, 491, 493, 479, 583, 481, 480, 483, 482, + 475, 476, 437, 438, 494, 495, 291, 0, 0, 0, + 0, 0, 0, 295, 611, 611, 88, 312, 0, 0, + 0, 0, 0, 0, 452, 0, 0, 0, 3, 597, + 6, 9, 27, 33, 539, 539, 49, 60, 59, 0, + 76, 0, 80, 90, 0, 54, 248, 0, 61, 310, + 284, 285, 435, 286, 287, 288, 433, 432, 464, 434, + 431, 486, 0, 289, 290, 270, 5, 8, 337, 338, + 305, 611, 413, 0, 113, 114, 291, 0, 0, 0, + 0, 539, 539, 116, 496, 341, 0, 486, 290, 0, + 333, 168, 178, 169, 165, 194, 195, 196, 197, 176, + 191, 184, 174, 173, 189, 172, 171, 167, 192, 166, + 179, 183, 185, 177, 170, 186, 193, 188, 187, 180, + 190, 175, 164, 182, 181, 163, 161, 162, 158, 159, + 160, 118, 120, 119, 153, 154, 131, 132, 133, 140, + 137, 139, 134, 135, 155, 156, 141, 142, 146, 149, + 150, 136, 138, 128, 129, 130, 143, 144, 145, 147, + 148, 151, 152, 157, 569, 55, 121, 122, 568, 0, + 0, 0, 58, 539, 539, 0, 0, 54, 0, 486, + 0, 290, 0, 0, 0, 112, 0, 352, 351, 0, + 0, 486, 290, 187, 180, 190, 175, 158, 159, 160, + 118, 119, 0, 123, 125, 20, 124, 455, 460, 459, + 605, 608, 597, 607, 0, 457, 0, 609, 606, 598, + 581, 0, 0, 0, 0, 265, 277, 74, 269, 611, + 435, 611, 573, 75, 73, 611, 259, 306, 72, 0, + 258, 412, 71, 597, 0, 600, 18, 0, 0, 221, + 0, 222, 209, 212, 302, 0, 0, 0, 597, 15, + 597, 78, 14, 0, 597, 0, 602, 602, 249, 0, + 0, 602, 571, 0, 0, 86, 0, 96, 103, 539, + 469, 468, 470, 471, 0, 467, 466, 439, 444, 443, + 446, 0, 0, 441, 448, 0, 450, 0, 462, 0, + 473, 0, 477, 478, 53, 236, 237, 4, 598, 0, + 0, 0, 0, 0, 0, 0, 546, 542, 541, 540, + 543, 544, 548, 560, 515, 516, 564, 563, 559, 539, + 0, 504, 0, 508, 513, 611, 518, 611, 538, 0, + 545, 547, 550, 524, 0, 557, 524, 562, 524, 0, + 522, 500, 0, 0, 400, 402, 0, 92, 0, 84, + 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 208, 211, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 594, 611, 593, 0, 596, 595, 0, 417, 415, 311, + 436, 0, 0, 406, 65, 309, 330, 113, 114, 115, + 477, 478, 504, 497, 328, 0, 611, 0, 0, 0, + 592, 591, 56, 0, 611, 302, 0, 0, 343, 0, + 342, 0, 0, 611, 0, 0, 0, 0, 0, 0, + 302, 0, 611, 0, 325, 0, 126, 0, 0, 456, + 458, 0, 0, 610, 575, 0, 278, 580, 272, 0, + 275, 266, 0, 274, 0, 267, 0, 597, 0, 597, + 611, 611, 260, 271, 597, 0, 308, 52, 0, 0, + 0, 0, 0, 0, 17, 597, 300, 13, 598, 77, + 296, 299, 303, 604, 250, 603, 604, 252, 304, 572, + 102, 94, 0, 89, 0, 0, 611, 0, 539, 313, + 397, 472, 0, 0, 447, 453, 440, 442, 449, 451, + 463, 474, 0, 0, 7, 21, 22, 23, 24, 25, + 50, 51, 506, 552, 0, 597, 597, 524, 0, 0, + 507, 0, 520, 567, 517, 0, 521, 505, 0, 531, + 553, 0, 534, 561, 0, 536, 565, 0, 0, 611, + 0, 28, 30, 0, 31, 597, 0, 82, 93, 48, + 34, 46, 0, 253, 198, 29, 0, 290, 226, 231, + 232, 233, 228, 230, 240, 241, 234, 235, 207, 210, + 238, 239, 32, 218, 599, 227, 229, 223, 224, 225, + 213, 214, 215, 216, 217, 584, 589, 585, 590, 411, + 270, 409, 0, 611, 584, 586, 585, 587, 410, 270, + 584, 585, 270, 611, 611, 35, 253, 199, 45, 206, + 63, 66, 0, 0, 0, 113, 114, 117, 0, 0, + 611, 0, 597, 0, 294, 611, 611, 423, 0, 0, + 611, 344, 588, 301, 0, 584, 585, 611, 346, 318, + 345, 321, 588, 301, 0, 584, 585, 0, 0, 0, + 0, 277, 0, 324, 576, 578, 577, 0, 0, 279, + 273, 611, 579, 574, 257, 255, 261, 262, 264, 307, + 601, 19, 0, 26, 205, 79, 16, 597, 602, 95, + 87, 99, 101, 0, 98, 100, 599, 0, 465, 0, + 454, 219, 220, 546, 360, 597, 353, 503, 501, 0, + 41, 244, 335, 0, 514, 611, 566, 523, 551, 524, + 524, 524, 558, 524, 546, 524, 43, 246, 336, 388, + 386, 0, 385, 384, 283, 0, 91, 85, 0, 0, + 0, 0, 0, 611, 0, 0, 0, 0, 408, 69, + 414, 262, 0, 0, 407, 67, 403, 62, 0, 0, + 611, 331, 0, 0, 414, 334, 570, 57, 424, 425, + 611, 426, 0, 611, 349, 0, 0, 347, 0, 0, + 414, 0, 0, 0, 0, 0, 414, 0, 127, 461, + 323, 0, 0, 276, 280, 268, 597, 611, 11, 297, + 251, 97, 0, 390, 0, 0, 314, 445, 361, 358, + 549, 0, 597, 0, 0, 519, 0, 527, 0, 529, + 0, 535, 0, 532, 537, 0, 0, 383, 599, 599, + 510, 511, 611, 611, 368, 0, 555, 368, 368, 366, + 0, 0, 281, 83, 47, 254, 584, 585, 0, 584, + 585, 0, 0, 40, 203, 39, 204, 70, 0, 37, + 201, 38, 202, 68, 404, 405, 0, 0, 0, 0, + 498, 329, 0, 0, 428, 350, 0, 12, 430, 0, + 315, 0, 316, 0, 0, 326, 279, 611, 256, 263, + 396, 0, 0, 0, 0, 0, 356, 502, 42, 245, + 524, 524, 524, 524, 44, 247, 0, 0, 0, 509, + 0, 364, 365, 368, 376, 554, 0, 379, 0, 381, + 401, 282, 414, 243, 242, 36, 200, 418, 416, 0, + 0, 0, 427, 0, 104, 111, 0, 429, 0, 319, + 322, 0, 420, 421, 419, 394, 599, 392, 395, 399, + 398, 362, 359, 0, 354, 528, 0, 525, 530, 533, + 389, 387, 302, 0, 512, 611, 0, 367, 374, 368, + 368, 368, 556, 368, 368, 64, 332, 110, 0, 611, + 0, 611, 611, 0, 0, 391, 0, 357, 0, 524, + 588, 301, 363, 0, 371, 0, 373, 0, 380, 0, + 377, 382, 107, 109, 0, 584, 585, 422, 348, 327, + 393, 355, 526, 368, 368, 368, 368, 105, 372, 0, + 369, 375, 378, 368, 370 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -850, -850, -850, 379, -850, 44, -850, -221, 102, -850, + 30, -850, -19, -171, 161, 1373, 1745, -850, 1, -30, + -850, -656, -850, -13, 889, -220, 23, -60, -285, -450, + 15, 2261, -78, 901, 43, 3, -850, -850, 19, -850, + 1221, -850, 464, 81, -495, -377, 114, 17, -850, -415, + -256, -111, 39, -338, 32, -850, -850, -850, -850, -850, + -850, -850, -850, -850, -850, -850, -850, -850, -850, -850, + -850, 8, -213, -435, -122, -602, -850, -850, -850, 134, + 101, -850, -566, -850, -850, -359, -850, -116, -850, -850, + 135, -850, -850, -850, -81, -850, -850, -458, -850, -112, + -850, -850, -850, -850, -850, 66, 6, -158, -850, -850, + -850, -850, -394, -280, -850, 671, -850, -850, -850, 13, + -850, -850, -850, 2384, 2648, 924, 1983, -850, -850, 14, + 459, 24, 163, 357, -14, -850, -850, -850, 112, -453, + 189, -206, -837, -693, -553, -850, 280, -715, -542, -849, + -12, -518, -850, -90, -850, 111, -357, -850, -850, -850, + 26, 691, -399, 625, -173, -850, -850, -82, -850, 42, + -25, 525, -249, 78, -26, 9, -2 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 1, 2, 68, 69, 70, 287, 463, 464, 298, + 299, 518, 72, 610, 73, 213, 214, 683, 215, 76, + 77, 671, 810, 78, 79, 300, 80, 81, 82, 543, + 83, 216, 123, 124, 243, 244, 245, 708, 648, 207, + 85, 305, 614, 649, 277, 508, 509, 278, 279, 268, + 501, 536, 653, 604, 86, 210, 303, 737, 304, 319, + 747, 223, 834, 224, 835, 707, 991, 674, 672, 919, + 458, 290, 469, 699, 826, 827, 230, 755, 944, 1017, + 964, 878, 781, 782, 879, 852, 996, 997, 549, 856, + 395, 599, 88, 89, 445, 664, 663, 492, 994, 686, + 820, 923, 927, 90, 91, 92, 332, 333, 553, 93, + 94, 95, 554, 253, 254, 255, 487, 96, 97, 98, + 326, 99, 100, 219, 220, 103, 221, 454, 673, 370, + 371, 372, 373, 374, 881, 882, 375, 376, 377, 378, + 589, 379, 380, 381, 382, 574, 383, 384, 385, 886, + 887, 386, 387, 388, 389, 390, 582, 209, 459, 310, + 511, 495, 272, 129, 678, 651, 462, 457, 436, 515, + 853, 516, 534, 257, 258, 259, 302 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 106, 285, 284, 265, 265, 433, 435, 265, 439, 477, + 87, 222, 87, 126, 126, 505, 252, 218, 218, 280, + 586, 229, 400, 218, 218, 218, 206, 246, 218, 542, + 710, 286, 71, 206, 71, 768, 344, 125, 125, 282, + 449, 246, 271, 271, 701, 125, 271, 206, 107, 772, + 205, 555, 308, 312, 652, 269, 269, 256, 537, 269, + 87, 859, 539, 615, 316, 885, 335, 337, 339, 341, + 769, 315, 391, 391, 218, 301, 525, 206, 348, 679, + 307, 311, 270, 270, 823, 468, 270, 720, 125, 392, + 316, 720, -104, 306, 740, 833, 694, 808, 809, 393, + 714, 325, 276, 281, 998, 704, 854, 723, 437, 280, + 437, 347, -111, 550, 125, 366, -107, 1022, 572, -110, + 270, 270, 444, -109, 3, 218, -485, 87, -106, -108, + 267, 273, -105, 901, 274, 767, 474, 723, 767, -488, + 367, 767, 779, 907, 342, 343, 393, 483, -487, 913, + 434, 579, 354, 355, 297, -112, 787, 440, 502, -77, + 506, 294, -489, 576, 804, 430, 822, 806, 491, 743, + 212, 212, 598, -490, 557, 288, 212, 557, 605, 557, + -91, 557, 573, 557, 247, 804, 443, 248, 249, 780, + 855, 396, 276, 281, 1022, 533, -488, 998, 753, 902, + 357, 358, 359, 360, 394, -487, 768, 432, 522, -96, + 443, 391, 391, 397, 555, 250, 361, 251, 87, -489, + 438, 297, 438, -492, 478, 479, 275, 466, 467, -103, + -490, 218, 218, -99, 547, -584, -102, 681, 393, 401, + -101, 769, -585, -484, 918, -98, -100, 476, 885, -97, + 523, 885, -491, 1004, 541, 505, 650, 441, 1034, 542, + 659, 206, 265, 662, 251, 468, 265, 503, 453, 503, + 665, 668, -104, 512, 750, 275, -111, -493, 446, -110, + -492, 283, -301, 218, 680, 325, -479, 218, 465, 858, + 471, 218, 218, 470, 488, 475, 87, -301, -483, 650, + 470, 659, 480, 87, 87, 271, 767, 528, 768, -491, + 680, 87, 720, 720, 510, 535, 535, 768, 269, 301, + 535, 542, 316, 843, 772, 524, 450, 451, 885, 723, + 552, 460, -301, 530, -493, 992, -585, 493, 893, -301, + 527, 270, 746, -479, 283, 270, 125, 819, 251, 680, + 565, 566, 567, 568, 484, -483, 87, 218, 218, 218, + 218, 87, 218, 218, 247, 447, 601, 248, 249, 448, + 486, 611, 491, 583, 680, 583, 442, 677, 71, 500, + 87, 494, 609, 569, 212, 212, 720, 417, 461, 519, + 520, 500, 564, 513, 557, 250, 763, 251, 297, 727, + 728, 87, 935, 831, 218, -111, 87, 316, 865, 616, + 768, 611, 611, 767, 607, 767, 898, 767, 265, 767, + 526, 301, 609, 609, -76, 42, 493, 538, 43, 512, + 832, 125, -106, 532, 750, 603, 540, 555, 544, 218, + 603, -484, 562, 265, 514, 517, 364, 365, 366, 616, + 616, 563, 657, 813, 512, 657, 417, 587, 578, -108, + 265, -499, 687, 581, 218, 845, 87, 218, 584, 265, + -104, 512, 59, 367, 285, 717, 657, 87, 931, 993, + 512, 218, 739, 768, 541, 87, 426, 427, 428, 850, + 218, -96, 785, 657, 768, 87, 585, 270, 770, 842, + 297, 773, 657, 542, 825, 822, 802, -105, 503, 503, + 212, 212, 212, 212, 658, 570, 571, 106, 803, 956, + 957, 731, 270, 593, 720, 961, 962, 87, 721, 588, + 712, 246, -581, 265, 794, -106, 87, 206, 658, 270, + 723, 657, 801, 591, 512, 594, 541, -108, 270, 71, + 316, 726, 316, 767, 218, 658, 700, 700, 736, 738, + 890, 87, 596, 750, 658, 760, 657, -341, 270, -106, + 597, 690, 270, 429, 125, 592, 125, 595, 908, 697, + 452, 452, -341, 608, 776, 632, 218, 916, 430, 709, + 670, 845, 684, 442, 685, 688, -479, 783, 691, 270, + 689, 841, 270, 658, 551, 218, 493, -105, 285, 795, + 506, -479, 270, 493, 316, 713, 725, -341, 730, 650, + 682, 659, -111, 431, -341, 903, -91, 105, 658, 105, + 432, 909, 911, 942, 105, 105, 523, 733, 125, 759, + 105, 105, 105, -103, -581, 105, -479, 762, 789, 577, + -581, 503, 1054, -479, 788, 749, 802, 280, 1042, 778, + 280, 783, 783, 790, 800, -110, 698, 799, -106, 770, + 814, -106, -106, 815, 812, 822, 805, 105, 280, 807, + 803, 218, 87, 821, 824, -106, -102, 830, 824, 455, + 888, 105, 766, 765, 839, 824, 766, 836, 980, -106, + 840, -106, 206, 851, 430, 908, -98, 848, 837, -108, + 986, 838, 857, 251, 861, 218, 988, 863, 472, 503, + 285, 246, 572, 875, 603, 914, 817, 206, 541, 866, + -100, 798, 868, 430, -105, 870, 939, 975, 872, 456, + 276, 921, 105, 276, 105, 922, 432, 535, -298, -291, + 811, -298, -298, 847, 247, -97, 926, 248, 249, 798, + 611, 276, 930, 583, -291, 932, 611, 905, 473, 940, + 970, 609, 611, 611, 977, 432, 951, 609, -298, -298, + 265, -298, -414, 609, 609, 250, 941, 251, 945, 87, + 470, 512, 960, 270, 270, 963, 316, 87, 616, -291, + 989, 218, 966, 968, 616, 218, -291, 972, 783, 978, + 616, 616, 990, 657, 999, 1000, 87, 87, 924, 894, + 125, 928, 481, 1006, 1010, 529, 929, 847, 334, 531, + 87, 328, 329, 218, 212, 105, 489, 430, 1011, 248, + 249, 1012, 87, 87, 1025, 503, -414, 1026, 105, 105, + 87, 1027, 285, 285, 756, 1036, 1038, 680, 1043, 270, + 1045, -414, 87, 87, 1047, 1049, 247, 270, 212, 248, + 249, 771, 482, 1020, 775, 658, 1023, -584, 611, 432, + 583, 583, -108, 330, 331, 1059, 1067, -585, 959, 609, + 920, 889, 883, 965, -414, 1069, -414, 250, 732, 251, + 105, 1030, 227, -414, 105, 667, 669, 130, 105, 105, + 1058, 917, 125, 105, 877, 700, 616, 125, 1060, 1057, + 105, 105, 354, 355, 925, 490, 87, 87, 105, 247, + 983, 208, 248, 249, 87, 824, 933, 934, 764, 667, + 669, 521, 915, 880, 937, 753, 1014, 357, 358, 359, + 360, 1019, 545, 1064, 125, 0, 430, 943, 867, 869, + 871, 504, 873, 361, 874, 0, 0, 430, 0, 0, + 285, 1035, 0, 105, 105, 105, 105, 105, 105, 105, + 105, -108, 0, 0, -108, -108, 212, 734, 967, 969, + 0, 473, 0, 0, 87, -486, 87, 105, 432, 87, + 247, 470, 546, 248, 249, 270, 0, 470, 0, 432, + -486, 0, -108, 583, -108, 0, 265, 0, 105, -290, + 979, 105, 0, 105, 0, 0, 105, 512, 987, 687, + 824, 250, 724, 251, -290, 0, 1003, 218, 0, 729, + 0, 0, -302, 0, 0, -486, 792, 1013, 0, 657, + 735, 336, -486, 328, 329, 0, 105, -302, 1028, 0, + 884, 430, 430, 0, 1018, 0, 105, 105, 0, -290, + -582, 766, 1015, 430, 889, 883, -290, 889, 883, 889, + 883, 105, 558, 105, 105, 328, 329, 0, 1031, 0, + 1032, 0, -302, 1033, 105, 270, 793, 456, 105, -302, + 757, 758, 105, 432, 432, 330, 331, 105, 1029, 0, + 0, 658, 105, 0, 559, 432, 328, 329, 0, 0, + 1044, 1046, 1048, 880, 1050, 1051, 880, 889, 883, 880, + 786, 880, 0, 0, -483, -588, 0, 330, 331, 1005, + 1007, 1008, 1009, 0, 105, 0, 950, 0, 952, -483, + 0, 0, 953, 105, 889, 883, 889, 883, 889, 883, + 889, 883, 0, 0, 1068, 1070, 1071, 1072, 330, 331, + 0, 105, -599, 0, 1074, -599, -599, 0, 105, 880, + 889, 883, -582, 0, -483, 0, 0, 0, -582, 0, + 0, -483, 0, -584, -585, 0, 0, 0, 0, -588, + 0, 0, 0, 105, 0, 251, 880, 816, 880, 0, + 880, 0, 880, 0, -588, 0, 753, 0, 357, 358, + 359, 360, 105, 0, 1001, 1002, 0, 0, 1062, 0, + 217, 217, 880, 0, 361, 0, 217, 266, 266, 0, + 0, 266, 0, 0, 0, 0, 1021, -588, 1024, -588, + 327, 328, 329, -584, 0, 0, -588, -584, -585, 362, + 904, 906, 849, 0, 0, 754, 910, 912, 289, 291, + 292, 293, -584, -585, 0, 266, 309, 338, 328, 329, + 860, 0, 0, 1037, 0, 0, 1039, 345, 346, 0, + 0, 0, 904, 906, 0, 910, 912, 0, 105, 105, + 340, 328, 329, 330, 331, -584, -585, -584, -585, 0, + 0, -584, -585, 0, -584, -585, 0, 356, 1061, 357, + 358, 359, 360, 1063, 0, 1065, 0, 0, 0, 1066, + 330, 331, 105, 417, 0, 361, 0, 0, 217, 356, + 0, 357, 358, 359, 360, 551, 328, 329, 0, 1073, + 556, 328, 329, 330, 331, 0, 0, 361, 0, 0, + 362, 424, 425, 426, 427, 428, 363, 364, 365, 366, + 0, 938, 976, 0, 0, 74, 0, 74, 121, 121, + 0, 0, 362, 560, 328, 329, 121, 947, 363, 364, + 365, 366, 0, 0, 367, 976, 0, 368, 330, 331, + 561, 328, 329, 330, 331, 0, 105, 0, 0, -611, + 369, 748, 328, 329, 105, 105, 367, 0, 105, 368, + 0, 105, 105, 0, 0, 74, 0, 105, 105, 121, + 0, 0, 369, 105, 105, 0, 330, 331, 356, 0, + 357, 358, 359, 360, 217, 217, 0, 105, 0, 0, + 105, 0, 0, 330, 331, 121, 361, 0, 0, 105, + 105, 0, 0, 0, 330, 331, 247, 105, 0, 248, + 249, 0, 0, 356, 0, 357, 358, 359, 360, 105, + 105, 362, 496, 497, 498, 345, 0, 363, 364, 365, + 366, 361, 74, 500, 0, 0, 266, 250, 0, 251, + 266, 0, 0, 0, 217, 217, 0, 0, 0, 356, + 0, 357, 358, 359, 360, 367, 362, 0, 368, 0, + 0, 0, 363, 364, 365, 366, 0, 361, 0, 0, + 0, 548, 0, 105, 0, 0, 753, 0, 357, 358, + 359, 360, 0, 105, 105, 349, 350, 351, 352, 353, + 367, 105, 362, 368, 361, 414, 415, 0, 363, 364, + 365, 366, 0, 0, 1016, 414, 415, 0, 417, 0, + 217, 217, 217, 217, 0, 217, 217, 0, 417, 362, + 0, 0, 0, 74, 0, 946, 367, 0, 0, 368, + 0, 0, 0, 0, 580, 423, 424, 425, 426, 427, + 428, 0, 0, 0, 0, 590, 424, 425, 426, 427, + 428, 105, 0, 105, 0, 0, 105, 602, 0, 0, + 0, 0, 613, 618, 619, 620, 621, 622, 623, 624, + 625, 626, 627, 628, 629, 630, 631, 0, 633, 634, + 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, + 0, 0, 266, 0, 105, 356, 0, 357, 358, 359, + 360, 74, 666, 666, 0, 0, 0, 0, 74, 74, + 0, 0, 0, 361, 0, 0, 74, 266, 0, 0, + 217, 753, 0, 357, 358, 359, 360, 121, 0, 575, + 0, 0, 666, 0, 266, 0, 666, 666, 362, 361, + 0, 0, 0, 266, 363, 364, 365, 366, 0, 0, + 0, 0, 711, 0, 0, 0, 715, 0, 0, 0, + 716, 74, 0, 719, 362, 722, 74, 309, 293, 0, + 0, 0, 367, 0, 995, 368, 357, 358, 359, 360, + 0, 0, 0, 0, 666, 74, 0, 75, 0, 75, + 122, 122, 361, 0, 719, 0, 0, 309, 122, 356, + 0, 357, 358, 359, 360, 0, 74, 266, 0, 0, + 0, 74, 121, 0, 74, 0, 0, 361, 0, 0, + 0, 0, 0, 751, 752, 0, 0, 0, 0, 0, + 0, 0, 0, 862, 0, 0, 0, 75, 0, 761, + 0, 122, 362, 0, 0, 0, 0, 0, 363, 364, + 365, 366, 0, 0, 74, 74, 0, 0, 777, 0, + 774, 784, 357, 358, 359, 360, 0, 122, 0, 0, + 0, 74, 0, 0, 0, 0, 367, 0, 361, 368, + 414, 415, 74, 0, 0, 0, 0, 0, 0, 0, + 74, 0, 0, 417, 0, 0, 0, 0, 0, 0, + 74, 0, 0, 362, 75, 0, 0, 0, 0, 0, + 364, 365, 366, 0, 0, 0, 0, 0, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 0, 0, + 0, 0, 74, 0, 217, 0, 0, 367, 0, 0, + 0, 74, 0, 0, 0, 0, 818, 0, 0, 761, + 777, 0, 0, 0, 0, 121, 0, 121, 0, 0, + 0, 0, 0, 0, 0, 0, 74, 0, 217, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 844, + 0, 0, 0, 0, 0, 0, 0, 0, 719, 309, + 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 121, + 0, 0, 0, 0, 0, 104, 0, 104, 128, 128, + 0, 0, 0, 0, 0, 0, 232, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 892, 0, 0, 0, + 0, 666, 895, 0, 266, 0, 0, 666, 666, 0, + 0, 0, 719, 666, 666, 0, 0, 0, 0, 0, + 0, 0, 0, 75, 0, 104, 0, 0, 0, 318, + 75, 75, 0, 0, 0, 0, 217, 74, 75, 666, + 666, 0, 666, 666, 0, 0, 0, 0, 0, 122, + 0, 0, 936, 0, 0, 318, 0, 293, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 948, 949, 0, 0, 0, 0, + 0, 0, 0, 75, 0, 0, 954, 955, 75, 0, + 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 971, 0, 0, 0, 0, 75, 0, 0, + 0, 0, 973, 974, 0, 0, 0, 0, 0, 666, + 0, 0, 0, 0, 0, 0, 0, 0, 75, 0, + 0, 0, 0, 75, 122, 0, 75, 0, 0, 0, + 0, 0, 666, 0, 74, 0, 0, 0, 0, 0, + 309, 121, 74, 74, 0, 0, 0, 0, 0, 74, + 0, 0, 0, 0, 0, 74, 74, 0, 0, 0, + 0, 74, 74, 0, 0, 0, 75, 75, 0, 0, + 0, 0, 0, 104, 0, 74, 0, 0, 0, 0, + 0, 0, 0, 75, 0, 0, 0, 74, 74, 0, + 0, 0, 0, 0, 75, 74, 0, 0, 0, 0, + 0, 0, 75, 0, 0, 0, 0, 74, 74, 0, + 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 266, 0, 0, 121, 0, 0, 0, 0, 121, 0, + 0, 0, 0, 84, 75, 84, 0, 0, 0, 0, + 0, 104, 0, 75, 228, 0, 0, 0, 104, 104, + 0, 74, 0, 0, 0, 0, 104, 122, 0, 122, + 0, 74, 74, 0, 0, 121, 0, 318, 75, 74, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -611, 104, 0, 0, 0, 0, 104, 0, 0, 0, + 0, 0, 0, -611, -611, -611, -611, -611, -611, 0, + -611, 122, 0, 0, 0, 104, -611, -611, 0, 74, + 0, 74, 0, 0, 74, 0, 0, -611, -611, 0, + -611, -611, -611, -611, -611, 0, 104, 0, 0, 0, + 84, 104, 318, 0, 617, 0, 101, 0, 101, 127, + 127, 127, 0, 0, 0, 0, 0, 231, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + -611, 0, 0, 0, 617, 617, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -611, 101, 0, 0, 0, + 317, 104, 0, 0, 0, -611, 0, 0, -611, -611, + 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, + 104, 0, 0, 0, 0, 0, 317, 0, -611, -611, + 104, 84, 0, 0, 275, -611, -611, -611, -611, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 104, 101, 0, 0, 0, 0, 0, 0, + 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 318, 75, 318, 0, 0, + 0, 0, 0, 122, 75, 75, 104, 0, 0, 0, + 0, 75, 0, 0, 0, 0, 0, 75, 75, 84, + 0, 0, 0, 75, 75, 0, 84, 84, 0, 0, + 0, 0, 0, 0, 84, 0, 0, 75, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 75, + 75, 0, 0, 0, 0, 0, 0, 75, 0, 318, + 0, 0, 0, 0, 101, 0, 0, 0, 0, 75, + 75, 0, 0, 0, 0, 0, 0, 0, 0, 84, + 0, 0, 0, 0, 84, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 122, 0, 0, 0, 0, + 122, 0, 0, 84, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 102, 0, 102, 75, 84, 0, 0, 104, 0, 84, + 0, 0, 612, 75, 75, 0, 0, 122, 0, 0, + 0, 75, 101, 0, 0, 0, 0, 0, 0, 101, + 101, 0, 0, 0, 0, 0, 0, 101, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 317, 0, + 102, 0, 612, 612, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 84, 75, 101, 75, 0, 0, 75, 101, 84, 0, + 0, 402, 403, 404, 405, 406, 407, 408, 84, 410, + 411, 0, 0, 0, 0, 0, 101, 414, 415, 0, + 0, 0, 0, 0, 104, 0, 0, 102, 0, 0, + 417, 318, 104, 617, 0, 0, 0, 101, 0, 617, + 84, 0, 101, 317, 0, 617, 617, 0, 0, 84, + 0, 104, 104, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 0, 0, 104, 0, 0, 0, 0, + 0, 0, 0, 0, 84, 0, 0, 104, 104, 0, + 0, 0, 0, 0, 0, 104, 0, -612, -612, -612, + -612, 406, 407, 0, 0, -612, -612, 104, 104, 0, + 0, 0, 101, 414, 415, 0, 0, 0, 0, 0, + 0, 0, 0, 101, 0, 0, 417, 0, 102, 0, + 0, 101, 0, 128, 0, 0, 0, 0, 128, 0, + 0, 101, 0, 0, 0, 0, 0, 0, 0, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 0, + 0, 617, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 104, 104, 101, 0, 985, 0, 0, 0, 104, + 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 317, 0, 317, 0, + 0, 0, 0, 0, 0, 84, 102, 101, 0, 0, + 0, 0, 0, 102, 102, 0, 0, 791, 0, 0, + 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, + 0, 104, 0, 0, 104, 402, 403, 404, 405, 406, + 407, 408, 409, 410, 411, 412, 413, 0, 0, 0, + 317, 414, 415, 0, 0, 0, 102, 0, 0, 0, + 0, 102, 0, 0, 417, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 102, 0, 0, 0, 0, 418, 0, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 0, 0, 0, + 0, 102, 84, 0, 0, -277, 102, 0, 0, 102, + 84, 612, 0, 0, 0, 0, 0, 612, 101, 0, + 0, 0, 0, 612, 612, 0, 0, 0, 0, 84, + 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 84, 0, 0, 0, 0, 0, 102, + 102, 0, 0, 0, 0, 84, 84, 0, 0, 0, + 0, 0, 0, 84, 0, 0, 102, 0, 0, 0, + 0, 0, 0, 0, 0, 84, 84, 102, 0, 0, + 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 101, 0, 102, 0, 612, + 0, 0, 317, 101, 0, 0, 102, 0, 0, 84, + 84, 0, 0, 982, 0, 0, 0, 84, 0, 0, + 0, 0, 101, 101, 0, 0, 0, 0, 0, 0, + 0, 102, 0, 0, 0, 0, 101, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 101, 101, + 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 101, 101, + 0, 0, 0, 0, 0, 0, 0, 84, 0, 84, + 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 127, 0, 0, 0, 0, 127, + 0, 0, 0, 0, 0, -588, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -588, -588, + -588, 0, -588, -588, 0, -588, 0, 0, 0, 0, + 0, -588, 101, 101, 0, 0, 984, 0, 0, 0, + 101, 0, -588, -588, 0, -588, -588, -588, -588, -588, + 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -588, -588, -588, + -588, -588, -588, -588, -588, -588, -588, -588, -588, 0, + 0, 0, 0, -588, -588, -588, 0, 796, -588, 0, + 101, 0, 101, 0, 0, 101, -588, 0, 0, 0, + -588, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -588, 0, 0, -588, -588, 0, -107, -588, 0, -588, + -588, -588, -588, -588, -588, -588, -588, -588, -588, 0, + 0, 0, 0, -588, -588, -588, 0, -99, 0, 0, + -588, -588, -588, -588, 0, 0, 0, 0, 0, 102, + 0, 0, 0, 0, 0, 0, 0, 102, 102, 0, + 0, 0, 645, 646, 102, 0, 647, 0, 0, 0, + 102, 102, 0, 0, 0, 0, 102, 102, 0, 0, + 0, 174, 175, 176, 177, 178, 179, 180, 181, 0, + 102, 182, 183, 0, 0, 0, 0, 184, 185, 186, + 187, 0, 102, 102, 0, 0, 0, 0, 0, 0, + 102, 188, 189, 190, 0, 0, 0, 0, 0, 0, + 0, 0, 102, 102, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 202, 402, 403, + 404, 405, 406, 407, 203, 275, 410, 411, 0, 0, + 0, 0, 0, 0, 414, 415, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 102, 417, 0, 0, + 0, 0, 0, 0, 0, 0, 102, 102, 0, 0, + 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 0, 0, 0, 0, 0, 0, -611, 4, 0, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, + 0, 0, 0, 0, 0, 15, 0, 16, 17, 18, + 19, 0, 0, 0, 0, 0, 20, 21, 22, 23, + 24, 25, 26, 0, 102, 27, 102, 0, 0, 102, + 0, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 0, 40, 41, 42, 0, 0, 43, + 0, 0, 44, 45, 0, 46, 47, 48, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 49, 50, 0, 0, 0, 0, 0, 51, 0, 0, + 52, 53, 0, 54, 55, 0, 56, 0, 0, 0, + 57, 0, 58, 59, 60, 0, 61, 62, 63, -292, + 64, -611, 0, 0, -611, -611, 0, 0, 0, 0, + 0, 0, -292, -292, -292, -292, -292, -292, 0, -292, + 65, 66, 67, 0, 0, 0, -292, -292, -292, 0, + 0, 0, -611, 0, -611, 0, -292, -292, 0, -292, + -292, -292, -292, -292, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -292, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -292, -292, -292, -292, -292, -292, -292, -292, -292, + -292, -292, -292, 0, 0, 0, 0, -292, -292, -292, + 0, 0, -292, 0, 0, 0, 0, 0, -292, 0, + -292, 0, 0, 0, -292, 0, 0, 0, 0, 0, + 0, 0, -292, 0, -292, 0, 0, -292, -292, 0, + 0, -292, -292, -292, -292, -292, -292, -292, -292, -292, + -292, -292, -292, 0, 0, -413, 0, 0, -292, -292, + -292, -292, 0, 0, -292, -292, -292, -292, -413, -413, + -413, -413, -413, -413, 0, -413, 0, 0, 0, 0, + 0, -413, -413, -413, 0, 0, 0, 0, 0, 0, + 0, 0, -413, -413, 0, -413, -413, -413, -413, -413, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -413, -413, -413, + -413, -413, -413, -413, -413, -413, -413, -413, -413, 0, + 0, 0, 0, -413, -413, -413, 0, 0, -413, 0, + 0, 0, 0, 0, -413, 0, -413, 0, 0, 0, + -413, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -413, 0, 0, -413, -413, 0, 0, -413, 0, -413, + -413, -413, -413, -413, -413, -413, -413, -413, -413, 0, + 0, -479, 0, -413, -413, -413, -413, -413, 0, 275, + -413, -413, -413, -413, -479, -479, -479, -479, -479, -479, + 0, -479, 0, 0, 0, 0, 0, 0, -479, -479, + 0, 0, 0, 0, 0, 0, 0, 0, -479, -479, + 0, -479, -479, -479, -479, -479, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 494, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -479, -479, -479, -479, -479, -479, -479, + -479, -479, -479, -479, -479, 0, 0, 0, 0, -479, + -479, -479, 0, -479, -479, 0, 0, 0, 0, 0, + -479, 0, -479, 0, 0, 0, -479, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -479, 0, 0, -479, + -479, 0, -479, -479, 0, -479, -479, -479, -479, -479, + -479, -479, -479, -479, -479, 0, 0, -611, 0, 0, + -479, -479, -479, -479, 0, 0, -479, -479, -479, -479, + -611, -611, -611, -611, -611, -611, 0, -611, 0, 0, + 0, 0, 0, -611, -611, -611, 0, 0, 0, 0, + 0, 0, 0, 0, -611, -611, 0, -611, -611, -611, + -611, -611, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -611, + -611, -611, -611, -611, -611, -611, -611, -611, -611, -611, + -611, 0, 0, 0, 0, -611, -611, -611, 0, 0, + -611, 0, 0, 0, 0, 0, -611, 0, -611, 0, + 0, 0, -611, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -611, 0, 0, -611, -611, 0, 0, -611, + 0, -611, -611, -611, -611, -611, -611, -611, -611, -611, + -611, 0, 0, -611, 0, -611, -611, -611, -611, -611, + 0, 275, -611, -611, -611, -611, -611, -611, -611, -611, + -611, -611, 0, -611, 0, 0, 0, 0, 0, 0, + -611, -611, 0, 0, 0, 0, 0, 0, 0, 0, + -611, -611, 0, -611, -611, -611, -611, -611, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -611, -611, -611, -611, -611, + -611, -611, -611, -611, -611, -611, -611, 0, 0, 0, + 0, -611, -611, -611, 0, 0, -611, 0, 0, 0, + 0, 0, -611, 0, -611, 0, 0, 0, -611, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -611, 0, + 0, -611, -611, 0, 0, -611, 0, -611, -611, -611, + -611, -611, -611, -611, -611, -611, -611, 0, 0, -588, + 0, 0, -611, -611, -611, -611, 0, 275, -611, -611, + -611, -611, -588, -588, -588, 0, -588, -588, 0, -588, + 0, 0, 0, 0, 0, -588, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -588, -588, 0, -588, + -588, -588, -588, -588, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -588, -588, -588, -588, -588, -588, -588, -588, -588, + -588, -588, -588, 0, 0, 0, 0, -588, -588, -588, + 0, 796, -588, 0, 0, 0, 0, 0, 0, 0, + -588, 0, 0, 0, -588, 0, 0, 0, 0, 0, + 0, 0, 0, 0, -588, 0, 0, -588, -588, 0, + -107, -588, 0, -588, -588, -588, -588, -588, -588, -588, + -588, -588, -588, 0, 0, -301, 0, -588, -588, -588, + 0, -588, 0, 0, -588, -588, -588, -588, -301, -301, + -301, 0, -301, -301, 0, -301, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -301, -301, 0, -301, -301, -301, -301, -301, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -301, -301, -301, + -301, -301, -301, -301, -301, -301, -301, -301, -301, 0, + 0, 0, 0, -301, -301, -301, 0, 797, -301, 0, + 0, 0, 0, 0, 0, 0, -301, 0, 0, 0, + -301, 0, 0, 0, 0, 0, 0, 0, 0, 0, + -301, 0, 0, -301, -301, 0, -109, -301, 0, -301, + -301, -301, -301, -301, -301, -301, -301, -301, -301, 0, + 0, -301, 0, 0, -301, -301, 0, -101, 0, 0, + -301, -301, -301, -301, -301, -301, -301, 0, -301, -301, + 0, -301, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -301, -301, + 0, -301, -301, -301, -301, -301, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -301, -301, -301, -301, -301, -301, -301, + -301, -301, -301, -301, -301, 0, 0, 0, 0, -301, + -301, -301, 0, 797, -301, 0, 0, 0, 0, 0, + 0, 0, -301, 0, 0, 0, -301, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -301, 0, 0, -301, + -301, 0, -109, -301, 0, -301, -301, -301, -301, -301, + -301, -301, -301, -301, -301, 0, 0, 0, 0, 0, + -301, -301, 0, -301, 0, 0, -301, -301, -301, -301, + 295, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, -611, -611, -611, 0, 0, -611, 15, 0, + 16, 17, 18, 19, 0, 0, 0, 0, 0, 20, + 21, 22, 23, 24, 25, 26, 0, 0, 27, 0, + 0, 0, 0, 0, 28, 0, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, + 51, 0, 0, 52, 53, 0, 54, 55, 0, 56, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, -611, 0, 0, -611, -611, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -611, 295, -611, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, + -611, 0, -611, -611, 15, 0, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, + 25, 26, 0, 0, 27, 0, 0, 0, 0, 0, + 28, 0, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 51, 0, 0, 52, + 53, 0, 54, 55, 0, 56, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + -611, 0, 0, -611, -611, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 67, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -611, 295, -611, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 0, 0, -611, 0, 0, -611, + 15, -611, 16, 17, 18, 19, 0, 0, 0, 0, + 0, 20, 21, 22, 23, 24, 25, 26, 0, 0, + 27, 0, 0, 0, 0, 0, 28, 0, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 51, 0, 0, 52, 53, 0, 54, 55, + 0, 56, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, -611, 0, 0, -611, + -611, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 66, 67, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -611, 295, -611, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 0, 0, -611, 0, 0, -611, 15, 0, 16, 17, + 18, 19, 0, 0, 0, 0, 0, 20, 21, 22, + 23, 24, 25, 26, 0, 0, 27, 0, 0, 0, + 0, 0, 28, 0, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 50, 0, 0, 0, 0, 0, 51, 0, + 0, 52, 53, 0, 54, 55, 0, 56, 0, 0, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, -611, 0, 0, -611, -611, 4, 0, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, + 0, 65, 66, 67, 0, 15, 0, 16, 17, 18, + 19, 0, 0, -611, 0, -611, 20, 21, 22, 23, + 24, 25, 26, 0, 0, 27, 0, 0, 0, 0, + 0, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 0, 40, 41, 42, 0, 0, 43, + 0, 0, 44, 45, 0, 46, 47, 48, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 49, 50, 0, 0, 0, 0, 0, 51, 0, 0, + 52, 53, 0, 54, 55, 0, 56, 0, 0, 0, + 57, 0, 58, 59, 60, 0, 61, 62, 63, 0, + 64, -611, 0, 0, -611, -611, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 65, 66, 67, 0, 0, -611, 0, 0, 0, 0, + 0, 0, -611, 295, -611, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 0, -611, -611, 0, 0, + 0, 15, 0, 16, 17, 18, 19, 0, 0, 0, + 0, 0, 20, 21, 22, 23, 24, 25, 26, 0, + 0, 27, 0, 0, 0, 0, 0, 28, 0, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, + 40, 41, 42, 0, 0, 43, 0, 0, 44, 45, + 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 49, 50, 0, 0, + 0, 0, 0, 51, 0, 0, 52, 53, 0, 54, + 55, 0, 56, 0, 0, 0, 57, 0, 58, 59, + 60, 0, 61, 62, 63, 0, 64, -611, 0, 0, + -611, -611, 295, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 0, 0, 65, 66, 67, 0, + 15, 0, 16, 17, 18, 19, 0, 0, -611, 0, + -611, 20, 21, 22, 23, 24, 25, 26, 0, 0, + 27, 0, 0, 0, 0, 0, 28, 0, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 51, 0, 0, 296, 53, 0, 54, 55, + 0, 56, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, -611, 0, 0, -611, + -611, 295, 0, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 0, 0, 65, 66, 67, 0, 15, + 0, 16, 17, 18, 19, 0, -611, -611, 0, -611, + 20, 21, 22, 23, 24, 25, 26, 0, 0, 27, + 0, 0, 0, 0, 0, 28, 0, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 0, 40, 41, + 42, 0, 0, 43, 0, 0, 44, 45, 0, 46, + 47, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 49, 50, 0, 0, 0, 0, + 0, 51, 0, 0, 52, 53, 0, 54, 55, 0, + 56, 0, 0, 0, 57, 0, 58, 59, 60, 0, + 61, 62, 63, 0, 64, -611, 0, 0, -611, -611, + 295, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 0, 0, 65, 66, 67, 0, 15, 0, + 16, 17, 18, 19, 0, -611, -611, 0, -611, 20, + 21, 22, 23, 24, 25, 26, 0, 0, 27, 0, + 0, 0, 0, 0, 28, 0, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, + 51, 0, 0, 52, 53, 0, 54, 55, 0, 56, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, -611, 0, 0, -611, -611, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 65, 66, 67, 0, 0, -611, 0, + 0, 0, 0, 0, 0, -611, 295, -611, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, + -611, 0, 0, 0, 15, 0, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, + 25, 26, 0, 0, 27, 0, 0, 0, 0, 0, + 28, 0, 30, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 51, 0, 0, 52, + 53, 0, 54, 55, 0, 56, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + -611, 0, 0, -611, -611, 0, 0, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 0, 0, 65, + 66, 67, 0, 15, 0, 16, 17, 18, 19, 0, + 0, -611, 0, -611, 20, 21, 22, 23, 24, 25, + 26, 0, 0, 27, 0, 0, 0, 0, 0, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 0, 40, 41, 42, 0, 0, 43, 0, 0, + 44, 45, 0, 46, 47, 48, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, + 0, 0, 0, 0, 0, 51, 0, 0, 52, 53, + 0, 54, 55, 0, 56, 0, 0, 0, 57, 0, + 58, 59, 60, 0, 61, 62, 63, 0, 64, 247, + 0, 0, 248, 249, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 0, 0, 65, 66, + 67, 0, 15, 0, 16, 17, 18, 19, 0, 0, + 250, 0, 251, 20, 21, 22, 23, 24, 25, 26, + 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 49, 50, 0, + 0, 0, 0, 0, 51, 0, 0, 52, 53, 0, + 54, 55, 0, 56, 0, 0, 0, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 247, 0, + 0, 248, 249, 0, 0, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 0, 0, 0, 65, 66, 67, + 0, 15, 0, 16, 17, 18, 19, 0, 0, 250, + 0, 251, 20, 21, 22, 23, 24, 25, 26, 0, + 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, + 40, 41, 42, 0, 0, 43, 0, 0, 44, 45, + 0, 46, 47, 48, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 49, 50, 0, 0, + 0, 0, 0, 211, 0, 0, 119, 53, 0, 54, + 55, 0, 0, 0, 0, 0, 57, 0, 58, 59, + 60, 0, 61, 62, 63, 0, 64, 247, 0, 0, + 248, 249, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 65, 66, 67, 0, + 15, 0, 108, 109, 18, 19, 0, 0, 250, 0, + 251, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 211, 0, 0, 119, 53, 0, 54, 55, + 0, 0, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 247, 0, 0, 248, + 249, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 65, 264, 67, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 250, 0, 251, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 0, 0, 0, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164, 0, 0, 0, + 0, 0, 165, 166, 167, 168, 169, 170, 171, 172, + 36, 37, 173, 39, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 174, 175, 176, + 177, 178, 179, 180, 181, 0, 0, 182, 183, 0, + 0, 0, 0, 184, 185, 186, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 189, 190, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 202, 0, 0, 0, 0, 0, 0, + 203, 204, -581, -581, -581, -581, -581, -581, -581, -581, + -581, 0, 0, 0, 0, 0, 0, 0, -581, 0, + -581, -581, -581, -581, 0, -581, 0, 0, 0, -581, + -581, -581, -581, -581, -581, -581, 0, 0, -581, 0, + 0, 0, 0, 0, 0, 0, 0, -581, -581, -581, + -581, -581, -581, -581, -581, -581, 0, -581, -581, -581, + 0, 0, -581, 0, 0, -581, -581, 0, -581, -581, + -581, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -581, -581, 0, 0, 0, 0, 0, + -581, 0, 0, -581, -581, 0, -581, -581, 0, -581, + 0, -581, -581, -581, 0, -581, -581, -581, 0, -581, + -581, -581, 0, -581, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -581, -581, -581, 0, -581, 0, 0, + 0, 0, 0, -581, -582, -582, -582, -582, -582, -582, + -582, -582, -582, 0, 0, 0, 0, 0, 0, 0, + -582, 0, -582, -582, -582, -582, 0, -582, 0, 0, + 0, -582, -582, -582, -582, -582, -582, -582, 0, 0, + -582, 0, 0, 0, 0, 0, 0, 0, 0, -582, + -582, -582, -582, -582, -582, -582, -582, -582, 0, -582, + -582, -582, 0, 0, -582, 0, 0, -582, -582, 0, + -582, -582, -582, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -582, -582, 0, 0, 0, + 0, 0, -582, 0, 0, -582, -582, 0, -582, -582, + 0, -582, 0, -582, -582, -582, 0, -582, -582, -582, + 0, -582, -582, -582, 0, -582, 0, 0, 0, 0, + 0, 0, -584, -584, -584, -584, -584, -584, -584, -584, + -584, 0, 0, 0, 0, -582, -582, -582, -584, -582, + -584, -584, -584, -584, 0, -582, 0, 0, 0, -584, + -584, -584, -584, -584, -584, -584, 0, 0, -584, 0, + 0, 0, 0, 0, 0, 0, 0, -584, -584, -584, + -584, -584, -584, -584, -584, -584, 0, -584, -584, -584, + 0, 0, -584, 0, 0, -584, -584, 0, -584, -584, + -584, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -584, -584, 0, 0, 0, 0, 0, + -584, 828, 0, -584, -584, 0, -584, -584, 0, -584, + 0, -584, -584, -584, 0, -584, -584, -584, 0, -584, + -584, -584, 0, -584, 0, 0, 0, 0, 0, 0, + -107, -585, -585, -585, -585, -585, -585, -585, -585, -585, + 0, 0, 0, -584, -584, -584, 0, -585, 0, -585, + -585, -585, -585, -584, 0, 0, 0, 0, -585, -585, + -585, -585, -585, -585, -585, 0, 0, -585, 0, 0, + 0, 0, 0, 0, 0, 0, -585, -585, -585, -585, + -585, -585, -585, -585, -585, 0, -585, -585, -585, 0, + 0, -585, 0, 0, -585, -585, 0, -585, -585, -585, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, -585, -585, 0, 0, 0, 0, 0, -585, + 829, 0, -585, -585, 0, -585, -585, 0, -585, 0, + -585, -585, -585, 0, -585, -585, -585, 0, -585, -585, + -585, 0, -585, 0, 0, 0, 0, 0, 0, -109, + -586, -586, -586, -586, -586, -586, -586, -586, -586, 0, + 0, 0, -585, -585, -585, 0, -586, 0, -586, -586, + -586, -586, -585, 0, 0, 0, 0, -586, -586, -586, + -586, -586, -586, -586, 0, 0, -586, 0, 0, 0, + 0, 0, 0, 0, 0, -586, -586, -586, -586, -586, + -586, -586, -586, -586, 0, -586, -586, -586, 0, 0, + -586, 0, 0, -586, -586, 0, -586, -586, -586, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, -586, -586, 0, 0, 0, 0, 0, -586, 0, + 0, -586, -586, 0, -586, -586, 0, -586, 0, -586, + -586, -586, 0, -586, -586, -586, 0, -586, -586, -586, + 0, -586, 0, 0, 0, 0, 0, 0, -587, -587, + -587, -587, -587, -587, -587, -587, -587, 0, 0, 0, + 0, -586, -586, -586, -587, 0, -587, -587, -587, -587, + 0, -586, 0, 0, 0, -587, -587, -587, -587, -587, + -587, -587, 0, 0, -587, 0, 0, 0, 0, 0, + 0, 0, 0, -587, -587, -587, -587, -587, -587, -587, + -587, -587, 0, -587, -587, -587, 0, 0, -587, 0, + 0, -587, -587, 0, -587, -587, -587, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -587, + -587, 0, 0, 0, 0, 0, -587, 0, 0, -587, + -587, 0, -587, -587, 0, -587, 0, -587, -587, -587, + 0, -587, -587, -587, 0, -587, -587, -587, 0, -587, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -587, + -587, -587, 0, 0, 0, 0, 0, 0, 0, -587, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 0, 0, 0, 155, 156, 157, + 233, 234, 235, 236, 162, 163, 164, 0, 0, 0, + 0, 0, 165, 166, 167, 237, 238, 239, 240, 172, + 320, 321, 241, 322, 0, 0, 0, 0, 0, 0, + 323, 0, 0, 0, 0, 0, 0, 174, 175, 176, + 177, 178, 179, 180, 181, 0, 0, 182, 183, 0, + 0, 0, 0, 184, 185, 186, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 189, 190, + 0, 0, 0, 0, 324, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 202, 0, 0, 0, 0, 0, 0, + 203, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 0, 0, 0, 155, 156, + 157, 233, 234, 235, 236, 162, 163, 164, 0, 0, + 0, 0, 0, 165, 166, 167, 237, 238, 239, 240, + 172, 320, 321, 241, 322, 0, 0, 0, 0, 0, + 0, 323, 0, 0, 0, 0, 0, 0, 174, 175, + 176, 177, 178, 179, 180, 181, 0, 0, 182, 183, + 0, 0, 0, 0, 184, 185, 186, 187, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 188, 189, + 190, 0, 0, 0, 0, 485, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 0, 201, 202, 0, 0, 0, 0, 0, + 0, 203, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 0, 0, 0, 155, + 156, 157, 233, 234, 235, 236, 162, 163, 164, 0, + 0, 0, 0, 0, 165, 166, 167, 237, 238, 239, + 240, 172, 0, 0, 241, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, + 175, 176, 177, 178, 179, 180, 181, 0, 0, 182, + 183, 0, 0, 0, 0, 184, 185, 186, 187, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 188, + 189, 190, 0, 0, 0, 242, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 202, 0, 0, 0, 0, + 0, 0, 203, 131, 132, 133, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 0, 0, 0, + 155, 156, 157, 233, 234, 235, 236, 162, 163, 164, + 0, 0, 0, 0, 0, 165, 166, 167, 237, 238, + 239, 240, 172, 0, 0, 241, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 174, 175, 176, 177, 178, 179, 180, 181, 0, 0, + 182, 183, 0, 0, 0, 0, 184, 185, 186, 187, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 188, 189, 190, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 0, 201, 202, 0, 0, 0, + 0, 0, 0, 203, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, + 15, 0, 108, 109, 18, 19, 0, 0, 0, 0, + 0, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 313, 0, 0, 119, 53, 0, 54, 55, + 0, 0, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 0, 0, 0, 15, 120, 108, 109, 18, 19, + 0, 0, 0, 314, 0, 110, 111, 112, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 313, 0, 0, 119, + 53, 0, 54, 55, 0, 0, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 0, 0, 0, 0, 0, 0, 15, 120, + 16, 17, 18, 19, 0, 0, 0, 606, 0, 20, + 21, 22, 23, 24, 25, 26, 0, 0, 27, 0, + 0, 0, 0, 0, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, + 51, 0, 0, 52, 53, 0, 54, 55, 0, 56, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 0, 0, 0, 65, 66, 67, 15, 0, 16, 17, + 18, 19, 0, 0, 0, 0, 0, 20, 21, 22, + 23, 24, 25, 26, 0, 0, 27, 0, 0, 0, + 0, 0, 28, 0, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 50, 0, 0, 0, 0, 0, 51, 0, + 0, 52, 53, 0, 54, 55, 0, 56, 0, 0, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 0, 0, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 65, 66, 67, 15, 0, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 260, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 211, 0, 0, 119, + 53, 0, 54, 55, 0, 261, 0, 262, 263, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 0, 0, 0, 0, 65, + 264, 67, 15, 0, 16, 17, 18, 19, 0, 0, + 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 32, 33, 260, 35, 36, 37, 38, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 49, 507, 0, + 0, 0, 0, 0, 211, 0, 0, 119, 53, 0, + 54, 55, 0, 261, 0, 262, 263, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 0, 0, + 0, 0, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 0, 65, 264, 67, + 15, 0, 108, 109, 18, 19, 0, 0, 0, 0, + 0, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 260, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 211, 0, 0, 119, 53, 0, 54, 55, + 0, 718, 0, 262, 263, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 0, 0, 0, 0, 65, 264, 67, 15, 0, + 108, 109, 18, 19, 0, 0, 0, 0, 0, 110, + 111, 112, 23, 24, 25, 26, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, + 260, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 846, 0, 0, 0, 0, 0, + 211, 0, 0, 119, 53, 0, 54, 55, 0, 718, + 0, 262, 263, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 65, 264, 67, 15, 0, 108, 109, + 18, 19, 0, 0, 0, 0, 0, 110, 111, 112, + 23, 24, 25, 26, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 260, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 50, 0, 0, 0, 0, 0, 211, 0, + 0, 119, 53, 0, 54, 55, 0, 261, 0, 262, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 0, 0, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 65, 264, 67, 15, 0, 108, 109, 18, 19, + 0, 0, 0, 0, 0, 110, 111, 112, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 260, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 211, 0, 0, 119, + 53, 0, 54, 55, 0, 0, 0, 262, 263, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 0, 0, 0, 0, 65, + 264, 67, 15, 0, 108, 109, 18, 19, 0, 0, + 0, 0, 0, 110, 111, 112, 23, 24, 25, 26, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 32, 33, 260, 35, 36, 37, 38, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 49, 50, 0, + 0, 0, 0, 0, 211, 0, 0, 119, 53, 0, + 54, 55, 0, 718, 0, 262, 0, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 0, 0, + 0, 0, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 0, 65, 264, 67, + 15, 0, 108, 109, 18, 19, 0, 0, 0, 0, + 0, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 260, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 211, 0, 0, 119, 53, 0, 54, 55, + 0, 0, 0, 262, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 0, 0, 0, 0, 65, 264, 67, 15, 0, + 16, 17, 18, 19, 0, 0, 0, 0, 0, 20, + 21, 22, 23, 24, 25, 26, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, + 211, 0, 0, 119, 53, 0, 54, 55, 0, 600, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 65, 264, 67, 15, 0, 108, 109, + 18, 19, 0, 0, 0, 0, 0, 110, 111, 112, + 23, 24, 25, 26, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 50, 0, 0, 0, 0, 0, 211, 0, + 0, 119, 53, 0, 54, 55, 0, 261, 0, 0, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 0, 0, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 65, 264, 67, 15, 0, 108, 109, 18, 19, + 0, 0, 0, 0, 0, 110, 111, 112, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 211, 0, 0, 119, + 53, 0, 54, 55, 0, 600, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 0, 0, 0, 0, 65, + 264, 67, 15, 0, 108, 109, 18, 19, 0, 0, + 0, 0, 0, 110, 111, 112, 23, 24, 25, 26, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 46, 47, 48, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 49, 50, 0, + 0, 0, 0, 0, 211, 0, 0, 119, 53, 0, + 54, 55, 0, 891, 0, 0, 0, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 0, 0, + 0, 0, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 0, 65, 264, 67, + 15, 0, 108, 109, 18, 19, 0, 0, 0, 0, + 0, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 46, 47, 48, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, + 0, 0, 211, 0, 0, 119, 53, 0, 54, 55, + 0, 718, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 0, 0, 0, 0, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 0, 0, 0, 0, 65, 264, 67, 15, 0, + 16, 17, 18, 19, 0, 0, 0, 0, 0, 20, + 21, 22, 23, 24, 25, 26, 0, 0, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 46, 47, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 49, 50, 0, 0, 0, 0, 0, + 211, 0, 0, 119, 53, 0, 54, 55, 0, 0, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 65, 66, 67, 15, 0, 108, 109, + 18, 19, 0, 0, 0, 0, 0, 110, 111, 112, + 23, 24, 25, 26, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 46, 47, 48, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 49, 50, 0, 0, 0, 0, 0, 211, 0, + 0, 119, 53, 0, 54, 55, 0, 0, 0, 0, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 0, 0, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 65, 264, 67, 15, 0, 16, 17, 18, 19, + 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 34, 35, 36, 37, + 38, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 46, 47, 48, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, + 50, 0, 0, 0, 0, 0, 211, 0, 0, 119, + 53, 0, 54, 55, 0, 0, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 0, 0, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 0, 0, 0, 0, 65, + 264, 67, 15, 0, 108, 109, 18, 19, 0, 0, + 0, 0, 0, 110, 111, 112, 23, 24, 25, 26, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 32, 33, 114, 35, 36, 37, 115, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 116, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 117, 0, 0, 118, 0, 0, 119, 53, 0, + 54, 55, 0, 0, 0, 0, 0, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 0, 0, 0, 15, 120, 108, 109, + 18, 19, 0, 0, 0, 0, 0, 110, 111, 112, + 23, 24, 25, 26, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 225, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 226, 0, + 0, 52, 53, 0, 54, 55, 0, 56, 0, 0, + 0, 57, 0, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, + 15, 120, 108, 109, 18, 19, 0, 0, 0, 0, + 0, 110, 111, 112, 23, 24, 25, 26, 0, 0, + 113, 0, 0, 0, 0, 0, 0, 0, 0, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 0, 40, + 41, 42, 0, 0, 43, 0, 0, 44, 45, 0, + 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 313, 0, 0, 398, 53, 0, 54, 55, + 0, 399, 0, 0, 0, 57, 0, 58, 59, 60, + 0, 61, 62, 63, 0, 64, 0, 0, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, + 0, 0, 0, 0, 15, 120, 108, 109, 18, 19, + 0, 0, 0, 0, 0, 110, 111, 112, 23, 24, + 25, 26, 0, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 31, 32, 33, 114, 35, 36, 37, + 115, 39, 0, 40, 41, 42, 0, 0, 43, 0, + 0, 44, 45, 0, 116, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 118, 0, 0, 119, + 53, 0, 54, 55, 0, 0, 0, 0, 0, 57, + 0, 58, 59, 60, 0, 61, 62, 63, 0, 64, + 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 0, 0, 0, 0, 0, 0, 0, 15, 120, + 108, 109, 18, 19, 0, 0, 0, 0, 0, 110, + 111, 112, 23, 24, 25, 26, 0, 0, 113, 0, + 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 0, 40, 41, 42, + 0, 0, 43, 0, 0, 44, 45, 0, 116, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 313, 0, 0, 398, 53, 0, 54, 55, 0, 0, + 0, 0, 0, 57, 0, 58, 59, 60, 0, 61, + 62, 63, 0, 64, 0, 0, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, + 0, 0, 15, 120, 108, 109, 18, 19, 0, 0, + 0, 0, 0, 110, 111, 112, 23, 24, 25, 26, + 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, + 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 0, 40, 41, 42, 0, 0, 43, 0, 0, 44, + 45, 0, 116, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 958, 0, 0, 119, 53, 0, + 54, 55, 0, 0, 0, 0, 0, 57, 0, 58, + 59, 60, 0, 61, 62, 63, 0, 64, 0, 0, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, + 0, 0, 0, 0, 0, 0, 15, 120, 108, 109, + 18, 19, 0, 0, 0, 0, 0, 110, 111, 112, + 23, 24, 25, 26, 0, 0, 113, 0, 0, 0, + 0, 0, 0, 0, 0, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 0, 40, 41, 42, 0, 0, + 43, 0, 0, 44, 45, 0, 225, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 981, 0, + 0, 119, 53, 0, 54, 55, 0, 0, 654, 655, + 0, 57, 656, 58, 59, 60, 0, 61, 62, 63, + 0, 64, 0, 0, 0, 0, 0, 174, 175, 176, + 177, 178, 179, 180, 181, 0, 0, 182, 183, 0, + 0, 120, 0, 184, 185, 186, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 189, 190, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 202, 675, 646, 0, 0, 676, 0, + 203, 275, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 174, 175, 176, 177, 178, 179, 180, + 181, 0, 0, 182, 183, 0, 0, 0, 0, 184, + 185, 186, 187, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 188, 189, 190, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 202, + 660, 655, 0, 0, 661, 0, 203, 275, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, + 175, 176, 177, 178, 179, 180, 181, 0, 0, 182, + 183, 0, 0, 0, 0, 184, 185, 186, 187, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 188, + 189, 190, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 202, 692, 646, 0, 0, + 693, 0, 203, 275, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 174, 175, 176, 177, 178, + 179, 180, 181, 0, 0, 182, 183, 0, 0, 0, + 0, 184, 185, 186, 187, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 188, 189, 190, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 202, 695, 655, 0, 0, 696, 0, 203, 275, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 174, 175, 176, 177, 178, 179, 180, 181, 0, + 0, 182, 183, 0, 0, 0, 0, 184, 185, 186, + 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 188, 189, 190, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 202, 702, 646, + 0, 0, 703, 0, 203, 275, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 174, 175, 176, + 177, 178, 179, 180, 181, 0, 0, 182, 183, 0, + 0, 0, 0, 184, 185, 186, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 189, 190, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 202, 705, 655, 0, 0, 706, 0, + 203, 275, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 174, 175, 176, 177, 178, 179, 180, + 181, 0, 0, 182, 183, 0, 0, 0, 0, 184, + 185, 186, 187, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 188, 189, 190, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 202, + 741, 646, 0, 0, 742, 0, 203, 275, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, + 175, 176, 177, 178, 179, 180, 181, 0, 0, 182, + 183, 0, 0, 0, 0, 184, 185, 186, 187, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 188, + 189, 190, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 202, 744, 655, 0, 0, + 745, 0, 203, 275, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 174, 175, 176, 177, 178, + 179, 180, 181, 0, 0, 182, 183, 0, 0, 0, + 0, 184, 185, 186, 187, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 188, 189, 190, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 202, 896, 646, 0, 0, 897, 0, 203, 275, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 174, 175, 176, 177, 178, 179, 180, 181, 0, + 0, 182, 183, 0, 0, 0, 0, 184, 185, 186, + 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 188, 189, 190, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 202, 899, 655, + 0, 0, 900, 0, 203, 275, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 174, 175, 176, + 177, 178, 179, 180, 181, 0, 0, 182, 183, 0, + 0, 0, 0, 184, 185, 186, 187, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 188, 189, 190, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 202, 1040, 646, 0, 0, 1041, 0, + 203, 275, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 174, 175, 176, 177, 178, 179, 180, + 181, 0, 0, 182, 183, 0, 0, 0, 0, 184, + 185, 186, 187, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 188, 189, 190, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 202, + 1052, 646, 0, 0, 1053, 0, 203, 275, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, + 175, 176, 177, 178, 179, 180, 181, 0, 0, 182, + 183, 0, 0, 0, 0, 184, 185, 186, 187, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 188, + 189, 190, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 202, 1055, 655, 0, 0, + 1056, 0, 203, 275, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 174, 175, 176, 177, 178, + 179, 180, 181, 0, 0, 182, 183, 0, 0, 0, + 0, 184, 185, 186, 187, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 188, 189, 190, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 202, 660, 655, 0, 0, 661, 0, 203, 275, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 174, 175, 176, 177, 178, 179, 180, 181, 0, + 0, 182, 183, 0, 0, 0, 0, 184, 185, 186, + 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 188, 189, 190, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 791, 0, 0, + 0, 0, 0, 0, 0, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 202, 0, 0, + 0, 0, 0, 0, 203, 402, 403, 404, 405, 406, + 407, 408, 409, 410, 411, 412, 413, 0, 0, 0, + 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 417, 0, 0, 0, 0, 864, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 418, 0, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 0, + 0, 0, 0, 414, 415, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 417, 0, 0, 0, + 0, 876, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 418, 0, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 402, + 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, + 413, 0, 0, 0, 0, 414, 415, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 417, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 418, + 0, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 402, 403, 404, 405, 406, 407, 408, 409, 410, + 411, 412, 413, 0, 0, 0, 0, 414, 415, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 417, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 418, 0, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 402, 403, 404, 405, 406, 407, 408, + 409, 410, 411, 412, 413, 0, 0, 251, 0, 414, + 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 417, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 418, 0, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 0, 0, 0, 0, 0, + 0, 0, 0, -277, 402, 403, 404, 405, 406, 407, + 408, 409, 410, 411, 412, 413, 0, 0, 0, 0, + 414, 415, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 417, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 418, 0, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 0, 0, 0, 0, + 0, 0, 0, 0, -278, 402, 403, 404, 405, 406, + 407, 408, 409, 410, 411, 412, 413, 0, 0, 0, + 0, 414, 415, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 417, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 418, 0, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 0, 0, 0, + 0, 0, 0, 0, 0, -279, 402, 403, 404, 405, + 406, 407, 408, 409, 410, 411, 412, 413, 0, 0, + 0, 0, 414, 415, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 417, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 418, 0, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 0, 0, + 0, 0, 0, 0, 0, 0, -280, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 0, + 0, 0, 0, 414, 415, 0, 0, 0, 416, 0, + 0, 0, 0, 0, 0, 0, 417, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 418, 0, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 402, + 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, + 413, 0, 0, 0, 0, 414, 415, 0, 0, 0, + 499, 0, 0, 0, 0, 0, 0, 0, 417, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 418, + 0, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 402, 403, 404, 405, 406, 407, 408, 409, 410, + 411, 412, 413, 0, 0, 0, 0, 414, 415, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 417, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 418, 0, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 402, 403, 404, 405, 406, 407, 408, + 409, 410, 411, -612, -612, 0, 0, 0, 0, 414, + 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 417, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428 +}; + +static const yytype_int16 yycheck[] = +{ + 2, 27, 27, 16, 17, 87, 88, 20, 89, 222, + 2, 10, 4, 5, 6, 271, 15, 9, 10, 21, + 377, 13, 82, 15, 16, 17, 7, 14, 20, 314, + 488, 28, 2, 14, 4, 588, 66, 5, 6, 22, + 118, 28, 16, 17, 479, 13, 20, 28, 4, 591, + 7, 331, 54, 55, 431, 16, 17, 15, 307, 20, + 52, 754, 311, 401, 56, 780, 60, 61, 62, 63, + 588, 56, 74, 75, 66, 52, 296, 58, 69, 456, + 54, 55, 16, 17, 686, 16, 20, 502, 56, 75, + 82, 506, 25, 54, 544, 697, 473, 663, 664, 75, + 494, 58, 21, 22, 941, 482, 29, 506, 26, 111, + 26, 69, 25, 319, 82, 103, 25, 966, 57, 25, + 54, 55, 105, 25, 0, 117, 92, 119, 25, 25, + 16, 17, 25, 57, 20, 588, 218, 536, 591, 90, + 128, 594, 79, 799, 58, 59, 122, 229, 90, 805, + 90, 372, 37, 38, 52, 121, 606, 91, 269, 121, + 271, 55, 90, 369, 659, 105, 18, 662, 20, 546, + 9, 10, 393, 90, 332, 138, 15, 335, 398, 337, + 142, 339, 121, 341, 115, 680, 105, 118, 119, 126, + 113, 121, 111, 112, 1043, 306, 147, 1034, 51, 123, + 53, 54, 55, 56, 28, 147, 759, 147, 290, 142, + 129, 213, 214, 142, 494, 146, 69, 148, 210, 147, + 138, 119, 138, 90, 223, 224, 144, 213, 214, 142, + 147, 223, 224, 142, 316, 144, 142, 458, 214, 121, + 142, 759, 144, 92, 810, 142, 142, 92, 963, 142, + 92, 966, 90, 946, 314, 511, 429, 92, 142, 544, + 433, 242, 275, 436, 148, 16, 279, 269, 125, 271, + 441, 442, 121, 275, 554, 144, 121, 90, 117, 121, + 147, 144, 90, 275, 457, 242, 90, 279, 55, 142, + 121, 283, 284, 215, 252, 92, 288, 105, 90, 472, + 222, 474, 55, 295, 296, 279, 759, 298, 861, 147, + 483, 303, 727, 728, 275, 306, 307, 870, 279, 296, + 311, 606, 314, 717, 866, 295, 58, 59, 1043, 728, + 324, 90, 140, 303, 147, 937, 144, 259, 788, 147, + 298, 275, 548, 147, 144, 279, 314, 685, 148, 522, + 349, 350, 351, 352, 25, 147, 348, 349, 350, 351, + 352, 353, 354, 355, 115, 51, 396, 118, 119, 55, + 142, 401, 20, 375, 547, 377, 92, 455, 348, 142, + 372, 57, 401, 353, 223, 224, 801, 101, 147, 138, + 288, 142, 348, 279, 552, 146, 51, 148, 296, 510, + 511, 393, 837, 92, 396, 121, 398, 399, 765, 401, + 963, 441, 442, 866, 399, 868, 793, 870, 431, 872, + 145, 398, 441, 442, 121, 60, 348, 139, 63, 431, + 92, 399, 121, 141, 714, 396, 55, 717, 142, 431, + 401, 92, 101, 456, 283, 284, 101, 102, 103, 441, + 442, 101, 433, 674, 456, 436, 101, 379, 121, 121, + 473, 121, 464, 142, 456, 721, 458, 459, 51, 482, + 121, 473, 107, 128, 500, 500, 457, 469, 92, 937, + 482, 473, 542, 1036, 544, 477, 131, 132, 133, 738, + 482, 142, 603, 474, 1047, 487, 142, 431, 588, 712, + 398, 591, 483, 788, 17, 18, 92, 121, 510, 511, + 349, 350, 351, 352, 433, 354, 355, 519, 92, 878, + 879, 518, 456, 51, 939, 882, 883, 519, 502, 142, + 491, 518, 26, 546, 616, 121, 528, 518, 457, 473, + 939, 522, 653, 142, 546, 142, 606, 121, 482, 519, + 542, 509, 544, 1006, 546, 474, 478, 479, 528, 533, + 781, 553, 51, 843, 483, 578, 547, 90, 502, 16, + 121, 469, 506, 90, 542, 386, 544, 388, 92, 477, + 121, 122, 105, 142, 597, 51, 578, 808, 105, 487, + 99, 847, 15, 92, 13, 121, 90, 599, 16, 533, + 121, 712, 536, 522, 63, 597, 528, 121, 634, 634, + 721, 105, 546, 535, 606, 15, 145, 140, 145, 792, + 459, 794, 121, 140, 147, 796, 142, 2, 547, 4, + 147, 802, 803, 854, 9, 10, 92, 139, 606, 142, + 15, 16, 17, 142, 138, 20, 140, 15, 44, 369, + 144, 653, 1029, 147, 142, 553, 92, 659, 1015, 15, + 662, 663, 664, 121, 141, 121, 27, 650, 115, 759, + 141, 118, 119, 15, 673, 18, 659, 52, 680, 662, + 92, 673, 674, 685, 686, 121, 142, 141, 690, 90, + 780, 66, 581, 581, 139, 697, 585, 141, 919, 146, + 15, 148, 683, 141, 105, 92, 142, 139, 707, 121, + 923, 708, 139, 148, 142, 707, 929, 44, 90, 721, + 746, 708, 57, 44, 685, 806, 683, 708, 788, 142, + 142, 650, 142, 105, 121, 142, 847, 908, 142, 140, + 659, 15, 117, 662, 119, 93, 147, 738, 115, 90, + 672, 118, 119, 727, 115, 142, 14, 118, 119, 678, + 790, 680, 15, 765, 105, 15, 796, 797, 140, 145, + 15, 790, 802, 803, 15, 147, 866, 796, 145, 146, + 793, 148, 26, 802, 803, 146, 146, 148, 142, 781, + 712, 793, 142, 727, 728, 142, 788, 789, 790, 140, + 15, 793, 142, 142, 796, 797, 147, 141, 810, 139, + 802, 803, 15, 794, 15, 139, 808, 809, 820, 789, + 788, 823, 90, 142, 126, 300, 825, 801, 61, 304, + 822, 64, 65, 825, 673, 210, 115, 105, 126, 118, + 119, 55, 834, 835, 139, 847, 90, 15, 223, 224, + 842, 55, 878, 879, 574, 142, 142, 1030, 142, 793, + 142, 105, 854, 855, 142, 142, 115, 801, 707, 118, + 119, 591, 140, 963, 594, 794, 966, 144, 908, 147, + 882, 883, 16, 116, 117, 15, 141, 144, 880, 908, + 812, 780, 780, 885, 138, 142, 140, 146, 519, 148, + 275, 983, 13, 147, 279, 441, 442, 6, 283, 284, + 1032, 809, 880, 288, 780, 837, 908, 885, 1034, 1031, + 295, 296, 37, 38, 822, 254, 918, 919, 303, 115, + 922, 7, 118, 119, 926, 937, 834, 835, 581, 475, + 476, 90, 807, 780, 842, 51, 960, 53, 54, 55, + 56, 963, 90, 1043, 922, -1, 105, 855, 769, 770, + 771, 270, 773, 69, 775, -1, -1, 105, -1, -1, + 996, 996, -1, 348, 349, 350, 351, 352, 353, 354, + 355, 115, -1, -1, 118, 119, 825, 523, 887, 888, + -1, 140, -1, -1, 986, 90, 988, 372, 147, 991, + 115, 923, 140, 118, 119, 939, -1, 929, -1, 147, + 105, -1, 146, 1015, 148, -1, 1029, -1, 393, 90, + 918, 396, -1, 398, -1, -1, 401, 1029, 926, 1031, + 1032, 146, 507, 148, 105, -1, 142, 1029, -1, 514, + -1, -1, 90, -1, -1, 140, 90, 90, -1, 1030, + 525, 62, 147, 64, 65, -1, 431, 105, 90, -1, + 780, 105, 105, -1, 963, -1, 441, 442, -1, 140, + 26, 960, 960, 105, 963, 963, 147, 966, 966, 968, + 968, 456, 61, 458, 459, 64, 65, -1, 986, -1, + 988, -1, 140, 991, 469, 1029, 140, 140, 473, 147, + 575, 576, 477, 147, 147, 116, 117, 482, 140, -1, + -1, 1030, 487, -1, 62, 147, 64, 65, -1, -1, + 1019, 1020, 1021, 960, 1023, 1024, 963, 1016, 1016, 966, + 605, 968, -1, -1, 90, 26, -1, 116, 117, 950, + 951, 952, 953, -1, 519, -1, 866, -1, 868, 105, + -1, -1, 872, 528, 1043, 1043, 1045, 1045, 1047, 1047, + 1049, 1049, -1, -1, 1063, 1064, 1065, 1066, 116, 117, + -1, 546, 115, -1, 1073, 118, 119, -1, 553, 1016, + 1069, 1069, 138, -1, 140, -1, -1, -1, 144, -1, + -1, 147, -1, 26, 26, -1, -1, -1, -1, 90, + -1, -1, -1, 578, -1, 148, 1043, 682, 1045, -1, + 1047, -1, 1049, -1, 105, -1, 51, -1, 53, 54, + 55, 56, 597, -1, 944, 945, -1, -1, 1039, -1, + 9, 10, 1069, -1, 69, -1, 15, 16, 17, -1, + -1, 20, -1, -1, -1, -1, 966, 138, 968, 140, + 63, 64, 65, 144, -1, -1, 147, 90, 90, 94, + 796, 797, 737, -1, -1, 100, 802, 803, 47, 48, + 49, 50, 105, 105, -1, 54, 55, 63, 64, 65, + 755, -1, -1, 1003, -1, -1, 1006, 66, 67, -1, + -1, -1, 828, 829, -1, 831, 832, -1, 673, 674, + 63, 64, 65, 116, 117, 138, 138, 140, 140, -1, + -1, 144, 144, -1, 147, 147, -1, 51, 1038, 53, + 54, 55, 56, 1043, -1, 1045, -1, -1, -1, 1049, + 116, 117, 707, 101, -1, 69, -1, -1, 117, 51, + -1, 53, 54, 55, 56, 63, 64, 65, -1, 1069, + 63, 64, 65, 116, 117, -1, -1, 69, -1, -1, + 94, 129, 130, 131, 132, 133, 100, 101, 102, 103, + -1, 846, 908, -1, -1, 2, -1, 4, 5, 6, + -1, -1, 94, 63, 64, 65, 13, 862, 100, 101, + 102, 103, -1, -1, 128, 931, -1, 131, 116, 117, + 63, 64, 65, 116, 117, -1, 781, -1, -1, 121, + 144, 63, 64, 65, 789, 790, 128, -1, 793, 131, + -1, 796, 797, -1, -1, 52, -1, 802, 803, 56, + -1, -1, 144, 808, 809, -1, 116, 117, 51, -1, + 53, 54, 55, 56, 223, 224, -1, 822, -1, -1, + 825, -1, -1, 116, 117, 82, 69, -1, -1, 834, + 835, -1, -1, -1, 116, 117, 115, 842, -1, 118, + 119, -1, -1, 51, -1, 53, 54, 55, 56, 854, + 855, 94, 261, 262, 263, 264, -1, 100, 101, 102, + 103, 69, 119, 142, -1, -1, 275, 146, -1, 148, + 279, -1, -1, -1, 283, 284, -1, -1, -1, 51, + -1, 53, 54, 55, 56, 128, 94, -1, 131, -1, + -1, -1, 100, 101, 102, 103, -1, 69, -1, -1, + -1, 144, -1, 908, -1, -1, 51, -1, 53, 54, + 55, 56, -1, 918, 919, 40, 41, 42, 43, 44, + 128, 926, 94, 131, 69, 88, 89, -1, 100, 101, + 102, 103, -1, -1, 142, 88, 89, -1, 101, -1, + 349, 350, 351, 352, -1, 354, 355, -1, 101, 94, + -1, -1, -1, 210, -1, 100, 128, -1, -1, 131, + -1, -1, -1, -1, 373, 128, 129, 130, 131, 132, + 133, -1, -1, -1, -1, 384, 129, 130, 131, 132, + 133, 986, -1, 988, -1, -1, 991, 396, -1, -1, + -1, -1, 401, 402, 403, 404, 405, 406, 407, 408, + 409, 410, 411, 412, 413, 414, 415, -1, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + -1, -1, 431, -1, 1029, 51, -1, 53, 54, 55, + 56, 288, 441, 442, -1, -1, -1, -1, 295, 296, + -1, -1, -1, 69, -1, -1, 303, 456, -1, -1, + 459, 51, -1, 53, 54, 55, 56, 314, -1, 85, + -1, -1, 471, -1, 473, -1, 475, 476, 94, 69, + -1, -1, -1, 482, 100, 101, 102, 103, -1, -1, + -1, -1, 491, -1, -1, -1, 495, -1, -1, -1, + 499, 348, -1, 502, 94, 504, 353, 506, 507, -1, + -1, -1, 128, -1, 51, 131, 53, 54, 55, 56, + -1, -1, -1, -1, 523, 372, -1, 2, -1, 4, + 5, 6, 69, -1, 533, -1, -1, 536, 13, 51, + -1, 53, 54, 55, 56, -1, 393, 546, -1, -1, + -1, 398, 399, -1, 401, -1, -1, 69, -1, -1, + -1, -1, -1, 562, 563, -1, -1, -1, -1, -1, + -1, -1, -1, 85, -1, -1, -1, 52, -1, 578, + -1, 56, 94, -1, -1, -1, -1, -1, 100, 101, + 102, 103, -1, -1, 441, 442, -1, -1, 597, -1, + 51, 600, 53, 54, 55, 56, -1, 82, -1, -1, + -1, 458, -1, -1, -1, -1, 128, -1, 69, 131, + 88, 89, 469, -1, -1, -1, -1, -1, -1, -1, + 477, -1, -1, 101, -1, -1, -1, -1, -1, -1, + 487, -1, -1, 94, 119, -1, -1, -1, -1, -1, + 101, 102, 103, -1, -1, -1, -1, -1, 126, 127, + 128, 129, 130, 131, 132, 133, -1, -1, -1, -1, + -1, -1, 519, -1, 673, -1, -1, 128, -1, -1, + -1, 528, -1, -1, -1, -1, 685, -1, -1, 688, + 689, -1, -1, -1, -1, 542, -1, 544, -1, -1, + -1, -1, -1, -1, -1, -1, 553, -1, 707, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 718, + -1, -1, -1, -1, -1, -1, -1, -1, 727, 728, + -1, -1, -1, -1, -1, 210, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 606, + -1, -1, -1, -1, -1, 2, -1, 4, 5, 6, + -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 785, -1, -1, -1, + -1, 790, 791, -1, 793, -1, -1, 796, 797, -1, + -1, -1, 801, 802, 803, -1, -1, -1, -1, -1, + -1, -1, -1, 288, -1, 52, -1, -1, -1, 56, + 295, 296, -1, -1, -1, -1, 825, 674, 303, 828, + 829, -1, 831, 832, -1, -1, -1, -1, -1, 314, + -1, -1, 841, -1, -1, 82, -1, 846, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 863, 864, -1, -1, -1, -1, + -1, -1, -1, 348, -1, -1, 875, 876, 353, -1, + -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 891, -1, -1, -1, -1, 372, -1, -1, + -1, -1, 901, 902, -1, -1, -1, -1, -1, 908, + -1, -1, -1, -1, -1, -1, -1, -1, 393, -1, + -1, -1, -1, 398, 399, -1, 401, -1, -1, -1, + -1, -1, 931, -1, 781, -1, -1, -1, -1, -1, + 939, 788, 789, 790, -1, -1, -1, -1, -1, 796, + -1, -1, -1, -1, -1, 802, 803, -1, -1, -1, + -1, 808, 809, -1, -1, -1, 441, 442, -1, -1, + -1, -1, -1, 210, -1, 822, -1, -1, -1, -1, + -1, -1, -1, 458, -1, -1, -1, 834, 835, -1, + -1, -1, -1, -1, 469, 842, -1, -1, -1, -1, + -1, -1, 477, -1, -1, -1, -1, 854, 855, -1, + -1, -1, 487, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 1029, -1, -1, 880, -1, -1, -1, -1, 885, -1, + -1, -1, -1, 2, 519, 4, -1, -1, -1, -1, + -1, 288, -1, 528, 13, -1, -1, -1, 295, 296, + -1, 908, -1, -1, -1, -1, 303, 542, -1, 544, + -1, 918, 919, -1, -1, 922, -1, 314, 553, 926, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 0, 348, -1, -1, -1, -1, 353, -1, -1, -1, + -1, -1, -1, 13, 14, 15, 16, 17, 18, -1, + 20, 606, -1, -1, -1, 372, 26, 27, -1, 986, + -1, 988, -1, -1, 991, -1, -1, 37, 38, -1, + 40, 41, 42, 43, 44, -1, 393, -1, -1, -1, + 119, 398, 399, -1, 401, -1, 2, -1, 4, 5, + 6, 7, -1, -1, -1, -1, -1, 13, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 674, + 90, -1, -1, -1, 441, 442, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 105, 52, -1, -1, -1, + 56, 458, -1, -1, -1, 115, -1, -1, 118, 119, + -1, -1, 469, -1, -1, -1, -1, -1, -1, -1, + 477, -1, -1, -1, -1, -1, 82, -1, 138, 139, + 487, 210, -1, -1, 144, 145, 146, 147, 148, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 519, 119, -1, -1, -1, -1, -1, -1, + -1, 528, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 542, 781, 544, -1, -1, + -1, -1, -1, 788, 789, 790, 553, -1, -1, -1, + -1, 796, -1, -1, -1, -1, -1, 802, 803, 288, + -1, -1, -1, 808, 809, -1, 295, 296, -1, -1, + -1, -1, -1, -1, 303, -1, -1, 822, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 834, + 835, -1, -1, -1, -1, -1, -1, 842, -1, 606, + -1, -1, -1, -1, 210, -1, -1, -1, -1, 854, + 855, -1, -1, -1, -1, -1, -1, -1, -1, 348, + -1, -1, -1, -1, 353, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 880, -1, -1, -1, -1, + 885, -1, -1, 372, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 2, -1, 4, 908, 393, -1, -1, 674, -1, 398, + -1, -1, 401, 918, 919, -1, -1, 922, -1, -1, + -1, 926, 288, -1, -1, -1, -1, -1, -1, 295, + 296, -1, -1, -1, -1, -1, -1, 303, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, + 52, -1, 441, 442, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 458, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 469, 986, 348, 988, -1, -1, 991, 353, 477, -1, + -1, 72, 73, 74, 75, 76, 77, 78, 487, 80, + 81, -1, -1, -1, -1, -1, 372, 88, 89, -1, + -1, -1, -1, -1, 781, -1, -1, 119, -1, -1, + 101, 788, 789, 790, -1, -1, -1, 393, -1, 796, + 519, -1, 398, 399, -1, 802, 803, -1, -1, 528, + -1, 808, 809, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, -1, 822, -1, -1, -1, -1, + -1, -1, -1, -1, 553, -1, -1, 834, 835, -1, + -1, -1, -1, -1, -1, 842, -1, 72, 73, 74, + 75, 76, 77, -1, -1, 80, 81, 854, 855, -1, + -1, -1, 458, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, 469, -1, -1, 101, -1, 210, -1, + -1, 477, -1, 880, -1, -1, -1, -1, 885, -1, + -1, 487, -1, -1, -1, -1, -1, -1, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + -1, 908, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 918, 919, 519, -1, 922, -1, -1, -1, 926, + -1, -1, 528, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 542, -1, 544, -1, + -1, -1, -1, -1, -1, 674, 288, 553, -1, -1, + -1, -1, -1, 295, 296, -1, -1, 44, -1, -1, + -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 986, + -1, 988, -1, -1, 991, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, + 606, 88, 89, -1, -1, -1, 348, -1, -1, -1, + -1, 353, -1, -1, 101, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 372, -1, -1, -1, -1, 122, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, -1, -1, + -1, 393, 781, -1, -1, 142, 398, -1, -1, 401, + 789, 790, -1, -1, -1, -1, -1, 796, 674, -1, + -1, -1, -1, 802, 803, -1, -1, -1, -1, 808, + 809, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 822, -1, -1, -1, -1, -1, 441, + 442, -1, -1, -1, -1, 834, 835, -1, -1, -1, + -1, -1, -1, 842, -1, -1, 458, -1, -1, -1, + -1, -1, -1, -1, -1, 854, 855, 469, -1, -1, + -1, -1, -1, -1, -1, 477, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 487, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 781, -1, 519, -1, 908, + -1, -1, 788, 789, -1, -1, 528, -1, -1, 918, + 919, -1, -1, 922, -1, -1, -1, 926, -1, -1, + -1, -1, 808, 809, -1, -1, -1, -1, -1, -1, + -1, 553, -1, -1, -1, -1, 822, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 834, 835, + -1, -1, -1, -1, -1, -1, 842, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 854, 855, + -1, -1, -1, -1, -1, -1, -1, 986, -1, 988, + -1, -1, 991, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 880, -1, -1, -1, -1, 885, + -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 13, 14, + 15, -1, 17, 18, -1, 20, -1, -1, -1, -1, + -1, 26, 918, 919, -1, -1, 922, -1, -1, -1, + 926, -1, 37, 38, -1, 40, 41, 42, 43, 44, + -1, -1, 674, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, -1, -1, 88, 89, 90, -1, 92, 93, -1, + 986, -1, 988, -1, -1, 991, 101, -1, -1, -1, + 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, 119, -1, 121, 122, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + -1, -1, -1, 138, 139, 140, -1, 142, -1, -1, + 145, 146, 147, 148, -1, -1, -1, -1, -1, 781, + -1, -1, -1, -1, -1, -1, -1, 789, 790, -1, + -1, -1, 51, 52, 796, -1, 55, -1, -1, -1, + 802, 803, -1, -1, -1, -1, 808, 809, -1, -1, + -1, 70, 71, 72, 73, 74, 75, 76, 77, -1, + 822, 80, 81, -1, -1, -1, -1, 86, 87, 88, + 89, -1, 834, 835, -1, -1, -1, -1, -1, -1, + 842, 100, 101, 102, -1, -1, -1, -1, -1, -1, + -1, -1, 854, 855, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, 135, 136, 72, 73, + 74, 75, 76, 77, 143, 144, 80, 81, -1, -1, + -1, -1, -1, -1, 88, 89, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 908, 101, -1, -1, + -1, -1, -1, -1, -1, -1, 918, 919, -1, -1, + -1, -1, -1, -1, 926, -1, -1, -1, -1, -1, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + -1, -1, -1, -1, -1, -1, 0, 1, -1, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, + -1, -1, -1, -1, -1, 19, -1, 21, 22, 23, + 24, -1, -1, -1, -1, -1, 30, 31, 32, 33, + 34, 35, 36, -1, 986, 39, 988, -1, -1, 991, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, -1, 58, 59, 60, -1, -1, 63, + -1, -1, 66, 67, -1, 69, 70, 71, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 84, 85, -1, -1, -1, -1, -1, 91, -1, -1, + 94, 95, -1, 97, 98, -1, 100, -1, -1, -1, + 104, -1, 106, 107, 108, -1, 110, 111, 112, 0, + 114, 115, -1, -1, 118, 119, -1, -1, -1, -1, + -1, -1, 13, 14, 15, 16, 17, 18, -1, 20, + 134, 135, 136, -1, -1, -1, 27, 28, 29, -1, + -1, -1, 146, -1, 148, -1, 37, 38, -1, 40, + 41, 42, 43, 44, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, -1, -1, 88, 89, 90, + -1, -1, 93, -1, -1, -1, -1, -1, 99, -1, + 101, -1, -1, -1, 105, -1, -1, -1, -1, -1, + -1, -1, 113, -1, 115, -1, -1, 118, 119, -1, + -1, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, -1, 0, -1, -1, 139, 140, + 141, 142, -1, -1, 145, 146, 147, 148, 13, 14, + 15, 16, 17, 18, -1, 20, -1, -1, -1, -1, + -1, 26, 27, 28, -1, -1, -1, -1, -1, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, -1, -1, 88, 89, 90, -1, -1, 93, -1, + -1, -1, -1, -1, 99, -1, 101, -1, -1, -1, + 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, 119, -1, -1, 122, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + -1, 0, -1, 138, 139, 140, 141, 142, -1, 144, + 145, 146, 147, 148, 13, 14, 15, 16, 17, 18, + -1, 20, -1, -1, -1, -1, -1, -1, 27, 28, + -1, -1, -1, -1, -1, -1, -1, -1, 37, 38, + -1, 40, 41, 42, 43, 44, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 57, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, -1, -1, -1, -1, 88, + 89, 90, -1, 92, 93, -1, -1, -1, -1, -1, + 99, -1, 101, -1, -1, -1, 105, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, + 119, -1, 121, 122, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, -1, 0, -1, -1, + 139, 140, 141, 142, -1, -1, 145, 146, 147, 148, + 13, 14, 15, 16, 17, 18, -1, 20, -1, -1, + -1, -1, -1, 26, 27, 28, -1, -1, -1, -1, + -1, -1, -1, -1, 37, 38, -1, 40, 41, 42, + 43, 44, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, -1, -1, -1, -1, 88, 89, 90, -1, -1, + 93, -1, -1, -1, -1, -1, 99, -1, 101, -1, + -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 115, -1, -1, 118, 119, -1, -1, 122, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, -1, 0, -1, 138, 139, 140, 141, 142, + -1, 144, 145, 146, 147, 148, 13, 14, 15, 16, + 17, 18, -1, 20, -1, -1, -1, -1, -1, -1, + 27, 28, -1, -1, -1, -1, -1, -1, -1, -1, + 37, 38, -1, 40, 41, 42, 43, 44, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, + -1, 88, 89, 90, -1, -1, 93, -1, -1, -1, + -1, -1, 99, -1, 101, -1, -1, -1, 105, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, + -1, 118, 119, -1, -1, 122, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, -1, 0, + -1, -1, 139, 140, 141, 142, -1, 144, 145, 146, + 147, 148, 13, 14, 15, -1, 17, 18, -1, 20, + -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 37, 38, -1, 40, + 41, 42, 43, 44, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, -1, -1, 88, 89, 90, + -1, 92, 93, -1, -1, -1, -1, -1, -1, -1, + 101, -1, -1, -1, 105, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 115, -1, -1, 118, 119, -1, + 121, 122, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, -1, 0, -1, 138, 139, 140, + -1, 142, -1, -1, 145, 146, 147, 148, 13, 14, + 15, -1, 17, 18, -1, 20, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, 38, -1, 40, 41, 42, 43, 44, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, -1, -1, 88, 89, 90, -1, 92, 93, -1, + -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, + 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, 119, -1, 121, 122, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + -1, 0, -1, -1, 139, 140, -1, 142, -1, -1, + 145, 146, 147, 148, 13, 14, 15, -1, 17, 18, + -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 37, 38, + -1, 40, 41, 42, 43, 44, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, -1, -1, -1, -1, 88, + 89, 90, -1, 92, 93, -1, -1, -1, -1, -1, + -1, -1, 101, -1, -1, -1, 105, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, + 119, -1, 121, 122, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, -1, -1, -1, -1, + 139, 140, -1, 142, -1, -1, 145, 146, 147, 148, + 1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, -1, -1, 18, 19, -1, + 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, 45, -1, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, 115, -1, -1, 118, 119, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 134, 135, 136, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 146, 1, 148, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, + 15, -1, 17, 18, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, 100, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + 115, -1, -1, 118, 119, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, + 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 146, 1, 148, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, -1, -1, 15, -1, -1, 18, + 19, 20, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, 45, -1, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, 115, -1, -1, 118, + 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 134, 135, 136, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 146, 1, 148, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + -1, -1, 15, -1, -1, 18, 19, -1, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, 45, -1, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, -1, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, 115, -1, -1, 118, 119, 1, -1, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, -1, + -1, 134, 135, 136, -1, 19, -1, 21, 22, 23, + 24, -1, -1, 146, -1, 148, 30, 31, 32, 33, + 34, 35, 36, -1, -1, 39, -1, -1, -1, -1, + -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, + 54, 55, 56, -1, 58, 59, 60, -1, -1, 63, + -1, -1, 66, 67, -1, 69, 70, 71, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 84, 85, -1, -1, -1, -1, -1, 91, -1, -1, + 94, 95, -1, 97, 98, -1, 100, -1, -1, -1, + 104, -1, 106, 107, 108, -1, 110, 111, 112, -1, + 114, 115, -1, -1, 118, 119, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 134, 135, 136, -1, -1, 139, -1, -1, -1, -1, + -1, -1, 146, 1, 148, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, -1, 14, 15, -1, -1, + -1, 19, -1, 21, 22, 23, 24, -1, -1, -1, + -1, -1, 30, 31, 32, 33, 34, 35, 36, -1, + -1, 39, -1, -1, -1, -1, -1, 45, -1, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, + 58, 59, 60, -1, -1, 63, -1, -1, 66, 67, + -1, 69, 70, 71, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 84, 85, -1, -1, + -1, -1, -1, 91, -1, -1, 94, 95, -1, 97, + 98, -1, 100, -1, -1, -1, 104, -1, 106, 107, + 108, -1, 110, 111, 112, -1, 114, 115, -1, -1, + 118, 119, 1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, -1, -1, 134, 135, 136, -1, + 19, -1, 21, 22, 23, 24, -1, -1, 146, -1, + 148, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, 45, -1, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, 115, -1, -1, 118, + 119, 1, -1, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, -1, -1, 134, 135, 136, -1, 19, + -1, 21, 22, 23, 24, -1, 145, 146, -1, 148, + 30, 31, 32, 33, 34, 35, 36, -1, -1, 39, + -1, -1, -1, -1, -1, 45, -1, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, -1, 58, 59, + 60, -1, -1, 63, -1, -1, 66, 67, -1, 69, + 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 84, 85, -1, -1, -1, -1, + -1, 91, -1, -1, 94, 95, -1, 97, 98, -1, + 100, -1, -1, -1, 104, -1, 106, 107, 108, -1, + 110, 111, 112, -1, 114, 115, -1, -1, 118, 119, + 1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, -1, -1, 134, 135, 136, -1, 19, -1, + 21, 22, 23, 24, -1, 145, 146, -1, 148, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, 45, -1, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, 115, -1, -1, 118, 119, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 134, 135, 136, -1, -1, 139, -1, + -1, -1, -1, -1, -1, 146, 1, 148, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, -1, -1, + 15, -1, -1, -1, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, 100, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + 115, -1, -1, 118, 119, -1, -1, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, -1, -1, 134, + 135, 136, -1, 19, -1, 21, 22, 23, 24, -1, + -1, 146, -1, 148, 30, 31, 32, 33, 34, 35, + 36, -1, -1, 39, -1, -1, -1, -1, -1, 45, + 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, -1, 58, 59, 60, -1, -1, 63, -1, -1, + 66, 67, -1, 69, 70, 71, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 84, 85, + -1, -1, -1, -1, -1, 91, -1, -1, 94, 95, + -1, 97, 98, -1, 100, -1, -1, -1, 104, -1, + 106, 107, 108, -1, 110, 111, 112, -1, 114, 115, + -1, -1, 118, 119, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, -1, -1, 134, 135, + 136, -1, 19, -1, 21, 22, 23, 24, -1, -1, + 146, -1, 148, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, 45, -1, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, 70, 71, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 84, 85, -1, + -1, -1, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, 100, -1, -1, -1, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, 115, -1, + -1, 118, 119, -1, -1, 3, 4, 5, 6, 7, + 8, 9, 10, 11, -1, -1, -1, 134, 135, 136, + -1, 19, -1, 21, 22, 23, 24, -1, -1, 146, + -1, 148, 30, 31, 32, 33, 34, 35, 36, -1, + -1, 39, -1, -1, -1, -1, -1, -1, -1, -1, + 48, 49, 50, 51, 52, 53, 54, 55, 56, -1, + 58, 59, 60, -1, -1, 63, -1, -1, 66, 67, + -1, 69, 70, 71, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 84, 85, -1, -1, + -1, -1, -1, 91, -1, -1, 94, 95, -1, 97, + 98, -1, -1, -1, -1, -1, 104, -1, 106, 107, + 108, -1, 110, 111, 112, -1, 114, 115, -1, -1, + 118, 119, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, 134, 135, 136, -1, + 19, -1, 21, 22, 23, 24, -1, -1, 146, -1, + 148, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, -1, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, 115, -1, -1, 118, + 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 134, 135, 136, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 146, -1, 148, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, -1, -1, -1, + -1, -1, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, -1, + -1, -1, -1, 86, 87, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 100, 101, 102, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, 135, 136, -1, -1, -1, -1, -1, -1, + 143, 144, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, -1, -1, -1, 19, -1, + 21, 22, 23, 24, -1, 26, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, 102, 103, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 134, 135, 136, -1, 138, -1, -1, + -1, -1, -1, 144, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, + 19, -1, 21, 22, 23, 24, -1, 26, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, 102, 103, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, 134, 135, 136, 19, 138, + 21, 22, 23, 24, -1, 144, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, 92, -1, 94, 95, -1, 97, 98, -1, 100, + -1, 102, 103, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + 121, 3, 4, 5, 6, 7, 8, 9, 10, 11, + -1, -1, -1, 134, 135, 136, -1, 19, -1, 21, + 22, 23, 24, 144, -1, -1, -1, -1, 30, 31, + 32, 33, 34, 35, 36, -1, -1, 39, -1, -1, + -1, -1, -1, -1, -1, -1, 48, 49, 50, 51, + 52, 53, 54, 55, 56, -1, 58, 59, 60, -1, + -1, 63, -1, -1, 66, 67, -1, 69, 70, 71, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 84, 85, -1, -1, -1, -1, -1, 91, + 92, -1, 94, 95, -1, 97, 98, -1, 100, -1, + 102, 103, 104, -1, 106, 107, 108, -1, 110, 111, + 112, -1, 114, -1, -1, -1, -1, -1, -1, 121, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, 134, 135, 136, -1, 19, -1, 21, 22, + 23, 24, 144, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, 102, + 103, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, 134, 135, 136, 19, -1, 21, 22, 23, 24, + -1, 144, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, 100, -1, 102, 103, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, + 135, 136, -1, -1, -1, -1, -1, -1, -1, 144, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, -1, -1, -1, + -1, -1, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, -1, -1, -1, -1, -1, + 63, -1, -1, -1, -1, -1, -1, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, -1, + -1, -1, -1, 86, 87, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 100, 101, 102, + -1, -1, -1, -1, 107, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, 135, 136, -1, -1, -1, -1, -1, -1, + 143, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, -1, -1, -1, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, -1, -1, + -1, -1, -1, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, -1, -1, -1, -1, -1, + -1, 63, -1, -1, -1, -1, -1, -1, 70, 71, + 72, 73, 74, 75, 76, 77, -1, -1, 80, 81, + -1, -1, -1, -1, 86, 87, 88, 89, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 100, 101, + 102, -1, -1, -1, -1, 107, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, -1, 135, 136, -1, -1, -1, -1, -1, + -1, 143, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, -1, + -1, -1, -1, -1, 45, 46, 47, 48, 49, 50, + 51, 52, -1, -1, 55, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, -1, -1, -1, -1, 86, 87, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, + 101, 102, -1, -1, -1, 106, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, 135, 136, -1, -1, -1, -1, + -1, -1, 143, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, -1, -1, -1, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + -1, -1, -1, -1, -1, 45, 46, 47, 48, 49, + 50, 51, 52, -1, -1, 55, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 70, 71, 72, 73, 74, 75, 76, 77, -1, -1, + 80, 81, -1, -1, -1, -1, 86, 87, 88, 89, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, -1, 135, 136, -1, -1, -1, + -1, -1, -1, 143, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, + 19, -1, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, -1, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, -1, -1, -1, 19, 134, 21, 22, 23, 24, + -1, -1, -1, 142, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, -1, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, -1, -1, -1, -1, -1, -1, 19, 134, + 21, 22, 23, 24, -1, -1, -1, 142, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + -1, -1, -1, 134, 135, 136, 19, -1, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, 45, -1, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, -1, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, 134, 135, 136, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, 100, -1, 102, 103, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, -1, -1, -1, 134, + 135, 136, 19, -1, 21, 22, 23, 24, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, 70, 71, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 84, 85, -1, + -1, -1, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, 100, -1, 102, 103, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, 134, 135, 136, + 19, -1, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, 102, 103, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, 134, 135, 136, 19, -1, + 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, 102, 103, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, -1, 134, 135, 136, 19, -1, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, 102, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, 134, 135, 136, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, -1, -1, 102, 103, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, -1, -1, -1, 134, + 135, 136, 19, -1, 21, 22, 23, 24, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, 70, 71, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 84, 85, -1, + -1, -1, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, 100, -1, 102, -1, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, 134, 135, 136, + 19, -1, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, -1, -1, 102, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, 134, 135, 136, 19, -1, + 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, 100, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, -1, 134, 135, 136, 19, -1, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, -1, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, 134, 135, 136, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, 100, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, -1, -1, -1, 134, + 135, 136, 19, -1, 21, 22, 23, 24, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, 70, 71, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 84, 85, -1, + -1, -1, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, 100, -1, -1, -1, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, 134, 135, 136, + 19, -1, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 84, 85, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, -1, -1, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, 134, 135, 136, 19, -1, + 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, 70, + 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 84, 85, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, -1, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, -1, -1, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, -1, 134, 135, 136, 19, -1, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, 70, 71, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 84, 85, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, -1, -1, -1, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, 134, 135, 136, 19, -1, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, 70, 71, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, + 85, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, -1, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, -1, -1, -1, 134, + 135, 136, 19, -1, 21, 22, 23, 24, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 88, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, -1, -1, -1, -1, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, -1, -1, -1, -1, 19, 134, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, 100, -1, -1, + -1, 104, -1, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, 3, 4, 5, 6, 7, 8, + 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, + 19, 134, 21, 22, 23, 24, -1, -1, -1, -1, + -1, 30, 31, 32, 33, 34, 35, 36, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, 48, + 49, 50, 51, 52, 53, 54, 55, 56, -1, 58, + 59, 60, -1, -1, 63, -1, -1, 66, 67, -1, + 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 91, -1, -1, 94, 95, -1, 97, 98, + -1, 100, -1, -1, -1, 104, -1, 106, 107, 108, + -1, 110, 111, 112, -1, 114, -1, -1, 3, 4, + 5, 6, 7, 8, 9, 10, 11, -1, -1, -1, + -1, -1, -1, -1, 19, 134, 21, 22, 23, 24, + -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 35, 36, -1, -1, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, + 55, 56, -1, 58, 59, 60, -1, -1, 63, -1, + -1, 66, 67, -1, 69, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 91, -1, -1, 94, + 95, -1, 97, 98, -1, -1, -1, -1, -1, 104, + -1, 106, 107, 108, -1, 110, 111, 112, -1, 114, + -1, -1, 3, 4, 5, 6, 7, 8, 9, 10, + 11, -1, -1, -1, -1, -1, -1, -1, 19, 134, + 21, 22, 23, 24, -1, -1, -1, -1, -1, 30, + 31, 32, 33, 34, 35, 36, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, 48, 49, 50, + 51, 52, 53, 54, 55, 56, -1, 58, 59, 60, + -1, -1, 63, -1, -1, 66, 67, -1, 69, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 91, -1, -1, 94, 95, -1, 97, 98, -1, -1, + -1, -1, -1, 104, -1, 106, 107, 108, -1, 110, + 111, 112, -1, 114, -1, -1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, -1, -1, -1, -1, -1, + -1, -1, 19, 134, 21, 22, 23, 24, -1, -1, + -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, + -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, + -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, + -1, 58, 59, 60, -1, -1, 63, -1, -1, 66, + 67, -1, 69, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 91, -1, -1, 94, 95, -1, + 97, 98, -1, -1, -1, -1, -1, 104, -1, 106, + 107, 108, -1, 110, 111, 112, -1, 114, -1, -1, + 3, 4, 5, 6, 7, 8, 9, 10, 11, -1, + -1, -1, -1, -1, -1, -1, 19, 134, 21, 22, + 23, 24, -1, -1, -1, -1, -1, 30, 31, 32, + 33, 34, 35, 36, -1, -1, 39, -1, -1, -1, + -1, -1, -1, -1, -1, 48, 49, 50, 51, 52, + 53, 54, 55, 56, -1, 58, 59, 60, -1, -1, + 63, -1, -1, 66, 67, -1, 69, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 91, -1, + -1, 94, 95, -1, 97, 98, -1, -1, 51, 52, + -1, 104, 55, 106, 107, 108, -1, 110, 111, 112, + -1, 114, -1, -1, -1, -1, -1, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, -1, + -1, 134, -1, 86, 87, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 100, 101, 102, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, 135, 136, 51, 52, -1, -1, 55, -1, + 143, 144, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, + 77, -1, -1, 80, 81, -1, -1, -1, -1, 86, + 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 100, 101, 102, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, 135, 136, + 51, 52, -1, -1, 55, -1, 143, 144, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, -1, -1, -1, -1, 86, 87, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, + 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, 135, 136, 51, 52, -1, -1, + 55, -1, 143, 144, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 70, 71, 72, 73, 74, + 75, 76, 77, -1, -1, 80, 81, -1, -1, -1, + -1, 86, 87, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 100, 101, 102, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + 135, 136, 51, 52, -1, -1, 55, -1, 143, 144, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 70, 71, 72, 73, 74, 75, 76, 77, -1, + -1, 80, 81, -1, -1, -1, -1, 86, 87, 88, + 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 100, 101, 102, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, 135, 136, 51, 52, + -1, -1, 55, -1, 143, 144, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, -1, + -1, -1, -1, 86, 87, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 100, 101, 102, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, 135, 136, 51, 52, -1, -1, 55, -1, + 143, 144, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, + 77, -1, -1, 80, 81, -1, -1, -1, -1, 86, + 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 100, 101, 102, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, 135, 136, + 51, 52, -1, -1, 55, -1, 143, 144, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, -1, -1, -1, -1, 86, 87, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, + 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, 135, 136, 51, 52, -1, -1, + 55, -1, 143, 144, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 70, 71, 72, 73, 74, + 75, 76, 77, -1, -1, 80, 81, -1, -1, -1, + -1, 86, 87, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 100, 101, 102, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + 135, 136, 51, 52, -1, -1, 55, -1, 143, 144, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 70, 71, 72, 73, 74, 75, 76, 77, -1, + -1, 80, 81, -1, -1, -1, -1, 86, 87, 88, + 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 100, 101, 102, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, 135, 136, 51, 52, + -1, -1, 55, -1, 143, 144, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 70, 71, 72, + 73, 74, 75, 76, 77, -1, -1, 80, 81, -1, + -1, -1, -1, 86, 87, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 100, 101, 102, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, -1, 135, 136, 51, 52, -1, -1, 55, -1, + 143, 144, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 70, 71, 72, 73, 74, 75, 76, + 77, -1, -1, 80, 81, -1, -1, -1, -1, 86, + 87, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 100, 101, 102, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, 135, 136, + 51, 52, -1, -1, 55, -1, 143, 144, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, + 71, 72, 73, 74, 75, 76, 77, -1, -1, 80, + 81, -1, -1, -1, -1, 86, 87, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 100, + 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, -1, 135, 136, 51, 52, -1, -1, + 55, -1, 143, 144, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 70, 71, 72, 73, 74, + 75, 76, 77, -1, -1, 80, 81, -1, -1, -1, + -1, 86, 87, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 100, 101, 102, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, -1, + 135, 136, 51, 52, -1, -1, 55, -1, 143, 144, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 70, 71, 72, 73, 74, 75, 76, 77, -1, + -1, 80, 81, -1, -1, -1, -1, 86, 87, 88, + 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 100, 101, 102, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, 135, 136, -1, -1, + -1, -1, -1, -1, 143, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, + -1, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 101, -1, -1, -1, -1, 44, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 122, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, -1, -1, 88, 89, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, + -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 122, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, -1, -1, -1, -1, 88, 89, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, -1, -1, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 122, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, -1, -1, 148, -1, 88, + 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 122, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, -1, -1, -1, -1, -1, + -1, -1, -1, 142, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, -1, -1, -1, -1, + 88, 89, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 122, -1, 124, 125, 126, 127, + 128, 129, 130, 131, 132, 133, -1, -1, -1, -1, + -1, -1, -1, -1, 142, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, -1, -1, -1, + -1, 88, 89, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 122, -1, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, -1, -1, -1, + -1, -1, -1, -1, -1, 142, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, -1, -1, + -1, -1, 88, 89, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 101, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 122, -1, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, -1, -1, + -1, -1, -1, -1, -1, -1, 142, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, -1, + -1, -1, -1, 88, 89, -1, -1, -1, 93, -1, + -1, -1, -1, -1, -1, -1, 101, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 122, -1, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, + 83, -1, -1, -1, -1, 88, 89, -1, -1, -1, + 93, -1, -1, -1, -1, -1, -1, -1, 101, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, + -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, -1, -1, -1, -1, 88, 89, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 122, -1, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, -1, -1, -1, -1, 88, + 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_int16 yystos[] = +{ + 0, 150, 151, 0, 1, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 19, 21, 22, 23, 24, + 30, 31, 32, 33, 34, 35, 36, 39, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 58, 59, 60, 63, 66, 67, 69, 70, 71, 84, + 85, 91, 94, 95, 97, 98, 100, 104, 106, 107, + 108, 110, 111, 112, 114, 134, 135, 136, 152, 153, + 154, 159, 161, 163, 164, 165, 168, 169, 172, 173, + 175, 176, 177, 179, 180, 189, 203, 220, 241, 242, + 252, 253, 254, 258, 259, 260, 266, 267, 268, 270, + 271, 272, 273, 274, 275, 312, 325, 154, 21, 22, + 30, 31, 32, 39, 51, 55, 69, 88, 91, 94, + 134, 164, 165, 181, 182, 203, 220, 272, 275, 312, + 182, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 45, 46, 47, 48, 49, + 50, 51, 52, 55, 70, 71, 72, 73, 74, 75, + 76, 77, 80, 81, 86, 87, 88, 89, 100, 101, + 102, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 135, 136, 143, 144, 183, 187, 188, 274, 306, + 204, 91, 163, 164, 165, 167, 180, 189, 220, 272, + 273, 275, 167, 210, 212, 69, 91, 173, 180, 220, + 225, 272, 275, 33, 34, 35, 36, 48, 49, 50, + 51, 55, 106, 183, 184, 185, 268, 115, 118, 119, + 146, 148, 167, 262, 263, 264, 318, 322, 323, 324, + 51, 100, 102, 103, 135, 172, 189, 195, 198, 201, + 254, 309, 311, 195, 195, 144, 192, 193, 196, 197, + 325, 192, 196, 144, 319, 323, 184, 155, 138, 189, + 220, 189, 189, 189, 55, 1, 94, 157, 158, 159, + 174, 175, 325, 205, 207, 190, 201, 309, 325, 189, + 308, 309, 325, 91, 142, 179, 220, 272, 275, 208, + 53, 54, 56, 63, 107, 183, 269, 63, 64, 65, + 116, 117, 255, 256, 61, 255, 62, 255, 63, 255, + 63, 255, 58, 59, 168, 189, 189, 318, 324, 40, + 41, 42, 43, 44, 37, 38, 51, 53, 54, 55, + 56, 69, 94, 100, 101, 102, 103, 128, 131, 144, + 278, 279, 280, 281, 282, 285, 286, 287, 288, 290, + 291, 292, 293, 295, 296, 297, 300, 301, 302, 303, + 304, 325, 278, 280, 28, 239, 121, 142, 94, 100, + 176, 121, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 88, 89, 93, 101, 122, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 90, + 105, 140, 147, 316, 90, 316, 317, 26, 138, 243, + 254, 92, 92, 192, 196, 243, 163, 51, 55, 181, + 58, 59, 279, 125, 276, 90, 140, 316, 219, 307, + 90, 147, 315, 156, 157, 55, 278, 278, 16, 221, + 322, 121, 90, 140, 316, 92, 92, 221, 167, 167, + 55, 90, 140, 316, 25, 107, 142, 265, 318, 115, + 264, 20, 246, 322, 57, 310, 189, 189, 189, 93, + 142, 199, 200, 325, 310, 199, 200, 85, 194, 195, + 201, 309, 325, 195, 163, 318, 320, 163, 160, 138, + 157, 90, 316, 92, 159, 174, 145, 318, 324, 320, + 159, 320, 141, 200, 321, 324, 200, 321, 139, 321, + 55, 176, 177, 178, 142, 90, 140, 316, 144, 237, + 290, 63, 255, 257, 261, 262, 63, 256, 61, 62, + 63, 63, 101, 101, 154, 167, 167, 167, 167, 159, + 163, 163, 57, 121, 294, 85, 290, 295, 121, 156, + 189, 142, 305, 325, 51, 142, 305, 322, 142, 289, + 189, 142, 289, 51, 142, 289, 51, 121, 156, 240, + 100, 168, 189, 201, 202, 174, 142, 179, 142, 161, + 162, 168, 180, 189, 191, 202, 220, 275, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 51, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 51, 52, 55, 187, 192, + 313, 314, 194, 201, 51, 52, 55, 187, 192, 313, + 51, 55, 313, 245, 244, 162, 189, 191, 162, 191, + 99, 170, 217, 277, 216, 51, 55, 181, 313, 194, + 313, 156, 163, 166, 15, 13, 248, 325, 121, 121, + 157, 16, 51, 55, 194, 51, 55, 157, 27, 222, + 322, 222, 51, 55, 194, 51, 55, 214, 186, 157, + 246, 189, 201, 15, 261, 189, 189, 319, 100, 189, + 198, 309, 189, 311, 320, 145, 318, 200, 200, 320, + 145, 184, 152, 139, 191, 320, 159, 206, 309, 176, + 178, 51, 55, 194, 51, 55, 290, 209, 63, 157, + 262, 189, 189, 51, 100, 226, 295, 320, 320, 142, + 172, 189, 15, 51, 282, 287, 304, 288, 293, 300, + 302, 295, 297, 302, 51, 295, 172, 189, 15, 79, + 126, 231, 232, 325, 189, 200, 320, 178, 142, 44, + 121, 44, 90, 140, 316, 319, 92, 92, 192, 196, + 141, 200, 92, 92, 193, 196, 193, 196, 231, 231, + 171, 322, 167, 156, 141, 15, 320, 183, 189, 202, + 249, 325, 18, 224, 325, 17, 223, 224, 92, 92, + 141, 92, 92, 224, 211, 213, 141, 167, 184, 139, + 15, 200, 221, 261, 189, 199, 85, 309, 139, 320, + 321, 141, 234, 319, 29, 113, 238, 139, 142, 292, + 320, 142, 85, 44, 44, 305, 142, 289, 142, 289, + 142, 289, 142, 289, 289, 44, 44, 228, 230, 233, + 281, 283, 284, 287, 295, 296, 298, 299, 302, 304, + 156, 100, 189, 178, 159, 189, 51, 55, 194, 51, + 55, 57, 123, 162, 191, 168, 191, 170, 92, 162, + 191, 162, 191, 170, 243, 239, 156, 157, 231, 218, + 322, 15, 93, 250, 325, 157, 14, 251, 325, 167, + 15, 92, 15, 157, 157, 222, 189, 157, 320, 200, + 145, 146, 156, 157, 227, 142, 100, 320, 189, 189, + 295, 302, 295, 295, 189, 189, 234, 234, 91, 220, + 142, 305, 305, 142, 229, 220, 142, 229, 142, 229, + 15, 189, 141, 189, 189, 162, 191, 15, 139, 157, + 156, 91, 180, 220, 272, 275, 221, 157, 221, 15, + 15, 215, 224, 246, 247, 51, 235, 236, 291, 15, + 139, 295, 295, 142, 292, 289, 142, 289, 289, 289, + 126, 126, 55, 90, 283, 287, 142, 228, 229, 299, + 302, 295, 298, 302, 295, 139, 15, 55, 90, 140, + 316, 157, 157, 157, 142, 319, 142, 295, 142, 295, + 51, 55, 305, 142, 229, 142, 229, 142, 229, 142, + 229, 229, 51, 55, 194, 51, 55, 248, 223, 15, + 236, 295, 289, 295, 302, 295, 295, 141, 229, 142, + 229, 229, 229, 295, 229 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_int16 yyr1[] = +{ + 0, 149, 151, 150, 152, 153, 153, 153, 153, 154, + 155, 154, 156, 157, 158, 158, 158, 158, 160, 159, + 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, + 159, 159, 159, 159, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 162, 162, 162, 163, + 163, 163, 163, 163, 163, 164, 166, 165, 167, 168, + 168, 169, 169, 171, 170, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 173, 173, 174, 174, + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 176, 176, 177, 177, 178, 178, 179, 179, 179, 179, + 179, 179, 179, 179, 180, 180, 180, 180, 180, 180, + 180, 180, 180, 181, 181, 182, 182, 182, 183, 183, + 183, 183, 183, 184, 184, 185, 186, 185, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 188, 188, + 188, 188, 188, 188, 188, 188, 188, 188, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 189, 189, 189, 189, 189, 189, 190, + 190, 190, 190, 191, 191, 192, 192, 192, 193, 193, + 194, 194, 194, 194, 194, 195, 195, 195, 195, 195, + 197, 196, 198, 199, 199, 200, 200, 201, 201, 201, + 201, 202, 202, 202, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 204, 203, 205, 206, 203, 207, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 208, 209, 203, 203, 203, 210, 211, 203, + 212, 213, 203, 203, 203, 214, 215, 203, 216, 203, + 217, 218, 203, 219, 203, 203, 203, 203, 203, 203, + 203, 220, 221, 221, 221, 222, 222, 223, 223, 224, + 224, 225, 225, 226, 226, 226, 226, 226, 226, 226, + 226, 227, 226, 228, 228, 228, 228, 229, 229, 230, + 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 230, 230, 231, 231, 233, 232, 232, 232, + 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, + 240, 239, 241, 241, 241, 241, 242, 242, 242, 242, + 242, 242, 242, 242, 242, 244, 243, 245, 243, 246, + 247, 247, 248, 248, 249, 249, 249, 250, 250, 251, + 251, 252, 252, 252, 252, 253, 253, 254, 254, 254, + 254, 255, 255, 256, 257, 256, 256, 256, 258, 258, + 259, 259, 260, 261, 261, 262, 262, 263, 263, 264, + 265, 264, 266, 266, 267, 267, 268, 269, 269, 269, + 269, 269, 269, 270, 270, 271, 271, 271, 271, 272, + 272, 272, 272, 272, 273, 273, 274, 274, 274, 274, + 274, 274, 274, 274, 275, 275, 276, 277, 276, 278, + 278, 279, 279, 279, 280, 280, 281, 282, 282, 283, + 283, 284, 284, 285, 285, 286, 286, 287, 287, 288, + 288, 288, 288, 289, 289, 290, 290, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 291, 291, 291, 291, 291, 292, 292, 293, 294, 293, + 295, 295, 296, 297, 298, 299, 299, 300, 300, 301, + 301, 302, 302, 303, 303, 304, 305, 305, 306, 307, + 306, 308, 308, 309, 309, 310, 310, 311, 311, 311, + 311, 312, 312, 312, 313, 313, 313, 313, 314, 314, + 314, 315, 315, 316, 316, 317, 317, 318, 318, 319, + 319, 320, 321, 321, 321, 322, 322, 322, 323, 324, + 324, 325 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 0, 2, 2, 1, 1, 3, 2, 1, + 0, 5, 4, 2, 1, 1, 3, 2, 0, 4, + 2, 3, 3, 3, 3, 3, 4, 1, 3, 3, + 3, 3, 3, 1, 3, 3, 6, 5, 5, 5, + 5, 4, 6, 4, 6, 3, 1, 3, 1, 1, + 3, 3, 3, 2, 1, 2, 0, 5, 1, 1, + 1, 1, 4, 0, 5, 2, 3, 4, 5, 4, + 5, 2, 2, 2, 2, 2, 1, 3, 1, 3, + 1, 2, 3, 5, 2, 4, 2, 4, 1, 3, + 1, 3, 2, 3, 1, 2, 1, 4, 3, 3, + 3, 3, 2, 1, 1, 4, 3, 3, 3, 3, + 2, 1, 1, 1, 1, 2, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 4, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, + 6, 5, 5, 5, 5, 4, 3, 3, 2, 2, + 3, 2, 2, 3, 3, 3, 3, 3, 3, 4, + 4, 2, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, + 3, 3, 6, 6, 4, 6, 4, 6, 1, 1, + 2, 4, 2, 1, 3, 3, 5, 3, 1, 1, + 1, 2, 2, 4, 2, 1, 2, 2, 4, 1, + 0, 2, 2, 2, 1, 1, 3, 1, 2, 3, + 4, 3, 4, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 4, 0, 0, 5, 0, 3, + 3, 3, 2, 3, 3, 1, 2, 4, 3, 2, + 1, 2, 0, 0, 5, 6, 6, 0, 0, 7, + 0, 0, 7, 5, 4, 0, 0, 9, 0, 6, + 0, 0, 8, 0, 5, 4, 4, 1, 1, 1, + 1, 1, 1, 1, 2, 1, 1, 1, 5, 1, + 2, 1, 1, 1, 4, 6, 3, 5, 2, 4, + 1, 0, 4, 4, 2, 2, 1, 2, 0, 6, + 8, 4, 6, 4, 3, 6, 2, 4, 6, 2, + 4, 2, 4, 1, 1, 1, 0, 4, 1, 4, + 1, 4, 1, 3, 1, 1, 4, 1, 3, 3, + 0, 5, 2, 4, 5, 5, 2, 4, 4, 3, + 3, 3, 2, 1, 4, 0, 5, 0, 5, 5, + 1, 1, 6, 1, 1, 1, 1, 2, 1, 2, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, + 3, 1, 2, 1, 0, 4, 1, 2, 2, 3, + 2, 3, 1, 1, 2, 1, 2, 1, 2, 1, + 0, 4, 2, 3, 1, 4, 2, 1, 1, 1, + 1, 1, 2, 2, 3, 1, 1, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 0, 0, 4, 1, + 1, 3, 5, 3, 1, 2, 2, 2, 1, 2, + 1, 1, 3, 1, 3, 1, 1, 2, 1, 4, + 2, 2, 1, 2, 0, 6, 8, 4, 6, 4, + 6, 2, 4, 6, 2, 4, 2, 4, 1, 0, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 4, + 1, 3, 2, 2, 2, 1, 3, 1, 3, 1, + 1, 2, 1, 1, 1, 2, 2, 1, 1, 0, + 4, 1, 2, 1, 3, 1, 2, 3, 3, 3, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, + 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 2, 0 +}; + + +#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 (p, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +/* This macro is provided for backward compatibility. */ +#ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, p); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_state *p) +{ + FILE *yyoutput = yyo; + YYUSE (yyoutput); + YYUSE (p); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyo, yytoknum[yytype], *yyvaluep); +# endif + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + +static void +yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, parser_state *p) +{ + YYFPRINTF (yyo, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + yy_symbol_value_print (yyo, yytype, yyvaluep, p); + YYFPRINTF (yyo, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule, parser_state *p) +{ + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + yystos[+yyssp[yyi + 1 - yynrhs]], + &yyvsp[(yyi + 1) - (yynrhs)] + , p); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule, p); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S))) +# else +/* Return the length of YYSTR. */ +static YYPTRDIFF_T +yystrlen (const char *yystr) +{ + YYPTRDIFF_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYPTRDIFF_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYPTRDIFF_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; + else + goto append; + + append: + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (yyres) + return yystpcpy (yyres, yystr) - yyres; + else + return yystrlen (yystr); +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + required number of bytes is too large to store. */ +static int +yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg, + yy_state_t *yyssp, int yytoken) +{ + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* Arguments of yyformat: reported tokens (one for the "unexpected", + one per "expected"). */ + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + /* Actual size of YYARG. */ + int yycount = 0; + /* Cumulated lengths of YYARG. */ + YYPTRDIFF_T yysize = 0; + + /* There are many possibilities here to consider: + - If this state is a consistent state with a default action, then + the only way this function was invoked is if the default action + is an error action. In that case, don't check for expected + tokens because there are none. + - The only way there can be no lookahead present (in yychar) is if + this state is a consistent state with a default action. Thus, + detecting the absence of a lookahead is sufficient to determine + that there is no unexpected or expected token to report. In that + case, just report a simple "syntax error". + - Don't assume there isn't a lookahead just because this state is a + consistent state with a default action. There might have been a + previous inconsistent state, consistent state with a non-default + action, or user semantic action that manipulated yychar. + - Of course, the expected token list depends on states to have + correct lookahead information, and it depends on the parser not + to perform extra reductions after fetching a lookahead from the + scanner and before detecting a syntax error. Thus, state merging + (from LALR or IELR) and default reductions corrupt the expected + token list. However, the list is correct for canonical LR with + one exception: it will still contain any token that will not be + accepted due to an error action in a later state. + */ + if (yytoken != YYEMPTY) + { + int yyn = yypact[+*yyssp]; + YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); + yysize = yysize0; + yyarg[yycount++] = yytname[yytoken]; + if (!yypact_value_is_default (yyn)) + { + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. In other words, skip the first -YYN actions for + this state because they are default actions. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yyx; + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR + && !yytable_value_is_error (yytable[yyx + yyn])) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + break; + } + yyarg[yycount++] = yytname[yyx]; + { + YYPTRDIFF_T yysize1 + = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + } + } + } + + switch (yycount) + { +# define YYCASE_(N, S) \ + case N: \ + yyformat = S; \ + break + default: /* Avoid compiler warnings. */ + 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_ + } + + { + /* Don't count the "%s"s in the final size, but reserve room for + the terminator. */ + YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1; + if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) + yysize = yysize1; + else + return 2; + } + + if (*yymsg_alloc < yysize) + { + *yymsg_alloc = 2 * yysize; + if (! (yysize <= *yymsg_alloc + && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) + *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; + return 1; + } + + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + { + char *yyp = *yymsg; + int yyi = 0; + while ((*yyp = *yyformat) != '\0') + if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyformat += 2; + } + else + { + ++yyp; + ++yyformat; + } + } + return 0; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, parser_state *p) +{ + YYUSE (yyvaluep); + YYUSE (p); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (parser_state *p) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + + /* Number of syntax errors so far. */ + int yynerrs; + + yy_state_fast_t yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + 'yyss': related to states. + 'yyvs': related to semantic values. + + Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss; + yy_state_t *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYPTRDIFF_T yystacksize; + + int yyn; + int yyresult; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf; +#endif + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yyssp = yyss = yyssa; + yyvsp = yyvs = yyvsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + goto yysetstate; + + +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + goto yyexhaustedlab; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, 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 + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = yylex (&yylval, p); + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 1566 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_BEG; + if (!p->locals) p->locals = cons(0,0); + } +#line 6088 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 3: +#line 1571 "mrbgems/mruby-compiler/core/parse.y" + { + p->tree = new_scope(p, (yyvsp[0].nd)); + NODE_LINENO(p->tree, (yyvsp[0].nd)); + } +#line 6097 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 4: +#line 1578 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 6105 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 5: +#line 1584 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, 0); + } +#line 6113 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 6: +#line 1588 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 6122 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 7: +#line 1593 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), newline_node((yyvsp[0].nd))); + } +#line 6130 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 8: +#line 1597 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, 0); + } +#line 6138 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 10: +#line 1604 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = local_switch(p); + nvars_block(p); + } +#line 6147 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 11: +#line 1609 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "BEGIN not supported"); + local_resume(p, (yyvsp[-3].nd)); + nvars_unnest(p); + (yyval.nd) = 0; + } +#line 6158 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 12: +#line 1621 "mrbgems/mruby-compiler/core/parse.y" + { + if ((yyvsp[-2].nd)) { + (yyval.nd) = new_rescue(p, (yyvsp[-3].nd), (yyvsp[-2].nd), (yyvsp[-1].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-3].nd)); + } + else if ((yyvsp[-1].nd)) { + yywarn(p, "else without rescue is useless"); + (yyval.nd) = push((yyvsp[-3].nd), (yyvsp[-1].nd)); + } + else { + (yyval.nd) = (yyvsp[-3].nd); + } + if ((yyvsp[0].nd)) { + if ((yyval.nd)) { + (yyval.nd) = new_ensure(p, (yyval.nd), (yyvsp[0].nd)); + } + else { + (yyval.nd) = push((yyvsp[0].nd), new_nil(p)); + } + } + } +#line 6184 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 13: +#line 1645 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 6192 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 14: +#line 1651 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, 0); + } +#line 6200 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 15: +#line 1655 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 6209 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 16: +#line 1660 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), newline_node((yyvsp[0].nd))); + } +#line 6217 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 17: +#line 1664 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_begin(p, (yyvsp[0].nd)); + } +#line 6225 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 18: +#line 1669 "mrbgems/mruby-compiler/core/parse.y" + {p->lstate = EXPR_FNAME;} +#line 6231 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 19: +#line 1670 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_alias(p, (yyvsp[-2].id), (yyvsp[0].id)); + } +#line 6239 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 20: +#line 1674 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 6247 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 21: +#line 1678 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_if(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd), 0); + } +#line 6255 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 22: +#line 1682 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_unless(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd), 0); + } +#line 6263 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 23: +#line 1686 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_while(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd)); + } +#line 6271 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 24: +#line 1690 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_until(p, cond((yyvsp[0].nd)), (yyvsp[-2].nd)); + } +#line 6279 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 25: +#line 1694 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6287 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 26: +#line 1698 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "END not supported"); + (yyval.nd) = new_postexe(p, (yyvsp[-1].nd)); + } +#line 6296 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 28: +#line 1704 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6304 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 29: +#line 1708 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), new_array(p, (yyvsp[0].nd))); + } +#line 6312 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 30: +#line 1712 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6320 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 31: +#line 1716 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_masgn(p, (yyvsp[-2].nd), new_array(p, (yyvsp[0].nd))); + } +#line 6328 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 32: +#line 1720 "mrbgems/mruby-compiler/core/parse.y" + { + node *lhs = new_lvar(p, (yyvsp[0].id)); + void_expr_error(p, (yyvsp[-2].nd)); + assignable(p, lhs); + (yyval.nd) = new_asgn(p, lhs, (yyvsp[-2].nd)); + } +#line 6339 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 34: +#line 1730 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6347 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 35: +#line 1734 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, (yyvsp[-2].nd), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6355 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 36: +#line 1738 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-5].nd), intern_op(aref), (yyvsp[-3].nd), '.'), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6363 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 37: +#line 1742 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6371 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 38: +#line 1746 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6379 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 39: +#line 1750 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "constant re-assignment"); + (yyval.nd) = 0; + } +#line 6388 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 40: +#line 1755 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, tCOLON2), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6396 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 41: +#line 1759 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + endless_method_name(p, (yyvsp[-3].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defn_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[0].nd)); + nvars_unnest(p); + p->in_def--; + } +#line 6409 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 42: +#line 1768 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-5].nd); + endless_method_name(p, (yyvsp[-5].nd)); + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defn_setup(p, (yyval.nd), (yyvsp[-4].nd), new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd))); + nvars_unnest(p); + p->in_def--; + } +#line 6423 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 43: +#line 1778 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + void_expr_error(p, (yyvsp[0].nd)); + defs_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[0].nd)); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } +#line 6436 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 44: +#line 1787 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-5].nd); + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defs_setup(p, (yyval.nd), (yyvsp[-4].nd), new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd))); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } +#line 6450 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 45: +#line 1797 "mrbgems/mruby-compiler/core/parse.y" + { + backref_error(p, (yyvsp[-2].nd)); + (yyval.nd) = new_begin(p, 0); + } +#line 6459 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 47: +#line 1805 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6467 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 50: +#line 1814 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_and(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6475 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 51: +#line 1818 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_or(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6483 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 52: +#line 1822 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!"); + } +#line 6491 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 53: +#line 1826 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!"); + } +#line 6499 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 55: +#line 1834 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_def(p, (yyvsp[0].id), nint(p->cmdarg_stack), local_switch(p)); + p->cmdarg_stack = 0; + p->in_def++; + nvars_block(p); + } +#line 6510 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 56: +#line 1843 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_FNAME; + } +#line 6518 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 57: +#line 1847 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_sdef(p, (yyvsp[-3].nd), (yyvsp[0].id), nint(p->cmdarg_stack), local_switch(p)); + p->cmdarg_stack = 0; + p->in_def++; + p->in_single++; + nvars_block(p); + p->lstate = EXPR_ENDFN; /* force for args */ + } +#line 6531 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 58: +#line 1858 "mrbgems/mruby-compiler/core/parse.y" + { + if (!(yyvsp[0].nd)) (yyval.nd) = new_nil(p); + else { + (yyval.nd) = (yyvsp[0].nd); + } + } +#line 6542 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 62: +#line 1872 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num)); + } +#line 6550 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 63: +#line 1878 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + nvars_nest(p); + } +#line 6559 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 64: +#line 1885 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_block(p, (yyvsp[-2].nd), (yyvsp[-1].nd)); + local_unnest(p); + nvars_unnest(p); + } +#line 6569 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 65: +#line 1893 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_fcall(p, (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 6577 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 66: +#line 1897 "mrbgems/mruby-compiler/core/parse.y" + { + args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + (yyval.nd) = new_fcall(p, (yyvsp[-2].id), (yyvsp[-1].nd)); + } +#line 6586 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 67: +#line 1902 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num)); + } +#line 6594 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 68: +#line 1906 "mrbgems/mruby-compiler/core/parse.y" + { + args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num)); + } +#line 6603 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 69: +#line 1911 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), tCOLON2); + } +#line 6611 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 70: +#line 1915 "mrbgems/mruby-compiler/core/parse.y" + { + args_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), tCOLON2); + } +#line 6620 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 71: +#line 1920 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_super(p, (yyvsp[0].nd)); + } +#line 6628 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 72: +#line 1924 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_yield(p, (yyvsp[0].nd)); + } +#line 6636 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 73: +#line 1928 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_return(p, ret_args(p, (yyvsp[0].nd))); + } +#line 6644 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 74: +#line 1932 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_break(p, ret_args(p, (yyvsp[0].nd))); + } +#line 6652 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 75: +#line 1936 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_next(p, ret_args(p, (yyvsp[0].nd))); + } +#line 6660 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 76: +#line 1942 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 6668 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 77: +#line 1946 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 6676 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 79: +#line 1953 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 6684 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 80: +#line 1959 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 6692 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 81: +#line 1963 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1(push((yyvsp[-1].nd),(yyvsp[0].nd))); + } +#line 6700 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 82: +#line 1967 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list2((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6708 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 83: +#line 1971 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[-4].nd), (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6716 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 84: +#line 1975 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list2((yyvsp[-1].nd), new_nil(p)); + } +#line 6724 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 85: +#line 1979 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[-3].nd), new_nil(p), (yyvsp[0].nd)); + } +#line 6732 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 86: +#line 1983 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list2(0, (yyvsp[0].nd)); + } +#line 6740 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 87: +#line 1987 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3(0, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 6748 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 88: +#line 1991 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list2(0, new_nil(p)); + } +#line 6756 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 89: +#line 1995 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3(0, new_nil(p), (yyvsp[0].nd)); + } +#line 6764 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 91: +#line 2002 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_masgn(p, (yyvsp[-1].nd), NULL); + } +#line 6772 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 92: +#line 2008 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[-1].nd)); + } +#line 6780 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 93: +#line 2012 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[-1].nd)); + } +#line 6788 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 94: +#line 2018 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 6796 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 95: +#line 2022 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 6804 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 96: +#line 2028 "mrbgems/mruby-compiler/core/parse.y" + { + assignable(p, (yyvsp[0].nd)); + } +#line 6812 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 97: +#line 2032 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_op(aref), (yyvsp[-1].nd), '.'); + } +#line 6820 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 98: +#line 2036 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num)); + } +#line 6828 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 99: +#line 2040 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2); + } +#line 6836 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 100: +#line 2044 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num)); + } +#line 6844 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 101: +#line 2048 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "dynamic constant assignment"); + (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id)); + } +#line 6854 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 102: +#line 2054 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "dynamic constant assignment"); + (yyval.nd) = new_colon3(p, (yyvsp[0].id)); + } +#line 6864 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 103: +#line 2060 "mrbgems/mruby-compiler/core/parse.y" + { + backref_error(p, (yyvsp[0].nd)); + (yyval.nd) = 0; + } +#line 6873 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 104: +#line 2067 "mrbgems/mruby-compiler/core/parse.y" + { + assignable(p, (yyvsp[0].nd)); + } +#line 6881 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 105: +#line 2071 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_op(aref), (yyvsp[-1].nd), '.'); + } +#line 6889 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 106: +#line 2075 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num)); + } +#line 6897 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 107: +#line 2079 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2); + } +#line 6905 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 108: +#line 2083 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, (yyvsp[-1].num)); + } +#line 6913 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 109: +#line 2087 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "dynamic constant assignment"); + (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id)); + } +#line 6923 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 110: +#line 2093 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "dynamic constant assignment"); + (yyval.nd) = new_colon3(p, (yyvsp[0].id)); + } +#line 6933 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 111: +#line 2099 "mrbgems/mruby-compiler/core/parse.y" + { + backref_error(p, (yyvsp[0].nd)); + (yyval.nd) = 0; + } +#line 6942 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 112: +#line 2104 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "can't assign to numbered parameter"); + } +#line 6950 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 113: +#line 2110 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "class/module name must be CONSTANT"); + } +#line 6958 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 115: +#line 2117 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(nint(1), nsym((yyvsp[0].id))); + } +#line 6966 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 116: +#line 2121 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(nint(0), nsym((yyvsp[0].id))); + } +#line 6974 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 117: +#line 2125 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[-2].nd)); + (yyval.nd) = cons((yyvsp[-2].nd), nsym((yyvsp[0].id))); + } +#line 6983 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 121: +#line 2135 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_ENDFN; + (yyval.id) = (yyvsp[0].id); + } +#line 6992 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 122: +#line 2140 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_ENDFN; + (yyval.id) = (yyvsp[0].id); + } +#line 7001 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 125: +#line 2151 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_undef(p, (yyvsp[0].id)); + } +#line 7009 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 126: +#line 2154 "mrbgems/mruby-compiler/core/parse.y" + {p->lstate = EXPR_FNAME;} +#line 7015 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 127: +#line 2155 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-3].nd), nsym((yyvsp[0].id))); + } +#line 7023 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 128: +#line 2160 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(or); } +#line 7029 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 129: +#line 2161 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(xor); } +#line 7035 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 130: +#line 2162 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(and); } +#line 7041 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 131: +#line 2163 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(cmp); } +#line 7047 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 132: +#line 2164 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(eq); } +#line 7053 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 133: +#line 2165 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(eqq); } +#line 7059 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 134: +#line 2166 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(match); } +#line 7065 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 135: +#line 2167 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(nmatch); } +#line 7071 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 136: +#line 2168 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(gt); } +#line 7077 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 137: +#line 2169 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(ge); } +#line 7083 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 138: +#line 2170 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(lt); } +#line 7089 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 139: +#line 2171 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(le); } +#line 7095 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 140: +#line 2172 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(neq); } +#line 7101 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 141: +#line 2173 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(lshift); } +#line 7107 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 142: +#line 2174 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(rshift); } +#line 7113 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 143: +#line 2175 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(add); } +#line 7119 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 144: +#line 2176 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(sub); } +#line 7125 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 145: +#line 2177 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(mul); } +#line 7131 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 146: +#line 2178 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(mul); } +#line 7137 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 147: +#line 2179 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(div); } +#line 7143 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 148: +#line 2180 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(mod); } +#line 7149 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 149: +#line 2181 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(pow); } +#line 7155 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 150: +#line 2182 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(pow); } +#line 7161 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 151: +#line 2183 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(not); } +#line 7167 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 152: +#line 2184 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(neg); } +#line 7173 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 153: +#line 2185 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(plus); } +#line 7179 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 154: +#line 2186 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(minus); } +#line 7185 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 155: +#line 2187 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(aref); } +#line 7191 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 156: +#line 2188 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(aset); } +#line 7197 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 157: +#line 2189 "mrbgems/mruby-compiler/core/parse.y" + { (yyval.id) = intern_op(tick); } +#line 7203 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 198: +#line 2207 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_asgn(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7211 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 199: +#line 2211 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, (yyvsp[-2].nd), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 7219 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 200: +#line 2215 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-5].nd), intern_op(aref), (yyvsp[-3].nd), '.'), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 7227 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 201: +#line 2219 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 7235 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 202: +#line 2223 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, (yyvsp[-3].num)), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 7243 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 203: +#line 2227 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_op_asgn(p, new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), 0, tCOLON2), (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 7251 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 204: +#line 2231 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "constant re-assignment"); + (yyval.nd) = new_begin(p, 0); + } +#line 7260 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 205: +#line 2236 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "constant re-assignment"); + (yyval.nd) = new_begin(p, 0); + } +#line 7269 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 206: +#line 2241 "mrbgems/mruby-compiler/core/parse.y" + { + backref_error(p, (yyvsp[-2].nd)); + (yyval.nd) = new_begin(p, 0); + } +#line 7278 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 207: +#line 2246 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot2(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7286 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 208: +#line 2250 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot2(p, (yyvsp[-1].nd), new_nil(p)); + } +#line 7294 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 209: +#line 2254 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot2(p, new_nil(p), (yyvsp[0].nd)); + } +#line 7302 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 210: +#line 2258 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot3(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7310 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 211: +#line 2262 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot3(p, (yyvsp[-1].nd), new_nil(p)); + } +#line 7318 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 212: +#line 2266 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dot3(p, new_nil(p), (yyvsp[0].nd)); + } +#line 7326 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 213: +#line 2270 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "+", (yyvsp[0].nd)); + } +#line 7334 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 214: +#line 2274 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "-", (yyvsp[0].nd)); + } +#line 7342 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 215: +#line 2278 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "*", (yyvsp[0].nd)); + } +#line 7350 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 216: +#line 2282 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "/", (yyvsp[0].nd)); + } +#line 7358 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 217: +#line 2286 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "%", (yyvsp[0].nd)); + } +#line 7366 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 218: +#line 2290 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd)); + } +#line 7374 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 219: +#line 2294 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd)), "-@"); + } +#line 7382 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 220: +#line 2298 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, call_bin_op(p, (yyvsp[-2].nd), "**", (yyvsp[0].nd)), "-@"); + } +#line 7390 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 221: +#line 2302 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, (yyvsp[0].nd), "+@"); + } +#line 7398 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 222: +#line 2306 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, (yyvsp[0].nd), "-@"); + } +#line 7406 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 223: +#line 2310 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "|", (yyvsp[0].nd)); + } +#line 7414 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 224: +#line 2314 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "^", (yyvsp[0].nd)); + } +#line 7422 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 225: +#line 2318 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "&", (yyvsp[0].nd)); + } +#line 7430 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 226: +#line 2322 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<=>", (yyvsp[0].nd)); + } +#line 7438 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 227: +#line 2326 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">", (yyvsp[0].nd)); + } +#line 7446 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 228: +#line 2330 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">=", (yyvsp[0].nd)); + } +#line 7454 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 229: +#line 2334 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<", (yyvsp[0].nd)); + } +#line 7462 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 230: +#line 2338 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<=", (yyvsp[0].nd)); + } +#line 7470 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 231: +#line 2342 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "==", (yyvsp[0].nd)); + } +#line 7478 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 232: +#line 2346 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "===", (yyvsp[0].nd)); + } +#line 7486 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 233: +#line 2350 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "!=", (yyvsp[0].nd)); + } +#line 7494 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 234: +#line 2354 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "=~", (yyvsp[0].nd)); + } +#line 7502 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 235: +#line 2358 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "!~", (yyvsp[0].nd)); + } +#line 7510 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 236: +#line 2362 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "!"); + } +#line 7518 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 237: +#line 2366 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, cond((yyvsp[0].nd)), "~"); + } +#line 7526 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 238: +#line 2370 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), "<<", (yyvsp[0].nd)); + } +#line 7534 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 239: +#line 2374 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_bin_op(p, (yyvsp[-2].nd), ">>", (yyvsp[0].nd)); + } +#line 7542 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 240: +#line 2378 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_and(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7550 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 241: +#line 2382 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_or(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7558 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 242: +#line 2386 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_if(p, cond((yyvsp[-5].nd)), (yyvsp[-3].nd), (yyvsp[0].nd)); + } +#line 7566 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 243: +#line 2390 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_if(p, cond((yyvsp[-5].nd)), (yyvsp[-3].nd), (yyvsp[0].nd)); + } +#line 7574 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 244: +#line 2394 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + endless_method_name(p, (yyvsp[-3].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defn_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[0].nd)); + nvars_unnest(p); + p->in_def--; + } +#line 7587 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 245: +#line 2403 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-5].nd); + endless_method_name(p, (yyvsp[-5].nd)); + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defn_setup(p, (yyval.nd), (yyvsp[-4].nd), new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd))); + nvars_unnest(p); + p->in_def--; + } +#line 7601 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 246: +#line 2413 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + void_expr_error(p, (yyvsp[0].nd)); + defs_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[0].nd)); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } +#line 7614 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 247: +#line 2422 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-5].nd); + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + defs_setup(p, (yyval.nd), (yyvsp[-4].nd), new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd))); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } +#line 7628 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 248: +#line 2432 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 7636 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 250: +#line 2439 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7645 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 251: +#line 2444 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd))); + } +#line 7653 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 252: +#line 2448 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(new_kw_hash(p, (yyvsp[-1].nd)), 0); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7662 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 253: +#line 2455 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 7670 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 254: +#line 2459 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = new_mod_rescue(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7680 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 255: +#line 2467 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 7688 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 256: +#line 2471 "mrbgems/mruby-compiler/core/parse.y" + { +#if 1 + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + (yyval.nd) = cons(push((yyvsp[-3].nd), new_splat(p, new_lvar(p, r))), + new_block_arg(p, new_lvar(p, b))); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + (yyval.nd) = cons(list2(push((yyvsp[-3].nd), new_splat(p, new_lvar(p, r))), + new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))), + new_block_arg(p, new_lvar(p, b))); +#endif + } +#line 7708 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 257: +#line 2487 "mrbgems/mruby-compiler/core/parse.y" + { +#if 1 + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + if (local_var_p(p, r) && local_var_p(p, b)) { + (yyval.nd) = cons(list1(new_splat(p, new_lvar(p, r))), + new_block_arg(p, new_lvar(p, b))); + } +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + if (local_var_p(p, r) && local_var_p(p, k) && local_var_p(p, b)) { + (yyval.nd) = cons(list2(new_splat(p, new_lvar(p, r)), + new_kw_hash(p, list1(cons(new_kw_rest_args(p, 0), new_lvar(p, k))))), + new_block_arg(p, new_lvar(p, b))); + } +#endif + else { + yyerror(p, "unexpected argument forwarding ..."); + (yyval.nd) = 0; + } + } +#line 7736 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 262: +#line 2519 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons((yyvsp[-1].nd),0); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7745 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 263: +#line 2524 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd))), 0); + NODE_LINENO((yyval.nd), (yyvsp[-3].nd)); + } +#line 7754 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 264: +#line 2529 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(list1(new_kw_hash(p, (yyvsp[-1].nd))), 0); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7763 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 265: +#line 2536 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(list1((yyvsp[0].nd)), 0); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 7773 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 266: +#line 2542 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons((yyvsp[-1].nd), (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7782 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 267: +#line 2547 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(list1(new_kw_hash(p, (yyvsp[-1].nd))), (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 7791 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 268: +#line 2552 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(push((yyvsp[-3].nd), new_kw_hash(p, (yyvsp[-1].nd))), (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-3].nd)); + } +#line 7800 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 269: +#line 2557 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(0, (yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 7809 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 270: +#line 2563 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.stack) = p->cmdarg_stack; + CMDARG_PUSH(1); + } +#line 7818 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 271: +#line 2568 "mrbgems/mruby-compiler/core/parse.y" + { + p->cmdarg_stack = (yyvsp[-1].stack); + (yyval.nd) = (yyvsp[0].nd); + } +#line 7827 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 272: +#line 2575 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_block_arg(p, (yyvsp[0].nd)); + } +#line 7835 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 273: +#line 2581 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 7843 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 274: +#line 2585 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 7851 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 277: +#line 2595 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons((yyvsp[0].nd), 0); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 7861 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 278: +#line 2601 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(new_splat(p, (yyvsp[0].nd)), 0); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 7871 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 279: +#line 2607 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7880 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 280: +#line 2612 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = push((yyvsp[-3].nd), new_splat(p, (yyvsp[0].nd))); + } +#line 7889 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 281: +#line 2619 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 7898 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 282: +#line 2624 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = push((yyvsp[-3].nd), new_splat(p, (yyvsp[0].nd))); + } +#line 7907 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 283: +#line 2629 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = list1(new_splat(p, (yyvsp[0].nd))); + } +#line 7916 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 291: +#line 2643 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_nvar(p, (yyvsp[0].num)); + } +#line 7924 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 292: +#line 2647 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_fcall(p, (yyvsp[0].id), 0); + } +#line 7932 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 293: +#line 2651 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.stack) = p->cmdarg_stack; + p->cmdarg_stack = 0; + } +#line 7941 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 294: +#line 2657 "mrbgems/mruby-compiler/core/parse.y" + { + p->cmdarg_stack = (yyvsp[-2].stack); + (yyval.nd) = (yyvsp[-1].nd); + } +#line 7950 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 295: +#line 2662 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.stack) = p->cmdarg_stack; + p->cmdarg_stack = 0; + } +#line 7959 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 296: +#line 2666 "mrbgems/mruby-compiler/core/parse.y" + {p->lstate = EXPR_ENDARG;} +#line 7965 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 297: +#line 2667 "mrbgems/mruby-compiler/core/parse.y" + { + p->cmdarg_stack = (yyvsp[-3].stack); + (yyval.nd) = (yyvsp[-2].nd); + } +#line 7974 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 298: +#line 2671 "mrbgems/mruby-compiler/core/parse.y" + {p->lstate = EXPR_ENDARG;} +#line 7980 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 299: +#line 2672 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_nil(p); + } +#line 7988 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 300: +#line 2676 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 7996 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 301: +#line 2680 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_colon2(p, (yyvsp[-2].nd), (yyvsp[0].id)); + } +#line 8004 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 302: +#line 2684 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_colon3(p, (yyvsp[0].id)); + } +#line 8012 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 303: +#line 2688 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_array(p, (yyvsp[-1].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 8021 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 304: +#line 2693 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_hash(p, (yyvsp[-1].nd)); + NODE_LINENO((yyval.nd), (yyvsp[-1].nd)); + } +#line 8030 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 305: +#line 2698 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_return(p, 0); + } +#line 8038 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 306: +#line 2702 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_yield(p, (yyvsp[0].nd)); + } +#line 8046 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 307: +#line 2706 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, cond((yyvsp[-1].nd)), "!"); + } +#line 8054 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 308: +#line 2710 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = call_uni_op(p, new_nil(p), "!"); + } +#line 8062 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 309: +#line 2714 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_fcall(p, (yyvsp[-1].id), cons(0, (yyvsp[0].nd))); + } +#line 8070 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 311: +#line 2719 "mrbgems/mruby-compiler/core/parse.y" + { + call_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + (yyval.nd) = (yyvsp[-1].nd); + } +#line 8079 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 312: +#line 2724 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + (yyval.num) = p->lpar_beg; + p->lpar_beg = ++p->paren_nest; + } +#line 8089 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 313: +#line 2730 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.stack) = p->cmdarg_stack; + p->cmdarg_stack = 0; + } +#line 8098 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 314: +#line 2735 "mrbgems/mruby-compiler/core/parse.y" + { + p->lpar_beg = (yyvsp[-3].num); + (yyval.nd) = new_lambda(p, (yyvsp[-2].nd), (yyvsp[0].nd)); + local_unnest(p); + p->cmdarg_stack = (yyvsp[-1].stack); + CMDARG_LEXPOP(); + } +#line 8110 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 315: +#line 2746 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_if(p, cond((yyvsp[-4].nd)), (yyvsp[-2].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-5].num)); + } +#line 8119 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 316: +#line 2754 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_unless(p, cond((yyvsp[-4].nd)), (yyvsp[-2].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-5].num)); + } +#line 8128 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 317: +#line 2758 "mrbgems/mruby-compiler/core/parse.y" + {COND_PUSH(1);} +#line 8134 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 318: +#line 2758 "mrbgems/mruby-compiler/core/parse.y" + {COND_POP();} +#line 8140 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 319: +#line 2761 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_while(p, cond((yyvsp[-4].nd)), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-6].num)); + } +#line 8149 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 320: +#line 2765 "mrbgems/mruby-compiler/core/parse.y" + {COND_PUSH(1);} +#line 8155 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 321: +#line 2765 "mrbgems/mruby-compiler/core/parse.y" + {COND_POP();} +#line 8161 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 322: +#line 2768 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_until(p, cond((yyvsp[-4].nd)), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-6].num)); + } +#line 8170 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 323: +#line 2775 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_case(p, (yyvsp[-3].nd), (yyvsp[-1].nd)); + } +#line 8178 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 324: +#line 2779 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_case(p, 0, (yyvsp[-1].nd)); + } +#line 8186 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 325: +#line 2783 "mrbgems/mruby-compiler/core/parse.y" + {COND_PUSH(1);} +#line 8192 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 326: +#line 2785 "mrbgems/mruby-compiler/core/parse.y" + {COND_POP();} +#line 8198 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 327: +#line 2788 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_for(p, (yyvsp[-7].nd), (yyvsp[-4].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-8].num)); + } +#line 8207 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 328: +#line 2794 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "class definition in method body"); + (yyval.nd) = local_switch(p); + nvars_block(p); + } +#line 8218 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 329: +#line 2802 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_class(p, (yyvsp[-4].nd), (yyvsp[-3].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-5].num)); + local_resume(p, (yyvsp[-2].nd)); + nvars_unnest(p); + } +#line 8229 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 330: +#line 2810 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.num) = p->in_def; + p->in_def = 0; + } +#line 8238 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 331: +#line 2815 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(local_switch(p), nint(p->in_single)); + nvars_block(p); + p->in_single = 0; + } +#line 8248 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 332: +#line 2822 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_sclass(p, (yyvsp[-5].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-7].num)); + local_resume(p, (yyvsp[-2].nd)->car); + nvars_unnest(p); + p->in_def = (yyvsp[-4].num); + p->in_single = intn((yyvsp[-2].nd)->cdr); + } +#line 8261 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 333: +#line 2832 "mrbgems/mruby-compiler/core/parse.y" + { + if (p->in_def || p->in_single) + yyerror(p, "module definition in method body"); + (yyval.nd) = local_switch(p); + nvars_block(p); + } +#line 8272 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 334: +#line 2840 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_module(p, (yyvsp[-3].nd), (yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-4].num)); + local_resume(p, (yyvsp[-2].nd)); + nvars_unnest(p); + } +#line 8283 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 335: +#line 2850 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + defn_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[-1].nd)); + nvars_unnest(p); + p->in_def--; + } +#line 8294 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 336: +#line 2860 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-3].nd); + defs_setup(p, (yyval.nd), (yyvsp[-2].nd), (yyvsp[-1].nd)); + nvars_unnest(p); + p->in_def--; + p->in_single--; + } +#line 8306 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 337: +#line 2868 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_break(p, 0); + } +#line 8314 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 338: +#line 2872 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_next(p, 0); + } +#line 8322 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 339: +#line 2876 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_redo(p); + } +#line 8330 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 340: +#line 2880 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_retry(p); + } +#line 8338 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 341: +#line 2886 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + if (!(yyval.nd)) (yyval.nd) = new_nil(p); + } +#line 8347 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 348: +#line 2905 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_if(p, cond((yyvsp[-3].nd)), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8355 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 350: +#line 2912 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8363 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 351: +#line 2918 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1(list1((yyvsp[0].nd))); + } +#line 8371 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 353: +#line 2925 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[0].nd),0,0); + } +#line 8379 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 354: +#line 2929 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[-3].nd), new_arg(p, (yyvsp[0].id)), 0); + } +#line 8387 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 355: +#line 2933 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[-5].nd), new_arg(p, (yyvsp[-2].id)), (yyvsp[0].nd)); + } +#line 8395 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 356: +#line 2937 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, 0); + (yyval.nd) = list3((yyvsp[-2].nd), nint(-1), 0); + } +#line 8404 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 357: +#line 2942 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3((yyvsp[-4].nd), nint(-1), (yyvsp[0].nd)); + } +#line 8412 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 358: +#line 2946 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3(0, new_arg(p, (yyvsp[0].id)), 0); + } +#line 8420 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 359: +#line 2950 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3(0, new_arg(p, (yyvsp[-2].id)), (yyvsp[0].nd)); + } +#line 8428 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 360: +#line 2954 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, 0); + (yyval.nd) = list3(0, nint(-1), 0); + } +#line 8437 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 361: +#line 2959 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, 0); + } +#line 8445 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 362: +#line 2963 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list3(0, nint(-1), (yyvsp[0].nd)); + } +#line 8453 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 363: +#line 2969 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, (yyvsp[-3].nd), (yyvsp[-1].nd), (yyvsp[0].id)); + } +#line 8461 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 364: +#line 2973 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, (yyvsp[-1].nd), 0, (yyvsp[0].id)); + } +#line 8469 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 365: +#line 2977 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, (yyvsp[-1].nd), (yyvsp[0].id)); + } +#line 8477 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 366: +#line 2981 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, 0, (yyvsp[0].id)); + } +#line 8485 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 367: +#line 2987 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8493 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 368: +#line 2991 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, 0, 0); + } +#line 8501 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 369: +#line 2997 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 8509 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 370: +#line 3001 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-7].nd), (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8517 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 371: +#line 3005 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-3].nd), (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd)); + } +#line 8525 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 372: +#line 3009 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8533 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 373: +#line 3013 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 8541 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 374: +#line 3017 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-2].nd), 0, 0, 0, (yyvsp[0].nd)); + } +#line 8549 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 375: +#line 3021 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8557 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 376: +#line 3025 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-1].nd), 0, 0, 0, (yyvsp[0].nd)); + } +#line 8565 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 377: +#line 3029 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 8573 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 378: +#line 3033 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8581 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 379: +#line 3037 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd)); + } +#line 8589 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 380: +#line 3041 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8597 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 381: +#line 3045 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 8605 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 382: +#line 3049 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8613 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 383: +#line 3053 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, 0, 0, (yyvsp[0].nd)); + } +#line 8621 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 384: +#line 3059 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_blk(p, 0); + (yyval.nd) = 0; + } +#line 8630 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 385: +#line 3064 "mrbgems/mruby-compiler/core/parse.y" + { + p->cmd_start = TRUE; + (yyval.nd) = (yyvsp[0].nd); + } +#line 8639 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 386: +#line 3070 "mrbgems/mruby-compiler/core/parse.y" + {local_add_blk(p, 0);} +#line 8645 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 387: +#line 3071 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 8653 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 388: +#line 3075 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_blk(p, 0); + (yyval.nd) = 0; + } +#line 8662 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 389: +#line 3080 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-2].nd); + } +#line 8670 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 390: +#line 3087 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 8678 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 391: +#line 3091 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 8686 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 394: +#line 3101 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, (yyvsp[0].id)); + new_bv(p, (yyvsp[0].id)); + } +#line 8695 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 396: +#line 3109 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-2].nd); + } +#line 8703 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 397: +#line 3113 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8711 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 398: +#line 3119 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 8719 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 399: +#line 3123 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 8727 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 400: +#line 3129 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + nvars_nest(p); + } +#line 8736 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 401: +#line 3136 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd)); + local_unnest(p); + nvars_unnest(p); + } +#line 8746 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 402: +#line 3144 "mrbgems/mruby-compiler/core/parse.y" + { + if (typen((yyvsp[-1].nd)->car) == NODE_YIELD) { + yyerror(p, "block given to yield"); + } + else { + call_with_block(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + } + (yyval.nd) = (yyvsp[-1].nd); + } +#line 8760 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 403: +#line 3154 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num)); + } +#line 8768 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 404: +#line 3158 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num)); + call_with_block(p, (yyval.nd), (yyvsp[0].nd)); + } +#line 8777 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 405: +#line 3163 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-4].nd), (yyvsp[-2].id), (yyvsp[-1].nd), (yyvsp[-3].num)); + call_with_block(p, (yyval.nd), (yyvsp[0].nd)); + } +#line 8786 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 406: +#line 3170 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_fcall(p, (yyvsp[-1].id), (yyvsp[0].nd)); + } +#line 8794 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 407: +#line 3174 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), (yyvsp[-2].num)); + } +#line 8802 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 408: +#line 3178 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), (yyvsp[-1].id), (yyvsp[0].nd), tCOLON2); + } +#line 8810 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 409: +#line 3182 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), (yyvsp[0].id), 0, tCOLON2); + } +#line 8818 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 410: +#line 3186 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), MRB_SYM_2(p->mrb, call), (yyvsp[0].nd), (yyvsp[-1].num)); + } +#line 8826 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 411: +#line 3190 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-2].nd), MRB_SYM_2(p->mrb, call), (yyvsp[0].nd), tCOLON2); + } +#line 8834 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 412: +#line 3194 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_super(p, (yyvsp[0].nd)); + } +#line 8842 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 413: +#line 3198 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_zsuper(p); + } +#line 8850 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 414: +#line 3202 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_call(p, (yyvsp[-3].nd), intern_op(aref), (yyvsp[-1].nd), '.'); + } +#line 8858 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 415: +#line 3208 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + nvars_nest(p); + (yyval.num) = p->lineno; + } +#line 8868 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 416: +#line 3215 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-3].num)); + local_unnest(p); + nvars_unnest(p); + } +#line 8879 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 417: +#line 3222 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + nvars_nest(p); + (yyval.num) = p->lineno; + } +#line 8889 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 418: +#line 3229 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_block(p,(yyvsp[-2].nd),(yyvsp[-1].nd)); + SET_LINENO((yyval.nd), (yyvsp[-3].num)); + local_unnest(p); + nvars_unnest(p); + } +#line 8900 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 419: +#line 3240 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = cons(cons((yyvsp[-3].nd), (yyvsp[-1].nd)), (yyvsp[0].nd)); + } +#line 8908 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 420: +#line 3246 "mrbgems/mruby-compiler/core/parse.y" + { + if ((yyvsp[0].nd)) { + (yyval.nd) = cons(cons(0, (yyvsp[0].nd)), 0); + } + else { + (yyval.nd) = 0; + } + } +#line 8921 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 422: +#line 3260 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1(list3((yyvsp[-4].nd), (yyvsp[-3].nd), (yyvsp[-1].nd))); + if ((yyvsp[0].nd)) (yyval.nd) = append((yyval.nd), (yyvsp[0].nd)); + } +#line 8930 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 424: +#line 3268 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 8938 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 427: +#line 3276 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8946 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 429: +#line 3283 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8954 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 436: +#line 3297 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = concat_string(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8962 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 439: +#line 3305 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 8970 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 440: +#line 3309 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd))); + } +#line 8978 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 442: +#line 3316 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = append((yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 8986 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 443: +#line 3322 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 8994 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 444: +#line 3326 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = p->lex_strterm; + p->lex_strterm = NULL; + } +#line 9003 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 445: +#line 3332 "mrbgems/mruby-compiler/core/parse.y" + { + p->lex_strterm = (yyvsp[-2].nd); + (yyval.nd) = list2((yyvsp[-3].nd), (yyvsp[-1].nd)); + } +#line 9012 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 446: +#line 3337 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1(new_literal_delim(p)); + } +#line 9020 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 447: +#line 3341 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1(new_literal_delim(p)); + } +#line 9028 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 448: +#line 3347 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 9036 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 449: +#line 3351 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dxstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd))); + } +#line 9044 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 450: +#line 3357 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 9052 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 451: +#line 3361 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_dregx(p, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9060 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 455: +#line 3374 "mrbgems/mruby-compiler/core/parse.y" + { + parser_heredoc_info * inf = parsing_heredoc_inf(p); + inf->doc = push(inf->doc, new_str(p, "", 0)); + heredoc_end(p); + } +#line 9070 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 456: +#line 3380 "mrbgems/mruby-compiler/core/parse.y" + { + heredoc_end(p); + } +#line 9078 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 459: +#line 3390 "mrbgems/mruby-compiler/core/parse.y" + { + parser_heredoc_info * inf = parsing_heredoc_inf(p); + inf->doc = push(inf->doc, (yyvsp[0].nd)); + heredoc_treat_nextline(p); + } +#line 9088 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 460: +#line 3396 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = p->lex_strterm; + p->lex_strterm = NULL; + } +#line 9097 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 461: +#line 3402 "mrbgems/mruby-compiler/core/parse.y" + { + parser_heredoc_info * inf = parsing_heredoc_inf(p); + p->lex_strterm = (yyvsp[-2].nd); + inf->doc = push(push(inf->doc, (yyvsp[-3].nd)), (yyvsp[-1].nd)); + } +#line 9107 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 462: +#line 3410 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_words(p, list1((yyvsp[0].nd))); + } +#line 9115 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 463: +#line 3414 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_words(p, push((yyvsp[-1].nd), (yyvsp[0].nd))); + } +#line 9123 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 464: +#line 3421 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_ENDARG; + (yyval.nd) = new_sym(p, (yyvsp[0].id)); + } +#line 9132 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 465: +#line 3426 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_ENDARG; + (yyval.nd) = new_dsym(p, new_dstr(p, push((yyvsp[-1].nd), (yyvsp[0].nd)))); + } +#line 9141 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 466: +#line 3433 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = (yyvsp[0].id); + } +#line 9149 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 471: +#line 3443 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = new_strsym(p, (yyvsp[0].nd)); + } +#line 9157 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 472: +#line 3447 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = new_strsym(p, (yyvsp[0].nd)); + } +#line 9165 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 473: +#line 3453 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_symbols(p, list1((yyvsp[0].nd))); + } +#line 9173 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 474: +#line 3457 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_symbols(p, push((yyvsp[-1].nd), (yyvsp[0].nd))); + } +#line 9181 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 477: +#line 3465 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = negate_lit(p, (yyvsp[0].nd)); + } +#line 9189 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 478: +#line 3469 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = negate_lit(p, (yyvsp[0].nd)); + } +#line 9197 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 479: +#line 3475 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_lvar(p, (yyvsp[0].id)); + } +#line 9205 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 480: +#line 3479 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_ivar(p, (yyvsp[0].id)); + } +#line 9213 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 481: +#line 3483 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_gvar(p, (yyvsp[0].id)); + } +#line 9221 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 482: +#line 3487 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_cvar(p, (yyvsp[0].id)); + } +#line 9229 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 483: +#line 3491 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_const(p, (yyvsp[0].id)); + } +#line 9237 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 484: +#line 3497 "mrbgems/mruby-compiler/core/parse.y" + { + assignable(p, (yyvsp[0].nd)); + } +#line 9245 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 485: +#line 3501 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "can't assign to numbered parameter"); + } +#line 9253 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 486: +#line 3507 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = var_reference(p, (yyvsp[0].nd)); + } +#line 9261 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 487: +#line 3511 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_nil(p); + } +#line 9269 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 488: +#line 3515 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_self(p); + } +#line 9277 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 489: +#line 3519 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_true(p); + } +#line 9285 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 490: +#line 3523 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_false(p); + } +#line 9293 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 491: +#line 3527 "mrbgems/mruby-compiler/core/parse.y" + { + const char *fn = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); + if (!fn) { + fn = "(null)"; + } + (yyval.nd) = new_str(p, fn, strlen(fn)); + } +#line 9305 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 492: +#line 3535 "mrbgems/mruby-compiler/core/parse.y" + { + char buf[16]; + + dump_int(p->lineno, buf); + (yyval.nd) = new_int(p, buf, 10, 0); + } +#line 9316 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 493: +#line 3542 "mrbgems/mruby-compiler/core/parse.y" + { +#ifdef MRB_UTF8_STRING + const char *enc = "UTF-8"; +#else + const char *enc = "ASCII-8BIT"; +#endif + (yyval.nd) = new_str(p, enc, strlen(enc)); + } +#line 9329 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 496: +#line 3557 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 9337 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 497: +#line 3561 "mrbgems/mruby-compiler/core/parse.y" + { + p->lstate = EXPR_BEG; + p->cmd_start = TRUE; + } +#line 9346 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 498: +#line 3566 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 9354 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 501: +#line 3582 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + p->lstate = EXPR_BEG; + p->cmd_start = TRUE; + } +#line 9364 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 502: +#line 3588 "mrbgems/mruby-compiler/core/parse.y" + { +#if 1 + /* til real keyword args implemented */ + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + local_add_f(p, r); + (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, r, 0, + new_args_tail(p, 0, 0, b)); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + local_add_f(p, r); local_add_f(p, k); + (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, r, 0, + new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b)); +#endif + } +#line 9386 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 503: +#line 3606 "mrbgems/mruby-compiler/core/parse.y" + { +#if 1 + /* til real keyword args implemented */ + mrb_sym r = intern_op(mul); + mrb_sym b = intern_op(and); + local_add_f(p, r); + (yyval.nd) = new_args(p, 0, 0, r, 0, + new_args_tail(p, 0, 0, b)); +#else + mrb_sym r = intern_op(mul); + mrb_sym k = intern_op(pow); + mrb_sym b = intern_op(and); + local_add_f(p, r); local_add_f(p, k); + (yyval.nd) = new_args(p, 0, 0, r, 0, + new_args_tail(p, 0, new_kw_rest_args(p, nsym(k)), b)); +#endif + } +#line 9408 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 505: +#line 3627 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 9416 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 506: +#line 3633 "mrbgems/mruby-compiler/core/parse.y" + { + local_nest(p); + } +#line 9424 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 507: +#line 3639 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = new_kw_arg(p, (yyvsp[-1].id), cons((yyvsp[0].nd), locals_node(p))); + local_unnest(p); + } +#line 9434 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 508: +#line 3645 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_kw_arg(p, (yyvsp[0].id), 0); + local_unnest(p); + } +#line 9443 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 509: +#line 3652 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_kw_arg(p, (yyvsp[-1].id), cons((yyvsp[0].nd), locals_node(p))); + local_unnest(p); + } +#line 9452 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 510: +#line 3657 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_kw_arg(p, (yyvsp[0].id), 0); + local_unnest(p); + } +#line 9461 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 511: +#line 3664 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 9469 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 512: +#line 3668 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9477 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 513: +#line 3674 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 9485 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 514: +#line 3678 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9493 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 517: +#line 3688 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_kw_rest_args(p, nsym((yyvsp[0].id))); + } +#line 9501 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 518: +#line 3692 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_kw_rest_args(p, 0); + } +#line 9509 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 519: +#line 3698 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, (yyvsp[-3].nd), (yyvsp[-1].nd), (yyvsp[0].id)); + } +#line 9517 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 520: +#line 3702 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, (yyvsp[-1].nd), 0, (yyvsp[0].id)); + } +#line 9525 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 521: +#line 3706 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, (yyvsp[-1].nd), (yyvsp[0].id)); + } +#line 9533 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 522: +#line 3710 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, 0, (yyvsp[0].id)); + } +#line 9541 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 523: +#line 3716 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + } +#line 9549 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 524: +#line 3720 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args_tail(p, 0, 0, 0); + } +#line 9557 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 525: +#line 3726 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 9565 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 526: +#line 3730 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-7].nd), (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9573 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 527: +#line 3734 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-3].nd), (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd)); + } +#line 9581 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 528: +#line 3738 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9589 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 529: +#line 3742 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-3].nd), 0, (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 9597 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 530: +#line 3746 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-5].nd), 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9605 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 531: +#line 3750 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, (yyvsp[-1].nd), 0, 0, 0, (yyvsp[0].nd)); + } +#line 9613 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 532: +#line 3754 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 9621 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 533: +#line 3758 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-5].nd), (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9629 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 534: +#line 3762 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-1].nd), 0, 0, (yyvsp[0].nd)); + } +#line 9637 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 535: +#line 3766 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, (yyvsp[-3].nd), 0, (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9645 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 536: +#line 3770 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, (yyvsp[-1].id), 0, (yyvsp[0].nd)); + } +#line 9653 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 537: +#line 3774 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, (yyvsp[-3].id), (yyvsp[-1].nd), (yyvsp[0].nd)); + } +#line 9661 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 538: +#line 3778 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_args(p, 0, 0, 0, 0, (yyvsp[0].nd)); + } +#line 9669 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 539: +#line 3782 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, intern_op(and)); + (yyval.nd) = new_args(p, 0, 0, 0, 0, 0); + } +#line 9678 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 540: +#line 3789 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "formal argument cannot be a constant"); + (yyval.nd) = 0; + } +#line 9687 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 541: +#line 3794 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "formal argument cannot be an instance variable"); + (yyval.nd) = 0; + } +#line 9696 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 542: +#line 3799 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "formal argument cannot be a global variable"); + (yyval.nd) = 0; + } +#line 9705 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 543: +#line 3804 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "formal argument cannot be a class variable"); + (yyval.nd) = 0; + } +#line 9714 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 544: +#line 3809 "mrbgems/mruby-compiler/core/parse.y" + { + yyerror(p, "formal argument cannot be a numbered parameter"); + (yyval.nd) = 0; + } +#line 9723 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 545: +#line 3816 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = 0; + } +#line 9731 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 546: +#line 3820 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, (yyvsp[0].id)); + (yyval.id) = (yyvsp[0].id); + } +#line 9740 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 547: +#line 3827 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_arg(p, (yyvsp[0].id)); + } +#line 9748 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 548: +#line 3831 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = local_switch(p); + } +#line 9756 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 549: +#line 3835 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = new_masgn_param(p, (yyvsp[-1].nd), p->locals->car); + local_resume(p, (yyvsp[-2].nd)); + local_add_f(p, 0); + } +#line 9766 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 550: +#line 3843 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 9774 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 551: +#line 3847 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9782 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 552: +#line 3853 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, (yyvsp[-1].id)); + local_nest(p); + (yyval.id) = (yyvsp[-1].id); + } +#line 9792 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 553: +#line 3861 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(nsym((yyvsp[-1].id)), cons((yyvsp[0].nd), locals_node(p))); + local_unnest(p); + } +#line 9802 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 554: +#line 3869 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(nsym((yyvsp[-1].id)), cons((yyvsp[0].nd), locals_node(p))); + local_unnest(p); + } +#line 9812 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 555: +#line 3877 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 9820 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 556: +#line 3881 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9828 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 557: +#line 3887 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + } +#line 9836 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 558: +#line 3891 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9844 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 561: +#line 3901 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, (yyvsp[0].id)); + (yyval.id) = (yyvsp[0].id); + } +#line 9853 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 562: +#line 3906 "mrbgems/mruby-compiler/core/parse.y" + { + local_add_f(p, intern_op(mul)); + (yyval.id) = -1; + } +#line 9862 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 565: +#line 3917 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = (yyvsp[0].id); + } +#line 9870 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 566: +#line 3923 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = (yyvsp[0].id); + } +#line 9878 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 567: +#line 3927 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.id) = 0; + } +#line 9886 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 568: +#line 3933 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[0].nd); + if (!(yyval.nd)) (yyval.nd) = new_nil(p); + } +#line 9895 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 569: +#line 3937 "mrbgems/mruby-compiler/core/parse.y" + {p->lstate = EXPR_BEG;} +#line 9901 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 570: +#line 3938 "mrbgems/mruby-compiler/core/parse.y" + { + if ((yyvsp[-1].nd) == 0) { + yyerror(p, "can't define singleton method for ()."); + } + else { + switch (typen((yyvsp[-1].nd)->car)) { + case NODE_STR: + case NODE_DSTR: + case NODE_XSTR: + case NODE_DXSTR: + case NODE_DREGX: + case NODE_MATCH: + case NODE_FLOAT: + case NODE_ARRAY: + case NODE_HEREDOC: + yyerror(p, "can't define singleton method for literals"); + default: + break; + } + } + (yyval.nd) = (yyvsp[-1].nd); + } +#line 9928 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 572: +#line 3964 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = (yyvsp[-1].nd); + } +#line 9936 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 573: +#line 3970 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = list1((yyvsp[0].nd)); + NODE_LINENO((yyval.nd), (yyvsp[0].nd)); + } +#line 9945 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 574: +#line 3975 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = push((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9953 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 577: +#line 3985 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[-2].nd)); + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons((yyvsp[-2].nd), (yyvsp[0].nd)); + } +#line 9963 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 578: +#line 3991 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(new_sym(p, (yyvsp[-2].id)), (yyvsp[0].nd)); + } +#line 9972 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 579: +#line 3996 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + if (typen((yyvsp[-2].nd)->car) == NODE_DSTR) { + (yyval.nd) = cons(new_dsym(p, (yyvsp[-2].nd)), (yyvsp[0].nd)); + } + else { + (yyval.nd) = cons(new_sym(p, new_strsym(p, (yyvsp[-2].nd))), (yyvsp[0].nd)); + } + } +#line 9986 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 580: +#line 4006 "mrbgems/mruby-compiler/core/parse.y" + { + void_expr_error(p, (yyvsp[0].nd)); + (yyval.nd) = cons(new_kw_rest_args(p, 0), (yyvsp[0].nd)); + } +#line 9995 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 593: +#line 4033 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.num) = '.'; + } +#line 10003 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 594: +#line 4037 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.num) = 0; + } +#line 10011 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 596: +#line 4044 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.num) = tCOLON2; + } +#line 10019 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 605: +#line 4065 "mrbgems/mruby-compiler/core/parse.y" + {yyerrok;} +#line 10025 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 608: +#line 4071 "mrbgems/mruby-compiler/core/parse.y" + { + p->lineno += (yyvsp[0].num); + p->column = 0; + } +#line 10034 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + case 611: +#line 4082 "mrbgems/mruby-compiler/core/parse.y" + { + (yyval.nd) = 0; + } +#line 10042 "mrbgems/mruby-compiler/core/y.tab.c" + break; + + +#line 10046 "mrbgems/mruby-compiler/core/y.tab.c" + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); + + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (p, 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 = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc))); + if (!yymsg) + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + yysyntax_error_status = 2; + } + else + { + yysyntax_error_status = YYSYNTAX_ERROR; + yymsgp = yymsg; + } + } + yyerror (p, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval, p); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp, p); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (p, YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + + +/*-----------------------------------------------------. +| yyreturn -- parsing is finished, return the result. | +`-----------------------------------------------------*/ +yyreturn: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval, p); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[+*yyssp], yyvsp, p); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 4086 "mrbgems/mruby-compiler/core/parse.y" + +#define pylval (*((YYSTYPE*)(p->ylval))) + +static void +yyerror(parser_state *p, const char *s) +{ + char* c; + size_t n; + + if (! p->capture_errors) { +#ifndef MRB_NO_STDIO + if (p->filename_sym) { + const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); + fprintf(stderr, "%s:%d:%d: %s\n", filename, p->lineno, p->column, s); + } + else { + fprintf(stderr, "line %d:%d: %s\n", p->lineno, p->column, s); + } +#endif + } + else if (p->nerr < sizeof(p->error_buffer) / sizeof(p->error_buffer[0])) { + n = strlen(s); + c = (char *)parser_palloc(p, n + 1); + memcpy(c, s, n + 1); + p->error_buffer[p->nerr].message = c; + p->error_buffer[p->nerr].lineno = p->lineno; + p->error_buffer[p->nerr].column = p->column; + } + p->nerr++; +} + +static void +yyerror_c(parser_state *p, const char *msg, char c) +{ + char buf[256]; + + strncpy(buf, msg, sizeof(buf) - 2); + buf[sizeof(buf) - 2] = '\0'; + strncat(buf, &c, 1); + yyerror(p, buf); +} + +static void +yywarn(parser_state *p, const char *s) +{ + char* c; + size_t n; + + if (! p->capture_errors) { +#ifndef MRB_NO_STDIO + if (p->filename_sym) { + const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL); + fprintf(stderr, "%s:%d:%d: warning: %s\n", filename, p->lineno, p->column, s); + } + else { + fprintf(stderr, "line %d:%d: warning: %s\n", p->lineno, p->column, s); + } +#endif + } + else if (p->nwarn < sizeof(p->warn_buffer) / sizeof(p->warn_buffer[0])) { + n = strlen(s); + c = (char *)parser_palloc(p, n + 1); + memcpy(c, s, n + 1); + p->warn_buffer[p->nwarn].message = c; + p->warn_buffer[p->nwarn].lineno = p->lineno; + p->warn_buffer[p->nwarn].column = p->column; + } + p->nwarn++; +} + +static void +yywarning(parser_state *p, const char *s) +{ + yywarn(p, s); +} + +static void +yywarning_s(parser_state *p, const char *msg, const char *s) +{ + char buf[256]; + + strncpy(buf, msg, sizeof(buf) - 1); + buf[sizeof(buf) - 1] = '\0'; + strncat(buf, ": ", sizeof(buf) - strlen(buf) - 1); + strncat(buf, s, sizeof(buf) - strlen(buf) - 1); + yywarning(p, buf); +} + +static void +backref_error(parser_state *p, node *n) +{ + int c; + + c = intn(n->car); + + if (c == NODE_NTH_REF) { + yyerror_c(p, "can't set variable $", (char)intn(n->cdr)+'0'); + } + else if (c == NODE_BACK_REF) { + yyerror_c(p, "can't set variable $", (char)intn(n->cdr)); + } + else { + mrb_bug(p->mrb, "Internal error in backref_error() : n=>car == %d", c); + } +} + +static void +void_expr_error(parser_state *p, node *n) +{ + int c; + + if (n == NULL) return; + c = intn(n->car); + switch (c) { + case NODE_BREAK: + case NODE_RETURN: + case NODE_NEXT: + case NODE_REDO: + case NODE_RETRY: + yyerror(p, "void value expression"); + break; + case NODE_AND: + case NODE_OR: + if (n->cdr) { + void_expr_error(p, n->cdr->car); + void_expr_error(p, n->cdr->cdr); + } + break; + case NODE_BEGIN: + if (n->cdr) { + while (n->cdr) { + n = n->cdr; + } + void_expr_error(p, n->car); + } + break; + default: + break; + } +} + +static void pushback(parser_state *p, int c); +static mrb_bool peeks(parser_state *p, const char *s); +static mrb_bool skips(parser_state *p, const char *s); + +static inline int +nextc0(parser_state *p) +{ + int c; + + if (p->s && p->s < p->send) { + c = (unsigned char)*p->s++; + } + else { +#ifndef MRB_NO_STDIO + if (p->f) { + c = fgetc(p->f); + if (feof(p->f)) return -1; + } + else +#endif + return -1; + } + return c; +} + +static inline int +nextc(parser_state *p) +{ + int c; + + if (p->pb) { + node *tmp; + + c = intn(p->pb->car); + tmp = p->pb; + p->pb = p->pb->cdr; + cons_free(tmp); + } + else { + c = nextc0(p); + if (c < 0) goto eof; + } + if (c >= 0) { + p->column++; + } + if (c == '\r') { + const int lf = nextc0(p); + if (lf == '\n') { + return '\n'; + } + if (lf > 0) pushback(p, lf); + } + return c; + + eof: + if (!p->cxt) return -1; + else { + if (p->cxt->partial_hook(p) < 0) + return -1; /* end of program(s) */ + return -2; /* end of a file in the program files */ + } +} + +static void +pushback(parser_state *p, int c) +{ + if (c >= 0) { + p->column--; + } + p->pb = cons(nint(c), p->pb); +} + +static void +skip(parser_state *p, char term) +{ + int c; + + for (;;) { + c = nextc(p); + if (c < 0) break; + if (c == term) break; + } +} + +static int +peekc_n(parser_state *p, int n) +{ + node *list = 0; + int c0; + + do { + c0 = nextc(p); + if (c0 == -1) return c0; /* do not skip partial EOF */ + if (c0 >= 0) --p->column; + list = push(list, nint(c0)); + } while(n--); + if (p->pb) { + p->pb = append(list, p->pb); + } + else { + p->pb = list; + } + return c0; +} + +static mrb_bool +peek_n(parser_state *p, int c, int n) +{ + return peekc_n(p, n) == c && c >= 0; +} +#define peek(p,c) peek_n((p), (c), 0) + +static mrb_bool +peeks(parser_state *p, const char *s) +{ + size_t len = strlen(s); + +#ifndef MRB_NO_STDIO + if (p->f) { + int n = 0; + while (*s) { + if (!peek_n(p, *s++, n++)) return FALSE; + } + return TRUE; + } + else +#endif + if (p->s && p->s + len <= p->send) { + if (memcmp(p->s, s, len) == 0) return TRUE; + } + return FALSE; +} + +static mrb_bool +skips(parser_state *p, const char *s) +{ + int c; + + for (;;) { + /* skip until first char */ + for (;;) { + c = nextc(p); + if (c < 0) return FALSE; + if (c == '\n') { + p->lineno++; + p->column = 0; + } + if (c == *s) break; + } + s++; + if (peeks(p, s)) { + size_t len = strlen(s); + + while (len--) { + if (nextc(p) == '\n') { + p->lineno++; + p->column = 0; + } + } + return TRUE; + } + else{ + s--; + } + } + return FALSE; +} + + +static int +newtok(parser_state *p) +{ + if (p->tokbuf != p->buf) { + mrb_free(p->mrb, p->tokbuf); + p->tokbuf = p->buf; + p->tsiz = MRB_PARSER_TOKBUF_SIZE; + } + p->tidx = 0; + return p->column - 1; +} + +static void +tokadd(parser_state *p, int32_t c) +{ + char utf8[4]; + int i, len; + + /* mrb_assert(-0x10FFFF <= c && c <= 0xFF); */ + if (c >= 0) { + /* Single byte from source or non-Unicode escape */ + utf8[0] = (char)c; + len = 1; + } + else { + /* Unicode character */ + c = -c; + if (c < 0x80) { + utf8[0] = (char)c; + len = 1; + } + else if (c < 0x800) { + utf8[0] = (char)(0xC0 | (c >> 6)); + utf8[1] = (char)(0x80 | (c & 0x3F)); + len = 2; + } + else if (c < 0x10000) { + utf8[0] = (char)(0xE0 | (c >> 12) ); + utf8[1] = (char)(0x80 | ((c >> 6) & 0x3F)); + utf8[2] = (char)(0x80 | ( c & 0x3F)); + len = 3; + } + else { + utf8[0] = (char)(0xF0 | (c >> 18) ); + utf8[1] = (char)(0x80 | ((c >> 12) & 0x3F)); + utf8[2] = (char)(0x80 | ((c >> 6) & 0x3F)); + utf8[3] = (char)(0x80 | ( c & 0x3F)); + len = 4; + } + } + if (p->tidx+len >= p->tsiz) { + if (p->tsiz >= MRB_PARSER_TOKBUF_MAX) { + p->tidx += len; + return; + } + p->tsiz *= 2; + if (p->tokbuf == p->buf) { + p->tokbuf = (char*)mrb_malloc(p->mrb, p->tsiz); + memcpy(p->tokbuf, p->buf, MRB_PARSER_TOKBUF_SIZE); + } + else { + p->tokbuf = (char*)mrb_realloc(p->mrb, p->tokbuf, p->tsiz); + } + } + for (i = 0; i < len; i++) { + p->tokbuf[p->tidx++] = utf8[i]; + } +} + +static int +toklast(parser_state *p) +{ + return p->tokbuf[p->tidx-1]; +} + +static void +tokfix(parser_state *p) +{ + if (p->tidx >= MRB_PARSER_TOKBUF_MAX) { + p->tidx = MRB_PARSER_TOKBUF_MAX-1; + yyerror(p, "string too long (truncated)"); + } + p->tokbuf[p->tidx] = '\0'; +} + +static const char* +tok(parser_state *p) +{ + return p->tokbuf; +} + +static int +toklen(parser_state *p) +{ + return p->tidx; +} + +#define IS_ARG() (p->lstate == EXPR_ARG || p->lstate == EXPR_CMDARG) +#define IS_END() (p->lstate == EXPR_END || p->lstate == EXPR_ENDARG || p->lstate == EXPR_ENDFN) +#define IS_BEG() (p->lstate == EXPR_BEG || p->lstate == EXPR_MID || p->lstate == EXPR_VALUE || p->lstate == EXPR_CLASS) +#define IS_SPCARG(c) (IS_ARG() && space_seen && !ISSPACE(c)) +#define IS_LABEL_POSSIBLE() ((p->lstate == EXPR_BEG && !cmd_state) || IS_ARG()) +#define IS_LABEL_SUFFIX(n) (peek_n(p, ':',(n)) && !peek_n(p, ':', (n)+1)) + +static int32_t +scan_oct(const int *start, int len, int *retlen) +{ + const int *s = start; + int32_t retval = 0; + + /* mrb_assert(len <= 3) */ + while (len-- && *s >= '0' && *s <= '7') { + retval <<= 3; + retval |= *s++ - '0'; + } + *retlen = (int)(s - start); + + return retval; +} + +static int32_t +scan_hex(parser_state *p, const int *start, int len, int *retlen) +{ + static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; + const int *s = start; + uint32_t retval = 0; + char *tmp; + + /* mrb_assert(len <= 8) */ + while (len-- && *s && (tmp = (char*)strchr(hexdigit, *s))) { + retval <<= 4; + retval |= (tmp - hexdigit) & 15; + s++; + } + *retlen = (int)(s - start); + + return (int32_t)retval; +} + +static int32_t +read_escape_unicode(parser_state *p, int limit) +{ + int buf[9]; + int i; + int32_t hex; + + /* Look for opening brace */ + i = 0; + buf[0] = nextc(p); + if (buf[0] < 0) { + eof: + yyerror(p, "invalid escape character syntax"); + return -1; + } + if (ISXDIGIT(buf[0])) { + /* \uxxxx form */ + for (i=1; i<limit; i++) { + buf[i] = nextc(p); + if (buf[i] < 0) goto eof; + if (!ISXDIGIT(buf[i])) { + pushback(p, buf[i]); + break; + } + } + } + else { + pushback(p, buf[0]); + } + hex = scan_hex(p, buf, i, &i); + if (i == 0 || hex > 0x10FFFF || (hex & 0xFFFFF800) == 0xD800) { + yyerror(p, "invalid Unicode code point"); + return -1; + } + return hex; +} + +/* Return negative to indicate Unicode code point */ +static int32_t +read_escape(parser_state *p) +{ + int32_t c; + + switch (c = nextc(p)) { + case '\\':/* Backslash */ + return c; + + case 'n':/* newline */ + return '\n'; + + case 't':/* horizontal tab */ + return '\t'; + + case 'r':/* carriage-return */ + return '\r'; + + case 'f':/* form-feed */ + return '\f'; + + case 'v':/* vertical tab */ + return '\13'; + + case 'a':/* alarm(bell) */ + return '\007'; + + case 'e':/* escape */ + return 033; + + case '0': case '1': case '2': case '3': /* octal constant */ + case '4': case '5': case '6': case '7': + { + int buf[3]; + int i; + + buf[0] = c; + for (i=1; i<3; i++) { + buf[i] = nextc(p); + if (buf[i] < 0) goto eof; + if (buf[i] < '0' || '7' < buf[i]) { + pushback(p, buf[i]); + break; + } + } + c = scan_oct(buf, i, &i); + } + return c; + + case 'x': /* hex constant */ + { + int buf[2]; + int i; + + for (i=0; i<2; i++) { + buf[i] = nextc(p); + if (buf[i] < 0) goto eof; + if (!ISXDIGIT(buf[i])) { + pushback(p, buf[i]); + break; + } + } + if (i == 0) { + yyerror(p, "invalid hex escape"); + return -1; + } + return scan_hex(p, buf, i, &i); + } + + case 'u': /* Unicode */ + if (peek(p, '{')) { + /* \u{xxxxxxxx} form */ + nextc(p); + c = read_escape_unicode(p, 8); + if (c < 0) return 0; + if (nextc(p) != '}') goto eof; + } + else { + c = read_escape_unicode(p, 4); + if (c < 0) return 0; + } + return -c; + + case 'b':/* backspace */ + return '\010'; + + case 's':/* space */ + return ' '; + + case 'M': + if ((c = nextc(p)) != '-') { + yyerror(p, "Invalid escape character syntax"); + pushback(p, c); + return '\0'; + } + if ((c = nextc(p)) == '\\') { + return read_escape(p) | 0x80; + } + else if (c < 0) goto eof; + else { + return ((c & 0xff) | 0x80); + } + + case 'C': + if ((c = nextc(p)) != '-') { + yyerror(p, "Invalid escape character syntax"); + pushback(p, c); + return '\0'; + } + case 'c': + if ((c = nextc(p))== '\\') { + c = read_escape(p); + } + else if (c == '?') + return 0177; + else if (c < 0) goto eof; + return c & 0x9f; + + eof: + case -1: + case -2: /* end of a file */ + yyerror(p, "Invalid escape character syntax"); + return '\0'; + + default: + return c; + } +} + +static void +heredoc_count_indent(parser_heredoc_info *hinf, const char *str, size_t len, size_t spaces, size_t *offset) +{ + size_t indent = 0; + *offset = 0; + for (size_t i = 0; i < len; i++) { + size_t size; + if (str[i] == '\n') + break; + else if (str[i] == '\t') + size = 8; + else if (ISSPACE(str[i])) + size = 1; + else + break; + size_t nindent = indent + size; + if (nindent > spaces || nindent > hinf->indent) + break; + indent = nindent; + *offset += 1; + } +} + +static void +heredoc_remove_indent(parser_state *p, parser_heredoc_info *hinf) +{ + if (!hinf->remove_indent || hinf->indent == 0) + return; + node *indented, *n, *pair, *escaped, *nspaces; + const char *str; + size_t len, spaces, offset, start, end; + indented = hinf->indented; + while (indented) { + n = indented->car; + pair = n->car; + str = (char*)pair->car; + len = (size_t)pair->cdr; + escaped = n->cdr->car; + nspaces = n->cdr->cdr; + if (escaped) { + char *newstr = strndup(str, len); + size_t newlen = 0; + start = 0; + while (start < len) { + end = escaped ? (size_t)escaped->car : len; + if (end > len) end = len; + spaces = (size_t)nspaces->car; + size_t esclen = end - start; + heredoc_count_indent(hinf, str + start, esclen, spaces, &offset); + esclen -= offset; + memcpy(newstr + newlen, str + start + offset, esclen); + newlen += esclen; + start = end; + if (escaped) + escaped = escaped->cdr; + nspaces = nspaces->cdr; + } + if (newlen < len) + newstr[newlen] = '\0'; + pair->car = (node*)newstr; + pair->cdr = (node*)newlen; + } else { + spaces = (size_t)nspaces->car; + heredoc_count_indent(hinf, str, len, spaces, &offset); + pair->car = (node*)(str + offset); + pair->cdr = (node*)(len - offset); + } + indented = indented->cdr; + } +} + +static void +heredoc_push_indented(parser_state *p, parser_heredoc_info *hinf, node *pair, node *escaped, node *nspaces, mrb_bool empty_line) +{ + hinf->indented = push(hinf->indented, cons(pair, cons(escaped, nspaces))); + while (nspaces) { + size_t tspaces = (size_t)nspaces->car; + if ((hinf->indent == ~0U || tspaces < hinf->indent) && !empty_line) + hinf->indent = tspaces; + nspaces = nspaces->cdr; + } +} + +static int +parse_string(parser_state *p) +{ + int c; + string_type type = (string_type)(intptr_t)p->lex_strterm->car; + int nest_level = intn(p->lex_strterm->cdr->car); + int beg = intn(p->lex_strterm->cdr->cdr->car); + int end = intn(p->lex_strterm->cdr->cdr->cdr); + parser_heredoc_info *hinf = (type & STR_FUNC_HEREDOC) ? parsing_heredoc_inf(p) : NULL; + + mrb_bool unindent = hinf && hinf->remove_indent; + mrb_bool head = hinf && hinf->line_head; + mrb_bool empty = TRUE; + size_t spaces = 0; + size_t pos = -1; + node *escaped = NULL; + node *nspaces = NULL; + + if (beg == 0) beg = -3; /* should never happen */ + if (end == 0) end = -3; + newtok(p); + while ((c = nextc(p)) != end || nest_level != 0) { + pos++; + if (hinf && (c == '\n' || c < 0)) { + mrb_bool line_head; + tokadd(p, '\n'); + tokfix(p); + p->lineno++; + p->column = 0; + line_head = hinf->line_head; + hinf->line_head = TRUE; + if (line_head) { + /* check whether end of heredoc */ + const char *s = tok(p); + int len = toklen(p); + if (hinf->allow_indent) { + while (ISSPACE(*s) && len > 0) { + ++s; + --len; + } + } + if ((len-1 == hinf->term_len) && (strncmp(s, hinf->term, len-1) == 0)) { + heredoc_remove_indent(p, hinf); + return tHEREDOC_END; + } + } + if (c < 0) { + char buf[256]; + const char s1[] = "can't find heredoc delimiter \""; + const char s2[] = "\" anywhere before EOF"; + + if (sizeof(s1)+sizeof(s2)+strlen(hinf->term)+1 >= sizeof(buf)) { + yyerror(p, "can't find heredoc delimiter anywhere before EOF"); + } else { + strcpy(buf, s1); + strcat(buf, hinf->term); + strcat(buf, s2); + yyerror(p, buf); + } + return 0; + } + node *nd = new_str(p, tok(p), toklen(p)); + pylval.nd = nd; + if (unindent && head) { + nspaces = push(nspaces, nint(spaces)); + heredoc_push_indented(p, hinf, nd->cdr, escaped, nspaces, empty && line_head); + } + return tHD_STRING_MID; + } + if (unindent && empty) { + if (c == '\t') + spaces += 8; + else if (ISSPACE(c)) + ++spaces; + else + empty = FALSE; + } + if (c < 0) { + yyerror(p, "unterminated string meets end of file"); + return 0; + } + else if (c == beg) { + nest_level++; + p->lex_strterm->cdr->car = nint(nest_level); + } + else if (c == end) { + nest_level--; + p->lex_strterm->cdr->car = nint(nest_level); + } + else if (c == '\\') { + c = nextc(p); + if (type & STR_FUNC_EXPAND) { + if (c == end || c == beg) { + tokadd(p, c); + } + else if (c == '\n') { + p->lineno++; + p->column = 0; + if (unindent) { + nspaces = push(nspaces, nint(spaces)); + escaped = push(escaped, nint(pos)); + pos--; + empty = TRUE; + spaces = 0; + } + if (type & STR_FUNC_ARRAY) { + tokadd(p, '\n'); + } + } + else if (type & STR_FUNC_REGEXP) { + tokadd(p, '\\'); + tokadd(p, c); + } + else if (c == 'u' && peek(p, '{')) { + /* \u{xxxx xxxx xxxx} form */ + nextc(p); + while (1) { + do c = nextc(p); while (ISSPACE(c)); + if (c == '}') break; + pushback(p, c); + c = read_escape_unicode(p, 8); + if (c < 0) break; + tokadd(p, -c); + } + if (hinf) + hinf->line_head = FALSE; + } + else { + pushback(p, c); + tokadd(p, read_escape(p)); + if (hinf) + hinf->line_head = FALSE; + } + } + else { + if (c != beg && c != end) { + if (c == '\n') { + p->lineno++; + p->column = 0; + } + if (!(c == '\\' || ((type & STR_FUNC_ARRAY) && ISSPACE(c)))) { + tokadd(p, '\\'); + } + } + tokadd(p, c); + } + continue; + } + else if ((c == '#') && (type & STR_FUNC_EXPAND)) { + c = nextc(p); + if (c == '{') { + tokfix(p); + p->lstate = EXPR_BEG; + p->cmd_start = TRUE; + node *nd = new_str(p, tok(p), toklen(p)); + pylval.nd = nd; + if (hinf) { + if (unindent && head) { + nspaces = push(nspaces, nint(spaces)); + heredoc_push_indented(p, hinf, nd->cdr, escaped, nspaces, FALSE); + } + hinf->line_head = FALSE; + return tHD_STRING_PART; + } + return tSTRING_PART; + } + tokadd(p, '#'); + pushback(p, c); + continue; + } + if ((type & STR_FUNC_ARRAY) && ISSPACE(c)) { + if (toklen(p) == 0) { + do { + if (c == '\n') { + p->lineno++; + p->column = 0; + heredoc_treat_nextline(p); + if (p->parsing_heredoc != NULL) { + return tHD_LITERAL_DELIM; + } + } + c = nextc(p); + } while (ISSPACE(c)); + pushback(p, c); + return tLITERAL_DELIM; + } + else { + pushback(p, c); + tokfix(p); + pylval.nd = new_str(p, tok(p), toklen(p)); + return tSTRING_MID; + } + } + if (c == '\n') { + p->lineno++; + p->column = 0; + } + tokadd(p, c); + } + + tokfix(p); + p->lstate = EXPR_ENDARG; + end_strterm(p); + + if (type & STR_FUNC_XQUOTE) { + pylval.nd = new_xstr(p, tok(p), toklen(p)); + return tXSTRING; + } + + if (type & STR_FUNC_REGEXP) { + int f = 0; + int re_opt; + char *s = strndup(tok(p), toklen(p)); + char flags[3]; + char *flag = flags; + char enc = '\0'; + char *encp; + char *dup; + + newtok(p); + while (re_opt = nextc(p), re_opt >= 0 && ISALPHA(re_opt)) { + switch (re_opt) { + case 'i': f |= 1; break; + case 'x': f |= 2; break; + case 'm': f |= 4; break; + case 'u': f |= 16; break; + case 'n': f |= 32; break; + case 'o': break; + default: tokadd(p, re_opt); break; + } + } + pushback(p, re_opt); + if (toklen(p)) { + char msg[128]; + + strcpy(msg, "unknown regexp option"); + tokfix(p); + if (toklen(p) > 1) { + strcat(msg, "s"); + } + strcat(msg, " - "); + strncat(msg, tok(p), sizeof(msg) - strlen(msg) - 1); + yyerror(p, msg); + } + if (f != 0) { + if (f & 1) *flag++ = 'i'; + if (f & 2) *flag++ = 'x'; + if (f & 4) *flag++ = 'm'; + if (f & 16) enc = 'u'; + if (f & 32) enc = 'n'; + } + if (flag > flags) { + dup = strndup(flags, (size_t)(flag - flags)); + } + else { + dup = NULL; + } + if (enc) { + encp = strndup(&enc, 1); + } + else { + encp = NULL; + } + pylval.nd = new_regx(p, s, dup, encp); + + return tREGEXP; + } + pylval.nd = new_str(p, tok(p), toklen(p)); + + return tSTRING; +} + +static int +number_literal_suffix(parser_state *p) +{ + int c, result = 0; + node *list = 0; + int column = p->column; + int mask = NUM_SUFFIX_R|NUM_SUFFIX_I; + + while ((c = nextc(p)) != -1) { + list = push(list, nint(c)); + + if ((mask & NUM_SUFFIX_I) && c == 'i') { + result |= (mask & NUM_SUFFIX_I); + mask &= ~NUM_SUFFIX_I; + /* r after i, rational of complex is disallowed */ + mask &= ~NUM_SUFFIX_R; + continue; + } + if ((mask & NUM_SUFFIX_R) && c == 'r') { + result |= (mask & NUM_SUFFIX_R); + mask &= ~NUM_SUFFIX_R; + continue; + } + if (!ISASCII(c) || ISALPHA(c) || c == '_') { + p->column = column; + if (p->pb) { + p->pb = append(list, p->pb); + } + else { + p->pb = list; + } + return 0; + } + pushback(p, c); + break; + } + return result; +} + +static int +heredoc_identifier(parser_state *p) +{ + int c; + int type = str_heredoc; + mrb_bool indent = FALSE; + mrb_bool squiggly = FALSE; + mrb_bool quote = FALSE; + node *newnode; + parser_heredoc_info *info; + + c = nextc(p); + if (ISSPACE(c) || c == '=') { + pushback(p, c); + return 0; + } + if (c == '-' || c == '~') { + if (c == '-') + indent = TRUE; + if (c == '~') + squiggly = TRUE; + c = nextc(p); + } + if (c == '\'' || c == '"') { + int term = c; + if (c == '\'') + quote = TRUE; + newtok(p); + while ((c = nextc(p)) >= 0 && c != term) { + if (c == '\n') { + c = -1; + break; + } + tokadd(p, c); + } + if (c < 0) { + yyerror(p, "unterminated here document identifier"); + return 0; + } + } + else { + if (c < 0) { + return 0; /* missing here document identifier */ + } + if (! identchar(c)) { + pushback(p, c); + if (indent) pushback(p, '-'); + if (squiggly) pushback(p, '~'); + return 0; + } + newtok(p); + do { + tokadd(p, c); + } while ((c = nextc(p)) >= 0 && identchar(c)); + pushback(p, c); + } + tokfix(p); + newnode = new_heredoc(p); + info = (parser_heredoc_info*)newnode->cdr; + info->term = strndup(tok(p), toklen(p)); + info->term_len = toklen(p); + if (! quote) + type |= STR_FUNC_EXPAND; + info->type = (string_type)type; + info->allow_indent = indent || squiggly; + info->remove_indent = squiggly; + info->indent = ~0U; + info->indented = NULL; + info->line_head = TRUE; + info->doc = NULL; + p->heredocs_from_nextline = push(p->heredocs_from_nextline, newnode); + p->lstate = EXPR_END; + + pylval.nd = newnode; + return tHEREDOC_BEG; +} + +static int +arg_ambiguous(parser_state *p) +{ + yywarning(p, "ambiguous first argument; put parentheses or even spaces"); + return 1; +} + +#include "lex.def" + +static int +parser_yylex(parser_state *p) +{ + int32_t c; + int nlines = 1; + int space_seen = 0; + int cmd_state; + enum mrb_lex_state_enum last_state; + int token_column; + + if (p->lex_strterm) { + if (is_strterm_type(p, STR_FUNC_HEREDOC)) { + if (p->parsing_heredoc != NULL) + return parse_string(p); + } + else + return parse_string(p); + } + cmd_state = p->cmd_start; + p->cmd_start = FALSE; + retry: + last_state = p->lstate; + switch (c = nextc(p)) { + case '\004': /* ^D */ + case '\032': /* ^Z */ + case '\0': /* NUL */ + case -1: /* end of script. */ + if (p->heredocs_from_nextline) + goto maybe_heredoc; + return 0; + + /* white spaces */ + case ' ': case '\t': case '\f': case '\r': + case '\13': /* '\v' */ + space_seen = 1; + goto retry; + + case '#': /* it's a comment */ + skip(p, '\n'); + /* fall through */ + case -2: /* end of a file */ + case '\n': + maybe_heredoc: + heredoc_treat_nextline(p); + p->column = 0; + switch (p->lstate) { + case EXPR_BEG: + case EXPR_FNAME: + case EXPR_DOT: + case EXPR_CLASS: + case EXPR_VALUE: + p->lineno++; + if (p->parsing_heredoc != NULL) { + if (p->lex_strterm) { + return parse_string(p); + } + } + goto retry; + default: + break; + } + if (p->parsing_heredoc != NULL) { + pylval.num = nlines; + return '\n'; + } + while ((c = nextc(p))) { + switch (c) { + case ' ': case '\t': case '\f': case '\r': + case '\13': /* '\v' */ + space_seen = 1; + break; + case '#': /* comment as a whitespace */ + skip(p, '\n'); + nlines++; + break; + case '.': + if (!peek(p, '.')) { + pushback(p, '.'); + p->lineno+=nlines; nlines=1; + goto retry; + } + pushback(p, c); + goto normal_newline; + case '&': + if (peek(p, '.')) { + pushback(p, '&'); + p->lineno+=nlines; nlines=1; + goto retry; + } + pushback(p, c); + goto normal_newline; + case -1: /* EOF */ + case -2: /* end of a file */ + goto normal_newline; + default: + pushback(p, c); + goto normal_newline; + } + } + normal_newline: + p->cmd_start = TRUE; + p->lstate = EXPR_BEG; + pylval.num = nlines; + return '\n'; + + case '*': + if ((c = nextc(p)) == '*') { + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(pow); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + if (IS_SPCARG(c)) { + yywarning(p, "'**' interpreted as argument prefix"); + c = tDSTAR; + } + else if (IS_BEG()) { + c = tDSTAR; + } + else { + c = tPOW; /* "**", "argument prefix" */ + } + } + else { + if (c == '=') { + pylval.id = intern_op(mul); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + if (IS_SPCARG(c)) { + yywarning(p, "'*' interpreted as argument prefix"); + c = tSTAR; + } + else if (IS_BEG()) { + c = tSTAR; + } + else { + c = '*'; + } + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + return c; + + case '!': + c = nextc(p); + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + if (c == '@') { + return '!'; + } + } + else { + p->lstate = EXPR_BEG; + } + if (c == '=') { + return tNEQ; + } + if (c == '~') { + return tNMATCH; + } + pushback(p, c); + return '!'; + + case '=': + if (p->column == 1) { + static const char begin[] = "begin"; + static const char end[] = "\n=end"; + if (peeks(p, begin)) { + c = peekc_n(p, sizeof(begin)-1); + if (c < 0 || ISSPACE(c)) { + do { + if (!skips(p, end)) { + yyerror(p, "embedded document meets end of file"); + return 0; + } + c = nextc(p); + } while (!(c < 0 || ISSPACE(c))); + if (c != '\n') skip(p, '\n'); + p->lineno+=nlines; nlines=1; + p->column = 0; + goto retry; + } + } + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + if ((c = nextc(p)) == '=') { + if ((c = nextc(p)) == '=') { + return tEQQ; + } + pushback(p, c); + return tEQ; + } + if (c == '~') { + return tMATCH; + } + else if (c == '>') { + return tASSOC; + } + pushback(p, c); + return '='; + + case '<': + c = nextc(p); + if (c == '<' && + p->lstate != EXPR_DOT && + p->lstate != EXPR_CLASS && + !IS_END() && + (!IS_ARG() || space_seen)) { + int token = heredoc_identifier(p); + if (token) + return token; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + if (p->lstate == EXPR_CLASS) { + p->cmd_start = TRUE; + } + } + if (c == '=') { + if ((c = nextc(p)) == '>') { + return tCMP; + } + pushback(p, c); + return tLEQ; + } + if (c == '<') { + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(lshift); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + return tLSHFT; + } + pushback(p, c); + return '<'; + + case '>': + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + if ((c = nextc(p)) == '=') { + return tGEQ; + } + if (c == '>') { + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(rshift); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + return tRSHFT; + } + pushback(p, c); + return '>'; + + case '"': + p->lex_strterm = new_strterm(p, str_dquote, '"', 0); + return tSTRING_BEG; + + case '\'': + p->lex_strterm = new_strterm(p, str_squote, '\'', 0); + return parse_string(p); + + case '`': + if (p->lstate == EXPR_FNAME) { + p->lstate = EXPR_ENDFN; + return '`'; + } + if (p->lstate == EXPR_DOT) { + if (cmd_state) + p->lstate = EXPR_CMDARG; + else + p->lstate = EXPR_ARG; + return '`'; + } + p->lex_strterm = new_strterm(p, str_xquote, '`', 0); + return tXSTRING_BEG; + + case '?': + if (IS_END()) { + p->lstate = EXPR_VALUE; + return '?'; + } + c = nextc(p); + if (c < 0) { + yyerror(p, "incomplete character syntax"); + return 0; + } + if (ISSPACE(c)) { + if (!IS_ARG()) { + int c2; + switch (c) { + case ' ': + c2 = 's'; + break; + case '\n': + c2 = 'n'; + break; + case '\t': + c2 = 't'; + break; + case '\v': + c2 = 'v'; + break; + case '\r': + c2 = 'r'; + break; + case '\f': + c2 = 'f'; + break; + default: + c2 = 0; + break; + } + if (c2) { + char buf[256]; + char cc[] = { (char)c2, '\0' }; + + strcpy(buf, "invalid character syntax; use ?\\"); + strncat(buf, cc, 2); + yyerror(p, buf); + } + } + ternary: + pushback(p, c); + p->lstate = EXPR_VALUE; + return '?'; + } + newtok(p); + /* need support UTF-8 if configured */ + if ((ISALNUM(c) || c == '_')) { + int c2 = nextc(p); + pushback(p, c2); + if ((ISALNUM(c2) || c2 == '_')) { + goto ternary; + } + } + if (c == '\\') { + c = read_escape(p); + tokadd(p, c); + } + else { + tokadd(p, c); + } + tokfix(p); + pylval.nd = new_str(p, tok(p), toklen(p)); + p->lstate = EXPR_ENDARG; + return tCHAR; + + case '&': + if ((c = nextc(p)) == '&') { + p->lstate = EXPR_BEG; + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(andand); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + return tANDOP; + } + else if (c == '.') { + p->lstate = EXPR_DOT; + return tANDDOT; + } + else if (c == '=') { + pylval.id = intern_op(and); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + if (IS_SPCARG(c)) { + yywarning(p, "'&' interpreted as argument prefix"); + c = tAMPER; + } + else if (IS_BEG()) { + c = tAMPER; + } + else { + c = '&'; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + return c; + + case '|': + if ((c = nextc(p)) == '|') { + p->lstate = EXPR_BEG; + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(oror); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + return tOROP; + } + if (c == '=') { + pylval.id = intern_op(or); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + pushback(p, c); + return '|'; + + case '+': + c = nextc(p); + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + if (c == '@') { + return tUPLUS; + } + pushback(p, c); + return '+'; + } + if (c == '=') { + pylval.id = intern_op(add); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous(p))) { + p->lstate = EXPR_BEG; + pushback(p, c); + if (c >= 0 && ISDIGIT(c)) { + c = '+'; + goto start_num; + } + return tUPLUS; + } + p->lstate = EXPR_BEG; + pushback(p, c); + return '+'; + + case '-': + c = nextc(p); + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + if (c == '@') { + return tUMINUS; + } + pushback(p, c); + return '-'; + } + if (c == '=') { + pylval.id = intern_op(sub); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + if (c == '>') { + p->lstate = EXPR_ENDFN; + return tLAMBDA; + } + if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous(p))) { + p->lstate = EXPR_BEG; + pushback(p, c); + if (c >= 0 && ISDIGIT(c)) { + return tUMINUS_NUM; + } + return tUMINUS; + } + p->lstate = EXPR_BEG; + pushback(p, c); + return '-'; + + case '.': + { + int is_beg = IS_BEG(); + p->lstate = EXPR_BEG; + if ((c = nextc(p)) == '.') { + if ((c = nextc(p)) == '.') { + return is_beg ? tBDOT3 : tDOT3; + } + pushback(p, c); + return is_beg ? tBDOT2 : tDOT2; + } + pushback(p, c); + if (c >= 0 && ISDIGIT(c)) { + yyerror(p, "no .<digit> floating literal anymore; put 0 before dot"); + } + p->lstate = EXPR_DOT; + return '.'; + } + + start_num: + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + { + int is_float, seen_point, seen_e, nondigit; + int suffix = 0; + + is_float = seen_point = seen_e = nondigit = 0; + p->lstate = EXPR_ENDARG; + newtok(p); + if (c == '-' || c == '+') { + tokadd(p, c); + c = nextc(p); + } + if (c == '0') { +#define no_digits() do {yyerror(p,"numeric literal without digits"); return 0;} while (0) + int start = toklen(p); + c = nextc(p); + if (c == 'x' || c == 'X') { + /* hexadecimal */ + c = nextc(p); + if (c >= 0 && ISXDIGIT(c)) { + do { + if (c == '_') { + if (nondigit) break; + nondigit = c; + continue; + } + if (!ISXDIGIT(c)) break; + nondigit = 0; + tokadd(p, tolower(c)); + } while ((c = nextc(p)) >= 0); + } + pushback(p, c); + tokfix(p); + if (toklen(p) == start) { + no_digits(); + } + else if (nondigit) goto trailing_uc; + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 16, suffix); + return tINTEGER; + } + if (c == 'b' || c == 'B') { + /* binary */ + c = nextc(p); + if (c == '0' || c == '1') { + do { + if (c == '_') { + if (nondigit) break; + nondigit = c; + continue; + } + if (c != '0' && c != '1') break; + nondigit = 0; + tokadd(p, c); + } while ((c = nextc(p)) >= 0); + } + pushback(p, c); + tokfix(p); + if (toklen(p) == start) { + no_digits(); + } + else if (nondigit) goto trailing_uc; + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 2, suffix); + return tINTEGER; + } + if (c == 'd' || c == 'D') { + /* decimal */ + c = nextc(p); + if (c >= 0 && ISDIGIT(c)) { + do { + if (c == '_') { + if (nondigit) break; + nondigit = c; + continue; + } + if (!ISDIGIT(c)) break; + nondigit = 0; + tokadd(p, c); + } while ((c = nextc(p)) >= 0); + } + pushback(p, c); + tokfix(p); + if (toklen(p) == start) { + no_digits(); + } + else if (nondigit) goto trailing_uc; + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 10, suffix); + return tINTEGER; + } + if (c == '_') { + /* 0_0 */ + goto octal_number; + } + if (c == 'o' || c == 'O') { + /* prefixed octal */ + c = nextc(p); + if (c < 0 || c == '_' || !ISDIGIT(c)) { + no_digits(); + } + } + if (c >= '0' && c <= '7') { + /* octal */ + octal_number: + do { + if (c == '_') { + if (nondigit) break; + nondigit = c; + continue; + } + if (c < '0' || c > '9') break; + if (c > '7') goto invalid_octal; + nondigit = 0; + tokadd(p, c); + } while ((c = nextc(p)) >= 0); + + if (toklen(p) > start) { + pushback(p, c); + tokfix(p); + if (nondigit) goto trailing_uc; + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 8, suffix); + return tINTEGER; + } + if (nondigit) { + pushback(p, c); + goto trailing_uc; + } + } + if (c > '7' && c <= '9') { + invalid_octal: + yyerror(p, "Invalid octal digit"); + } + else if (c == '.' || c == 'e' || c == 'E') { + tokadd(p, '0'); + } + else { + pushback(p, c); + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, "0", 10, suffix); + return tINTEGER; + } + } + + for (;;) { + switch (c) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + nondigit = 0; + tokadd(p, c); + break; + + case '.': + if (nondigit) goto trailing_uc; + if (seen_point || seen_e) { + goto decode_num; + } + else { + int c0 = nextc(p); + if (c0 < 0 || !ISDIGIT(c0)) { + pushback(p, c0); + goto decode_num; + } + c = c0; + } + tokadd(p, '.'); + tokadd(p, c); + is_float++; + seen_point++; + nondigit = 0; + break; + + case 'e': + case 'E': + if (nondigit) { + pushback(p, c); + c = nondigit; + goto decode_num; + } + if (seen_e) { + goto decode_num; + } + tokadd(p, c); + seen_e++; + is_float++; + nondigit = c; + c = nextc(p); + if (c != '-' && c != '+') continue; + tokadd(p, c); + nondigit = c; + break; + + case '_': /* '_' in number just ignored */ + if (nondigit) goto decode_num; + nondigit = c; + break; + + default: + goto decode_num; + } + c = nextc(p); + } + + decode_num: + pushback(p, c); + if (nondigit) { + trailing_uc: + yyerror_c(p, "trailing non digit in number: ", (char)nondigit); + } + tokfix(p); + if (is_float) { +#ifdef MRB_NO_FLOAT + yywarning_s(p, "floating-point numbers are not supported", tok(p)); + pylval.nd = new_int(p, "0", 10, 0); + return tINTEGER; +#else + double d; + char *endp; + + errno = 0; + d = mrb_float_read(tok(p), &endp); + if (d == 0 && endp == tok(p)) { + yywarning_s(p, "corrupted float value", tok(p)); + } + else if (errno == ERANGE) { + yywarning_s(p, "float out of range", tok(p)); + errno = 0; + } + suffix = number_literal_suffix(p); + if (seen_e && (suffix & NUM_SUFFIX_R)) { + pushback(p, 'r'); + suffix &= ~NUM_SUFFIX_R; + } + pylval.nd = new_float(p, tok(p), suffix); + return tFLOAT; +#endif + } + suffix = number_literal_suffix(p); + pylval.nd = new_int(p, tok(p), 10, suffix); + return tINTEGER; + } + + case ')': + case ']': + p->paren_nest--; + /* fall through */ + case '}': + COND_LEXPOP(); + CMDARG_LEXPOP(); + if (c == ')') + p->lstate = EXPR_ENDFN; + else + p->lstate = EXPR_END; + return c; + + case ':': + c = nextc(p); + if (c == ':') { + if (IS_BEG() || p->lstate == EXPR_CLASS || IS_SPCARG(-1)) { + p->lstate = EXPR_BEG; + return tCOLON3; + } + p->lstate = EXPR_DOT; + return tCOLON2; + } + if (!space_seen && IS_END()) { + pushback(p, c); + p->lstate = EXPR_BEG; + return tLABEL_TAG; + } + if (IS_END() || ISSPACE(c) || c == '#') { + pushback(p, c); + p->lstate = EXPR_BEG; + return ':'; + } + pushback(p, c); + p->lstate = EXPR_FNAME; + return tSYMBEG; + + case '/': + if (IS_BEG()) { + p->lex_strterm = new_strterm(p, str_regexp, '/', 0); + return tREGEXP_BEG; + } + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(div); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + pushback(p, c); + if (IS_SPCARG(c)) { + p->lex_strterm = new_strterm(p, str_regexp, '/', 0); + return tREGEXP_BEG; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + return '/'; + + case '^': + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(xor); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + pushback(p, c); + return '^'; + + case ';': + p->lstate = EXPR_BEG; + return ';'; + + case ',': + p->lstate = EXPR_BEG; + return ','; + + case '~': + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + if ((c = nextc(p)) != '@') { + pushback(p, c); + } + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + return '~'; + + case '(': + if (IS_BEG()) { + c = tLPAREN; + } + else if (IS_SPCARG(-1)) { + c = tLPAREN_ARG; + } + else if (p->lstate == EXPR_END && space_seen) { + c = tLPAREN_ARG; + } + p->paren_nest++; + COND_PUSH(0); + CMDARG_PUSH(0); + p->lstate = EXPR_BEG; + return c; + + case '[': + p->paren_nest++; + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + p->paren_nest--; + if ((c = nextc(p)) == ']') { + if ((c = nextc(p)) == '=') { + return tASET; + } + pushback(p, c); + return tAREF; + } + pushback(p, c); + return '['; + } + else if (IS_BEG()) { + c = tLBRACK; + } + else if (IS_ARG() && space_seen) { + c = tLBRACK; + } + p->lstate = EXPR_BEG; + COND_PUSH(0); + CMDARG_PUSH(0); + return c; + + case '{': + if (p->lpar_beg && p->lpar_beg == p->paren_nest) { + p->lstate = EXPR_BEG; + p->lpar_beg = 0; + p->paren_nest--; + COND_PUSH(0); + CMDARG_PUSH(0); + return tLAMBEG; + } + if (IS_ARG() || p->lstate == EXPR_END || p->lstate == EXPR_ENDFN) + c = '{'; /* block (primary) */ + else if (p->lstate == EXPR_ENDARG) + c = tLBRACE_ARG; /* block (expr) */ + else + c = tLBRACE; /* hash */ + COND_PUSH(0); + CMDARG_PUSH(0); + p->lstate = EXPR_BEG; + return c; + + case '\\': + c = nextc(p); + if (c == '\n') { + p->lineno+=nlines; nlines=1; + p->column = 0; + space_seen = 1; + goto retry; /* skip \\n */ + } + pushback(p, c); + return '\\'; + + case '%': + if (IS_BEG()) { + int term; + int paren; + + c = nextc(p); + quotation: + if (c < 0 || !ISALNUM(c)) { + term = c; + c = 'Q'; + } + else { + term = nextc(p); + if (ISALNUM(term)) { + yyerror(p, "unknown type of %string"); + return 0; + } + } + if (c < 0 || term < 0) { + yyerror(p, "unterminated quoted string meets end of file"); + return 0; + } + paren = term; + if (term == '(') term = ')'; + else if (term == '[') term = ']'; + else if (term == '{') term = '}'; + else if (term == '<') term = '>'; + else paren = 0; + + switch (c) { + case 'Q': + p->lex_strterm = new_strterm(p, str_dquote, term, paren); + return tSTRING_BEG; + + case 'q': + p->lex_strterm = new_strterm(p, str_squote, term, paren); + return parse_string(p); + + case 'W': + p->lex_strterm = new_strterm(p, str_dword, term, paren); + return tWORDS_BEG; + + case 'w': + p->lex_strterm = new_strterm(p, str_sword, term, paren); + return tWORDS_BEG; + + case 'x': + p->lex_strterm = new_strterm(p, str_xquote, term, paren); + return tXSTRING_BEG; + + case 'r': + p->lex_strterm = new_strterm(p, str_regexp, term, paren); + return tREGEXP_BEG; + + case 's': + p->lex_strterm = new_strterm(p, str_ssym, term, paren); + return tSYMBEG; + + case 'I': + p->lex_strterm = new_strterm(p, str_dsymbols, term, paren); + return tSYMBOLS_BEG; + + case 'i': + p->lex_strterm = new_strterm(p, str_ssymbols, term, paren); + return tSYMBOLS_BEG; + + default: + yyerror(p, "unknown type of %string"); + return 0; + } + } + if ((c = nextc(p)) == '=') { + pylval.id = intern_op(mod); + p->lstate = EXPR_BEG; + return tOP_ASGN; + } + if (IS_SPCARG(c)) { + goto quotation; + } + if (p->lstate == EXPR_FNAME || p->lstate == EXPR_DOT) { + p->lstate = EXPR_ARG; + } + else { + p->lstate = EXPR_BEG; + } + pushback(p, c); + return '%'; + + case '$': + p->lstate = EXPR_END; + token_column = newtok(p); + c = nextc(p); + if (c < 0) { + yyerror(p, "incomplete global variable syntax"); + return 0; + } + switch (c) { + case '_': /* $_: last read line string */ + c = nextc(p); + if (c >= 0 && identchar(c)) { /* if there is more after _ it is a variable */ + tokadd(p, '$'); + tokadd(p, c); + break; + } + pushback(p, c); + c = '_'; + /* fall through */ + case '~': /* $~: match-data */ + case '*': /* $*: argv */ + case '$': /* $$: pid */ + case '?': /* $?: last status */ + case '!': /* $!: error string */ + case '@': /* $@: error position */ + case '/': /* $/: input record separator */ + case '\\': /* $\: output record separator */ + case ';': /* $;: field separator */ + case ',': /* $,: output field separator */ + case '.': /* $.: last read line number */ + case '=': /* $=: ignorecase */ + case ':': /* $:: load path */ + case '<': /* $<: reading filename */ + case '>': /* $>: default output handle */ + case '\"': /* $": already loaded files */ + tokadd(p, '$'); + tokadd(p, c); + tokfix(p); + pylval.id = intern(tok(p), toklen(p)); + return tGVAR; + + case '-': + tokadd(p, '$'); + tokadd(p, c); + c = nextc(p); + pushback(p, c); + gvar: + tokfix(p); + pylval.id = intern(tok(p), toklen(p)); + return tGVAR; + + case '&': /* $&: last match */ + case '`': /* $`: string before last match */ + case '\'': /* $': string after last match */ + case '+': /* $+: string matches last pattern */ + if (last_state == EXPR_FNAME) { + tokadd(p, '$'); + tokadd(p, c); + goto gvar; + } + pylval.nd = new_back_ref(p, c); + return tBACK_REF; + + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': case '9': + do { + tokadd(p, c); + c = nextc(p); + } while (c >= 0 && ISDIGIT(c)); + pushback(p, c); + if (last_state == EXPR_FNAME) goto gvar; + tokfix(p); + { + unsigned long n = strtoul(tok(p), NULL, 10); + if (n > INT_MAX) { + yyerror(p, "capture group index must be <= " MRB_STRINGIZE(INT_MAX)); + return 0; + } + pylval.nd = new_nth_ref(p, (int)n); + } + return tNTH_REF; + + default: + if (!identchar(c)) { + pushback(p, c); + return '$'; + } + /* fall through */ + case '0': + tokadd(p, '$'); + } + break; + + case '@': + c = nextc(p); + token_column = newtok(p); + tokadd(p, '@'); + if (c == '@') { + tokadd(p, '@'); + c = nextc(p); + } + if (c < 0) { + if (p->tidx == 1) { + yyerror(p, "incomplete instance variable syntax"); + } + else { + yyerror(p, "incomplete class variable syntax"); + } + return 0; + } + else if (ISDIGIT(c)) { + if (p->tidx == 1) { + yyerror_c(p, "wrong instance variable name: @", c); + } + else { + yyerror_c(p, "wrong class variable name: @@", c); + } + return 0; + } + if (!identchar(c)) { + pushback(p, c); + return '@'; + } + break; + + case '_': + token_column = newtok(p); + break; + + default: + if (!identchar(c)) { + char buf[36]; + const char s[] = "Invalid char in expression: 0x"; + const char hexdigits[] = "0123456789ABCDEF"; + + strcpy(buf, s); + buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4]; + buf[sizeof(s)] = hexdigits[(c & 0x0f)]; + buf[sizeof(s)+1] = 0; + yyerror(p, buf); + goto retry; + } + + token_column = newtok(p); + break; + } + + do { + tokadd(p, c); + c = nextc(p); + if (c < 0) break; + } while (identchar(c)); + if (token_column == 0 && toklen(p) == 7 && (c < 0 || c == '\n') && + strncmp(tok(p), "__END__", toklen(p)) == 0) + return -1; + + switch (tok(p)[0]) { + case '@': case '$': + pushback(p, c); + break; + default: + if ((c == '!' || c == '?') && !peek(p, '=')) { + tokadd(p, c); + } + else { + pushback(p, c); + } + } + tokfix(p); + { + int result = 0; + + switch (tok(p)[0]) { + case '$': + p->lstate = EXPR_END; + result = tGVAR; + break; + case '@': + p->lstate = EXPR_END; + if (tok(p)[1] == '@') + result = tCVAR; + else + result = tIVAR; + break; + + case '_': + if (p->lstate != EXPR_FNAME && toklen(p) == 2 && ISDIGIT(tok(p)[1]) && p->nvars) { + int n = tok(p)[1] - '0'; + int nvar; + + if (n > 0) { + node *nvars = p->nvars->cdr; + + while (nvars) { + nvar = intn(nvars->car); + if (nvar == -2) break; /* top of the scope */ + if (nvar > 0) { + yywarning(p, "numbered parameter used in outer block"); + break; + } + nvars->car = nint(-1); + nvars = nvars->cdr; + } + nvar = intn(p->nvars->car); + if (nvar == -1) { + yywarning(p, "numbered parameter used in inner block"); + } + if (nvar >= -1) { + pylval.num = n; + p->lstate = EXPR_END; + return tNUMPARAM; + } + else { + yywarning(p, "identifier for numbered parameter; consider another name"); + } + } + } + /* fall through */ + default: + if (toklast(p) == '!' || toklast(p) == '?') { + result = tFID; + } + else { + if (p->lstate == EXPR_FNAME) { + if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') && + (!peek(p, '=') || (peek_n(p, '>', 1)))) { + result = tIDENTIFIER; + tokadd(p, c); + tokfix(p); + } + else { + pushback(p, c); + } + if ((c = nextc(p)) == '=' && !peek(p, '~') && !peek(p, '>') && + (!peek(p, '=') || (peek_n(p, '>', 1)))) { + result = tIDENTIFIER; + tokadd(p, c); + tokfix(p); + } + else { + pushback(p, c); + } + } + if (result == 0 && ISUPPER(tok(p)[0])) { + result = tCONSTANT; + } + else { + result = tIDENTIFIER; + } + } + + if (IS_LABEL_POSSIBLE()) { + if (IS_LABEL_SUFFIX(0)) { + p->lstate = EXPR_END; + tokfix(p); + pylval.id = intern(tok(p), toklen(p)); + return tIDENTIFIER; + } + } + if (p->lstate != EXPR_DOT) { + const struct kwtable *kw; + + /* See if it is a reserved word. */ + kw = mrb_reserved_word(tok(p), toklen(p)); + if (kw) { + enum mrb_lex_state_enum state = p->lstate; + pylval.num = p->lineno; + p->lstate = kw->state; + if (state == EXPR_FNAME) { + pylval.id = intern_cstr(kw->name); + return kw->id[0]; + } + if (p->lstate == EXPR_BEG) { + p->cmd_start = TRUE; + } + if (kw->id[0] == keyword_do) { + if (p->lpar_beg && p->lpar_beg == p->paren_nest) { + p->lpar_beg = 0; + p->paren_nest--; + return keyword_do_LAMBDA; + } + if (COND_P()) return keyword_do_cond; + if (CMDARG_P() && state != EXPR_CMDARG) + return keyword_do_block; + if (state == EXPR_ENDARG || state == EXPR_BEG) + return keyword_do_block; + return keyword_do; + } + if (state == EXPR_BEG || state == EXPR_VALUE) + return kw->id[0]; + else { + if (kw->id[0] != kw->id[1]) + p->lstate = EXPR_BEG; + return kw->id[1]; + } + } + } + + if (IS_BEG() || p->lstate == EXPR_DOT || IS_ARG()) { + if (cmd_state) { + p->lstate = EXPR_CMDARG; + } + else { + p->lstate = EXPR_ARG; + } + } + else if (p->lstate == EXPR_FNAME) { + p->lstate = EXPR_ENDFN; + } + else { + p->lstate = EXPR_END; + } + } + { + mrb_sym ident = intern(tok(p), toklen(p)); + + pylval.id = ident; + if (last_state != EXPR_DOT && ISLOWER(tok(p)[0]) && local_var_p(p, ident)) { + p->lstate = EXPR_END; + } + } + return result; + } +} + +static int +yylex(void *lval, parser_state *p) +{ + p->ylval = lval; + return parser_yylex(p); +} + +static void +parser_init_cxt(parser_state *p, mrbc_context *cxt) +{ + if (!cxt) return; + if (cxt->filename) mrb_parser_set_filename(p, cxt->filename); + if (cxt->lineno) p->lineno = cxt->lineno; + if (cxt->syms) { + int i; + + p->locals = cons(0,0); + for (i=0; i<cxt->slen; i++) { + local_add_f(p, cxt->syms[i]); + } + } + p->capture_errors = cxt->capture_errors; + p->no_optimize = cxt->no_optimize; + p->upper = cxt->upper; + if (cxt->partial_hook) { + p->cxt = cxt; + } +} + +static void +parser_update_cxt(parser_state *p, mrbc_context *cxt) +{ + node *n, *n0; + int i = 0; + + if (!cxt) return; + if (intn(p->tree->car) != NODE_SCOPE) return; + n0 = n = p->tree->cdr->car; + while (n) { + i++; + n = n->cdr; + } + cxt->syms = (mrb_sym *)mrb_realloc(p->mrb, cxt->syms, i*sizeof(mrb_sym)); + cxt->slen = i; + for (i=0, n=n0; n; i++,n=n->cdr) { + cxt->syms[i] = sym(n->car); + } +} + +void mrb_codedump_all(mrb_state*, struct RProc*); +void mrb_parser_dump(mrb_state *mrb, node *tree, int offset); + +MRB_API void +mrb_parser_parse(parser_state *p, mrbc_context *c) +{ + struct mrb_jmpbuf buf1; + p->jmp = &buf1; + + MRB_TRY(p->jmp) { + int n = 1; + + p->cmd_start = TRUE; + p->in_def = p->in_single = 0; + p->nerr = p->nwarn = 0; + p->lex_strterm = NULL; + + parser_init_cxt(p, c); + + if (p->mrb->jmp) { + n = yyparse(p); + } + else { + struct mrb_jmpbuf buf2; + + p->mrb->jmp = &buf2; + MRB_TRY(p->mrb->jmp) { + n = yyparse(p); + } + MRB_CATCH(p->mrb->jmp) { + p->nerr++; + } + MRB_END_EXC(p->mrb->jmp); + p->mrb->jmp = 0; + } + if (n != 0 || p->nerr > 0) { + p->tree = 0; + return; + } + if (!p->tree) { + p->tree = new_nil(p); + } + parser_update_cxt(p, c); + if (c && c->dump_result) { + mrb_parser_dump(p->mrb, p->tree, 0); + } + } + MRB_CATCH(p->jmp) { + yyerror(p, "memory allocation error"); + p->nerr++; + p->tree = 0; + return; + } + MRB_END_EXC(p->jmp); +} + +MRB_API parser_state* +mrb_parser_new(mrb_state *mrb) +{ + mrb_pool *pool; + parser_state *p; + static const parser_state parser_state_zero = { 0 }; + + pool = mrb_pool_open(mrb); + if (!pool) return NULL; + p = (parser_state *)mrb_pool_alloc(pool, sizeof(parser_state)); + if (!p) return NULL; + + *p = parser_state_zero; + p->mrb = mrb; + p->pool = pool; + + p->s = p->send = NULL; +#ifndef MRB_NO_STDIO + p->f = NULL; +#endif + + p->cmd_start = TRUE; + p->in_def = p->in_single = 0; + + p->capture_errors = FALSE; + p->lineno = 1; + p->column = 0; +#if defined(PARSER_TEST) || defined(PARSER_DEBUG) + yydebug = 1; +#endif + p->tsiz = MRB_PARSER_TOKBUF_SIZE; + p->tokbuf = p->buf; + + p->lex_strterm = NULL; + p->all_heredocs = p->parsing_heredoc = NULL; + p->lex_strterm_before_heredoc = NULL; + + p->current_filename_index = -1; + p->filename_table = NULL; + p->filename_table_length = 0; + + return p; +} + +MRB_API void +mrb_parser_free(parser_state *p) { + if (p->tokbuf != p->buf) { + mrb_free(p->mrb, p->tokbuf); + } + mrb_pool_close(p->pool); +} + +MRB_API mrbc_context* +mrbc_context_new(mrb_state *mrb) +{ + return (mrbc_context *)mrb_calloc(mrb, 1, sizeof(mrbc_context)); +} + +MRB_API void +mrbc_context_free(mrb_state *mrb, mrbc_context *cxt) +{ + mrb_free(mrb, cxt->filename); + mrb_free(mrb, cxt->syms); + mrb_free(mrb, cxt); +} + +MRB_API const char* +mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s) +{ + if (s) { + size_t len = strlen(s); + char *p = (char *)mrb_malloc(mrb, len + 1); + + memcpy(p, s, len + 1); + if (c->filename) { + mrb_free(mrb, c->filename); + } + c->filename = p; + } + return c->filename; +} + +MRB_API void +mrbc_partial_hook(mrb_state *mrb, mrbc_context *c, int (*func)(struct mrb_parser_state*), void *data) +{ + c->partial_hook = func; + c->partial_data = data; +} + +MRB_API void +mrbc_cleanup_local_variables(mrb_state *mrb, mrbc_context *c) +{ + if (c->syms) { + mrb_free(mrb, c->syms); + c->syms = NULL; + c->slen = 0; + } +} + +MRB_API void +mrb_parser_set_filename(struct mrb_parser_state *p, const char *f) +{ + mrb_sym sym; + uint16_t i; + mrb_sym* new_table; + + sym = mrb_intern_cstr(p->mrb, f); + p->filename_sym = sym; + p->lineno = (p->filename_table_length > 0)? 0 : 1; + + for (i = 0; i < p->filename_table_length; ++i) { + if (p->filename_table[i] == sym) { + p->current_filename_index = i; + return; + } + } + + if (p->filename_table_length == UINT16_MAX) { + yyerror(p, "too many files to compile"); + return; + } + p->current_filename_index = p->filename_table_length++; + + new_table = (mrb_sym*)parser_palloc(p, sizeof(mrb_sym) * p->filename_table_length); + if (p->filename_table) { + memmove(new_table, p->filename_table, sizeof(mrb_sym) * p->current_filename_index); + } + p->filename_table = new_table; + p->filename_table[p->filename_table_length - 1] = sym; +} + +MRB_API mrb_sym +mrb_parser_get_filename(struct mrb_parser_state* p, uint16_t idx) { + if (idx >= p->filename_table_length) return 0; + else { + return p->filename_table[idx]; + } +} + +#ifndef MRB_NO_STDIO +static struct mrb_parser_state * +mrb_parse_file_continue(mrb_state *mrb, FILE *f, const void *prebuf, size_t prebufsize, mrbc_context *c) +{ + parser_state *p; + + p = mrb_parser_new(mrb); + if (!p) return NULL; + if (prebuf) { + p->s = (const char *)prebuf; + p->send = (const char *)prebuf + prebufsize; + } + else { + p->s = p->send = NULL; + } + p->f = f; + + mrb_parser_parse(p, c); + return p; +} + +MRB_API parser_state* +mrb_parse_file(mrb_state *mrb, FILE *f, mrbc_context *c) +{ + return mrb_parse_file_continue(mrb, f, NULL, 0, c); +} +#endif + +MRB_API parser_state* +mrb_parse_nstring(mrb_state *mrb, const char *s, size_t len, mrbc_context *c) +{ + parser_state *p; + + p = mrb_parser_new(mrb); + if (!p) return NULL; + p->s = s; + p->send = s + len; + + mrb_parser_parse(p, c); + return p; +} + +MRB_API parser_state* +mrb_parse_string(mrb_state *mrb, const char *s, mrbc_context *c) +{ + return mrb_parse_nstring(mrb, s, strlen(s), c); +} + +MRB_API mrb_value +mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c) +{ + struct RClass *target = mrb->object_class; + struct RProc *proc; + mrb_value v; + mrb_int keep = 0; + + if (!p) { + return mrb_undef_value(); + } + if (!p->tree || p->nerr) { + if (c) c->parser_nerr = p->nerr; + if (p->capture_errors) { + char buf[256]; + + strcpy(buf, "line "); + dump_int(p->error_buffer[0].lineno, buf+5); + strcat(buf, ": "); + strncat(buf, p->error_buffer[0].message, sizeof(buf) - strlen(buf) - 1); + mrb->exc = mrb_obj_ptr(mrb_exc_new(mrb, E_SYNTAX_ERROR, buf, strlen(buf))); + mrb_parser_free(p); + return mrb_undef_value(); + } + else { + if (mrb->exc == NULL) { + mrb->exc = mrb_obj_ptr(mrb_exc_new_lit(mrb, E_SYNTAX_ERROR, "syntax error")); + } + mrb_parser_free(p); + return mrb_undef_value(); + } + } + proc = mrb_generate_code(mrb, p); + mrb_parser_free(p); + if (proc == NULL) { + if (mrb->exc == NULL) { + mrb->exc = mrb_obj_ptr(mrb_exc_new_lit(mrb, E_SCRIPT_ERROR, "codegen error")); + } + return mrb_undef_value(); + } + if (c) { + if (c->dump_result) mrb_codedump_all(mrb, proc); + if (c->no_exec) return mrb_obj_value(proc); + if (c->target_class) { + target = c->target_class; + } + if (c->keep_lv) { + keep = c->slen + 1; + } + else { + c->keep_lv = TRUE; + } + } + MRB_PROC_SET_TARGET_CLASS(proc, target); + if (mrb->c->ci) { + mrb_vm_ci_target_class_set(mrb->c->ci, target); + } + v = mrb_top_run(mrb, proc, mrb_top_self(mrb), keep); + if (mrb->exc) return mrb_nil_value(); + return v; +} + +#ifndef MRB_NO_STDIO +MRB_API mrb_value +mrb_load_file_cxt(mrb_state *mrb, FILE *f, mrbc_context *c) +{ + return mrb_load_exec(mrb, mrb_parse_file(mrb, f, c), c); +} + +MRB_API mrb_value +mrb_load_file(mrb_state *mrb, FILE *f) +{ + return mrb_load_file_cxt(mrb, f, NULL); +} + +#define DETECT_SIZE 64 + +/* + * In order to be recognized as a `.mrb` file, the following three points must be satisfied: + * - File starts with "RITE" + * - At least `sizeof(struct rite_binary_header)` bytes can be read + * - `NUL` is included in the first 64 bytes of the file + */ +MRB_API mrb_value +mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrbc_context *c) +{ + union { + char b[DETECT_SIZE]; + struct rite_binary_header h; + } leading; + size_t bufsize; + + if (mrb == NULL || fp == NULL) { + return mrb_nil_value(); + } + + bufsize = fread(leading.b, sizeof(char), sizeof(leading), fp); + if (bufsize < sizeof(leading.h) || + memcmp(leading.h.binary_ident, RITE_BINARY_IDENT, sizeof(leading.h.binary_ident)) != 0 || + memchr(leading.b, '\0', bufsize) == NULL) { + return mrb_load_exec(mrb, mrb_parse_file_continue(mrb, fp, leading.b, bufsize, c), c); + } + else { + size_t binsize; + uint8_t *bin; + mrb_value bin_obj = mrb_nil_value(); /* temporary string object */ + mrb_value result; + + binsize = bin_to_uint32(leading.h.binary_size); + bin_obj = mrb_str_new(mrb, NULL, binsize); + bin = (uint8_t *)RSTRING_PTR(bin_obj); + memcpy(bin, leading.b, bufsize); + if (binsize > bufsize && + fread(bin + bufsize, binsize - bufsize, 1, fp) == 0) { + binsize = bufsize; + /* The error is reported by mrb_load_irep_buf_cxt() */ + } + + result = mrb_load_irep_buf_cxt(mrb, bin, binsize, c); + if (mrb_string_p(bin_obj)) mrb_str_resize(mrb, bin_obj, 0); + return result; + } +} +#endif + +MRB_API mrb_value +mrb_load_nstring_cxt(mrb_state *mrb, const char *s, size_t len, mrbc_context *c) +{ + return mrb_load_exec(mrb, mrb_parse_nstring(mrb, s, len, c), c); +} + +MRB_API mrb_value +mrb_load_nstring(mrb_state *mrb, const char *s, size_t len) +{ + return mrb_load_nstring_cxt(mrb, s, len, NULL); +} + +MRB_API mrb_value +mrb_load_string_cxt(mrb_state *mrb, const char *s, mrbc_context *c) +{ + return mrb_load_nstring_cxt(mrb, s, strlen(s), c); +} + +MRB_API mrb_value +mrb_load_string(mrb_state *mrb, const char *s) +{ + return mrb_load_string_cxt(mrb, s, NULL); +} + +#ifndef MRB_NO_STDIO + +static void +dump_prefix(node *tree, int offset) +{ + printf("%05d ", tree->lineno); + while (offset--) { + putc(' ', stdout); + putc(' ', stdout); + } +} + +static void +dump_recur(mrb_state *mrb, node *tree, int offset) +{ + while (tree) { + mrb_parser_dump(mrb, tree->car, offset); + tree = tree->cdr; + } +} + +static void +dump_args(mrb_state *mrb, node *n, int offset) +{ + if (n->car) { + dump_prefix(n, offset+1); + printf("mandatory args:\n"); + dump_recur(mrb, n->car, offset+2); + } + n = n->cdr; + if (n->car) { + dump_prefix(n, offset+1); + printf("optional args:\n"); + { + node *n2 = n->car; + + while (n2) { + dump_prefix(n2, offset+2); + printf("%s=\n", mrb_sym_name(mrb, sym(n2->car->car))); + mrb_parser_dump(mrb, n2->car->cdr, offset+3); + n2 = n2->cdr; + } + } + } + n = n->cdr; + if (n->car) { + dump_prefix(n, offset+1); + printf("rest=*%s\n", mrb_sym_name(mrb, sym(n->car))); + } + n = n->cdr; + if (n->car) { + dump_prefix(n, offset+1); + printf("post mandatory args:\n"); + dump_recur(mrb, n->car, offset+2); + } + + n = n->cdr; + if (n) { + mrb_assert(intn(n->car) == NODE_ARGS_TAIL); + mrb_parser_dump(mrb, n, offset); + } +} + +/* + * This function restores the GC arena on return. + * For this reason, if a process that further generates an object is + * performed at the caller, the string pointer returned as the return + * value may become invalid. + */ +static const char* +str_dump(mrb_state *mrb, const char *str, int len) +{ + int ai = mrb_gc_arena_save(mrb); + mrb_value s; +# if INT_MAX > MRB_INT_MAX / 4 + /* check maximum length with "\xNN" character */ + if (len > MRB_INT_MAX / 4) { + len = MRB_INT_MAX / 4; + } +# endif + s = mrb_str_new(mrb, str, (mrb_int)len); + s = mrb_str_dump(mrb, s); + mrb_gc_arena_restore(mrb, ai); + return RSTRING_PTR(s); +} +#endif + +void +mrb_parser_dump(mrb_state *mrb, node *tree, int offset) +{ +#ifndef MRB_NO_STDIO + int nodetype; + + if (!tree) return; + again: + dump_prefix(tree, offset); + nodetype = intn(tree->car); + tree = tree->cdr; + switch (nodetype) { + case NODE_BEGIN: + printf("NODE_BEGIN:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_RESCUE: + printf("NODE_RESCUE:\n"); + if (tree->car) { + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + } + tree = tree->cdr; + if (tree->car) { + node *n2 = tree->car; + + dump_prefix(n2, offset+1); + printf("rescue:\n"); + while (n2) { + node *n3 = n2->car; + if (n3->car) { + dump_prefix(n2, offset+2); + printf("handle classes:\n"); + dump_recur(mrb, n3->car, offset+3); + } + if (n3->cdr->car) { + dump_prefix(n3, offset+2); + printf("exc_var:\n"); + mrb_parser_dump(mrb, n3->cdr->car, offset+3); + } + if (n3->cdr->cdr->car) { + dump_prefix(n3, offset+2); + printf("rescue body:\n"); + mrb_parser_dump(mrb, n3->cdr->cdr->car, offset+3); + } + n2 = n2->cdr; + } + } + tree = tree->cdr; + if (tree->car) { + dump_prefix(tree, offset+1); + printf("else:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + } + break; + + case NODE_ENSURE: + printf("NODE_ENSURE:\n"); + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + dump_prefix(tree, offset+1); + printf("ensure:\n"); + mrb_parser_dump(mrb, tree->cdr->cdr, offset+2); + break; + + case NODE_LAMBDA: + printf("NODE_LAMBDA:\n"); + dump_prefix(tree, offset); + goto block; + + case NODE_BLOCK: + block: + printf("NODE_BLOCK:\n"); + tree = tree->cdr; + if (tree->car) { + dump_args(mrb, tree->car, offset+1); + } + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr->car, offset+2); + break; + + case NODE_IF: + printf("NODE_IF:\n"); + dump_prefix(tree, offset+1); + printf("cond:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + dump_prefix(tree, offset+1); + printf("then:\n"); + mrb_parser_dump(mrb, tree->cdr->car, offset+2); + if (tree->cdr->cdr->car) { + dump_prefix(tree, offset+1); + printf("else:\n"); + mrb_parser_dump(mrb, tree->cdr->cdr->car, offset+2); + } + break; + + case NODE_AND: + printf("NODE_AND:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + mrb_parser_dump(mrb, tree->cdr, offset+1); + break; + + case NODE_OR: + printf("NODE_OR:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + mrb_parser_dump(mrb, tree->cdr, offset+1); + break; + + case NODE_CASE: + printf("NODE_CASE:\n"); + if (tree->car) { + mrb_parser_dump(mrb, tree->car, offset+1); + } + tree = tree->cdr; + while (tree) { + dump_prefix(tree, offset+1); + printf("case:\n"); + dump_recur(mrb, tree->car->car, offset+2); + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->car->cdr, offset+2); + tree = tree->cdr; + } + break; + + case NODE_WHILE: + printf("NODE_WHILE:\n"); + dump_prefix(tree, offset+1); + printf("cond:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + break; + + case NODE_UNTIL: + printf("NODE_UNTIL:\n"); + dump_prefix(tree, offset+1); + printf("cond:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + break; + + case NODE_FOR: + printf("NODE_FOR:\n"); + dump_prefix(tree, offset+1); + printf("var:\n"); + { + node *n2 = tree->car; + + if (n2->car) { + dump_prefix(n2, offset+2); + printf("pre:\n"); + dump_recur(mrb, n2->car, offset+3); + } + n2 = n2->cdr; + if (n2) { + if (n2->car) { + dump_prefix(n2, offset+2); + printf("rest:\n"); + mrb_parser_dump(mrb, n2->car, offset+3); + } + n2 = n2->cdr; + if (n2) { + if (n2->car) { + dump_prefix(n2, offset+2); + printf("post:\n"); + dump_recur(mrb, n2->car, offset+3); + } + } + } + } + tree = tree->cdr; + dump_prefix(tree, offset+1); + printf("in:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + tree = tree->cdr; + dump_prefix(tree, offset+1); + printf("do:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + break; + + case NODE_SCOPE: + printf("NODE_SCOPE:\n"); + { + node *n2 = tree->car; + mrb_bool first_lval = TRUE; + + if (n2 && (n2->car || n2->cdr)) { + dump_prefix(n2, offset+1); + printf("local variables:\n"); + dump_prefix(n2, offset+2); + while (n2) { + if (n2->car) { + if (!first_lval) printf(", "); + printf("%s", mrb_sym_name(mrb, sym(n2->car))); + first_lval = FALSE; + } + n2 = n2->cdr; + } + printf("\n"); + } + } + tree = tree->cdr; + offset++; + goto again; + + case NODE_FCALL: + case NODE_CALL: + case NODE_SCALL: + switch (nodetype) { + case NODE_FCALL: + printf("NODE_FCALL:\n"); break; + case NODE_CALL: + printf("NODE_CALL(.):\n"); break; + case NODE_SCALL: + printf("NODE_SCALL(&.):\n"); break; + default: + break; + } + mrb_parser_dump(mrb, tree->car, offset+1); + dump_prefix(tree, offset+1); + printf("method='%s' (%d)\n", + mrb_sym_dump(mrb, sym(tree->cdr->car)), + intn(tree->cdr->car)); + tree = tree->cdr->cdr->car; + if (tree) { + dump_prefix(tree, offset+1); + printf("args:\n"); + dump_recur(mrb, tree->car, offset+2); + if (tree->cdr) { + dump_prefix(tree, offset+1); + printf("block:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + } + } + break; + + case NODE_DOT2: + printf("NODE_DOT2:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + mrb_parser_dump(mrb, tree->cdr, offset+1); + break; + + case NODE_DOT3: + printf("NODE_DOT3:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + mrb_parser_dump(mrb, tree->cdr, offset+1); + break; + + case NODE_COLON2: + printf("NODE_COLON2:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + dump_prefix(tree, offset+1); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->cdr))); + break; + + case NODE_COLON3: + printf("NODE_COLON3: ::%s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_ARRAY: + printf("NODE_ARRAY:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_HASH: + printf("NODE_HASH:\n"); + while (tree) { + dump_prefix(tree, offset+1); + printf("key:\n"); + mrb_parser_dump(mrb, tree->car->car, offset+2); + dump_prefix(tree, offset+1); + printf("value:\n"); + mrb_parser_dump(mrb, tree->car->cdr, offset+2); + tree = tree->cdr; + } + break; + + case NODE_KW_HASH: + printf("NODE_KW_HASH:\n"); + while (tree) { + dump_prefix(tree, offset+1); + printf("key:\n"); + mrb_parser_dump(mrb, tree->car->car, offset+2); + dump_prefix(tree, offset+1); + printf("value:\n"); + mrb_parser_dump(mrb, tree->car->cdr, offset+2); + tree = tree->cdr; + } + break; + + case NODE_SPLAT: + printf("NODE_SPLAT:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_ASGN: + printf("NODE_ASGN:\n"); + dump_prefix(tree, offset+1); + printf("lhs:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + dump_prefix(tree, offset+1); + printf("rhs:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + break; + + case NODE_MASGN: + printf("NODE_MASGN:\n"); + dump_prefix(tree, offset+1); + printf("mlhs:\n"); + { + node *n2 = tree->car; + + if (n2->car) { + dump_prefix(tree, offset+2); + printf("pre:\n"); + dump_recur(mrb, n2->car, offset+3); + } + n2 = n2->cdr; + if (n2) { + if (n2->car) { + dump_prefix(n2, offset+2); + printf("rest:\n"); + if (n2->car == nint(-1)) { + dump_prefix(n2, offset+2); + printf("(empty)\n"); + } + else { + mrb_parser_dump(mrb, n2->car, offset+3); + } + } + n2 = n2->cdr; + if (n2) { + if (n2->car) { + dump_prefix(n2, offset+2); + printf("post:\n"); + dump_recur(mrb, n2->car, offset+3); + } + } + } + } + dump_prefix(tree, offset+1); + printf("rhs:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + break; + + case NODE_OP_ASGN: + printf("NODE_OP_ASGN:\n"); + dump_prefix(tree, offset+1); + printf("lhs:\n"); + mrb_parser_dump(mrb, tree->car, offset+2); + tree = tree->cdr; + dump_prefix(tree, offset+1); + printf("op='%s' (%d)\n", mrb_sym_name(mrb, sym(tree->car)), intn(tree->car)); + tree = tree->cdr; + mrb_parser_dump(mrb, tree->car, offset+1); + break; + + case NODE_SUPER: + printf("NODE_SUPER:\n"); + if (tree) { + dump_prefix(tree, offset+1); + printf("args:\n"); + dump_recur(mrb, tree->car, offset+2); + if (tree->cdr) { + dump_prefix(tree, offset+1); + printf("block:\n"); + mrb_parser_dump(mrb, tree->cdr, offset+2); + } + } + break; + + case NODE_ZSUPER: + printf("NODE_ZSUPER\n"); + break; + + case NODE_RETURN: + printf("NODE_RETURN:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_YIELD: + printf("NODE_YIELD:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_BREAK: + printf("NODE_BREAK:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_NEXT: + printf("NODE_NEXT:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_REDO: + printf("NODE_REDO\n"); + break; + + case NODE_RETRY: + printf("NODE_RETRY\n"); + break; + + case NODE_LVAR: + printf("NODE_LVAR %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_GVAR: + printf("NODE_GVAR %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_IVAR: + printf("NODE_IVAR %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_CVAR: + printf("NODE_CVAR %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_NVAR: + printf("NODE_NVAR %d\n", intn(tree)); + break; + + case NODE_CONST: + printf("NODE_CONST %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_MATCH: + printf("NODE_MATCH:\n"); + dump_prefix(tree, offset + 1); + printf("lhs:\n"); + mrb_parser_dump(mrb, tree->car, offset + 2); + dump_prefix(tree, offset + 1); + printf("rhs:\n"); + mrb_parser_dump(mrb, tree->cdr, offset + 2); + break; + + case NODE_BACK_REF: + printf("NODE_BACK_REF: $%c\n", intn(tree)); + break; + + case NODE_NTH_REF: + printf("NODE_NTH_REF: $%d\n", intn(tree)); + break; + + case NODE_ARG: + printf("NODE_ARG %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + case NODE_BLOCK_ARG: + printf("NODE_BLOCK_ARG:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_INT: + printf("NODE_INT %s base %d\n", (char*)tree->car, intn(tree->cdr->car)); + break; + + case NODE_FLOAT: + printf("NODE_FLOAT %s\n", (char*)tree); + break; + + case NODE_NEGATE: + printf("NODE_NEGATE:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_STR: + printf("NODE_STR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr)); + break; + + case NODE_DSTR: + printf("NODE_DSTR:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_XSTR: + printf("NODE_XSTR %s len %d\n", str_dump(mrb, (char*)tree->car, intn(tree->cdr)), intn(tree->cdr)); + break; + + case NODE_DXSTR: + printf("NODE_DXSTR:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_REGX: + printf("NODE_REGX /%s/%s\n", (char*)tree->car, (char*)tree->cdr); + break; + + case NODE_DREGX: + printf("NODE_DREGX:\n"); + dump_recur(mrb, tree->car, offset+1); + dump_prefix(tree, offset); + printf("tail: %s\n", (char*)tree->cdr->cdr->car); + if (tree->cdr->cdr->cdr->car) { + dump_prefix(tree, offset); + printf("opt: %s\n", (char*)tree->cdr->cdr->cdr->car); + } + if (tree->cdr->cdr->cdr->cdr) { + dump_prefix(tree, offset); + printf("enc: %s\n", (char*)tree->cdr->cdr->cdr->cdr); + } + break; + + case NODE_SYM: + printf("NODE_SYM :%s (%d)\n", mrb_sym_dump(mrb, sym(tree)), + intn(tree)); + break; + + case NODE_DSYM: + printf("NODE_DSYM:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_WORDS: + printf("NODE_WORDS:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_SYMBOLS: + printf("NODE_SYMBOLS:\n"); + dump_recur(mrb, tree, offset+1); + break; + + case NODE_LITERAL_DELIM: + printf("NODE_LITERAL_DELIM\n"); + break; + + case NODE_SELF: + printf("NODE_SELF\n"); + break; + + case NODE_NIL: + printf("NODE_NIL\n"); + break; + + case NODE_TRUE: + printf("NODE_TRUE\n"); + break; + + case NODE_FALSE: + printf("NODE_FALSE\n"); + break; + + case NODE_ALIAS: + printf("NODE_ALIAS %s %s:\n", + mrb_sym_dump(mrb, sym(tree->car)), + mrb_sym_dump(mrb, sym(tree->cdr))); + break; + + case NODE_UNDEF: + printf("NODE_UNDEF"); + { + node *t = tree; + while (t) { + printf(" %s", mrb_sym_dump(mrb, sym(t->car))); + t = t->cdr; + } + } + printf(":\n"); + break; + + case NODE_CLASS: + printf("NODE_CLASS:\n"); + if (tree->car->car == nint(0)) { + dump_prefix(tree, offset+1); + printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + else if (tree->car->car == nint(1)) { + dump_prefix(tree, offset+1); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + else { + mrb_parser_dump(mrb, tree->car->car, offset+1); + dump_prefix(tree, offset+1); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + if (tree->cdr->car) { + dump_prefix(tree, offset+1); + printf("super:\n"); + mrb_parser_dump(mrb, tree->cdr->car, offset+2); + } + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr->cdr->car->cdr, offset+2); + break; + + case NODE_MODULE: + printf("NODE_MODULE:\n"); + if (tree->car->car == nint(0)) { + dump_prefix(tree, offset+1); + printf(":%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + else if (tree->car->car == nint(1)) { + dump_prefix(tree, offset+1); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + else { + mrb_parser_dump(mrb, tree->car->car, offset+1); + dump_prefix(tree, offset+1); + printf("::%s\n", mrb_sym_name(mrb, sym(tree->car->cdr))); + } + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr->car->cdr, offset+2); + break; + + case NODE_SCLASS: + printf("NODE_SCLASS:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + dump_prefix(tree, offset+1); + printf("body:\n"); + mrb_parser_dump(mrb, tree->cdr->car->cdr, offset+2); + break; + + case NODE_DEF: + printf("NODE_DEF:\n"); + dump_prefix(tree, offset+1); + printf("%s\n", mrb_sym_dump(mrb, sym(tree->car))); + tree = tree->cdr; + { + node *n2 = tree->car; + mrb_bool first_lval = TRUE; + + if (n2 && (n2->car || n2->cdr)) { + dump_prefix(n2, offset+1); + printf("local variables:\n"); + dump_prefix(n2, offset+2); + while (n2) { + if (n2->car) { + if (!first_lval) printf(", "); + printf("%s", mrb_sym_name(mrb, sym(n2->car))); + first_lval = FALSE; + } + n2 = n2->cdr; + } + printf("\n"); + } + } + tree = tree->cdr; + if (tree->car) { + dump_args(mrb, tree->car, offset); + } + mrb_parser_dump(mrb, tree->cdr->car, offset+1); + break; + + case NODE_SDEF: + printf("NODE_SDEF:\n"); + mrb_parser_dump(mrb, tree->car, offset+1); + tree = tree->cdr; + dump_prefix(tree, offset+1); + printf(":%s\n", mrb_sym_dump(mrb, sym(tree->car))); + tree = tree->cdr->cdr; + if (tree->car) { + dump_args(mrb, tree->car, offset+1); + } + tree = tree->cdr; + mrb_parser_dump(mrb, tree->car, offset+1); + break; + + case NODE_POSTEXE: + printf("NODE_POSTEXE:\n"); + mrb_parser_dump(mrb, tree, offset+1); + break; + + case NODE_HEREDOC: + printf("NODE_HEREDOC (<<%s):\n", ((parser_heredoc_info*)tree)->term); + dump_recur(mrb, ((parser_heredoc_info*)tree)->doc, offset+1); + break; + + case NODE_ARGS_TAIL: + printf("NODE_ARGS_TAIL:\n"); + { + node *kws = tree->car; + + while (kws) { + mrb_parser_dump(mrb, kws->car, offset+1); + kws = kws->cdr; + } + } + tree = tree->cdr; + if (tree->car) { + mrb_assert(intn(tree->car->car) == NODE_KW_REST_ARGS); + mrb_parser_dump(mrb, tree->car, offset+1); + } + tree = tree->cdr; + if (tree->car) { + dump_prefix(tree, offset+1); + printf("block='%s'\n", mrb_sym_name(mrb, sym(tree->car))); + } + break; + + case NODE_KW_ARG: + printf("NODE_KW_ARG %s:\n", mrb_sym_name(mrb, sym(tree->car))); + mrb_parser_dump(mrb, tree->cdr->car, offset + 1); + break; + + case NODE_KW_REST_ARGS: + printf("NODE_KW_REST_ARGS %s\n", mrb_sym_name(mrb, sym(tree))); + break; + + default: + printf("node type: %d (0x%x)\n", nodetype, (unsigned)nodetype); + break; + } +#endif +} + +typedef mrb_bool mrb_parser_foreach_top_variable_func(mrb_state *mrb, mrb_sym sym, void *user); +void mrb_parser_foreach_top_variable(mrb_state *mrb, struct mrb_parser_state *p, mrb_parser_foreach_top_variable_func *func, void *user); + +void +mrb_parser_foreach_top_variable(mrb_state *mrb, struct mrb_parser_state *p, mrb_parser_foreach_top_variable_func *func, void *user) +{ + const mrb_ast_node *n = p->tree; + if ((intptr_t)n->car == NODE_SCOPE) { + n = n->cdr->car; + for (; n; n = n->cdr) { + mrb_sym sym = (intptr_t)n->car; + if (sym && !func(mrb, sym, user)) break; + } + } +} |
