diff options
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | eval.c | 12 | ||||
-rw-r--r-- | parser.y | 13 |
3 files changed, 27 insertions, 11 deletions
@@ -1,5 +1,18 @@ 2014-02-26 Kaz Kylheku <kaz@kylheku.com> + * eval.c (expand_op): Use rlcp_tree when constructing the + dwim_body, since the append2 copies list structure. + + * parser.y (n_exprs): propagate source loc info from both + constituents, giving precedence to the left one, rather than just taking + it from the left one and ignoring the second constituent. This fixes + cases of missing location info. The left constituent n_expr is often + a symbol, and those do not have location info. We want a case like + like ((x) y) to take from (x), and (x (y)) to take it from (y), + and so on. + +2014-02-26 Kaz Kylheku <kaz@kylheku.com> + * parser.y (list): For @n_expr, get the source location info from the @ token. (n_expr): Bugfix: do not attribute a symbol with location info. @@ -2227,12 +2227,12 @@ static val expand_op(val sym, val body, val menv) { uses_or2; - val dwim_body = rlcp(cons(dwim_s, - if3(or4(is_op, has_rest, ssyms, - null(proper_listp(body_trans))), - body_trans, - append2(body_trans, rest_gensym))), - body_trans); + val dwim_body = rlcp_tree(cons(dwim_s, + if3(or4(is_op, has_rest, ssyms, + null(proper_listp(body_trans))), + body_trans, + append2(body_trans, rest_gensym))), + body_trans); if (sym == do_s) dwim_body = rlcp(cdr(dwim_body), dwim_body); @@ -730,12 +730,15 @@ exprs_opt : exprs { $$ = $1; } ; n_exprs : n_expr { $$ = rlcp(cons($1, nil), $1); } - | n_expr n_exprs { $$ = rlcp(cons($1, $2), $1); } - | n_expr '.' n_expr { $$ = rlcp(cons($1, $3), $1); } - | n_expr DOTDOT n_exprs { $$ = rlcp(cons(list(cons_s, $1, + | n_expr n_exprs { uses_or2; + $$ = rlcp(cons($1, $2), or2($1, $2)); } + | n_expr '.' n_expr { uses_or2; + $$ = rlcp(cons($1, $3), or2($1, $3)); } + | n_expr DOTDOT n_exprs { uses_or2; + $$ = rlcp(cons(list(cons_s, $1, car($3), nao), - cdr($3)), $1); } - ; + cdr($3)), or2($1, $3)); } + ; n_expr : SYMTOK { $$ = sym_helper($1, t); } | METANUM { $$ = cons(var_s, cons($1, nil)); |