diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-11-17 06:41:38 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-11-20 16:17:18 -0800 |
commit | a25862d24050e8ff6e8eb1077715abac4afe5ff4 (patch) | |
tree | 7b292a9cb0866475ceedca6737b323b06e8d5dd9 /parser.y | |
parent | 559c24b4900f70e893902dbac99d7a8a113fb6f0 (diff) | |
download | txr-a25862d24050e8ff6e8eb1077715abac4afe5ff4.tar.gz txr-a25862d24050e8ff6e8eb1077715abac4afe5ff4.tar.bz2 txr-a25862d24050e8ff6e8eb1077715abac4afe5ff4.zip |
@(rep) as shorthand for @(coll :vars nil).
* match.c (h_coll): Check for rep symbol, and handle similarly
to v_coll. Use symbol in error message.
(dir_tables_init): Bind rep symbol to h_coll.
* parser.y (elems): Don't generate rep_elem phrase structure
for the sake of catching "rep outside of output"; this
production now conflicts with the intent to allow this.
(elem): Add various REP productions which clones of COLL.
* txr.1: Documented new @(rep) usage.
Diffstat (limited to 'parser.y')
-rw-r--r-- | parser.y | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -387,8 +387,6 @@ elems : elem { $$ = cons($1, nil); rlcp($$, $1); } | elem elems { $$ = cons($1, $2); rlcp($$, $1); } - | rep_elem { $$ = nil; - yyerr("rep outside of output"); } ; @@ -429,8 +427,17 @@ elem : texts { $$ = rlcp(cons(text_s, $1), $1); $2, nao); rl($$, num($1)); rl($6, car($5)); } + | REP exprs_opt ')' elems END { $$ = list(rep_s, $4, nil, $2, nao); + rl($$, num($1)); } + | REP exprs_opt ')' elems + until_last elems END { $$ = list(rep_s, $4, cons(cdr($5), $6), + $2, nao); + rl($$, num($1)); + rl($6, car($5)); } | COLL error { $$ = nil; yybadtok(yychar, lit("coll clause")); } + | REP error { $$ = nil; + yybadtok(yychar, lit("rep clause")); } | ALL clause_parts_h { $$ = rl(list(all_s, t, $2, nao), num($1)); } | ALL END { yyerr("empty all clause"); } | SOME exprs_opt ')' |