summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2011-02-24 17:17:39 -0800
committerGraydon Hoare <graydon@mozilla.com>2011-02-24 17:17:39 -0800
commit88f0463c2bd6e7fd2af461afc5e83bd3417e3bc5 (patch)
treef8b60c224a3ac6d1e62bcbc41653fe0e73730209 /src/comp
parentdbf53b4c37f9f2a1cda43aa8320ceb4c4460051e (diff)
Support the awful alt-else form in rustboot's cexp grammar, at least transiently. Remove in the future.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/front/parser.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 7ae0050e170..67b9cc80f2b 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1170,6 +1170,23 @@ impure fn parse_alt_expr(parser p) -> @ast.expr {
                 auto block = parse_block(p);
                 arms += vec(rec(pat=pat, block=block, index=index));
             }
+
+            // FIXME: this is a vestigial form left over from
+            // rustboot, we're keeping it here for source-compat
+            // for the time being but it should be flushed out
+            // once we've bootstrapped. When we see 'else {' here,
+            // we pretend we saw 'case (_) {'. It has the same
+            // meaning, and only exists due to the cexp/pexp split
+            // in rustboot, which we're not maintaining.
+
+            case (token.ELSE) {
+                p.bump();
+                auto hi = p.get_span();
+                auto pat = @spanned(lo, hi, ast.pat_wild(ast.ann_none));
+                auto index = index_arm(pat);
+                auto block = parse_block(p);
+                arms += vec(rec(pat=pat, block=block, index=index));
+            }
             case (token.RBRACE) { /* empty */ }
             case (?tok) {
                 p.err("expected 'case' or '}' when parsing 'alt' statement " +