summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-11-08 20:00:54 -0800
committerKaz Kylheku <kaz@kylheku.com>2011-11-08 20:00:54 -0800
commitbc7e9d90ffeef2d38524505f774cfb2f81b5e274 (patch)
tree0b9d307f6d8df1812eba9a343acb51890e9e6be0 /parser.y
parent8106bd9b10f0e81599e523b3d13039603b522ea7 (diff)
downloadtxr-bc7e9d90ffeef2d38524505f774cfb2f81b5e274.tar.gz
txr-bc7e9d90ffeef2d38524505f774cfb2f81b5e274.tar.bz2
txr-bc7e9d90ffeef2d38524505f774cfb2f81b5e274.zip
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.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y3
1 files changed, 2 insertions, 1 deletions
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 <lexeme> AND OR END COLLECT
%token <lexeme> UNTIL COLL OUTPUT REPEAT REP SINGLE FIRST LAST EMPTY DEFINE
%token <lexeme> TRY CATCH FINALLY
-%token <lexeme> ERRTOK
+%token <lexeme> ERRTOK /* deliberately not used in grammar */
%token <num> 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); }