From 904ac5cc1675b19249750e3f5492cba720dda4c5 Mon Sep 17 00:00:00 2001 From: Adrian Thurston Date: Mon, 5 Oct 2015 11:15:52 -0400 Subject: added syntax dedicated to reductions This avoids interferrence with existing parsing code. Calling the commit/reduce code only if the reduce construct is used. --- src/colm.lm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/colm.lm') diff --git a/src/colm.lm b/src/colm.lm index 9b305e70..5420014e 100644 --- a/src/colm.lm +++ b/src/colm.lm @@ -11,6 +11,7 @@ lex token PRINT_XML / 'print_xml' / token PRINT_XML_AC / 'print_xml_ac' / token PARSE / 'parse' / + token REDUCE / 'reduce' / token PARSE_TREE / 'parse_tree' / token PARSE_STOP / 'parse_stop' / token CONS / 'construct' | 'cons' / @@ -615,6 +616,7 @@ def code_factor | [PARSE opt_capture type_ref opt_field_init accumulate] :Parse | [PARSE_TREE opt_capture type_ref opt_field_init accumulate] :ParseTree | [PARSE_STOP opt_capture type_ref opt_field_init accumulate] :ParseStop +| [REDUCE type_ref opt_field_init accumulate] :Reduce | [CONS opt_capture type_ref opt_field_init constructor] :Cons | [MATCH var_ref pattern] :Match | [string] :String -- cgit v1.2.1