summaryrefslogtreecommitdiff
path: root/src/macro_rules/eval.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/macro_rules/eval.cpp')
-rw-r--r--src/macro_rules/eval.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/macro_rules/eval.cpp b/src/macro_rules/eval.cpp
index 05c02248..6344b26a 100644
--- a/src/macro_rules/eval.cpp
+++ b/src/macro_rules/eval.cpp
@@ -1325,17 +1325,35 @@ namespace
consume_tt(lex);
break;
case TOK_RWORD_IF:
- lex.consume();
- consume_expr(lex, true);
- if( lex.next() != TOK_BRACE_OPEN )
- return false;
- consume_tt(lex);
- if( lex.next() == TOK_RWORD_ELSE )
+ while(1)
{
+ assert(lex.next() == TOK_RWORD_IF);
lex.consume();
+ if(lex.next() == TOK_RWORD_LET)
+ {
+ lex.consume();
+ if( !consume_pat(lex) )
+ return false;
+ if( lex.next() != TOK_EQUAL )
+ return false;
+ lex.consume();
+ }
+ if( !consume_expr(lex, true) )
+ return false;
if( lex.next() != TOK_BRACE_OPEN )
return false;
consume_tt(lex);
+ if( lex.next() != TOK_RWORD_ELSE )
+ break;
+ lex.consume();
+
+ if( lex.next() != TOK_RWORD_IF )
+ {
+ if( lex.next() != TOK_BRACE_OPEN )
+ return false;
+ consume_tt(lex);
+ break;
+ }
}
break;
default: