summaryrefslogtreecommitdiffstats
path: root/parser.l
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-10-01 09:15:16 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-10-01 09:15:16 -0700
commitfb552521dfeca5bb1e36d5d0f85ed8e7585caffb (patch)
tree815b1609331c027514cc1efacef5f2eda0fcd114 /parser.l
parentd0416083b2672d431d9b29be300bf690ed246962 (diff)
downloadtxr-fb552521dfeca5bb1e36d5d0f85ed8e7585caffb.tar.gz
txr-fb552521dfeca5bb1e36d5d0f85ed8e7585caffb.tar.bz2
txr-fb552521dfeca5bb1e36d5d0f85ed8e7585caffb.zip
New directive: choose.
* match.c (choose_s, longest_k, shortest_k): New variables. (match_line, match_files): Introduced choose directive. (match_init): Initialize new variables. * match.h (choose_s): Declared. * parser.l (yybadtoken): Handle CHOOSE. (CHOOSE): Clause added for returning this token. * parser.y: Added #include "match.h". (CHOOSE): New token symbol. (choose_clause): New nonterminal symbol. (clause): choose_clause added. (all_clause, some_clause, none_clause, maybe_clause, cases_clause): Abstract syntax tree tweaked. (choose_clause): New syntax. (elem): Abstract syntax trees tweaked for many clauses. New CHOOSE clauses. (out_clause): New error case for choose_clause.
Diffstat (limited to 'parser.l')
-rw-r--r--parser.l7
1 files changed, 7 insertions, 0 deletions
diff --git a/parser.l b/parser.l
index a57c954b..b2b1e6b4 100644
--- a/parser.l
+++ b/parser.l
@@ -99,6 +99,7 @@ void yybadtoken(int tok, val context)
case NONE: problem = lit("\"none\""); break;
case MAYBE: problem = lit("\"maybe\""); break;
case CASES: problem = lit("\"cases\""); break;
+ case CHOOSE: problem = lit("\"choose\""); break;
case AND: problem = lit("\"and\""); break;
case OR: problem = lit("\"or\""); break;
case END: problem = lit("\"end\""); break;
@@ -256,6 +257,12 @@ UONLY {U2}{U}|{U3}{U}{U}|{U4}{U}{U}{U}
return CASES;
}
+<SPECIAL>\({WS}choose/{ID_END} {
+ yy_push_state(NESTED);
+ return CHOOSE;
+ }
+
+
<SPECIAL>\({WS}and{WS}\) {
yy_pop_state();
return AND;