diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-19 22:12:27 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-19 22:12:27 -0800 |
commit | d6dfa887dbfdea02658e053a401254b559c9445b (patch) | |
tree | f79ebaf90c355c18cd67d323cadc8f646c3161ce /parser.y | |
parent | c5a77bdebfe7daa83eacd6b4e3e208473b5f9ad2 (diff) | |
download | txr-d6dfa887dbfdea02658e053a401254b559c9445b.tar.gz txr-d6dfa887dbfdea02658e053a401254b559c9445b.tar.bz2 txr-d6dfa887dbfdea02658e053a401254b559c9445b.zip |
Expand lisp forms in @(mod) and @(modlast) args.
* parser.y (expand_forms_ver): New function.
(repeat_parts_opt, rep_parts_opt): Expand the exprs_opt that
follow MOD or MODLAST.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -82,6 +82,13 @@ int yyparse(scanner_t *, parser_t *); #define yyerr(msg) yyerror(scnr, parser, msg) #define yybadtok(tok, context) yybadtoken(parser, tok, context) +INLINE val expand_forms_ver(val forms, int ver) +{ + if (!opt_compat || opt_compat >= ver) + return expand_forms(forms, nil); + return forms; +} + %} %pure-parser @@ -635,13 +642,15 @@ repeat_parts_opt : SINGLE newl newl out_clauses_opt repeat_parts_opt { $$ = cons(cons(mod_s, - cons($2, $5)), $6); + cons(expand_forms_ver($2, 166), + $5)), $6); rl($$, num($1)); } | MODLAST exprs_opt ')' newl out_clauses_opt repeat_parts_opt { $$ = cons(cons(modlast_s, - cons($2, $5)), $6); + cons(expand_forms_ver($2, 166), + $5)), $6); rl($$, num($1)); } | /* empty */ { $$ = nil; } ; @@ -701,12 +710,14 @@ rep_parts_opt : SINGLE o_elems_opt | MOD exprs_opt ')' o_elems_opt rep_parts_opt { $$ = cons(cons(mod_s, - cons($2, $4)), $5); + cons(expand_forms_ver($2, 166), + $4)), $5); rl($$, num($1)); } | MODLAST exprs_opt ')' o_elems_opt rep_parts_opt { $$ = cons(cons(modlast_s, - cons($2, $4)), $5); + cons(expand_forms_ver($2, 166), + $4)), $5); rl($$, num($1)); } | /* empty */ { $$ = nil; } ; |