From bc7e9d90ffeef2d38524505f774cfb2f81b5e274 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 8 Nov 2011 20:00:54 -0800 Subject: Task #11431. First cut at horizontal match functions. * match.c (h_fun): New function. (match_line): Rearranged not to do hash lookup if the directive is a regex or list. If hash lookup fails, try it as a horizontal function. (h_define): New function. Handles horizontal function syntax embedded in line. (v_define): Handle the horizontal function syntax occuring on a line by itself. The function info is now stored as a cons cell whose car is the vertical function and cdr the horizontal one. (v_fun): Adjust to new function storage convention. (dir_tables_init): h_define entered in table. * parser.y: Added syntax for horizontal define. --- parser.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'parser.y') diff --git a/parser.y b/parser.y index 115d9fbd..e15b9f5d 100644 --- a/parser.y +++ b/parser.y @@ -63,7 +63,7 @@ static val parsed_spec; %token AND OR END COLLECT %token UNTIL COLL OUTPUT REPEAT REP SINGLE FIRST LAST EMPTY DEFINE %token TRY CATCH FINALLY -%token ERRTOK +%token ERRTOK /* deliberately not used in grammar */ %token NUMBER @@ -275,6 +275,7 @@ elem : TEXT { $$ = string_own($1); } | CHOOSE exprs_opt ')' clause_parts_h { $$ = list(choose_s, t, $4, $2, nao); } | CHOOSE exprs_opt ')' END { yyerror("empty cases clause"); } + | DEFINE exprs ')' elems END { $$ = list(define_s, t, $4, $2, nao); } ; clause_parts_h : elems additional_parts_h { $$ = cons($1, $2); } -- cgit v1.2.3