From 8c0902a00ad68bb3f830274342de608cd36f304d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 29 Sep 2011 22:02:03 -0700 Subject: * match.c (match_line): Implemented horizontal all, some, none, maybe and cases directives. (match_files): Recognize horizontal version of these directives by the presence of the extra symbol t and do not process. Also, bugfix in the all directive: not resetting the all_match flag when short circuiting out. * parser.y (clause_parts_h, additional_parts_h): New nonterminals. (elem): New clauses added. --- parser.y | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'parser.y') diff --git a/parser.y b/parser.y index 17ad883a..cc66a96f 100644 --- a/parser.y +++ b/parser.y @@ -67,7 +67,8 @@ static val parsed_spec; %type all_clause some_clause none_clause maybe_clause %type cases_clause collect_clause clause_parts additional_parts %type output_clause define_clause try_clause catch_clauses_opt -%type line elems_opt elems elem var var_op +%type line elems_opt elems clause_parts_h additional_parts_h +%type elem var var_op %type list exprs exprs_opt expr out_clauses out_clauses_opt out_clause %type repeat_clause repeat_parts_opt o_line %type o_elems_opt o_elems_opt2 o_elems o_elem rep_elem rep_parts_opt @@ -206,8 +207,26 @@ elem : TEXT { $$ = string_own($1); } UNTIL elems END { $$ = list(coll_s, $4, $6, $2, nao); } | COLL error { $$ = nil; yybadtoken(yychar, lit("coll clause")); } + | ALL clause_parts_h { $$ = cons(all_s, cons(t, $2)); } + | ALL END { yyerror("empty all clause"); } + | SOME clause_parts_h { $$ = cons(some_s, cons(t, $2)); } + | SOME END { yyerror("empty some clause"); } + | NONE clause_parts_h { $$ = cons(none_s, cons(t, $2)); } + | NONE END { yyerror("empty none clause"); } + | MAYBE clause_parts_h { $$ = cons(maybe_s, cons(t, $2)); } + | MAYBE END { yyerror("empty maybe clause"); } + | CASES clause_parts_h { $$ = cons(cases_s, cons(t, $2)); } + | CASES END { yyerror("empty cases clause"); } ; +clause_parts_h : elems additional_parts_h { $$ = cons($1, $2); } + ; + +additional_parts_h : END { $$ = nil; } + | AND elems additional_parts_h { $$ = cons($2, $3); } + | OR elems additional_parts_h { $$ = cons($2, $3); } + ; + define_clause : DEFINE exprs ')' newl clauses_opt END newl { $$ = list(define_s, $2, $5, nao); } -- cgit v1.2.3