diff options
author | Fate <fate-tmw@googlemail.com> | 2008-11-23 23:30:51 -0700 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2008-11-23 23:30:51 -0700 |
commit | 5bb68970dece3052f5bf82d53bec8c6eeac60e15 (patch) | |
tree | c1ca7cf0d8f5f88f35b1bccdaf844e716066d62c /src/map/magic-interpreter-parser.y | |
parent | 8678e872c4a8f5ce67f135bf2f5e6b44b4ba2997 (diff) | |
download | tmwa-5bb68970dece3052f5bf82d53bec8c6eeac60e15.tar.gz tmwa-5bb68970dece3052f5bf82d53bec8c6eeac60e15.tar.bz2 tmwa-5bb68970dece3052f5bf82d53bec8c6eeac60e15.tar.xz tmwa-5bb68970dece3052f5bf82d53bec8c6eeac60e15.zip |
Magic: looping over spells, spell field access, is-equipped check
Diffstat (limited to 'src/map/magic-interpreter-parser.y')
-rw-r--r-- | src/map/magic-interpreter-parser.y | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/map/magic-interpreter-parser.y b/src/map/magic-interpreter-parser.y index bae6844..a8f7168 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; |