diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/magic-expr.c | 140 | ||||
-rw-r--r-- | src/map/magic-expr.h | 10 | ||||
-rw-r--r-- | src/map/magic-interpreter-lexer.c | 493 | ||||
-rw-r--r-- | src/map/magic-interpreter-parser.c | 1143 | ||||
-rw-r--r-- | src/map/magic-interpreter-parser.h | 2 | ||||
-rw-r--r-- | src/map/magic-interpreter-parser.y | 20 | ||||
-rw-r--r-- | src/map/magic-interpreter.h | 5 | ||||
-rw-r--r-- | src/map/magic-interpreter.l | 1 | ||||
-rw-r--r-- | src/map/magic-stmt.c | 99 | ||||
-rw-r--r-- | src/map/magic.c | 2 | ||||
-rw-r--r-- | src/map/pc.c | 14 |
11 files changed, 1059 insertions, 870 deletions
diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index a300a74..0034441 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -214,6 +214,20 @@ make_location(val_t *v) } } +static void +make_spell(val_t *v) +{ + if (v->ty == TY_INVOCATION) { + invocation_t *invoc = v->v.v_invocation; //(invocation_t *) map_id2bl(v->v.v_int); + if (!invoc) + v->ty = TY_FAIL; + else { + v->ty = TY_SPELL; + v->v.v_spell = invoc->spell; + } + } +} + static int fun_add(env_t *env, int args_nr, val_t *result, val_t *args) { @@ -483,13 +497,13 @@ magic_area_rect(int *m, int *x, int *y, int *width, int *height, area_t *area) } } -static int -location_in_area(int m, int x, int y, area_t *area) +int +magic_location_in_area(int m, int x, int y, area_t *area) { switch (area->ty) { case AREA_UNION: - return location_in_area(m, x, y, area->a.a_union[0]) - || location_in_area(m, x, y, area->a.a_union[1]); + return magic_location_in_area(m, x, y, area->a.a_union[0]) + || magic_location_in_area(m, x, y, area->a.a_union[1]); case AREA_LOCATION: case AREA_RECT: case AREA_BAR: { @@ -510,10 +524,10 @@ location_in_area(int m, int x, int y, area_t *area) static int fun_is_in(env_t *env, int args_nr, val_t *result, val_t *args) { - RESULTINT = location_in_area(ARGLOCATION(0).m, - ARGLOCATION(0).x, - ARGLOCATION(0).y, - ARGAREA(1)); + RESULTINT = magic_location_in_area(ARGLOCATION(0).m, + ARGLOCATION(0).x, + ARGLOCATION(0).y, + ARGAREA(1)); return 0; } @@ -621,31 +635,79 @@ fun_hash_entity(env_t *env, int args_nr, val_t *result, val_t *args) return 0; } +int // ret -1: not a string, ret 1: no such item, ret 0: OK +magic_find_item(val_t *args, int index, struct item *item, int *stackable) +{ + struct item_data *item_data; + int must_add_sequentially; + + if (TY(index) == TY_INT) + item_data = itemdb_exists(ARGINT(index)); + else if (TY(index) == TY_STRING) + item_data = itemdb_searchname(ARGSTR(index)); + else + return -1; + + if (!item_data) + return 1; + + must_add_sequentially = (item_data->type == 4 + || item_data->type == 5 + || item_data->type == 7 + || item_data->type == 8); /* Very elegant. */ + + if (stackable) + *stackable = !must_add_sequentially; + + memset(item, 0, sizeof(struct item)); + item->nameid = item_data->nameid; + item->identify = 1; + + return 0; +} + static int fun_count_item(env_t *env, int args_nr, val_t *result, val_t *args) { character_t *chr = (ETY(0) == BL_PC) ? ARGPC(0) : NULL; - int item_id; - - if (TY(1) == TY_INT) - item_id = ARGINT(1); - else if (TY(1) == TY_STRING) { - struct item_data *bitem = itemdb_searchname(ARGSTR(1)); - if (!bitem) { - fprintf(stderr, "Unknown item `%s' used in spell\n", ARGSTR(1)); - return 1; - } else - item_id = bitem->nameid; - } else - return 0; + int stackable; + struct item item; + + GET_ARG_ITEM(1, item, stackable); if (!chr) return 1; - RESULTINT = pc_count_all_items(chr, item_id); + RESULTINT = pc_count_all_items(chr, item.nameid); return 0; } +static int +fun_is_equipped(env_t *env, int args_nr, val_t *result, val_t *args) +{ + character_t *chr = (ETY(0) == BL_PC) ? ARGPC(0) : NULL; + int stackable; + struct item item; + int i; + int retval = 0; + + GET_ARG_ITEM(1, item, stackable); + + if (!chr) + return 1; + + fprintf(stderr, "Checking for equipped status of item %d\n", item.nameid); + + for (i = 0; i < 11; i++) + if (chr->equip_index[i] >= 0 + && chr->status.inventory[chr->equip_index[i]].nameid == item.nameid) { + retval = i + 1; + break; + } + + RESULTINT = retval; + return 0; +} static int fun_is_married(env_t *env, int args_nr, val_t *result, val_t *args) @@ -885,6 +947,13 @@ fun_element_level(env_t *env, int args_nr, val_t *result, val_t *args) return 0; } +static int +fun_index(env_t *env, int args_nr, val_t *result, val_t *args) +{ + RESULTINT = ARGSPELL(0)->index; + return 0; +} + #define BATTLE_RECORD2(sname, name) { sname, "e", 'i', fun_get_##name } #define BATTLE_RECORD(name) BATTLE_RECORD2(#name, name) static fun_t functions[] = { @@ -944,6 +1013,8 @@ static fun_t functions[] = { { "element", "e", 'i', fun_element }, { "element_level", "e", 'i', fun_element_level }, { "has_shroud", "e", 'i', fun_has_shroud }, + { "is_equipped", "e.", 'i', fun_is_equipped }, + { "spell_index", "S", 'i', fun_index }, { NULL, NULL, '.', NULL } }; @@ -1167,6 +1238,7 @@ magic_signature_check(char *opname, char *funname, char *signature, int args_nr, case TY_STRING: stringify(arg, 1); break; /* 100% success rate */ case TY_AREA: make_area(arg); break; /* Only works for locations */ case TY_LOCATION: make_location(arg); break; /* Only works for some areas */ + case TY_SPELL: make_spell(arg); break; /* Only works for still-active invocatoins */ default: break; /* We'll fail right below */ } @@ -1241,8 +1313,30 @@ magic_eval(env_t *env, val_t *dest, expr_t *expr) break; } + case EXPR_SPELLFIELD: { + val_t v; + int id = expr->e.e_field.id; + magic_eval(env, &v, expr->e.e_field.expr); + + if (v.ty == TY_INVOCATION) { + invocation_t *t = (invocation_t *) map_id2bl(v.v.v_int); + + if (!t) + dest->ty = TY_UNDEF; + else { + env_t *env = t->env; + val_t v = VAR(id); + magic_copy_var(dest, &v); + } + } else { + fprintf(stderr, "[magic] Attempt to access field %s on non-spell\n", env->base_env->var_name[id]); + dest->ty = TY_FAIL; + } + break; + } + default: - fprintf(stderr, "INTERNAL ERROR: Unknown expression type %d\n", expr->ty); + fprintf(stderr, "[magic] INTERNAL ERROR: Unknown expression type %d\n", expr->ty); break; } } diff --git a/src/map/magic-expr.h b/src/map/magic-expr.h index 5f58d3c..d8221d0 100644 --- a/src/map/magic-expr.h +++ b/src/map/magic-expr.h @@ -89,4 +89,12 @@ magic_copy_var(val_t *dest, val_t *src); void magic_random_location(location_t *dest, area_t *area); -#endif /* !defined(MAGIC_EXPR_H_) */
\ No newline at end of file +int // ret -1: not a string, ret 1: no such item, ret 0: OK +magic_find_item(val_t *args, int index, struct item *item, int *stackable); + +#define GET_ARG_ITEM(index, dest, stackable) switch(magic_find_item(args, index, &dest, &stackable)) { case -1 : return 1; case 1 : return 0; } + +int +magic_location_in_area(int m, int x, int y, area_t *area); + +#endif /* !defined(MAGIC_EXPR_H_) */ diff --git a/src/map/magic-interpreter-lexer.c b/src/map/magic-interpreter-lexer.c index 2acc3d1..6cf5d73 100644 --- a/src/map/magic-interpreter-lexer.c +++ b/src/map/magic-interpreter-lexer.c @@ -396,8 +396,8 @@ static void yy_fatal_error (yyconst char msg[] ); *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 84 -#define YY_END_OF_BUFFER 85 +#define YY_NUM_RULES 85 +#define YY_END_OF_BUFFER 86 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -405,34 +405,34 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[237] = +static yyconst flex_int16_t yy_accept[238] = { 0, - 0, 0, 85, 83, 82, 82, 83, 83, 83, 23, - 33, 17, 18, 21, 19, 28, 20, 22, 77, 77, - 27, 26, 14, 9, 13, 29, 79, 79, 79, 79, - 7, 79, 79, 79, 79, 79, 5, 79, 79, 79, - 1, 79, 3, 31, 32, 34, 83, 30, 12, 0, - 76, 0, 0, 80, 24, 77, 0, 0, 35, 16, - 11, 10, 50, 15, 36, 79, 79, 79, 79, 79, - 79, 73, 79, 79, 79, 79, 68, 48, 79, 79, - 79, 79, 6, 79, 4, 39, 64, 79, 79, 8, - 79, 79, 79, 79, 2, 79, 79, 79, 40, 79, - - 0, 0, 75, 25, 0, 76, 0, 0, 81, 78, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 49, 79, 72, 47, 79, 79, 65, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 0, 0, 75, 79, 79, 79, 79, 38, 79, 79, - 79, 79, 79, 70, 79, 79, 79, 55, 79, 79, - 79, 79, 57, 79, 79, 79, 79, 69, 79, 74, - 58, 61, 79, 59, 79, 79, 79, 63, 79, 79, - 79, 44, 79, 79, 79, 79, 46, 79, 79, 79, - 79, 79, 79, 79, 79, 60, 66, 79, 79, 79, - - 79, 43, 51, 67, 79, 79, 79, 79, 79, 79, - 71, 79, 79, 52, 79, 41, 79, 56, 79, 79, - 45, 79, 79, 62, 53, 79, 37, 79, 54, 79, - 79, 79, 79, 79, 42, 0 + 0, 0, 86, 84, 83, 83, 84, 84, 84, 23, + 33, 17, 18, 21, 19, 28, 20, 35, 22, 78, + 78, 27, 26, 14, 9, 13, 29, 80, 80, 80, + 80, 7, 80, 80, 80, 80, 80, 5, 80, 80, + 80, 1, 80, 3, 31, 32, 34, 84, 30, 12, + 0, 77, 0, 0, 81, 24, 78, 0, 0, 36, + 16, 11, 10, 51, 15, 37, 80, 80, 80, 80, + 80, 80, 74, 80, 80, 80, 80, 69, 49, 80, + 80, 80, 80, 6, 80, 4, 40, 65, 80, 80, + 8, 80, 80, 80, 80, 2, 80, 80, 80, 41, + + 80, 0, 0, 76, 25, 0, 77, 0, 0, 82, + 79, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 50, 80, 73, 48, 80, 80, 66, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 0, 0, 76, 80, 80, 80, 80, 39, 80, + 80, 80, 80, 80, 71, 80, 80, 80, 56, 80, + 80, 80, 80, 58, 80, 80, 80, 80, 70, 80, + 75, 59, 62, 80, 60, 80, 80, 80, 64, 80, + 80, 80, 45, 80, 80, 80, 80, 47, 80, 80, + 80, 80, 80, 80, 80, 80, 61, 67, 80, 80, + + 80, 80, 44, 52, 68, 80, 80, 80, 80, 80, + 80, 72, 80, 80, 53, 80, 42, 80, 57, 80, + 80, 46, 80, 80, 63, 54, 80, 38, 80, 55, + 80, 80, 80, 80, 80, 43, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -441,16 +441,16 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 5, 6, 1, 7, 8, 1, 9, - 10, 11, 12, 13, 14, 1, 15, 16, 17, 17, - 17, 17, 17, 17, 17, 17, 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, 34, 46, 34, 47, 34, - 48, 49, 50, 51, 23, 1, 52, 52, 52, 52, - - 52, 52, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 53, - 34, 34, 54, 55, 56, 1, 1, 1, 1, 1, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, + 18, 18, 18, 18, 18, 18, 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, 35, 47, 35, 48, 35, + 49, 50, 51, 52, 24, 1, 53, 53, 53, 53, + + 53, 53, 35, 35, 35, 35, 35, 35, 35, 35, + 35, 35, 35, 35, 35, 35, 35, 35, 35, 54, + 35, 35, 55, 56, 57, 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, @@ -467,170 +467,170 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[57] = +static yyconst flex_int32_t yy_meta[58] = { 0, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 1, 3, 3, 1, 1, 1, - 1, 1, 2, 1, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, - 1, 3, 2, 1, 1, 1 + 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, + 1, 1, 1, 2, 1, 3, 3, 3, 3, 3, + 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, + 1, 1, 3, 2, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[245] = +static yyconst flex_int16_t yy_base[246] = { 0, - 0, 0, 286, 287, 287, 287, 264, 52, 281, 287, - 275, 287, 287, 287, 287, 287, 42, 267, 44, 46, - 287, 287, 44, 46, 48, 287, 45, 239, 47, 241, - 43, 240, 0, 44, 46, 51, 48, 236, 51, 248, - 63, 79, 251, 287, 287, 287, 35, 220, 287, 75, - 287, 97, 271, 287, 287, 89, 270, 0, 287, 287, - 287, 287, 287, 287, 287, 0, 233, 66, 242, 76, - 76, 0, 240, 226, 55, 226, 0, 0, 223, 239, - 227, 238, 0, 225, 0, 0, 0, 223, 220, 0, - 224, 226, 229, 215, 0, 214, 219, 225, 207, 219, - - 66, 85, 287, 287, 111, 112, 118, 248, 287, 0, - 208, 211, 206, 222, 210, 201, 219, 203, 199, 212, - 211, 0, 206, 209, 0, 212, 211, 0, 198, 207, - 188, 203, 191, 194, 196, 197, 198, 188, 200, 180, - 76, 123, 79, 179, 194, 188, 185, 0, 175, 182, - 178, 172, 188, 0, 170, 188, 176, 0, 186, 181, - 176, 170, 0, 171, 168, 176, 164, 0, 161, 0, - 0, 0, 171, 0, 168, 153, 140, 0, 133, 129, - 148, 0, 143, 145, 129, 126, 0, 138, 124, 127, - 137, 133, 126, 119, 130, 0, 0, 126, 124, 111, - - 126, 0, 0, 0, 112, 110, 123, 122, 106, 111, - 0, 121, 105, 0, 101, 0, 102, 0, 100, 98, - 0, 111, 125, 0, 0, 95, 0, 112, 0, 98, - 106, 99, 91, 87, 0, 287, 179, 182, 184, 187, - 190, 193, 124, 196 + 0, 0, 287, 288, 288, 288, 264, 53, 282, 288, + 276, 288, 288, 288, 288, 288, 42, 288, 267, 44, + 46, 288, 288, 44, 46, 48, 288, 45, 239, 47, + 241, 43, 240, 0, 44, 46, 51, 48, 236, 51, + 248, 63, 76, 251, 288, 288, 288, 35, 220, 288, + 76, 288, 102, 272, 288, 288, 83, 271, 0, 288, + 288, 288, 288, 288, 288, 288, 0, 233, 66, 242, + 75, 75, 0, 240, 226, 86, 226, 0, 0, 223, + 239, 227, 238, 0, 225, 0, 0, 0, 223, 220, + 0, 224, 226, 229, 215, 0, 214, 219, 225, 207, + + 219, 67, 86, 288, 288, 79, 113, 118, 249, 288, + 0, 208, 211, 206, 222, 210, 201, 219, 203, 199, + 212, 211, 0, 206, 209, 0, 212, 211, 0, 198, + 207, 188, 203, 191, 194, 196, 197, 198, 188, 200, + 180, 75, 119, 77, 179, 194, 188, 185, 0, 175, + 182, 178, 172, 188, 0, 170, 188, 176, 0, 186, + 181, 176, 170, 0, 171, 168, 176, 164, 0, 161, + 0, 0, 0, 171, 0, 168, 153, 161, 0, 154, + 150, 169, 0, 143, 145, 130, 127, 0, 139, 125, + 127, 137, 133, 126, 118, 131, 0, 0, 127, 125, + + 112, 127, 0, 0, 0, 113, 111, 124, 123, 106, + 111, 0, 121, 105, 0, 102, 0, 103, 0, 101, + 99, 0, 112, 127, 0, 0, 96, 0, 113, 0, + 99, 109, 102, 93, 87, 0, 288, 176, 179, 181, + 184, 187, 190, 125, 193 } ; -static yyconst flex_int16_t yy_def[245] = +static yyconst flex_int16_t yy_def[246] = { 0, - 236, 1, 236, 236, 236, 236, 236, 237, 238, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 236, 236, 236, 240, 236, 236, 237, - 236, 241, 238, 236, 236, 236, 242, 243, 236, 236, - 236, 236, 236, 236, 236, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - - 240, 244, 236, 236, 237, 237, 241, 242, 236, 243, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 240, 244, 240, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 239, 239, 239, 239, 239, - 239, 239, 239, 239, 239, 0, 236, 236, 236, 236, - 236, 236, 236, 236 + 237, 1, 237, 237, 237, 237, 237, 238, 239, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 237, 237, 237, 241, 237, 237, + 238, 237, 242, 239, 237, 237, 237, 243, 244, 237, + 237, 237, 237, 237, 237, 237, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + + 240, 241, 245, 237, 237, 238, 238, 242, 243, 237, + 244, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 241, 245, 241, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 240, 240, 240, 240, + 240, 240, 240, 240, 240, 240, 0, 237, 237, 237, + 237, 237, 237, 237, 237 } ; -static yyconst flex_int16_t yy_nxt[344] = +static yyconst flex_int16_t yy_nxt[346] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 4, 26, 27, 28, 29, 30, 31, 32, - 33, 33, 34, 33, 33, 35, 36, 37, 38, 39, - 33, 40, 41, 42, 33, 43, 33, 44, 4, 45, - 46, 33, 33, 47, 48, 4, 51, 56, 56, 56, - 56, 56, 56, 59, 60, 61, 62, 63, 64, 65, - 67, 70, 73, 77, 79, 81, 83, 87, 74, 51, - 75, 78, 122, 102, 80, 71, 84, 101, 68, 82, - 103, 90, 88, 85, 112, 91, 58, 92, 123, 50, - - 52, 106, 93, 96, 56, 56, 94, 97, 95, 113, - 98, 115, 118, 119, 102, 51, 51, 99, 116, 117, - 50, 103, 106, 52, 102, 101, 110, 102, 235, 234, - 233, 103, 232, 142, 103, 231, 230, 229, 228, 227, - 143, 226, 225, 224, 223, 107, 222, 221, 220, 219, - 218, 217, 216, 215, 214, 213, 212, 211, 210, 52, - 52, 209, 208, 207, 206, 205, 107, 204, 203, 202, - 201, 142, 200, 199, 198, 197, 196, 195, 143, 50, - 50, 50, 53, 53, 53, 66, 66, 101, 101, 101, - 105, 105, 105, 108, 108, 108, 141, 141, 141, 194, - - 193, 192, 191, 190, 189, 188, 187, 186, 185, 184, - 183, 182, 181, 180, 179, 178, 177, 176, 175, 174, - 173, 172, 171, 170, 169, 168, 167, 166, 165, 164, - 163, 162, 161, 160, 159, 158, 157, 156, 155, 154, - 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, - 109, 140, 139, 138, 137, 136, 135, 134, 133, 132, - 131, 130, 129, 128, 127, 126, 125, 124, 121, 120, - 114, 111, 109, 54, 104, 100, 89, 86, 76, 72, - 69, 57, 55, 54, 49, 236, 3, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236 + 24, 25, 26, 4, 27, 28, 29, 30, 31, 32, + 33, 34, 34, 35, 34, 34, 36, 37, 38, 39, + 40, 34, 41, 42, 43, 34, 44, 34, 45, 4, + 46, 47, 34, 34, 48, 49, 4, 52, 57, 57, + 57, 57, 57, 57, 60, 61, 62, 63, 64, 65, + 66, 68, 71, 74, 78, 80, 82, 84, 88, 75, + 52, 76, 79, 52, 103, 81, 72, 85, 102, 69, + 83, 104, 91, 89, 86, 113, 92, 59, 93, 57, + + 57, 97, 53, 94, 51, 98, 107, 95, 99, 96, + 114, 116, 119, 120, 123, 100, 103, 52, 117, 118, + 51, 102, 107, 104, 103, 53, 103, 111, 53, 236, + 124, 104, 235, 104, 234, 143, 233, 232, 231, 230, + 229, 228, 144, 227, 226, 225, 224, 223, 222, 221, + 220, 108, 219, 218, 217, 216, 215, 214, 213, 212, + 211, 210, 53, 209, 208, 207, 206, 108, 143, 205, + 204, 203, 202, 201, 200, 144, 51, 51, 51, 54, + 54, 54, 67, 67, 102, 102, 102, 106, 106, 106, + 109, 109, 109, 142, 142, 142, 199, 198, 197, 196, + + 195, 194, 193, 192, 191, 190, 189, 188, 187, 186, + 185, 184, 183, 182, 181, 180, 179, 178, 177, 176, + 175, 174, 173, 172, 171, 170, 169, 168, 167, 166, + 165, 164, 163, 162, 161, 160, 159, 158, 157, 156, + 155, 154, 153, 152, 151, 150, 149, 148, 147, 146, + 145, 110, 141, 140, 139, 138, 137, 136, 135, 134, + 133, 132, 131, 130, 129, 128, 127, 126, 125, 122, + 121, 115, 112, 110, 55, 105, 101, 90, 87, 77, + 73, 70, 58, 56, 55, 50, 237, 3, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237 } ; -static yyconst flex_int16_t yy_chk[344] = +static yyconst flex_int16_t yy_chk[346] = { 0, 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, 8, 17, 17, 19, - 19, 20, 20, 23, 23, 23, 24, 24, 25, 25, - 27, 29, 31, 34, 35, 36, 37, 39, 31, 50, - 31, 34, 75, 47, 35, 29, 37, 102, 27, 36, - 47, 41, 39, 37, 68, 41, 19, 41, 75, 52, - - 8, 52, 41, 42, 56, 56, 41, 42, 41, 68, - 42, 70, 71, 71, 101, 105, 106, 42, 70, 70, - 107, 101, 107, 50, 141, 142, 243, 143, 234, 233, - 232, 141, 231, 102, 143, 230, 228, 226, 223, 222, - 102, 220, 219, 217, 215, 52, 213, 212, 210, 209, - 208, 207, 206, 205, 201, 200, 199, 198, 195, 105, - 106, 194, 193, 192, 191, 190, 107, 189, 188, 186, - 185, 142, 184, 183, 181, 180, 179, 177, 142, 237, - 237, 237, 238, 238, 238, 239, 239, 240, 240, 240, - 241, 241, 241, 242, 242, 242, 244, 244, 244, 176, - - 175, 173, 169, 167, 166, 165, 164, 162, 161, 160, - 159, 157, 156, 155, 153, 152, 151, 150, 149, 147, - 146, 145, 144, 140, 139, 138, 137, 136, 135, 134, - 133, 132, 131, 130, 129, 127, 126, 124, 123, 121, - 120, 119, 118, 117, 116, 115, 114, 113, 112, 111, - 108, 100, 99, 98, 97, 96, 94, 93, 92, 91, - 89, 88, 84, 82, 81, 80, 79, 76, 74, 73, - 69, 67, 57, 53, 48, 43, 40, 38, 32, 30, - 28, 18, 11, 9, 7, 3, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 236, 236, 236 + 1, 1, 1, 1, 1, 1, 1, 8, 17, 17, + 20, 20, 21, 21, 24, 24, 24, 25, 25, 26, + 26, 28, 30, 32, 35, 36, 37, 38, 40, 32, + 51, 32, 35, 106, 48, 36, 30, 38, 103, 28, + 37, 48, 42, 40, 38, 69, 42, 20, 42, 57, + + 57, 43, 8, 42, 53, 43, 53, 42, 43, 42, + 69, 71, 72, 72, 76, 43, 102, 107, 71, 71, + 108, 143, 108, 102, 142, 51, 144, 244, 106, 235, + 76, 142, 234, 144, 233, 103, 232, 231, 229, 227, + 224, 223, 103, 221, 220, 218, 216, 214, 213, 211, + 210, 53, 209, 208, 207, 206, 202, 201, 200, 199, + 196, 195, 107, 194, 193, 192, 191, 108, 143, 190, + 189, 187, 186, 185, 184, 143, 238, 238, 238, 239, + 239, 239, 240, 240, 241, 241, 241, 242, 242, 242, + 243, 243, 243, 245, 245, 245, 182, 181, 180, 178, + + 177, 176, 174, 170, 168, 167, 166, 165, 163, 162, + 161, 160, 158, 157, 156, 154, 153, 152, 151, 150, + 148, 147, 146, 145, 141, 140, 139, 138, 137, 136, + 135, 134, 133, 132, 131, 130, 128, 127, 125, 124, + 122, 121, 120, 119, 118, 117, 116, 115, 114, 113, + 112, 109, 101, 100, 99, 98, 97, 95, 94, 93, + 92, 90, 89, 85, 83, 82, 81, 80, 77, 75, + 74, 70, 68, 58, 54, 49, 44, 41, 39, 33, + 31, 29, 19, 11, 9, 7, 3, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 237, 237, 237, 237, 237 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[85] = +static yyconst flex_int32_t yy_rule_can_match_eol[86] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 1, 0, 0, }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, + 0, 0, 0, 1, 0, 0, }; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -915,13 +915,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 237 ) + if ( yy_current_state >= 238 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 287 ); + while ( yy_base[yy_current_state] != 288 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1128,217 +1128,222 @@ YY_RULE_SETUP case 35: YY_RULE_SETUP #line 58 "magic-interpreter.l" -{FIXLOC; return SHL;} +{FIXLOC; return '.';} YY_BREAK case 36: YY_RULE_SETUP #line 59 "magic-interpreter.l" -{FIXLOC; return SHR;} +{FIXLOC; return SHL;} YY_BREAK case 37: YY_RULE_SETUP #line 60 "magic-interpreter.l" -{FIXLOC; return PROCEDURE;} +{FIXLOC; return SHR;} YY_BREAK case 38: YY_RULE_SETUP #line 61 "magic-interpreter.l" -{FIXLOC; return CALL;} +{FIXLOC; return PROCEDURE;} YY_BREAK case 39: YY_RULE_SETUP #line 62 "magic-interpreter.l" -{FIXLOC; return OR;} +{FIXLOC; return CALL;} YY_BREAK case 40: YY_RULE_SETUP #line 63 "magic-interpreter.l" -{FIXLOC; return TO;} +{FIXLOC; return OR;} YY_BREAK case 41: YY_RULE_SETUP #line 64 "magic-interpreter.l" -{FIXLOC; return TOWARDS;} +{FIXLOC; return TO;} YY_BREAK case 42: YY_RULE_SETUP #line 65 "magic-interpreter.l" -{FIXLOC; return TELEPORT_ANCHOR;} +{FIXLOC; return TOWARDS;} YY_BREAK case 43: YY_RULE_SETUP #line 66 "magic-interpreter.l" -{FIXLOC; return SILENT;} +{FIXLOC; return TELEPORT_ANCHOR;} YY_BREAK case 44: YY_RULE_SETUP #line 67 "magic-interpreter.l" -{FIXLOC; return LOCAL;} +{FIXLOC; return SILENT;} YY_BREAK case 45: YY_RULE_SETUP #line 68 "magic-interpreter.l" -{FIXLOC; return NONMAGIC;} +{FIXLOC; return LOCAL;} YY_BREAK case 46: YY_RULE_SETUP #line 69 "magic-interpreter.l" -{FIXLOC; return SPELL;} +{FIXLOC; return NONMAGIC;} YY_BREAK case 47: YY_RULE_SETUP #line 70 "magic-interpreter.l" -{FIXLOC; return LET;} +{FIXLOC; return SPELL;} YY_BREAK case 48: YY_RULE_SETUP #line 71 "magic-interpreter.l" -{FIXLOC; return IN;} +{FIXLOC; return LET;} YY_BREAK case 49: YY_RULE_SETUP #line 72 "magic-interpreter.l" -{FIXLOC; return END;} +{FIXLOC; return IN;} YY_BREAK case 50: YY_RULE_SETUP #line 73 "magic-interpreter.l" -{FIXLOC; return DARROW;} +{FIXLOC; return END;} YY_BREAK case 51: YY_RULE_SETUP #line 74 "magic-interpreter.l" -{FIXLOC; return STRING_TY;} +{FIXLOC; return DARROW;} YY_BREAK case 52: YY_RULE_SETUP #line 75 "magic-interpreter.l" -{FIXLOC; return REQUIRE;} +{FIXLOC; return STRING_TY;} YY_BREAK case 53: YY_RULE_SETUP #line 76 "magic-interpreter.l" -{FIXLOC; return CATALYSTS;} +{FIXLOC; return REQUIRE;} YY_BREAK case 54: YY_RULE_SETUP #line 77 "magic-interpreter.l" -{FIXLOC; return COMPONENTS;} +{FIXLOC; return CATALYSTS;} YY_BREAK case 55: YY_RULE_SETUP #line 78 "magic-interpreter.l" -{FIXLOC; return MANA;} +{FIXLOC; return COMPONENTS;} YY_BREAK case 56: YY_RULE_SETUP #line 79 "magic-interpreter.l" -{FIXLOC; return CASTTIME;} +{FIXLOC; return MANA;} YY_BREAK case 57: YY_RULE_SETUP #line 80 "magic-interpreter.l" -{FIXLOC; return SKIP;} +{FIXLOC; return CASTTIME;} YY_BREAK case 58: YY_RULE_SETUP #line 81 "magic-interpreter.l" -{FIXLOC; return ABORT;} +{FIXLOC; return SKIP;} YY_BREAK case 59: YY_RULE_SETUP #line 82 "magic-interpreter.l" -{FIXLOC; return BREAK;} +{FIXLOC; return ABORT;} YY_BREAK case 60: YY_RULE_SETUP #line 83 "magic-interpreter.l" -{FIXLOC; return EFFECT;} +{FIXLOC; return BREAK;} YY_BREAK case 61: YY_RULE_SETUP #line 84 "magic-interpreter.l" -{FIXLOC; return ATEND;} +{FIXLOC; return EFFECT;} YY_BREAK case 62: YY_RULE_SETUP #line 85 "magic-interpreter.l" -{FIXLOC; return ATTRIGGER;} +{FIXLOC; return ATEND;} YY_BREAK case 63: YY_RULE_SETUP #line 86 "magic-interpreter.l" -{FIXLOC; return CONST;} +{FIXLOC; return ATTRIGGER;} YY_BREAK case 64: YY_RULE_SETUP #line 87 "magic-interpreter.l" -{FIXLOC; return PC_F;} +{FIXLOC; return CONST;} YY_BREAK case 65: YY_RULE_SETUP #line 88 "magic-interpreter.l" -{FIXLOC; return MOB_F;} +{FIXLOC; return PC_F;} YY_BREAK case 66: YY_RULE_SETUP #line 89 "magic-interpreter.l" -{FIXLOC; return ENTITY_F;} +{FIXLOC; return MOB_F;} YY_BREAK case 67: YY_RULE_SETUP #line 90 "magic-interpreter.l" -{FIXLOC; return TARGET_F;} +{FIXLOC; return ENTITY_F;} YY_BREAK case 68: YY_RULE_SETUP #line 91 "magic-interpreter.l" -{FIXLOC; return IF;} +{FIXLOC; return TARGET_F;} YY_BREAK case 69: YY_RULE_SETUP #line 92 "magic-interpreter.l" -{FIXLOC; return THEN;} +{FIXLOC; return IF;} YY_BREAK case 70: YY_RULE_SETUP #line 93 "magic-interpreter.l" -{FIXLOC; return ELSE;} +{FIXLOC; return THEN;} YY_BREAK case 71: YY_RULE_SETUP #line 94 "magic-interpreter.l" -{FIXLOC; return FOREACH;} +{FIXLOC; return ELSE;} YY_BREAK case 72: YY_RULE_SETUP #line 95 "magic-interpreter.l" -{FIXLOC; return FOR;} +{FIXLOC; return FOREACH;} YY_BREAK case 73: YY_RULE_SETUP #line 96 "magic-interpreter.l" -{FIXLOC; return DO;} +{FIXLOC; return FOR;} YY_BREAK case 74: YY_RULE_SETUP #line 97 "magic-interpreter.l" -{FIXLOC; return SLEEP;} +{FIXLOC; return DO;} YY_BREAK case 75: -/* rule 75 can match eol */ YY_RULE_SETUP -#line 99 "magic-interpreter.l" +#line 98 "magic-interpreter.l" +{FIXLOC; return SLEEP;} + YY_BREAK +case 76: +/* rule 76 can match eol */ +YY_RULE_SETUP +#line 100 "magic-interpreter.l" { char *string = strdup(magic_frontend_text); magic_frontend_lval.s = string; FIXLOC; return SCRIPT_DATA; } YY_BREAK -case 76: -/* rule 76 can match eol */ +case 77: +/* rule 77 can match eol */ YY_RULE_SETUP -#line 105 "magic-interpreter.l" +#line 106 "magic-interpreter.l" { char *string = strdup(magic_frontend_text + 1); char *src = string; char *dst = string; @@ -1354,60 +1359,60 @@ YY_RULE_SETUP return STRING; } YY_BREAK -case 77: +case 78: YY_RULE_SETUP -#line 120 "magic-interpreter.l" +#line 121 "magic-interpreter.l" { magic_frontend_lval.i = atoi(magic_frontend_text); FIXLOC; return INT; } YY_BREAK -case 78: +case 79: YY_RULE_SETUP -#line 124 "magic-interpreter.l" +#line 125 "magic-interpreter.l" { magic_frontend_lval.i = strtol(magic_frontend_text + 2, NULL, 16); FIXLOC; return INT; } YY_BREAK -case 79: +case 80: YY_RULE_SETUP -#line 128 "magic-interpreter.l" +#line 129 "magic-interpreter.l" { magic_frontend_lval.s = strdup(magic_frontend_text); FIXLOC; return ID; } YY_BREAK -case 80: +case 81: *yy_cp = (yy_hold_char); /* undo effects of setting up magic_frontend_text */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up magic_frontend_text again */ YY_RULE_SETUP -#line 132 "magic-interpreter.l" +#line 133 "magic-interpreter.l" /* Ignore comments */ YY_BREAK -case 81: +case 82: *yy_cp = (yy_hold_char); /* undo effects of setting up magic_frontend_text */ (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up magic_frontend_text again */ YY_RULE_SETUP -#line 133 "magic-interpreter.l" +#line 134 "magic-interpreter.l" /* Ignore comments */ YY_BREAK -case 82: -/* rule 82 can match eol */ +case 83: +/* rule 83 can match eol */ YY_RULE_SETUP -#line 134 "magic-interpreter.l" +#line 135 "magic-interpreter.l" /* ignore whitespace */ YY_BREAK -case 83: +case 84: YY_RULE_SETUP -#line 135 "magic-interpreter.l" +#line 136 "magic-interpreter.l" fprintf(stderr, "%s: Unexpected character in line %d\n", MAGIC_CONFIG_FILE, magic_frontend_lineno); YY_BREAK -case 84: +case 85: YY_RULE_SETUP -#line 138 "magic-interpreter.l" +#line 139 "magic-interpreter.l" ECHO; YY_BREAK -#line 1411 "magic-interpreter-lexer.c" +#line 1416 "magic-interpreter-lexer.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1699,7 +1704,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 237 ) + if ( yy_current_state >= 238 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1727,11 +1732,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 237 ) + if ( yy_current_state >= 238 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 236); + yy_is_jam = (yy_current_state == 237); return yy_is_jam ? 0 : yy_current_state; } @@ -2376,7 +2381,7 @@ void magic_frontend_free (void * ptr ) #define YYTABLES_NAME "yytables" -#line 138 "magic-interpreter.l" +#line 139 "magic-interpreter.l" diff --git a/src/map/magic-interpreter-parser.c b/src/map/magic-interpreter-parser.c index 3472da0..66fb120 100644 --- a/src/map/magic-interpreter-parser.c +++ b/src/map/magic-interpreter-parser.c @@ -199,6 +199,9 @@ intern_id(char *id_name); static expr_t * fun_expr(char *name, int args_nr, expr_t **args, int line, int column); +static expr_t * +dot_expr(expr_t *lhs, int id); + #define BIN_EXPR(x, name, arg1, arg2, line, column) { expr_t *e[2]; e[0] = arg1; e[1] = arg2; x = fun_expr(name, 2, e, line, column); } static int failed_flag = 0; @@ -271,7 +274,7 @@ find_constant(char *name); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 71 "magic-interpreter-parser.y" +#line 74 "magic-interpreter-parser.y" { int i; char *s; @@ -293,7 +296,7 @@ typedef union YYSTYPE proc_t *proc; } /* Line 187 of yacc.c. */ -#line 297 "magic-interpreter-parser.c" +#line 300 "magic-interpreter-parser.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -318,7 +321,7 @@ typedef struct YYLTYPE /* Line 216 of yacc.c. */ -#line 322 "magic-interpreter-parser.c" +#line 325 "magic-interpreter-parser.c" #ifdef short # undef short @@ -535,16 +538,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 18 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 968 +#define YYLAST 1029 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 73 +#define YYNTOKENS 74 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 32 /* YYNRULES -- Number of rules. */ -#define YYNRULES 109 +#define YYNRULES 110 /* YYNRULES -- Number of states. */ -#define YYNSTATES 249 +#define YYNSTATES 251 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -559,16 +562,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 14, 22, 2, - 71, 72, 12, 10, 16, 11, 2, 13, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 17, 18, + 2, 2, 2, 2, 2, 2, 2, 14, 23, 2, + 72, 73, 12, 10, 16, 11, 17, 13, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 18, 19, 8, 7, 9, 2, 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 20, 2, 21, 23, 2, 2, 2, 2, 2, + 2, 21, 2, 22, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 19, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -582,11 +585,11 @@ static const yytype_uint8 yytranslate[] = 2, 2, 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, 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 + 5, 6, 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 }; #if YYDEBUG @@ -599,72 +602,75 @@ static const yytype_uint16 yyprhs[] = 65, 71, 73, 75, 77, 79, 81, 83, 85, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 127, 131, 135, 139, 143, 147, 151, 155, 159, 163, 168, - 172, 173, 175, 177, 181, 190, 192, 201, 211, 213, - 218, 220, 224, 228, 230, 234, 238, 242, 247, 248, - 251, 252, 255, 257, 261, 265, 267, 271, 274, 277, - 280, 283, 286, 290, 292, 296, 300, 302, 304, 306, - 308, 310, 312, 314, 316, 320, 323, 326, 329, 332, - 337, 345, 354, 361, 366, 370, 376, 378, 385, 386 + 172, 176, 177, 179, 181, 185, 194, 196, 205, 215, + 217, 222, 224, 228, 232, 234, 238, 242, 246, 251, + 252, 255, 256, 259, 261, 265, 269, 271, 275, 278, + 281, 284, 287, 290, 294, 296, 300, 304, 306, 308, + 310, 312, 314, 316, 318, 320, 324, 327, 330, 333, + 336, 341, 349, 358, 365, 370, 374, 380, 382, 389, + 390 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { - 74, 0, -1, -1, 78, 75, 74, -1, -1, 75, - 18, -1, -1, 77, -1, 5, -1, 77, 16, 5, - -1, 5, 7, 83, -1, 24, 5, 7, 83, -1, - 41, 5, 17, 83, 7, 83, -1, 25, 5, 71, - 76, 72, 7, 104, -1, 79, 42, 5, 80, 17, - 83, 7, 88, -1, -1, 28, 79, -1, 29, 79, - -1, 27, 79, -1, -1, 71, 5, 17, 81, 72, - -1, 59, -1, 47, -1, 6, -1, 3, -1, 4, - -1, 82, -1, 5, -1, 87, -1, 83, 10, 83, - -1, 83, 11, 83, -1, 83, 12, 83, -1, 83, - 14, 83, -1, 83, 13, 83, -1, 83, 8, 83, - -1, 83, 9, 83, -1, 83, 22, 83, -1, 83, - 23, 83, -1, 83, 19, 83, -1, 83, 30, 83, - -1, 83, 31, 83, -1, 83, 35, 83, -1, 83, - 34, 83, -1, 83, 36, 83, -1, 83, 37, 83, - -1, 83, 32, 83, -1, 83, 7, 83, -1, 83, - 33, 83, -1, 5, 71, 84, 72, -1, 71, 83, - 72, -1, -1, 85, -1, 83, -1, 85, 16, 83, - -1, 15, 71, 83, 16, 83, 16, 83, 72, -1, - 86, -1, 86, 15, 10, 71, 83, 16, 83, 72, - -1, 86, 40, 83, 17, 71, 83, 16, 83, 72, - -1, 91, -1, 43, 89, 44, 91, -1, 75, -1, - 89, 90, 75, -1, 5, 7, 83, -1, 92, -1, - 92, 19, 91, -1, 95, 46, 92, -1, 71, 91, - 72, -1, 56, 104, 93, 94, -1, -1, 58, 104, - -1, -1, 57, 104, -1, 97, -1, 95, 70, 95, - -1, 71, 96, 72, -1, 95, -1, 95, 16, 96, - -1, 48, 83, -1, 49, 98, -1, 50, 98, -1, - 51, 83, -1, 52, 83, -1, 20, 99, 21, -1, - 100, -1, 99, 16, 100, -1, 3, 12, 101, -1, - 101, -1, 4, -1, 3, -1, 59, -1, 60, -1, - 61, -1, 42, -1, 62, -1, 71, 104, 72, -1, - 53, 18, -1, 54, 18, -1, 45, 18, -1, 55, - 18, -1, 5, 7, 83, 18, -1, 66, 102, 5, - 44, 83, 68, 103, -1, 67, 5, 7, 83, 39, - 83, 68, 103, -1, 63, 83, 64, 103, 65, 103, - -1, 63, 83, 64, 103, -1, 69, 83, 18, -1, - 5, 71, 84, 72, 18, -1, 38, -1, 26, 5, - 71, 84, 72, 18, -1, -1, 103, 75, 104, -1 + 75, 0, -1, -1, 79, 76, 75, -1, -1, 76, + 19, -1, -1, 78, -1, 5, -1, 78, 16, 5, + -1, 5, 7, 84, -1, 25, 5, 7, 84, -1, + 42, 5, 18, 84, 7, 84, -1, 26, 5, 72, + 77, 73, 7, 105, -1, 80, 43, 5, 81, 18, + 84, 7, 89, -1, -1, 29, 80, -1, 30, 80, + -1, 28, 80, -1, -1, 72, 5, 18, 82, 73, + -1, 60, -1, 48, -1, 6, -1, 3, -1, 4, + -1, 83, -1, 5, -1, 88, -1, 84, 10, 84, + -1, 84, 11, 84, -1, 84, 12, 84, -1, 84, + 14, 84, -1, 84, 13, 84, -1, 84, 8, 84, + -1, 84, 9, 84, -1, 84, 23, 84, -1, 84, + 24, 84, -1, 84, 20, 84, -1, 84, 31, 84, + -1, 84, 32, 84, -1, 84, 36, 84, -1, 84, + 35, 84, -1, 84, 37, 84, -1, 84, 38, 84, + -1, 84, 33, 84, -1, 84, 7, 84, -1, 84, + 34, 84, -1, 5, 72, 85, 73, -1, 72, 84, + 73, -1, 84, 17, 5, -1, -1, 86, -1, 84, + -1, 86, 16, 84, -1, 15, 72, 84, 16, 84, + 16, 84, 73, -1, 87, -1, 87, 15, 10, 72, + 84, 16, 84, 73, -1, 87, 41, 84, 18, 72, + 84, 16, 84, 73, -1, 92, -1, 44, 90, 45, + 92, -1, 76, -1, 90, 91, 76, -1, 5, 7, + 84, -1, 93, -1, 93, 20, 92, -1, 96, 47, + 93, -1, 72, 92, 73, -1, 57, 105, 94, 95, + -1, -1, 59, 105, -1, -1, 58, 105, -1, 98, + -1, 96, 71, 96, -1, 72, 97, 73, -1, 96, + -1, 96, 16, 97, -1, 49, 84, -1, 50, 99, + -1, 51, 99, -1, 52, 84, -1, 53, 84, -1, + 21, 100, 22, -1, 101, -1, 100, 16, 101, -1, + 3, 12, 102, -1, 102, -1, 4, -1, 3, -1, + 60, -1, 61, -1, 62, -1, 43, -1, 63, -1, + 72, 105, 73, -1, 54, 19, -1, 55, 19, -1, + 46, 19, -1, 56, 19, -1, 5, 7, 84, 19, + -1, 67, 103, 5, 45, 84, 69, 104, -1, 68, + 5, 7, 84, 40, 84, 69, 104, -1, 64, 84, + 65, 104, 66, 104, -1, 64, 84, 65, 104, -1, + 70, 84, 19, -1, 5, 72, 85, 73, 19, -1, + 39, -1, 27, 5, 72, 85, 73, 19, -1, -1, + 104, 76, 105, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 207, 207, 208, 214, 215, 221, 222, 226, 232, - 239, 250, 256, 267, 276, 289, 290, 295, 300, 308, - 309, 315, 317, 322, 325, 328, 334, 337, 348, 351, - 353, 355, 357, 359, 361, 363, 365, 367, 369, 371, - 373, 375, 377, 379, 381, 383, 385, 387, 390, 395, - 400, 401, 406, 411, 418, 422, 426, 432, 442, 444, - 453, 457, 466, 479, 481, 490, 492, 494, 505, 506, - 512, 513, 518, 520, 526, 531, 533, 538, 542, 546, - 550, 554, 561, 566, 570, 577, 579, 584, 593, 598, - 600, 602, 604, 606, 611, 613, 615, 617, 619, 621, - 632, 639, 646, 652, 658, 662, 666, 673, 680, 681 + 0, 212, 212, 213, 219, 220, 226, 227, 231, 237, + 244, 255, 261, 272, 281, 294, 295, 300, 305, 313, + 314, 320, 322, 327, 330, 333, 339, 342, 353, 356, + 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, + 378, 380, 382, 384, 386, 388, 390, 392, 395, 400, + 402, 407, 408, 413, 418, 425, 429, 433, 439, 449, + 451, 460, 464, 473, 486, 488, 497, 499, 501, 512, + 513, 519, 520, 525, 527, 533, 538, 540, 545, 549, + 553, 557, 561, 568, 573, 577, 584, 586, 591, 600, + 605, 607, 609, 611, 613, 618, 620, 622, 624, 626, + 628, 639, 646, 653, 659, 665, 669, 673, 680, 687, + 688 }; #endif @@ -674,21 +680,21 @@ static const yytype_uint16 yyrline[] = static const char *const yytname[] = { "$end", "error", "$undefined", "INT", "STRING", "ID", "DIR", "'='", - "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'@'", "','", "':'", - "';'", "'|'", "'['", "']'", "'&'", "'^'", "CONST", "PROCEDURE", "CALL", - "SILENT", "LOCAL", "NONMAGIC", "SHL", "SHR", "EQ", "NEQ", "GTE", "LTE", - "ANDAND", "OROR", "SCRIPT_DATA", "TO", "TOWARDS", "TELEPORT_ANCHOR", - "SPELL", "LET", "IN", "END", "DARROW", "STRING_TY", "REQUIRE", - "CATALYSTS", "COMPONENTS", "MANA", "CASTTIME", "SKIP", "ABORT", "BREAK", - "EFFECT", "ATEND", "ATTRIGGER", "PC_F", "MOB_F", "ENTITY_F", "TARGET_F", - "IF", "THEN", "ELSE", "FOREACH", "FOR", "DO", "SLEEP", "OR", "'('", - "')'", "$accept", "spellconf", "semicolons", "proc_formals_list", - "proc_formals_list_ne", "spellconf_option", "spell_flags", "argopt", - "arg_ty", "value", "expr", "arg_list", "arg_list_ne", "location", "area", - "spelldef", "defs", "def", "spellbody_list", "spellbody", - "maybe_trigger", "maybe_end", "spellguard", "spellguard_list", "prereq", - "items", "item_list", "item", "item_name", "selection", "effect", - "effect_list", 0 + "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "'@'", "','", "'.'", + "':'", "';'", "'|'", "'['", "']'", "'&'", "'^'", "CONST", "PROCEDURE", + "CALL", "SILENT", "LOCAL", "NONMAGIC", "SHL", "SHR", "EQ", "NEQ", "GTE", + "LTE", "ANDAND", "OROR", "SCRIPT_DATA", "TO", "TOWARDS", + "TELEPORT_ANCHOR", "SPELL", "LET", "IN", "END", "DARROW", "STRING_TY", + "REQUIRE", "CATALYSTS", "COMPONENTS", "MANA", "CASTTIME", "SKIP", + "ABORT", "BREAK", "EFFECT", "ATEND", "ATTRIGGER", "PC_F", "MOB_F", + "ENTITY_F", "TARGET_F", "IF", "THEN", "ELSE", "FOREACH", "FOR", "DO", + "SLEEP", "OR", "'('", "')'", "$accept", "spellconf", "semicolons", + "proc_formals_list", "proc_formals_list_ne", "spellconf_option", + "spell_flags", "argopt", "arg_ty", "value", "expr", "arg_list", + "arg_list_ne", "location", "area", "spelldef", "defs", "def", + "spellbody_list", "spellbody", "maybe_trigger", "maybe_end", + "spellguard", "spellguard_list", "prereq", "items", "item_list", "item", + "item_name", "selection", "effect", "effect_list", 0 }; #endif @@ -698,30 +704,31 @@ static const char *const yytname[] = static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 61, 60, 62, - 43, 45, 42, 47, 37, 64, 44, 58, 59, 124, - 91, 93, 38, 94, 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, 40, 41 + 43, 45, 42, 47, 37, 64, 44, 46, 58, 59, + 124, 91, 93, 38, 94, 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, 40, 41 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 73, 74, 74, 75, 75, 76, 76, 77, 77, - 78, 78, 78, 78, 78, 79, 79, 79, 79, 80, - 80, 81, 81, 82, 82, 82, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 84, 84, 85, 85, 86, 87, 87, 87, 88, 88, - 89, 89, 90, 91, 91, 92, 92, 92, 93, 93, - 94, 94, 95, 95, 95, 96, 96, 97, 97, 97, - 97, 97, 98, 99, 99, 100, 100, 101, 101, 102, - 102, 102, 102, 102, 103, 103, 103, 103, 103, 103, - 103, 103, 103, 103, 103, 103, 103, 103, 104, 104 + 0, 74, 75, 75, 76, 76, 77, 77, 78, 78, + 79, 79, 79, 79, 79, 80, 80, 80, 80, 81, + 81, 82, 82, 83, 83, 83, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, + 84, 85, 85, 86, 86, 87, 88, 88, 88, 89, + 89, 90, 90, 91, 92, 92, 93, 93, 93, 94, + 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, + 98, 98, 98, 99, 100, 100, 101, 101, 102, 102, + 103, 103, 103, 103, 103, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 104, 104, 104, 104, 104, 105, + 105 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -732,12 +739,13 @@ static const yytype_uint8 yyr2[] = 5, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 3, - 0, 1, 1, 3, 8, 1, 8, 9, 1, 4, - 1, 3, 3, 1, 3, 3, 3, 4, 0, 2, - 0, 2, 1, 3, 3, 1, 3, 2, 2, 2, - 2, 2, 3, 1, 3, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 2, 2, 2, 2, 4, - 7, 8, 6, 4, 3, 5, 1, 6, 0, 3 + 3, 0, 1, 1, 3, 8, 1, 8, 9, 1, + 4, 1, 3, 3, 1, 3, 3, 3, 4, 0, + 2, 0, 2, 1, 3, 3, 1, 3, 2, 2, + 2, 2, 2, 3, 1, 3, 3, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 2, 2, 2, 2, + 4, 7, 8, 6, 4, 3, 5, 1, 6, 0, + 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -747,79 +755,81 @@ static const yytype_uint8 yydefact[] = { 2, 0, 0, 0, 15, 15, 15, 0, 0, 4, 0, 0, 0, 0, 18, 16, 17, 0, 1, 2, - 0, 24, 25, 27, 23, 0, 0, 26, 10, 55, - 28, 0, 6, 0, 5, 3, 19, 50, 0, 0, + 0, 24, 25, 27, 23, 0, 0, 26, 10, 56, + 28, 0, 6, 0, 5, 3, 19, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 11, 8, 0, 7, 0, 0, 0, 52, 0, - 51, 0, 49, 46, 34, 35, 29, 30, 31, 33, - 32, 38, 36, 37, 39, 40, 45, 47, 42, 41, - 43, 44, 0, 0, 0, 0, 0, 0, 0, 48, - 0, 0, 0, 0, 108, 9, 46, 0, 0, 53, - 0, 0, 0, 0, 0, 106, 0, 0, 0, 0, - 0, 0, 0, 0, 108, 4, 13, 22, 21, 0, - 0, 0, 0, 0, 0, 50, 0, 97, 95, 96, - 98, 0, 92, 89, 90, 91, 93, 0, 0, 0, - 0, 108, 20, 4, 0, 0, 0, 0, 0, 108, - 0, 14, 58, 63, 0, 72, 0, 0, 0, 0, - 0, 50, 0, 0, 0, 104, 94, 109, 60, 0, - 77, 0, 78, 79, 80, 81, 68, 0, 75, 0, - 0, 0, 0, 54, 56, 0, 99, 0, 0, 103, - 0, 0, 0, 0, 4, 88, 87, 0, 83, 86, - 108, 70, 66, 0, 74, 0, 64, 65, 0, 73, - 57, 105, 0, 0, 0, 0, 0, 59, 61, 0, - 0, 82, 69, 108, 67, 75, 76, 107, 102, 0, - 0, 62, 88, 85, 84, 71, 100, 0, 101 + 0, 0, 11, 8, 0, 7, 0, 0, 0, 53, + 0, 52, 0, 49, 46, 34, 35, 29, 30, 31, + 33, 32, 50, 38, 36, 37, 39, 40, 45, 47, + 42, 41, 43, 44, 0, 0, 0, 0, 0, 0, + 0, 48, 0, 0, 0, 0, 109, 9, 46, 0, + 0, 54, 0, 0, 0, 0, 0, 107, 0, 0, + 0, 0, 0, 0, 0, 0, 109, 4, 13, 22, + 21, 0, 0, 0, 0, 0, 0, 51, 0, 98, + 96, 97, 99, 0, 93, 90, 91, 92, 94, 0, + 0, 0, 0, 109, 20, 4, 0, 0, 0, 0, + 0, 109, 0, 14, 59, 64, 0, 73, 0, 0, + 0, 0, 0, 51, 0, 0, 0, 105, 95, 110, + 61, 0, 78, 0, 79, 80, 81, 82, 69, 0, + 76, 0, 0, 0, 0, 55, 57, 0, 100, 0, + 0, 104, 0, 0, 0, 0, 4, 89, 88, 0, + 84, 87, 109, 71, 67, 0, 75, 0, 65, 66, + 0, 74, 58, 106, 0, 0, 0, 0, 0, 60, + 62, 0, 0, 83, 70, 109, 68, 76, 77, 108, + 103, 0, 0, 63, 89, 86, 85, 72, 101, 0, + 102 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 8, 19, 63, 64, 9, 10, 67, 129, 27, - 68, 69, 70, 29, 30, 161, 179, 204, 187, 163, - 211, 234, 164, 189, 165, 182, 207, 208, 209, 147, - 125, 126 + -1, 8, 19, 64, 65, 9, 10, 68, 131, 27, + 69, 70, 71, 29, 30, 163, 181, 206, 189, 165, + 213, 236, 166, 191, 167, 184, 209, 210, 211, 149, + 127, 128 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -172 +#define YYPACT_NINF -174 static const yytype_int16 yypact[] = { - 137, 3, 9, 21, 37, 37, 37, 50, 59, -172, - 19, 1, 74, 17, -172, -172, -172, 60, -172, 482, - 81, -172, -172, 26, -172, 27, 1, -172, 756, 39, - -172, 1, 94, 1, -172, -172, 29, 1, 1, 215, + 56, 3, 12, 14, 72, 72, 72, 16, 26, -174, + -15, 1, 42, -12, -174, -174, -174, 45, -174, 524, + 60, -174, -174, -5, -174, 2, 1, -174, 819, 55, + -174, 1, 89, 1, -174, -174, 25, 1, 1, 247, + 1, 1, 1, 1, 1, 1, 1, 1, 99, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 93, - 1, 756, -172, 33, 90, 787, 103, 100, 756, 38, - 95, 539, -172, 111, 908, 908, 921, 921, 213, 213, - 213, 111, 111, 111, 111, 111, 908, 908, 908, 908, - 879, 849, 51, 570, 122, 123, 1, 114, 1, -172, - 1, 1, 1, 62, 150, -172, 461, -35, 818, 756, - 601, 632, 1, -4, 129, -172, 126, 132, 133, 134, - 1, 54, 148, 1, 150, -172, -172, -172, -172, 82, - 89, 1, 1, 663, 1, 1, 87, -172, -172, -172, - -172, 441, -172, -172, -172, -172, -172, 154, 160, 694, - 102, 130, -172, -172, 1, 161, 161, 1, 1, 150, - 121, -172, -172, 163, 14, -172, 246, 289, 1, 725, - 108, 1, 150, 142, 1, -172, -172, -172, 169, 6, - 756, 15, -172, -172, 756, 756, 136, 118, 12, 119, - 897, 897, 159, -172, -172, 320, -172, 180, 128, 141, - 1, 506, 195, 897, -172, 200, -172, -8, -172, -172, - 150, 174, -172, 159, -172, 897, -172, -172, 159, -172, - -172, -172, 221, 150, 363, 1, 1, -172, 169, 70, - 15, -172, -172, 150, -172, -7, -172, -172, -172, 150, - 402, 756, -172, -172, -172, -172, -172, 150, -172 + 95, 1, 819, -174, 39, 97, 851, 115, 108, 819, + 59, 122, 595, -174, 62, 976, 976, 997, 997, 245, + 245, 245, -174, 62, 62, 62, 62, 62, 976, 976, + 976, 976, 946, 915, 67, 627, 133, 152, 1, 140, + 1, -174, 1, 1, 1, 90, 181, -174, 516, -37, + 883, 819, 659, 691, 1, 5, 156, -174, 145, 153, + 154, 157, 1, 81, 166, 1, 181, -174, -174, -174, + -174, 105, 103, 1, 1, 723, 1, 1, 107, -174, + -174, -174, -174, 475, -174, -174, -174, -174, -174, 182, + 183, 755, 119, 158, -174, -174, 1, 172, 172, 1, + 1, 181, 131, -174, -174, 174, 19, -174, 279, 322, + 1, 787, 123, 1, 181, 150, 1, -174, -174, -174, + 179, 8, 819, 52, -174, -174, 819, 819, 141, 126, + 48, 128, 117, 117, 78, -174, -174, 354, -174, 186, + 129, 143, 1, 561, 199, 117, -174, 195, -174, -8, + -174, -174, 181, 160, -174, 78, -174, 117, -174, -174, + 78, -174, -174, -174, 191, 181, 397, 1, 1, -174, + 179, 68, 52, -174, -174, 181, -174, -13, -174, -174, + -174, 181, 436, 819, -174, -174, -174, -174, -174, 181, + -174 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -172, 199, -102, -172, -172, -172, 65, -172, -172, -172, - -11, -118, -172, -172, -172, -172, -172, -172, -128, 42, - -172, -172, -135, 28, -172, 84, -172, 31, 13, -172, - -171, -103 + -174, 192, -118, -174, -174, -174, 111, -174, -174, -174, + -11, -119, -174, -174, -174, -174, -174, -174, -130, 22, + -174, -174, -137, 4, -174, 63, -174, -9, -7, -174, + -173, -102 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -829,235 +839,248 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -16 static const yytype_int16 yytable[] = { - 28, 199, 162, 134, 21, 22, 23, 24, 230, 213, - 11, 202, 127, 231, 12, 39, 25, 170, 205, 206, - 61, 150, 65, 151, 128, 188, 13, 71, 213, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 177, 93, - 203, 178, 238, 198, 59, 17, 186, 219, 191, 18, - 191, 20, 216, 192, 4, 5, 6, 135, 246, 14, - 15, 16, 26, 242, 206, 227, 248, 33, 235, 60, - 188, 31, 192, 235, 192, 106, 36, 108, 32, 109, - 110, 111, 21, 22, 23, 24, 142, 37, 38, 62, - 66, 133, 228, 92, 25, 94, 95, 232, 97, 141, - 99, 100, 149, 143, 144, 145, 146, 98, 40, 73, - 166, 167, 102, 169, 21, 22, 23, 24, 105, 104, - 245, 107, 153, 112, 136, 113, 25, 154, 155, 156, - 157, 158, 1, 180, 137, 159, 184, 185, 34, 39, - 138, 139, 140, 148, 152, 113, 114, 195, 171, 173, - 160, 2, 3, 201, 4, 5, 6, 174, 115, 154, - 155, 156, 157, 158, 176, 116, 114, 159, 7, -15, - 197, 181, 190, 117, 118, 119, 200, 34, 115, 224, - 212, 214, 160, 120, 210, 116, 121, 122, 221, 123, - 222, 124, 226, 117, 118, 119, 223, 154, 155, 156, - 157, 158, 229, 120, 240, 241, 121, 122, 35, 123, - 40, 124, 40, 41, 42, 43, 44, 45, 46, 47, - 218, 233, 48, 217, 48, 49, 50, 49, 50, 237, - 183, 236, 243, 51, 52, 51, 52, 53, 54, 55, - 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, - 47, 244, 0, 0, 0, 48, 0, 0, 49, 50, - 0, 0, 0, 0, 0, 0, 51, 52, 53, 54, - 55, 56, 57, 58, 0, 0, 0, 72, 0, 0, - 0, 0, 0, 0, 0, 0, 40, 41, 42, 43, - 44, 45, 46, 47, 0, 0, 0, 0, 48, 0, - 0, 49, 50, 0, 0, 0, 0, 0, 193, 51, - 52, 53, 54, 55, 56, 57, 58, 40, 41, 42, - 43, 44, 45, 46, 47, 0, 0, 0, 0, 48, - 0, 0, 49, 50, 0, 0, 0, 0, 0, 0, - 51, 52, 53, 54, 55, 56, 57, 58, 0, 0, - 0, 194, 0, 0, 0, 0, 0, 0, 0, 0, - 40, 41, 42, 43, 44, 45, 46, 47, 0, 0, - 0, 0, 48, 0, 0, 49, 50, 0, 0, 0, - 0, 0, 220, 51, 52, 53, 54, 55, 56, 57, - 58, 0, 0, 0, 0, 0, 0, 0, 0, 40, - 41, 42, 43, 44, 45, 46, 47, 0, 0, 0, - 0, 48, 0, 0, 49, 50, 0, 0, 0, 0, - 0, 239, 51, 52, 53, 54, 55, 56, 57, 58, - 0, 0, 0, 0, 0, 0, 0, 0, 40, 41, - 42, 43, 44, 45, 46, 47, 0, 0, 0, 0, - 48, -12, 0, 49, 50, 0, -12, 0, 40, 0, - 247, 51, 52, 53, 54, 55, 56, 57, 58, -12, - 0, 0, 0, 0, 0, -12, -12, 1, -12, -12, - -12, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 34, 0, -12, -12, 0, 172, 2, 3, 0, 4, - 5, 6, 0, 40, 41, 42, 43, 44, 45, 46, - 47, 0, 0, 7, -15, 48, 0, 0, 49, 50, - 0, 0, 0, 0, 0, 0, 51, 52, 53, 54, - 55, 56, 57, 58, 0, 225, 40, 41, 42, 43, - 44, 45, 46, 47, 0, 101, 0, 0, 48, 0, - 0, 49, 50, 0, 0, 0, 0, 0, 0, 51, - 52, 53, 54, 55, 56, 57, 58, 40, 41, 42, - 43, 44, 45, 46, 47, 0, 0, 103, 0, 48, - 0, 0, 49, 50, 0, 0, 0, 0, 0, 0, - 51, 52, 53, 54, 55, 56, 57, 58, 40, 41, - 42, 43, 44, 45, 46, 47, 0, 131, 0, 0, - 48, 0, 0, 49, 50, 0, 0, 0, 0, 0, - 0, 51, 52, 53, 54, 55, 56, 57, 58, 40, - 41, 42, 43, 44, 45, 46, 47, 0, 132, 0, - 0, 48, 0, 0, 49, 50, 0, 0, 0, 0, - 0, 0, 51, 52, 53, 54, 55, 56, 57, 58, - 40, 41, 42, 43, 44, 45, 46, 47, 0, 168, - 0, 0, 48, 0, 0, 49, 50, 0, 0, 0, - 0, 0, 0, 51, 52, 53, 54, 55, 56, 57, - 58, 40, 41, 42, 43, 44, 45, 46, 47, 0, - 0, 0, 175, 48, 0, 0, 49, 50, 0, 0, - 0, 0, 0, 0, 51, 52, 53, 54, 55, 56, - 57, 58, 40, 41, 42, 43, 44, 45, 46, 47, - 0, 0, 0, 196, 48, 0, 0, 49, 50, 0, - 0, 0, 0, 0, 0, 51, 52, 53, 54, 55, + 28, 201, 164, 215, 21, 22, 23, 24, 232, 153, + 11, 129, 136, 204, 233, 39, 25, 12, 172, 13, + 62, 17, 66, 130, 152, 190, 18, 72, 20, 74, + 75, 76, 77, 78, 79, 80, 81, 180, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 31, + 95, 179, 240, 205, 200, 207, 208, 221, 194, 188, + 32, 1, 218, 33, 215, 36, 193, 37, 248, 40, + 60, 244, 208, 26, 38, 229, 250, 137, 237, 48, + 190, 2, 3, 237, 4, 5, 6, 108, 230, 110, + 194, 111, 112, 113, 63, 193, 61, 67, 7, -15, + 4, 5, 6, 135, 82, 94, 21, 22, 23, 24, + 234, 143, 96, 97, 151, 14, 15, 16, 25, 194, + 99, 74, 168, 169, 144, 171, 100, 156, 157, 158, + 159, 160, 101, 247, 21, 22, 23, 24, 102, 104, + 106, 145, 146, 147, 148, 182, 25, 155, 186, 187, + 220, 39, 156, 157, 158, 159, 160, 107, 109, 197, + 161, 138, 114, 115, 139, 203, 156, 157, 158, 159, + 160, 150, 140, 141, 161, 162, 142, 34, 154, 173, + 156, 157, 158, 159, 160, 116, 115, 175, 161, 217, + 176, 226, 178, 183, 192, 202, 199, 117, 34, 214, + 212, 216, 224, 162, 118, 223, 228, 231, 116, 225, + 239, 35, 119, 120, 121, 219, 242, 243, 235, 238, + 117, 185, 122, 246, 245, 123, 124, 118, 125, 0, + 126, 0, 0, 0, 0, 119, 120, 121, 0, 0, + 0, 0, 0, 0, 0, 122, 0, 0, 123, 124, + 0, 125, 40, 126, 40, 41, 42, 43, 44, 45, + 46, 47, 48, 0, 48, 49, 0, 49, 50, 51, + 50, 51, 0, 0, 0, 0, 52, 53, 52, 53, + 54, 55, 56, 57, 58, 59, 40, 41, 42, 43, + 44, 45, 46, 47, 0, 0, 48, 0, 0, 49, + 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, + 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, + 73, 0, 0, 0, 0, 0, 0, 0, 0, 40, + 41, 42, 43, 44, 45, 46, 47, 0, 0, 48, + 0, 0, 49, 0, 0, 50, 51, 0, 0, 0, + 0, 0, 195, 52, 53, 54, 55, 56, 57, 58, + 59, 40, 41, 42, 43, 44, 45, 46, 47, 0, + 0, 48, 0, 0, 49, 0, 0, 50, 51, 0, + 0, 0, 0, 0, 0, 52, 53, 54, 55, 56, + 57, 58, 59, 0, 0, 196, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 41, 42, 43, 44, 45, + 46, 47, 0, 0, 48, 0, 0, 49, 0, 0, + 50, 51, 0, 0, 0, 0, 0, 222, 52, 53, + 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, + 0, 0, 0, 40, 41, 42, 43, 44, 45, 46, + 47, 0, 0, 48, 0, 0, 49, 0, 0, 50, + 51, 0, 0, 0, 0, 0, 241, 52, 53, 54, + 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, + 0, 0, 40, 41, 42, 43, 44, 45, 46, 47, + 0, 0, 48, 0, 0, 49, 0, 0, 50, 51, + 0, 0, 0, 0, 0, 249, 52, 53, 54, 55, + 56, 57, 58, 59, 0, 0, -12, 0, 0, 0, + 0, -12, 0, 40, 0, 0, 0, 0, 0, 1, + 0, 0, 0, 48, 0, -12, 0, 0, 0, 0, + 174, -12, -12, 34, -12, -12, -12, 0, 0, 2, + 3, 0, 4, 5, 6, 0, 0, 0, -12, -12, + 0, 0, 0, 0, 0, 0, 7, -15, 40, 41, + 42, 43, 44, 45, 46, 47, 0, 0, 48, 0, + 0, 49, 0, 0, 50, 51, 0, 0, 0, 0, + 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, + 0, 227, 40, 41, 42, 43, 44, 45, 46, 47, + 0, 103, 48, 0, 0, 49, 0, 0, 50, 51, + 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, + 56, 57, 58, 59, 40, 41, 42, 43, 44, 45, + 46, 47, 0, 0, 48, 105, 0, 49, 0, 0, + 50, 51, 0, 0, 0, 0, 0, 0, 52, 53, + 54, 55, 56, 57, 58, 59, 40, 41, 42, 43, + 44, 45, 46, 47, 0, 133, 48, 0, 0, 49, + 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, + 52, 53, 54, 55, 56, 57, 58, 59, 40, 41, + 42, 43, 44, 45, 46, 47, 0, 134, 48, 0, + 0, 49, 0, 0, 50, 51, 0, 0, 0, 0, + 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, + 40, 41, 42, 43, 44, 45, 46, 47, 0, 170, + 48, 0, 0, 49, 0, 0, 50, 51, 0, 0, + 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, + 58, 59, 40, 41, 42, 43, 44, 45, 46, 47, + 0, 0, 48, 0, 177, 49, 0, 0, 50, 51, + 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, + 56, 57, 58, 59, 40, 41, 42, 43, 44, 45, + 46, 47, 0, 0, 48, 0, 198, 49, 0, 0, + 50, 51, 0, 0, 0, 0, 0, 0, 52, 53, + 54, 55, 56, 57, 58, 59, 40, 41, 42, 43, + 44, 45, 46, 47, 0, 0, 48, 0, 0, 49, + 0, 0, 50, 51, 0, 0, 0, 0, 0, 0, + 52, 53, 54, 55, 56, 57, 58, 59, 98, 41, + 42, 43, 44, 45, 46, 47, 0, 0, 48, 0, + 0, 49, 0, 0, 50, 51, 0, 0, 0, 0, + 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, + 132, 41, 42, 43, 44, 45, 46, 47, 0, 0, + 48, 0, 0, 49, 0, 0, 50, 51, 0, 0, + 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, + 58, 59, 40, 41, 42, 43, 44, 45, 46, 47, + 0, 0, 48, 0, 0, 49, 0, 0, 50, 51, + 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, 58, 40, 41, 42, 43, 44, 45, 46, - 47, 0, 0, 0, 0, 48, 0, 0, 49, 50, - 0, 0, 0, 0, 0, 0, 51, 52, 53, 54, - 55, 56, 57, 58, 96, 41, 42, 43, 44, 45, - 46, 47, 0, 0, 0, 0, 48, 0, 0, 49, - 50, 0, 0, 0, 0, 0, 0, 51, 52, 53, - 54, 55, 56, 57, 58, 130, 41, 42, 43, 44, - 45, 46, 47, 0, 0, 0, 0, 48, 0, 0, - 49, 50, 0, 0, 0, 0, 0, 0, 51, 52, - 53, 54, 55, 56, 57, 58, 40, 41, 42, 43, - 44, 45, 46, 47, 0, 0, 0, 0, 48, 0, - 0, 49, 50, 0, 0, 0, 0, 0, 0, 51, - 52, 53, 54, 55, 56, 57, 40, 41, 42, 43, - 44, 45, 46, 47, 0, 0, 0, 0, 48, 0, - 0, 49, 50, 0, 0, 0, 0, 0, 0, 51, - 52, 53, 54, 55, 56, 40, 0, 0, 43, 44, - 45, 46, 47, 0, 0, 0, 0, 48, 40, 0, - 49, 50, 0, 45, 46, 47, 0, 0, 51, 52, - 48, 0, 0, 49, 50, 154, 155, 156, 157, 158, - 0, 51, 52, 159, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 215 + 47, 0, 0, 48, 0, 0, 49, 0, 0, 50, + 51, 0, 0, 0, 0, 0, 0, 52, 53, 54, + 55, 56, 57, 40, 0, 0, 43, 44, 45, 46, + 47, 0, 0, 48, 0, 0, 49, 0, 0, 50, + 51, 0, 0, 0, 40, 0, 0, 52, 53, 45, + 46, 47, 0, 0, 48, 0, 0, 49, 0, 0, + 50, 51, 0, 0, 0, 0, 0, 0, 52, 53 }; static const yytype_int16 yycheck[] = { - 11, 172, 130, 7, 3, 4, 5, 6, 16, 16, - 7, 5, 47, 21, 5, 26, 15, 135, 3, 4, - 31, 124, 33, 125, 59, 160, 5, 38, 16, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 151, 60, - 44, 153, 223, 171, 15, 5, 159, 192, 46, 0, - 46, 42, 190, 70, 27, 28, 29, 71, 239, 4, - 5, 6, 71, 3, 4, 203, 247, 17, 213, 40, - 215, 7, 70, 218, 70, 96, 5, 98, 71, 100, - 101, 102, 3, 4, 5, 6, 42, 71, 71, 5, - 71, 112, 204, 10, 15, 72, 16, 210, 5, 120, - 72, 16, 123, 59, 60, 61, 62, 17, 7, 130, - 131, 132, 71, 134, 3, 4, 5, 6, 5, 7, - 233, 17, 43, 71, 5, 5, 15, 48, 49, 50, - 51, 52, 5, 154, 18, 56, 157, 158, 18, 160, - 18, 18, 18, 5, 72, 5, 26, 168, 71, 5, - 71, 24, 25, 174, 27, 28, 29, 7, 38, 48, - 49, 50, 51, 52, 72, 45, 26, 56, 41, 42, - 72, 20, 19, 53, 54, 55, 44, 18, 38, 200, - 72, 72, 71, 63, 58, 45, 66, 67, 18, 69, - 72, 71, 7, 53, 54, 55, 65, 48, 49, 50, - 51, 52, 12, 63, 225, 226, 66, 67, 19, 69, - 7, 71, 7, 8, 9, 10, 11, 12, 13, 14, - 71, 57, 19, 191, 19, 22, 23, 22, 23, 18, - 156, 213, 229, 30, 31, 30, 31, 32, 33, 34, - 35, 36, 37, 7, 8, 9, 10, 11, 12, 13, - 14, 230, -1, -1, -1, 19, -1, -1, 22, 23, - -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, - 34, 35, 36, 37, -1, -1, -1, 72, -1, -1, - -1, -1, -1, -1, -1, -1, 7, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, -1, - -1, 22, 23, -1, -1, -1, -1, -1, 72, 30, - 31, 32, 33, 34, 35, 36, 37, 7, 8, 9, - 10, 11, 12, 13, 14, -1, -1, -1, -1, 19, - -1, -1, 22, 23, -1, -1, -1, -1, -1, -1, - 30, 31, 32, 33, 34, 35, 36, 37, -1, -1, - -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, - 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, - -1, -1, 19, -1, -1, 22, 23, -1, -1, -1, - -1, -1, 72, 30, 31, 32, 33, 34, 35, 36, - 37, -1, -1, -1, -1, -1, -1, -1, -1, 7, - 8, 9, 10, 11, 12, 13, 14, -1, -1, -1, - -1, 19, -1, -1, 22, 23, -1, -1, -1, -1, - -1, 68, 30, 31, 32, 33, 34, 35, 36, 37, - -1, -1, -1, -1, -1, -1, -1, -1, 7, 8, - 9, 10, 11, 12, 13, 14, -1, -1, -1, -1, - 19, 0, -1, 22, 23, -1, 5, -1, 7, -1, - 68, 30, 31, 32, 33, 34, 35, 36, 37, 18, - -1, -1, -1, -1, -1, 24, 25, 5, 27, 28, - 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 18, -1, 41, 42, -1, 64, 24, 25, -1, 27, - 28, 29, -1, 7, 8, 9, 10, 11, 12, 13, - 14, -1, -1, 41, 42, 19, -1, -1, 22, 23, - -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, - 34, 35, 36, 37, -1, 39, 7, 8, 9, 10, - 11, 12, 13, 14, -1, 16, -1, -1, 19, -1, - -1, 22, 23, -1, -1, -1, -1, -1, -1, 30, - 31, 32, 33, 34, 35, 36, 37, 7, 8, 9, - 10, 11, 12, 13, 14, -1, -1, 17, -1, 19, - -1, -1, 22, 23, -1, -1, -1, -1, -1, -1, - 30, 31, 32, 33, 34, 35, 36, 37, 7, 8, - 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, - 19, -1, -1, 22, 23, -1, -1, -1, -1, -1, - -1, 30, 31, 32, 33, 34, 35, 36, 37, 7, - 8, 9, 10, 11, 12, 13, 14, -1, 16, -1, - -1, 19, -1, -1, 22, 23, -1, -1, -1, -1, - -1, -1, 30, 31, 32, 33, 34, 35, 36, 37, + 11, 174, 132, 16, 3, 4, 5, 6, 16, 127, + 7, 48, 7, 5, 22, 26, 15, 5, 137, 5, + 31, 5, 33, 60, 126, 162, 0, 38, 43, 40, + 41, 42, 43, 44, 45, 46, 47, 155, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 7, + 61, 153, 225, 45, 173, 3, 4, 194, 71, 161, + 72, 5, 192, 18, 16, 5, 47, 72, 241, 7, + 15, 3, 4, 72, 72, 205, 249, 72, 215, 17, + 217, 25, 26, 220, 28, 29, 30, 98, 206, 100, + 71, 102, 103, 104, 5, 47, 41, 72, 42, 43, + 28, 29, 30, 114, 5, 10, 3, 4, 5, 6, + 212, 122, 73, 16, 125, 4, 5, 6, 15, 71, + 5, 132, 133, 134, 43, 136, 18, 49, 50, 51, + 52, 53, 73, 235, 3, 4, 5, 6, 16, 72, + 7, 60, 61, 62, 63, 156, 15, 44, 159, 160, + 72, 162, 49, 50, 51, 52, 53, 5, 18, 170, + 57, 5, 72, 5, 19, 176, 49, 50, 51, 52, + 53, 5, 19, 19, 57, 72, 19, 19, 73, 72, + 49, 50, 51, 52, 53, 27, 5, 5, 57, 72, + 7, 202, 73, 21, 20, 45, 73, 39, 19, 73, + 59, 73, 73, 72, 46, 19, 7, 12, 27, 66, + 19, 19, 54, 55, 56, 193, 227, 228, 58, 215, + 39, 158, 64, 232, 231, 67, 68, 46, 70, -1, + 72, -1, -1, -1, -1, 54, 55, 56, -1, -1, + -1, -1, -1, -1, -1, 64, -1, -1, 67, 68, + -1, 70, 7, 72, 7, 8, 9, 10, 11, 12, + 13, 14, 17, -1, 17, 20, -1, 20, 23, 24, + 23, 24, -1, -1, -1, -1, 31, 32, 31, 32, + 33, 34, 35, 36, 37, 38, 7, 8, 9, 10, + 11, 12, 13, 14, -1, -1, 17, -1, -1, 20, + -1, -1, 23, 24, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, 35, 36, 37, 38, -1, -1, + 73, -1, -1, -1, -1, -1, -1, -1, -1, 7, + 8, 9, 10, 11, 12, 13, 14, -1, -1, 17, + -1, -1, 20, -1, -1, 23, 24, -1, -1, -1, + -1, -1, 73, 31, 32, 33, 34, 35, 36, 37, + 38, 7, 8, 9, 10, 11, 12, 13, 14, -1, + -1, 17, -1, -1, 20, -1, -1, 23, 24, -1, + -1, -1, -1, -1, -1, 31, 32, 33, 34, 35, + 36, 37, 38, -1, -1, 73, -1, -1, -1, -1, + -1, -1, -1, -1, 7, 8, 9, 10, 11, 12, + 13, 14, -1, -1, 17, -1, -1, 20, -1, -1, + 23, 24, -1, -1, -1, -1, -1, 73, 31, 32, + 33, 34, 35, 36, 37, 38, -1, -1, -1, -1, + -1, -1, -1, 7, 8, 9, 10, 11, 12, 13, + 14, -1, -1, 17, -1, -1, 20, -1, -1, 23, + 24, -1, -1, -1, -1, -1, 69, 31, 32, 33, + 34, 35, 36, 37, 38, -1, -1, -1, -1, -1, + -1, -1, 7, 8, 9, 10, 11, 12, 13, 14, + -1, -1, 17, -1, -1, 20, -1, -1, 23, 24, + -1, -1, -1, -1, -1, 69, 31, 32, 33, 34, + 35, 36, 37, 38, -1, -1, 0, -1, -1, -1, + -1, 5, -1, 7, -1, -1, -1, -1, -1, 5, + -1, -1, -1, 17, -1, 19, -1, -1, -1, -1, + 65, 25, 26, 19, 28, 29, 30, -1, -1, 25, + 26, -1, 28, 29, 30, -1, -1, -1, 42, 43, + -1, -1, -1, -1, -1, -1, 42, 43, 7, 8, + 9, 10, 11, 12, 13, 14, -1, -1, 17, -1, + -1, 20, -1, -1, 23, 24, -1, -1, -1, -1, + -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, + -1, 40, 7, 8, 9, 10, 11, 12, 13, 14, + -1, 16, 17, -1, -1, 20, -1, -1, 23, 24, + -1, -1, -1, -1, -1, -1, 31, 32, 33, 34, + 35, 36, 37, 38, 7, 8, 9, 10, 11, 12, + 13, 14, -1, -1, 17, 18, -1, 20, -1, -1, + 23, 24, -1, -1, -1, -1, -1, -1, 31, 32, + 33, 34, 35, 36, 37, 38, 7, 8, 9, 10, + 11, 12, 13, 14, -1, 16, 17, -1, -1, 20, + -1, -1, 23, 24, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, 35, 36, 37, 38, 7, 8, + 9, 10, 11, 12, 13, 14, -1, 16, 17, -1, + -1, 20, -1, -1, 23, 24, -1, -1, -1, -1, + -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, 7, 8, 9, 10, 11, 12, 13, 14, -1, 16, - -1, -1, 19, -1, -1, 22, 23, -1, -1, -1, - -1, -1, -1, 30, 31, 32, 33, 34, 35, 36, - 37, 7, 8, 9, 10, 11, 12, 13, 14, -1, - -1, -1, 18, 19, -1, -1, 22, 23, -1, -1, - -1, -1, -1, -1, 30, 31, 32, 33, 34, 35, - 36, 37, 7, 8, 9, 10, 11, 12, 13, 14, - -1, -1, -1, 18, 19, -1, -1, 22, 23, -1, - -1, -1, -1, -1, -1, 30, 31, 32, 33, 34, + 17, -1, -1, 20, -1, -1, 23, 24, -1, -1, + -1, -1, -1, -1, 31, 32, 33, 34, 35, 36, + 37, 38, 7, 8, 9, 10, 11, 12, 13, 14, + -1, -1, 17, -1, 19, 20, -1, -1, 23, 24, + -1, -1, -1, -1, -1, -1, 31, 32, 33, 34, + 35, 36, 37, 38, 7, 8, 9, 10, 11, 12, + 13, 14, -1, -1, 17, -1, 19, 20, -1, -1, + 23, 24, -1, -1, -1, -1, -1, -1, 31, 32, + 33, 34, 35, 36, 37, 38, 7, 8, 9, 10, + 11, 12, 13, 14, -1, -1, 17, -1, -1, 20, + -1, -1, 23, 24, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 34, 35, 36, 37, 38, 7, 8, + 9, 10, 11, 12, 13, 14, -1, -1, 17, -1, + -1, 20, -1, -1, 23, 24, -1, -1, -1, -1, + -1, -1, 31, 32, 33, 34, 35, 36, 37, 38, + 7, 8, 9, 10, 11, 12, 13, 14, -1, -1, + 17, -1, -1, 20, -1, -1, 23, 24, -1, -1, + -1, -1, -1, -1, 31, 32, 33, 34, 35, 36, + 37, 38, 7, 8, 9, 10, 11, 12, 13, 14, + -1, -1, 17, -1, -1, 20, -1, -1, 23, 24, + -1, -1, -1, -1, -1, -1, 31, 32, 33, 34, 35, 36, 37, 7, 8, 9, 10, 11, 12, 13, - 14, -1, -1, -1, -1, 19, -1, -1, 22, 23, - -1, -1, -1, -1, -1, -1, 30, 31, 32, 33, - 34, 35, 36, 37, 7, 8, 9, 10, 11, 12, - 13, 14, -1, -1, -1, -1, 19, -1, -1, 22, - 23, -1, -1, -1, -1, -1, -1, 30, 31, 32, - 33, 34, 35, 36, 37, 7, 8, 9, 10, 11, - 12, 13, 14, -1, -1, -1, -1, 19, -1, -1, - 22, 23, -1, -1, -1, -1, -1, -1, 30, 31, - 32, 33, 34, 35, 36, 37, 7, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, -1, - -1, 22, 23, -1, -1, -1, -1, -1, -1, 30, - 31, 32, 33, 34, 35, 36, 7, 8, 9, 10, - 11, 12, 13, 14, -1, -1, -1, -1, 19, -1, - -1, 22, 23, -1, -1, -1, -1, -1, -1, 30, - 31, 32, 33, 34, 35, 7, -1, -1, 10, 11, - 12, 13, 14, -1, -1, -1, -1, 19, 7, -1, - 22, 23, -1, 12, 13, 14, -1, -1, 30, 31, - 19, -1, -1, 22, 23, 48, 49, 50, 51, 52, - -1, 30, 31, 56, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 71 + 14, -1, -1, 17, -1, -1, 20, -1, -1, 23, + 24, -1, -1, -1, -1, -1, -1, 31, 32, 33, + 34, 35, 36, 7, -1, -1, 10, 11, 12, 13, + 14, -1, -1, 17, -1, -1, 20, -1, -1, 23, + 24, -1, -1, -1, 7, -1, -1, 31, 32, 12, + 13, 14, -1, -1, 17, -1, -1, 20, -1, -1, + 23, 24, -1, -1, -1, -1, -1, -1, 31, 32 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 5, 24, 25, 27, 28, 29, 41, 74, 78, - 79, 7, 5, 5, 79, 79, 79, 5, 0, 75, - 42, 3, 4, 5, 6, 15, 71, 82, 83, 86, - 87, 7, 71, 17, 18, 74, 5, 71, 71, 83, - 7, 8, 9, 10, 11, 12, 13, 14, 19, 22, - 23, 30, 31, 32, 33, 34, 35, 36, 37, 15, - 40, 83, 5, 76, 77, 83, 71, 80, 83, 84, - 85, 83, 72, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 10, 83, 72, 16, 7, 5, 17, 72, - 16, 16, 71, 17, 7, 5, 83, 17, 83, 83, - 83, 83, 71, 5, 26, 38, 45, 53, 54, 55, - 63, 66, 67, 69, 71, 103, 104, 47, 59, 81, - 7, 16, 16, 83, 7, 71, 5, 18, 18, 18, - 18, 83, 42, 59, 60, 61, 62, 102, 5, 83, - 104, 75, 72, 43, 48, 49, 50, 51, 52, 56, - 71, 88, 91, 92, 95, 97, 83, 83, 16, 83, - 84, 71, 64, 5, 7, 18, 72, 104, 75, 89, - 83, 20, 98, 98, 83, 83, 104, 91, 95, 96, - 19, 46, 70, 72, 72, 83, 18, 72, 84, 103, - 44, 83, 5, 44, 90, 3, 4, 99, 100, 101, - 58, 93, 72, 16, 72, 71, 91, 92, 71, 95, - 72, 18, 72, 65, 83, 39, 7, 91, 75, 12, - 16, 21, 104, 57, 94, 95, 96, 18, 103, 68, - 83, 83, 3, 101, 100, 104, 103, 68, 103 + 0, 5, 25, 26, 28, 29, 30, 42, 75, 79, + 80, 7, 5, 5, 80, 80, 80, 5, 0, 76, + 43, 3, 4, 5, 6, 15, 72, 83, 84, 87, + 88, 7, 72, 18, 19, 75, 5, 72, 72, 84, + 7, 8, 9, 10, 11, 12, 13, 14, 17, 20, + 23, 24, 31, 32, 33, 34, 35, 36, 37, 38, + 15, 41, 84, 5, 77, 78, 84, 72, 81, 84, + 85, 86, 84, 73, 84, 84, 84, 84, 84, 84, + 84, 84, 5, 84, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 10, 84, 73, 16, 7, 5, + 18, 73, 16, 16, 72, 18, 7, 5, 84, 18, + 84, 84, 84, 84, 72, 5, 27, 39, 46, 54, + 55, 56, 64, 67, 68, 70, 72, 104, 105, 48, + 60, 82, 7, 16, 16, 84, 7, 72, 5, 19, + 19, 19, 19, 84, 43, 60, 61, 62, 63, 103, + 5, 84, 105, 76, 73, 44, 49, 50, 51, 52, + 53, 57, 72, 89, 92, 93, 96, 98, 84, 84, + 16, 84, 85, 72, 65, 5, 7, 19, 73, 105, + 76, 90, 84, 21, 99, 99, 84, 84, 105, 92, + 96, 97, 20, 47, 71, 73, 73, 84, 19, 73, + 85, 104, 45, 84, 5, 45, 91, 3, 4, 100, + 101, 102, 59, 94, 73, 16, 73, 72, 92, 93, + 72, 96, 73, 19, 73, 66, 84, 40, 7, 92, + 76, 12, 16, 22, 105, 58, 95, 96, 97, 19, + 104, 69, 84, 84, 3, 102, 101, 105, 104, 69, + 104 }; #define yyerrok (yyerrstatus = 0) @@ -1894,37 +1917,37 @@ yyreduce: switch (yyn) { case 2: -#line 207 "magic-interpreter-parser.y" +#line 212 "magic-interpreter-parser.y" {;} break; case 3: -#line 209 "magic-interpreter-parser.y" +#line 214 "magic-interpreter-parser.y" {;} break; case 4: -#line 214 "magic-interpreter-parser.y" +#line 219 "magic-interpreter-parser.y" {;} break; case 5: -#line 216 "magic-interpreter-parser.y" +#line 221 "magic-interpreter-parser.y" {;} break; case 6: -#line 221 "magic-interpreter-parser.y" +#line 226 "magic-interpreter-parser.y" { (yyval.proc) = aCalloc(sizeof(proc_t), 1); ;} break; case 7: -#line 223 "magic-interpreter-parser.y" +#line 228 "magic-interpreter-parser.y" { (yyval.proc) = (yyvsp[(1) - (1)].proc); ;} break; case 8: -#line 227 "magic-interpreter-parser.y" +#line 232 "magic-interpreter-parser.y" { (yyval.proc) = aCalloc(sizeof(proc_t), 1); (yyval.proc)->args_nr = 1; (yyval.proc)->args = malloc(sizeof(int)); @@ -1933,7 +1956,7 @@ yyreduce: break; case 9: -#line 233 "magic-interpreter-parser.y" +#line 238 "magic-interpreter-parser.y" { (yyval.proc) = (yyvsp[(1) - (3)].proc); (yyval.proc)->args = realloc((yyval.proc)->args, sizeof(int) * (1 + (yyval.proc)->args_nr)); (yyval.proc)->args[(yyval.proc)->args_nr++] = intern_id((yyvsp[(3) - (3)].s)); @@ -1941,7 +1964,7 @@ yyreduce: break; case 10: -#line 240 "magic-interpreter-parser.y" +#line 245 "magic-interpreter-parser.y" { int var_id; if (find_constant((yyvsp[(1) - (3)].s))) { @@ -1955,7 +1978,7 @@ yyreduce: break; case 11: -#line 251 "magic-interpreter-parser.y" +#line 256 "magic-interpreter-parser.y" { val_t var; magic_eval(&magic_default_env, &var, (yyvsp[(4) - (4)].expr)); @@ -1964,7 +1987,7 @@ yyreduce: break; case 12: -#line 257 "magic-interpreter-parser.y" +#line 262 "magic-interpreter-parser.y" { teleport_anchor_t *anchor = calloc(sizeof(teleport_anchor_t), 1); anchor->name = (yyvsp[(2) - (6)].s); @@ -1978,7 +2001,7 @@ yyreduce: break; case 13: -#line 268 "magic-interpreter-parser.y" +#line 273 "magic-interpreter-parser.y" { proc_t *proc = (yyvsp[(4) - (7)].proc); proc->name = (yyvsp[(2) - (7)].s); @@ -1990,7 +2013,7 @@ yyreduce: break; case 14: -#line 277 "magic-interpreter-parser.y" +#line 282 "magic-interpreter-parser.y" { spell_t *spell = (yyvsp[(8) - (8)].spell); spell->name = (yyvsp[(3) - (8)].s); spell->invocation = magic_eval_str(&magic_default_env, (yyvsp[(6) - (8)].expr)); @@ -2004,12 +2027,12 @@ yyreduce: break; case 15: -#line 289 "magic-interpreter-parser.y" +#line 294 "magic-interpreter-parser.y" { (yyval.i) = 0; ;} break; case 16: -#line 291 "magic-interpreter-parser.y" +#line 296 "magic-interpreter-parser.y" { if ((yyvsp[(2) - (2)].i) & SPELL_FLAG_LOCAL) fail((yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column, "`LOCAL' specified more than once"); (yyval.i) = (yyvsp[(2) - (2)].i) | SPELL_FLAG_LOCAL; @@ -2017,7 +2040,7 @@ yyreduce: break; case 17: -#line 296 "magic-interpreter-parser.y" +#line 301 "magic-interpreter-parser.y" { if ((yyvsp[(2) - (2)].i) & SPELL_FLAG_NONMAGIC) fail((yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column, "`NONMAGIC' specified more than once"); (yyval.i) = (yyvsp[(2) - (2)].i) | SPELL_FLAG_NONMAGIC; @@ -2025,7 +2048,7 @@ yyreduce: break; case 18: -#line 301 "magic-interpreter-parser.y" +#line 306 "magic-interpreter-parser.y" { if ((yyvsp[(2) - (2)].i) & SPELL_FLAG_SILENT) fail((yylsp[(1) - (2)]).first_line, (yylsp[(1) - (2)]).first_column, "`SILENT' specified more than once"); (yyval.i) = (yyvsp[(2) - (2)].i) | SPELL_FLAG_SILENT; @@ -2033,52 +2056,52 @@ yyreduce: break; case 19: -#line 308 "magic-interpreter-parser.y" +#line 313 "magic-interpreter-parser.y" { (yyval.spellarg_def).ty = SPELLARG_NONE; ;} break; case 20: -#line 310 "magic-interpreter-parser.y" +#line 315 "magic-interpreter-parser.y" { (yyval.spellarg_def).id = intern_id((yyvsp[(2) - (5)].s)); (yyval.spellarg_def).ty = (yyvsp[(4) - (5)].i); ;} break; case 21: -#line 316 "magic-interpreter-parser.y" +#line 321 "magic-interpreter-parser.y" { (yyval.i) = SPELLARG_PC; ;} break; case 22: -#line 318 "magic-interpreter-parser.y" +#line 323 "magic-interpreter-parser.y" { (yyval.i) = SPELLARG_STRING; ;} break; case 23: -#line 323 "magic-interpreter-parser.y" +#line 328 "magic-interpreter-parser.y" { (yyval.value).ty = TY_DIR; (yyval.value).v.v_int = (yyvsp[(1) - (1)].i); ;} break; case 24: -#line 326 "magic-interpreter-parser.y" +#line 331 "magic-interpreter-parser.y" { (yyval.value).ty = TY_INT; (yyval.value).v.v_int = (yyvsp[(1) - (1)].i); ;} break; case 25: -#line 329 "magic-interpreter-parser.y" +#line 334 "magic-interpreter-parser.y" { (yyval.value).ty = TY_STRING; (yyval.value).v.v_string = (yyvsp[(1) - (1)].s); ;} break; case 26: -#line 335 "magic-interpreter-parser.y" +#line 340 "magic-interpreter-parser.y" { (yyval.expr) = magic_new_expr(EXPR_VAL); (yyval.expr)->e.e_val = (yyvsp[(1) - (1)].value); ;} break; case 27: -#line 338 "magic-interpreter-parser.y" +#line 343 "magic-interpreter-parser.y" { val_t *val; if ((val = find_constant((yyvsp[(1) - (1)].s)))) { @@ -2092,109 +2115,109 @@ yyreduce: break; case 28: -#line 349 "magic-interpreter-parser.y" +#line 354 "magic-interpreter-parser.y" { (yyval.expr) = magic_new_expr(EXPR_AREA); (yyval.expr)->e.e_area = (yyvsp[(1) - (1)].area); ;} break; case 29: -#line 352 "magic-interpreter-parser.y" +#line 357 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "+", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 30: -#line 354 "magic-interpreter-parser.y" +#line 359 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "-", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 31: -#line 356 "magic-interpreter-parser.y" +#line 361 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "*", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 32: -#line 358 "magic-interpreter-parser.y" +#line 363 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "%", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 33: -#line 360 "magic-interpreter-parser.y" +#line 365 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "/", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 34: -#line 362 "magic-interpreter-parser.y" +#line 367 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), ">", (yyvsp[(3) - (3)].expr), (yyvsp[(1) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 35: -#line 364 "magic-interpreter-parser.y" +#line 369 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), ">", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 36: -#line 366 "magic-interpreter-parser.y" +#line 371 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "&", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 37: -#line 368 "magic-interpreter-parser.y" +#line 373 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "^", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 38: -#line 370 "magic-interpreter-parser.y" +#line 375 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "|", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 39: -#line 372 "magic-interpreter-parser.y" +#line 377 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "<<", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 40: -#line 374 "magic-interpreter-parser.y" +#line 379 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), ">>", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 41: -#line 376 "magic-interpreter-parser.y" +#line 381 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), ">=", (yyvsp[(3) - (3)].expr), (yyvsp[(1) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 42: -#line 378 "magic-interpreter-parser.y" +#line 383 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), ">=", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 43: -#line 380 "magic-interpreter-parser.y" +#line 385 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "&&", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 44: -#line 382 "magic-interpreter-parser.y" +#line 387 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "||", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 45: -#line 384 "magic-interpreter-parser.y" +#line 389 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "=", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 46: -#line 386 "magic-interpreter-parser.y" +#line 391 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "=", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 47: -#line 388 "magic-interpreter-parser.y" +#line 393 "magic-interpreter-parser.y" { BIN_EXPR((yyval.expr), "=", (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); (yyval.expr) = fun_expr("not", 1, &(yyval.expr), (yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column); ;} break; case 48: -#line 391 "magic-interpreter-parser.y" +#line 396 "magic-interpreter-parser.y" { (yyval.expr) = fun_expr((yyvsp[(1) - (4)].s), (yyvsp[(3) - (4)].arg_list).args_nr, (yyvsp[(3) - (4)].arg_list).args, (yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column); if ((yyvsp[(3) - (4)].arg_list).args) free((yyvsp[(3) - (4)].arg_list).args); @@ -2202,49 +2225,54 @@ yyreduce: break; case 49: -#line 396 "magic-interpreter-parser.y" +#line 401 "magic-interpreter-parser.y" { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 50: -#line 400 "magic-interpreter-parser.y" - { (yyval.arg_list).args_nr = 0; ;} +#line 403 "magic-interpreter-parser.y" + { (yyval.expr) = dot_expr((yyvsp[(1) - (3)].expr), intern_id((yyvsp[(3) - (3)].s))); ;} break; case 51: -#line 402 "magic-interpreter-parser.y" - { (yyval.arg_list) = (yyvsp[(1) - (1)].arg_list) ;} +#line 407 "magic-interpreter-parser.y" + { (yyval.arg_list).args_nr = 0; ;} break; case 52: -#line 407 "magic-interpreter-parser.y" +#line 409 "magic-interpreter-parser.y" + { (yyval.arg_list) = (yyvsp[(1) - (1)].arg_list) ;} + break; + + case 53: +#line 414 "magic-interpreter-parser.y" { (yyval.arg_list).args = aCalloc(sizeof(expr_t *), 1); (yyval.arg_list).args_nr = 1; (yyval.arg_list).args[0] = (yyvsp[(1) - (1)].expr); ;} break; - case 53: -#line 412 "magic-interpreter-parser.y" + case 54: +#line 419 "magic-interpreter-parser.y" { (yyval.arg_list).args = realloc((yyval.arg_list).args, (1 + (yyval.arg_list).args_nr) * sizeof(expr_t *)); (yyval.arg_list).args[(yyval.arg_list).args_nr++] = (yyvsp[(3) - (3)].expr); ;} break; - case 54: -#line 419 "magic-interpreter-parser.y" + case 55: +#line 426 "magic-interpreter-parser.y" { (yyval.location).m = (yyvsp[(3) - (8)].expr); (yyval.location).x = (yyvsp[(5) - (8)].expr); (yyval.location).y = (yyvsp[(7) - (8)].expr); ;} break; - case 55: -#line 423 "magic-interpreter-parser.y" + case 56: +#line 430 "magic-interpreter-parser.y" { (yyval.area).ty = AREA_LOCATION; (yyval.area).a.a_loc = (yyvsp[(1) - (1)].location); ;} break; - case 56: -#line 427 "magic-interpreter-parser.y" + case 57: +#line 434 "magic-interpreter-parser.y" { (yyval.area).ty = AREA_RECT; (yyval.area).a.a_rect.loc = (yyvsp[(1) - (8)].location); (yyval.area).a.a_rect.width = (yyvsp[(5) - (8)].expr); @@ -2252,8 +2280,8 @@ yyreduce: ;} break; - case 57: -#line 433 "magic-interpreter-parser.y" + case 58: +#line 440 "magic-interpreter-parser.y" { (yyval.area).ty = AREA_BAR; (yyval.area).a.a_bar.loc = (yyvsp[(1) - (9)].location); (yyval.area).a.a_bar.width = (yyvsp[(6) - (9)].expr); @@ -2262,13 +2290,13 @@ yyreduce: ;} break; - case 58: -#line 443 "magic-interpreter-parser.y" + case 59: +#line 450 "magic-interpreter-parser.y" { (yyval.spell) = new_spell((yyvsp[(1) - (1)].spellguard)); ;} break; - case 59: -#line 445 "magic-interpreter-parser.y" + case 60: +#line 452 "magic-interpreter-parser.y" { (yyval.spell) = new_spell((yyvsp[(4) - (4)].spellguard)); (yyval.spell)->letdefs_nr = (yyvsp[(2) - (4)].letdefs).letdefs_nr; (yyval.spell)->letdefs = (yyvsp[(2) - (4)].letdefs).letdefs; @@ -2276,15 +2304,15 @@ yyreduce: ;} break; - case 60: -#line 454 "magic-interpreter-parser.y" + case 61: +#line 461 "magic-interpreter-parser.y" { (yyval.letdefs).letdefs_nr = 0; (yyval.letdefs).letdefs = (letdef_t *) malloc(1); ;} break; - case 61: -#line 458 "magic-interpreter-parser.y" + case 62: +#line 465 "magic-interpreter-parser.y" { (yyval.letdefs) = (yyvsp[(1) - (3)].letdefs); (yyval.letdefs).letdefs_nr++; (yyval.letdefs).letdefs = realloc((yyval.letdefs).letdefs, sizeof(letdef_t) * (yyval.letdefs).letdefs_nr); @@ -2292,8 +2320,8 @@ yyreduce: ;} break; - case 62: -#line 467 "magic-interpreter-parser.y" + case 63: +#line 474 "magic-interpreter-parser.y" { if (find_constant((yyvsp[(1) - (3)].s))) { fail((yylsp[(1) - (3)]).first_line, (yylsp[(1) - (3)]).first_column, "Attempt to re-define constant `%s' as LET-bound variable.\n", (yyvsp[(1) - (3)].s)); @@ -2305,13 +2333,13 @@ yyreduce: ;} break; - case 63: -#line 480 "magic-interpreter-parser.y" + case 64: +#line 487 "magic-interpreter-parser.y" { (yyval.spellguard) = (yyvsp[(1) - (1)].spellguard); ;} break; - case 64: -#line 482 "magic-interpreter-parser.y" + case 65: +#line 489 "magic-interpreter-parser.y" { spellguard_t *sg = new_spellguard(SPELLGUARD_CHOICE); sg->next = (yyvsp[(1) - (3)].spellguard); sg->s.s_alt = (yyvsp[(3) - (3)].spellguard); @@ -2319,18 +2347,18 @@ yyreduce: ;} break; - case 65: -#line 491 "magic-interpreter-parser.y" + case 66: +#line 498 "magic-interpreter-parser.y" { (yyval.spellguard) = spellguard_implication((yyvsp[(1) - (3)].spellguard), (yyvsp[(3) - (3)].spellguard)); ;} break; - case 66: -#line 493 "magic-interpreter-parser.y" + case 67: +#line 500 "magic-interpreter-parser.y" { (yyval.spellguard) = (yyvsp[(2) - (3)].spellguard); ;} break; - case 67: -#line 495 "magic-interpreter-parser.y" + case 68: +#line 502 "magic-interpreter-parser.y" { spellguard_t *sg = new_spellguard(SPELLGUARD_EFFECT); sg->s.s_effect.effect = (yyvsp[(2) - (4)].effect); sg->s.s_effect.at_trigger = (yyvsp[(3) - (4)].effect); @@ -2339,33 +2367,33 @@ yyreduce: ;} break; - case 68: -#line 505 "magic-interpreter-parser.y" + case 69: +#line 512 "magic-interpreter-parser.y" { (yyval.effect) = NULL; ;} break; - case 69: -#line 507 "magic-interpreter-parser.y" + case 70: +#line 514 "magic-interpreter-parser.y" { (yyval.effect) = (yyvsp[(2) - (2)].effect); ;} break; - case 70: -#line 512 "magic-interpreter-parser.y" + case 71: +#line 519 "magic-interpreter-parser.y" { (yyval.effect) = NULL; ;} break; - case 71: -#line 514 "magic-interpreter-parser.y" + case 72: +#line 521 "magic-interpreter-parser.y" { (yyval.effect) = (yyvsp[(2) - (2)].effect); ;} break; - case 72: -#line 519 "magic-interpreter-parser.y" + case 73: +#line 526 "magic-interpreter-parser.y" { (yyval.spellguard) = (yyvsp[(1) - (1)].spellguard); ;} break; - case 73: -#line 521 "magic-interpreter-parser.y" + case 74: +#line 528 "magic-interpreter-parser.y" { spellguard_t *sg = new_spellguard(SPELLGUARD_CHOICE); sg->next = (yyvsp[(1) - (3)].spellguard); sg->s.s_alt = (yyvsp[(3) - (3)].spellguard); @@ -2373,87 +2401,87 @@ yyreduce: ;} break; - case 74: -#line 527 "magic-interpreter-parser.y" + case 75: +#line 534 "magic-interpreter-parser.y" { (yyval.spellguard) = (yyvsp[(2) - (3)].spellguard); ;} break; - case 75: -#line 532 "magic-interpreter-parser.y" + case 76: +#line 539 "magic-interpreter-parser.y" { (yyval.spellguard) = (yyvsp[(1) - (1)].spellguard); ;} break; - case 76: -#line 534 "magic-interpreter-parser.y" + case 77: +#line 541 "magic-interpreter-parser.y" { (yyval.spellguard) = spellguard_implication ((yyvsp[(1) - (3)].spellguard), (yyvsp[(3) - (3)].spellguard)); ;} break; - case 77: -#line 539 "magic-interpreter-parser.y" + case 78: +#line 546 "magic-interpreter-parser.y" { (yyval.spellguard) = new_spellguard(SPELLGUARD_CONDITION); (yyval.spellguard)->s.s_condition = (yyvsp[(2) - (2)].expr); ;} break; - case 78: -#line 543 "magic-interpreter-parser.y" + case 79: +#line 550 "magic-interpreter-parser.y" { (yyval.spellguard) = new_spellguard(SPELLGUARD_CATALYSTS); (yyval.spellguard)->s.s_catalysts = (yyvsp[(2) - (2)].components); ;} break; - case 79: -#line 547 "magic-interpreter-parser.y" + case 80: +#line 554 "magic-interpreter-parser.y" { (yyval.spellguard) = new_spellguard(SPELLGUARD_COMPONENTS); (yyval.spellguard)->s.s_components = (yyvsp[(2) - (2)].components); ;} break; - case 80: -#line 551 "magic-interpreter-parser.y" + case 81: +#line 558 "magic-interpreter-parser.y" { (yyval.spellguard) = new_spellguard(SPELLGUARD_MANA); (yyval.spellguard)->s.s_mana = (yyvsp[(2) - (2)].expr); ;} break; - case 81: -#line 555 "magic-interpreter-parser.y" + case 82: +#line 562 "magic-interpreter-parser.y" { (yyval.spellguard) = new_spellguard(SPELLGUARD_CASTTIME); (yyval.spellguard)->s.s_casttime = (yyvsp[(2) - (2)].expr); ;} break; - case 82: -#line 562 "magic-interpreter-parser.y" + case 83: +#line 569 "magic-interpreter-parser.y" { (yyval.components) = (yyvsp[(2) - (3)].components); ;} break; - case 83: -#line 567 "magic-interpreter-parser.y" + case 84: +#line 574 "magic-interpreter-parser.y" { (yyval.components) = NULL; magic_add_component(&(yyval.components), (yyvsp[(1) - (1)].component).id, (yyvsp[(1) - (1)].component).count); ;} break; - case 84: -#line 571 "magic-interpreter-parser.y" + case 85: +#line 578 "magic-interpreter-parser.y" { (yyval.components) = (yyvsp[(1) - (3)].components); magic_add_component(&(yyval.components), (yyvsp[(3) - (3)].component).id, (yyvsp[(3) - (3)].component).count); ;} break; - case 85: -#line 578 "magic-interpreter-parser.y" + case 86: +#line 585 "magic-interpreter-parser.y" { (yyval.component).id = (yyvsp[(3) - (3)].i); (yyval.component).count = (yyvsp[(1) - (3)].i); ;} break; - case 86: -#line 580 "magic-interpreter-parser.y" + case 87: +#line 587 "magic-interpreter-parser.y" { (yyval.component).id = (yyvsp[(1) - (1)].i); (yyval.component).count = 1; ;} break; - case 87: -#line 585 "magic-interpreter-parser.y" + case 88: +#line 592 "magic-interpreter-parser.y" { struct item_data *item = itemdb_searchname((yyvsp[(1) - (1)].s)); if (!item) { fail ((yylsp[(1) - (1)]).first_line, (yylsp[(1) - (1)]).first_column, "Unknown item `%s'\n", (yyvsp[(1) - (1)].s)); @@ -2464,63 +2492,63 @@ yyreduce: ;} break; - case 88: -#line 594 "magic-interpreter-parser.y" + case 89: +#line 601 "magic-interpreter-parser.y" { (yyval.i) = (yyvsp[(1) - (1)].i); ;} break; - case 89: -#line 599 "magic-interpreter-parser.y" + case 90: +#line 606 "magic-interpreter-parser.y" { (yyval.i) = FOREACH_FILTER_PC; ;} break; - case 90: -#line 601 "magic-interpreter-parser.y" + case 91: +#line 608 "magic-interpreter-parser.y" { (yyval.i) = FOREACH_FILTER_MOB; ;} break; - case 91: -#line 603 "magic-interpreter-parser.y" + case 92: +#line 610 "magic-interpreter-parser.y" { (yyval.i) = FOREACH_FILTER_ENTITY; ;} break; - case 92: -#line 605 "magic-interpreter-parser.y" + case 93: +#line 612 "magic-interpreter-parser.y" { (yyval.i) = FOREACH_FILTER_SPELL; ;} break; - case 93: -#line 607 "magic-interpreter-parser.y" + case 94: +#line 614 "magic-interpreter-parser.y" { (yyval.i) = FOREACH_FILTER_TARGET; ;} break; - case 94: -#line 612 "magic-interpreter-parser.y" + case 95: +#line 619 "magic-interpreter-parser.y" { (yyval.effect) = (yyvsp[(2) - (3)].effect); ;} break; - case 95: -#line 614 "magic-interpreter-parser.y" + case 96: +#line 621 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_SKIP); ;} break; - case 96: -#line 616 "magic-interpreter-parser.y" + case 97: +#line 623 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_ABORT); ;} break; - case 97: -#line 618 "magic-interpreter-parser.y" + case 98: +#line 625 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_END); ;} break; - case 98: -#line 620 "magic-interpreter-parser.y" + case 99: +#line 627 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_BREAK); ;} break; - case 99: -#line 622 "magic-interpreter-parser.y" + case 100: +#line 629 "magic-interpreter-parser.y" { if (find_constant((yyvsp[(1) - (4)].s))) { fail((yylsp[(1) - (4)]).first_line, (yylsp[(1) - (4)]).first_column, "Attempt to re-define constant `%s' in assignment.", (yyvsp[(1) - (4)].s)); @@ -2533,8 +2561,8 @@ yyreduce: ;} break; - case 100: -#line 633 "magic-interpreter-parser.y" + case 101: +#line 640 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_FOREACH); (yyval.effect)->e.e_foreach.id = intern_id((yyvsp[(3) - (7)].s)); (yyval.effect)->e.e_foreach.area = (yyvsp[(5) - (7)].expr); @@ -2543,8 +2571,8 @@ yyreduce: ;} break; - case 101: -#line 640 "magic-interpreter-parser.y" + case 102: +#line 647 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_FOR); (yyval.effect)->e.e_for.id = intern_id((yyvsp[(2) - (8)].s)); (yyval.effect)->e.e_for.start = (yyvsp[(4) - (8)].expr); @@ -2553,8 +2581,8 @@ yyreduce: ;} break; - case 102: -#line 647 "magic-interpreter-parser.y" + case 103: +#line 654 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_IF); (yyval.effect)->e.e_if.cond = (yyvsp[(2) - (6)].expr); (yyval.effect)->e.e_if.true_branch = (yyvsp[(4) - (6)].effect); @@ -2562,8 +2590,8 @@ yyreduce: ;} break; - case 103: -#line 653 "magic-interpreter-parser.y" + case 104: +#line 660 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_IF); (yyval.effect)->e.e_if.cond = (yyvsp[(2) - (4)].expr); (yyval.effect)->e.e_if.true_branch = (yyvsp[(4) - (4)].effect); @@ -2571,22 +2599,22 @@ yyreduce: ;} break; - case 104: -#line 659 "magic-interpreter-parser.y" + case 105: +#line 666 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_SLEEP); (yyval.effect)->e.e_sleep = (yyvsp[(2) - (3)].expr); ;} break; - case 105: -#line 663 "magic-interpreter-parser.y" + case 106: +#line 670 "magic-interpreter-parser.y" { (yyval.effect) = op_effect((yyvsp[(1) - (5)].s), (yyvsp[(3) - (5)].arg_list).args_nr, (yyvsp[(3) - (5)].arg_list).args, (yylsp[(1) - (5)]).first_line, (yylsp[(1) - (5)]).first_column); free((yyvsp[(1) - (5)].s)); ;} break; - case 106: -#line 667 "magic-interpreter-parser.y" + case 107: +#line 674 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_SCRIPT); (yyval.effect)->e.e_script = parse_script((unsigned char *) (yyvsp[(1) - (1)].s), (yylsp[(1) - (1)]).first_line); free((yyvsp[(1) - (1)].s)); @@ -2595,26 +2623,26 @@ yyreduce: ;} break; - case 107: -#line 674 "magic-interpreter-parser.y" + case 108: +#line 681 "magic-interpreter-parser.y" { (yyval.effect) = call_proc((yyvsp[(2) - (6)].s), (yyvsp[(4) - (6)].arg_list).args_nr, (yyvsp[(4) - (6)].arg_list).args, (yylsp[(1) - (6)]).first_line, (yylsp[(1) - (6)]).first_column); free((yyvsp[(2) - (6)].s)); ;} break; - case 108: -#line 680 "magic-interpreter-parser.y" + case 109: +#line 687 "magic-interpreter-parser.y" { (yyval.effect) = new_effect(EFFECT_SKIP); ;} break; - case 109: -#line 682 "magic-interpreter-parser.y" + case 110: +#line 689 "magic-interpreter-parser.y" { (yyval.effect) = set_effect_continuation((yyvsp[(1) - (3)].effect), (yyvsp[(3) - (3)].effect)); ;} break; /* Line 1267 of yacc.c. */ -#line 2618 "magic-interpreter-parser.c" +#line 2646 "magic-interpreter-parser.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -2834,7 +2862,7 @@ yyreturn: } -#line 686 "magic-interpreter-parser.y" +#line 693 "magic-interpreter-parser.y" /* We do incremental realloc here to store our results. Since this happens only once @@ -2921,6 +2949,16 @@ fail(int line, int column, char *fmt, ...) } static expr_t * +dot_expr(expr_t *expr, int id) +{ + expr_t *retval = magic_new_expr(EXPR_SPELLFIELD); + retval->e.e_field.id = id; + retval->e.e_field.expr = expr; + + return retval; +} + +static expr_t * fun_expr(char *name, int args_nr, expr_t **args, int line, int column) { int id; @@ -2956,7 +2994,10 @@ fun_expr(char *name, int args_nr, expr_t **args, int line, int column) static spell_t * new_spell(spellguard_t *guard) { + static int spell_counter = 0; + spell_t *retval = calloc(1, sizeof(spell_t)); + retval->index = ++spell_counter; retval->spellguard = guard; return retval; } diff --git a/src/map/magic-interpreter-parser.h b/src/map/magic-interpreter-parser.h index 6edcb9a..9b84fa1 100644 --- a/src/map/magic-interpreter-parser.h +++ b/src/map/magic-interpreter-parser.h @@ -150,7 +150,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 71 "magic-interpreter-parser.y" +#line 74 "magic-interpreter-parser.y" { int i; char *s; diff --git a/src/map/magic-interpreter-parser.y b/src/map/magic-interpreter-parser.y index bae6844..deb686d 100644 --- a/src/map/magic-interpreter-parser.y +++ b/src/map/magic-interpreter-parser.y @@ -12,6 +12,9 @@ intern_id(char *id_name); static expr_t * fun_expr(char *name, int args_nr, expr_t **args, int line, int column); +static expr_t * +dot_expr(expr_t *lhs, int id); + #define BIN_EXPR(x, name, arg1, arg2, line, column) { expr_t *e[2]; e[0] = arg1; e[1] = arg2; x = fun_expr(name, 2, e, line, column); } static int failed_flag = 0; @@ -106,6 +109,7 @@ find_constant(char *name); %token '%' %token '@' %token ',' +%token '.' %token ':' %token ';' %token '|' @@ -200,6 +204,7 @@ find_constant(char *name); %right '=' %left OR %left DARROW +%left '.' %% @@ -394,6 +399,8 @@ expr : value free($1); } | '(' expr ')' { $$ = $2; } + | expr '.' ID + { $$ = dot_expr($1, intern_id($3)); } ; arg_list : /* empty */ @@ -769,6 +776,16 @@ fail(int line, int column, char *fmt, ...) } static expr_t * +dot_expr(expr_t *expr, int id) +{ + expr_t *retval = magic_new_expr(EXPR_SPELLFIELD); + retval->e.e_field.id = id; + retval->e.e_field.expr = expr; + + return retval; +} + +static expr_t * fun_expr(char *name, int args_nr, expr_t **args, int line, int column) { int id; @@ -804,7 +821,10 @@ fun_expr(char *name, int args_nr, expr_t **args, int line, int column) static spell_t * new_spell(spellguard_t *guard) { + static int spell_counter = 0; + spell_t *retval = calloc(1, sizeof(spell_t)); + retval->index = ++spell_counter; retval->spellguard = guard; return retval; } diff --git a/src/map/magic-interpreter.h b/src/map/magic-interpreter.h index 26f6c5c..0e6218e 100644 --- a/src/map/magic-interpreter.h +++ b/src/map/magic-interpreter.h @@ -115,6 +115,7 @@ typedef struct val { #define EXPR_AREA 2 #define EXPR_FUNAPP 3 #define EXPR_ID 4 +#define EXPR_SPELLFIELD 5 typedef struct e_location { struct expr *m, *x, *y; @@ -137,6 +138,7 @@ typedef struct expr { e_area_t e_area; struct { int id, line_nr, column; int args_nr; struct expr *args[MAX_ARGS]; } e_funapp; int e_id; + struct { struct expr *expr; int id; } e_field; } e; unsigned char ty; } expr_t; @@ -244,6 +246,7 @@ typedef struct letdef { typedef struct spell { char *name; char *invocation; + int index; // Relative location in the definitions file int flags; int arg; int spellarg_ty; @@ -312,7 +315,7 @@ typedef struct env { typedef struct cont_activation_record { effect_t *return_location; union c { - struct { int id; effect_t *body; int entities_nr; int *entities; int index; } c_foreach; + struct { int id, ty; effect_t *body; int entities_nr; int *entities; int index; } c_foreach; struct { int id; effect_t *body; int current; int stop; } c_for; struct { int args_nr, *formals; val_t *old_actuals; } c_proc; } c; diff --git a/src/map/magic-interpreter.l b/src/map/magic-interpreter.l index 017ca15..c16ba8e 100644 --- a/src/map/magic-interpreter.l +++ b/src/map/magic-interpreter.l @@ -55,6 +55,7 @@ "]" {FIXLOC; return ']';} "&" {FIXLOC; return '&';} "^" {FIXLOC; return '^';} +"." {FIXLOC; return '.';} "<<" {FIXLOC; return SHL;} ">>" {FIXLOC; return SHR;} "PROCEDURE" {FIXLOC; return PROCEDURE;} diff --git a/src/map/magic-stmt.c b/src/map/magic-stmt.c index 9760674..c9984af 100644 --- a/src/map/magic-stmt.c +++ b/src/map/magic-stmt.c @@ -10,6 +10,7 @@ clif_spawn_fake_npc_for_player(struct map_session_data *sd, int fake_npc_id); //#define DEBUG +#ifdef DEBUG static void print_val(val_t *v) { @@ -37,6 +38,7 @@ dump_env(env_t *env) fprintf(stderr, ")\n"); } } +#endif static void clear_activation_record(cont_activation_record_t *ar) @@ -504,40 +506,6 @@ op_override_attack(env_t *env, int args_nr, val_t *args) return 0; } -static int // ret -1: not a string, ret 1: no such item, ret 0: OK -find_item(val_t *args, int index, struct item *item, int *stackable) -{ - struct item_data *item_data; - int must_add_sequentially; - - if (TY(index) == TY_INT) - item_data = itemdb_exists(ARGINT(index)); - else if (TY(index) == TY_STRING) - item_data = itemdb_searchname(ARGSTR(index)); - else - return -1; - - if (!item_data) - return 1; - - must_add_sequentially = (item_data->type == 4 - || item_data->type == 5 - || item_data->type == 7 - || item_data->type == 8); /* Very elegant. */ - - - if (stackable) - *stackable = !must_add_sequentially; - - memset(item, 0, sizeof(struct item)); - item->nameid = item_data->nameid; - item->identify = 1; - - return 0; -} - -#define GET_ARG_ITEM(index, dest, stackable) switch(find_item(args, index, &dest, &stackable)) { case -1 : return 1; case 1 : return 0; } - static int op_create_item(env_t *env, int args_nr, val_t *args) { @@ -916,7 +884,7 @@ return_to_stack(invocation_t *invocation) } while (!entity_id || !map_id2bl(entity_id)); magic_clear_var(var); - var->ty = TY_ENTITY; + var->ty = ar->c.c_foreach.ty; var->v.v_int = entity_id; return ar->c.c_foreach.body; @@ -966,6 +934,17 @@ find_entities_in_area_c(entity_t *target, va_list va) int **entities_p = va_arg(va, int **); int filter = va_arg(va, int); +/* The following macro adds an entity to the result list: */ +#define ADD_ENTITY(e) \ + if (*entities_nr_p == *entities_allocd_p) { \ + /* Need more space */ \ + (*entities_allocd_p) += 32; \ + *entities_p = realloc(*entities_p, sizeof(int) * (*entities_allocd_p)); \ + } \ + (*entities_p)[(*entities_nr_p)++] = e; + + + switch (target->type) { case BL_PC: @@ -974,8 +953,16 @@ find_entities_in_area_c(entity_t *target, va_list va) || (filter == FOREACH_FILTER_TARGET && map[target->m].flag.pvp)) break; - else - return 0; + else if (filter == FOREACH_FILTER_SPELL) { /* Check all spells bound to the caster */ + invocation_t *invoc = ((character_t *) target) -> active_spells; + /* Add all spells locked onto thie PC */ + + while (invoc) { + ADD_ENTITY(invoc->bl.id); + invoc = invoc->next_invocation; + } + } + return 0; case BL_MOB: if (filter == FOREACH_FILTER_MOB @@ -985,18 +972,24 @@ find_entities_in_area_c(entity_t *target, va_list va) else return 0; + case BL_SPELL: + if (filter == FOREACH_FILTER_SPELL) { + invocation_t *invocation = (invocation_t *) target; + + /* Check whether the spell is `bound'-- if so, we'll consider it iff we see the caster (case BL_PC). */ + if (invocation->flags & INVOCATION_FLAG_BOUND) + return 0; + else + break; /* Add the spell */ + } else + return 0; + default: return 0; } - if (*entities_nr_p == *entities_allocd_p) { - /* Need more space */ - (*entities_allocd_p) += 32; - *entities_p = realloc(*entities_p, sizeof(int) * (*entities_allocd_p)); - } - - (*entities_p)[(*entities_nr_p)++] = target->id; - + ADD_ENTITY(target->id); +#undef ADD_ENTITY return 0; } @@ -1069,6 +1062,7 @@ run_foreach(invocation_t *invocation, effect_t *foreach, effect_t *return_locati ar->c.c_foreach.index = 0; ar->c.c_foreach.entities_nr = entities_nr; ar->c.c_foreach.entities = entities; + ar->c.c_foreach.ty = (filter == FOREACH_FILTER_SPELL) ? TY_INVOCATION : TY_ENTITY; magic_clear_var(&area); @@ -1132,6 +1126,7 @@ run_call(invocation_t *invocation, effect_t *return_location) return current->e.e_call.body; } +#ifdef DEBUG static void print_cfg(int i, effect_t *e) { @@ -1185,6 +1180,7 @@ print_cfg(int i, effect_t *e) } print_cfg(i, e->next); } +#endif /** @@ -1199,6 +1195,9 @@ print_cfg(int i, effect_t *e) static int spell_run(invocation_t *invocation, int allow_delete) { + const int invocation_id = invocation->bl.id; +#define REFRESH_INVOCATION invocation = (invocation_t *) map_id2bl(invocation_id); if (!invocation) return 0; + #ifdef DEBUG fprintf(stderr, "Resuming execution: invocation of `%s'\n", invocation->spell->name); print_cfg(1, invocation->current_effect); @@ -1289,6 +1288,7 @@ spell_run(invocation_t *invocation, int allow_delete) invocation->script_pos = 0; clif_clearchar_id(invocation->bl.id, 1, caster->fd); } + REFRESH_INVOCATION; // Script may have killed the caster break; } @@ -1310,6 +1310,8 @@ spell_run(invocation_t *invocation, int allow_delete) for (i = 0; i < e->e.e_op.args_nr; i++) magic_clear_var(&args[i]); + + REFRESH_INVOCATION; // Effect may have killed the caster break; } @@ -1331,6 +1333,7 @@ spell_run(invocation_t *invocation, int allow_delete) if (allow_delete) try_to_finish_invocation(invocation); return 0; +#undef REFRESH_INVOCATION } @@ -1375,7 +1378,11 @@ spell_attack(int caster_id, int target_id) invocation->flags &= ~INVOCATION_FLAG_ABORTED; spell_execute_d(invocation, 0 /* don't delete the invocation if done */); - if (!(invocation->flags & INVOCATION_FLAG_ABORTED)) // If we didn't abort: + // If the caster died, we need to refresh here: + invocation = (invocation_t *)map_id2bl(caster->attack_spell_override); + + if (invocation + && !(invocation->flags & INVOCATION_FLAG_ABORTED)) // If we didn't abort: caster->attack_spell_charges--; } diff --git a/src/map/magic.c b/src/map/magic.c index 5225ede..8800bb3 100644 --- a/src/map/magic.c +++ b/src/map/magic.c @@ -56,7 +56,7 @@ int magic_message(character_t *caster, char *spell_, size_t spell_len) { - int power = caster->status.base_level + (caster->status.int_ * 2) + caster->spellpower_bonus_current; + int power = caster->matk1; char *invocation_base = spell_ + 8; char *source_invocation = strchr(invocation_base, ':'); spell_t *spell; diff --git a/src/map/pc.c b/src/map/pc.c index 353f60c..62e2cd5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1525,6 +1525,12 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->matk2 = sd->matk1; sd->matk1 = temp; } + // [Fate] New tmw magic system + sd->matk1 += sd->status.base_level + sd->spellpower_bonus_current; + sd->matk2 = 0; + if (sd->matk1 < 0) + sd->matk1 = 0; + sd->hit += sd->paramc[4] + sd->status.base_level; sd->flee += sd->paramc[1] + sd->status.base_level; sd->def2 += sd->paramc[2]; @@ -7125,10 +7131,14 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) { nullpo_retr(0, sd); // Hijack this callback: Adjust spellpower bonus - if (sd->spellpower_bonus_target < sd->spellpower_bonus_current) + if (sd->spellpower_bonus_target < sd->spellpower_bonus_current) { sd->spellpower_bonus_current = sd->spellpower_bonus_target; - else if (sd->spellpower_bonus_target > sd->spellpower_bonus_current) + pc_calcstatus(sd, 0); + } + else if (sd->spellpower_bonus_target > sd->spellpower_bonus_current) { sd->spellpower_bonus_current += 1 + ((sd->spellpower_bonus_target - sd->spellpower_bonus_current) >> 5); + pc_calcstatus(sd, 0); + } if (sd->sc_data[SC_HALT_REGENERATE].timer != -1) return 0; |