about summary refs log tree commit diff
path: root/src/comp/syntax/parse
diff options
context:
space:
mode:
authorKevin Atkinson <kevina@cs.utah.edu>2012-02-01 00:20:31 -0700
committerKevin Atkinson <kevina@cs.utah.edu>2012-02-03 20:41:48 -0700
commitda74a7f9ca774cd8addcb00a361bb230facc3b31 (patch)
tree56a6c60c5d6825a02e59c8934deba409334f70e0 /src/comp/syntax/parse
parent5ea04c65c151708272b92d00c8448156239affb2 (diff)
downloadrust-da74a7f9ca774cd8addcb00a361bb230facc3b31.tar.gz
rust-da74a7f9ca774cd8addcb00a361bb230facc3b31.zip
Make macro arg optional in syntax, again untested.
Diffstat (limited to 'src/comp/syntax/parse')
-rw-r--r--src/comp/syntax/parse/parser.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/comp/syntax/parse/parser.rs b/src/comp/syntax/parse/parser.rs
index ae00c9fbce7..291f820df18 100644
--- a/src/comp/syntax/parse/parser.rs
+++ b/src/comp/syntax/parse/parser.rs
@@ -985,14 +985,20 @@ fn parse_syntax_ext_naked(p: parser, lo: uint) -> @ast::expr {
     let pth = parse_path(p);
     //temporary for a backwards-compatible cycle:
     let sep = seq_sep(token::COMMA);
-    let es =
-        if p.token == token::LPAREN {
-            parse_seq(token::LPAREN, token::RPAREN, sep, parse_expr, p)
-        } else {
-            parse_seq(token::LBRACKET, token::RBRACKET, sep, parse_expr, p)
-        };
-    let hi = es.span.hi;
-    let e = mk_expr(p, es.span.lo, hi, ast::expr_vec(es.node, ast::imm));
+    let e = none;
+    if (p.token == token::LPAREN || p.token == token::LBRACKET) {
+        let es =
+            if p.token == token::LPAREN {
+                parse_seq(token::LPAREN, token::RPAREN,
+                          sep, parse_expr, p)
+            } else {
+                parse_seq(token::LBRACKET, token::RBRACKET,
+                          sep, parse_expr, p)
+            };
+        let hi = es.span.hi;
+        e = some(mk_expr(p, es.span.lo, hi,
+                         ast::expr_vec(es.node, ast::imm)));
+    }
     let b = none;
     if p.token == token::LBRACE {
         p.bump();