From 2a632dc3768f6c65abc8f33192cdcaef4c9a9571 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 26 Feb 2014 07:17:07 -0800 Subject: * 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. --- parser.y | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'parser.y') diff --git a/parser.y b/parser.y index 396d097f..b1540c90 100644 --- a/parser.y +++ b/parser.y @@ -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)); -- cgit v1.2.3