diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-10-01 09:15:16 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-10-01 09:15:16 -0700 |
commit | fb552521dfeca5bb1e36d5d0f85ed8e7585caffb (patch) | |
tree | 815b1609331c027514cc1efacef5f2eda0fcd114 /parser.l | |
parent | d0416083b2672d431d9b29be300bf690ed246962 (diff) | |
download | txr-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.l | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |