about summary refs log tree commit diff
path: root/src/boot
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-12-13 09:25:19 -0800
committerGraydon Hoare <graydon@mozilla.com>2010-12-13 09:25:19 -0800
commit734c1909188c7b505ca9a0b88bda561a08cf45fd (patch)
tree0ba475271d0709ad657cc8853be8c5e3847bdd2f /src/boot
parent04e15bf8f8b5a8138a2adbac6bff843f183f0301 (diff)
downloadrust-734c1909188c7b505ca9a0b88bda561a08cf45fd.tar.gz
rust-734c1909188c7b505ca9a0b88bda561a08cf45fd.zip
Syntax tweak: move 'mutable' from pseudo-ty-param on vec ctor to low-precedence prefix inside paren.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/fe/pexp.ml30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/boot/fe/pexp.ml b/src/boot/fe/pexp.ml
index 2f9c2badf72..a5f3759a70c 100644
--- a/src/boot/fe/pexp.ml
+++ b/src/boot/fe/pexp.ml
@@ -471,18 +471,28 @@ and parse_bottom_pexp (ps:pstate) : Ast.pexp =
 
     | VEC ->
         bump ps;
-        let mutability =
-          match peek ps with
-              LBRACKET ->
-                bump ps;
-                expect ps MUTABLE;
-                expect ps RBRACKET;
-                Ast.MUT_mutable
-            | _ -> Ast.MUT_immutable
+        let pexps =
+          ctxt "paren pexps(s)" (rstr false parse_mutable_and_pexp_list) ps
+        in
+        let mutability = ref Ast.MUT_immutable in
+        let pexps =
+          Array.mapi
+            begin
+              fun i (mut, e) ->
+                if i = 0
+                then
+                  mutability := mut
+                else
+                  if mut <> Ast.MUT_immutable
+                  then
+                    raise
+                      (err "'mutable' keyword after first vec element" ps);
+                e
+            end
+            pexps
         in
-        let pexps = ctxt "vec pexp: exprs" parse_pexp_list ps in
         let bpos = lexpos ps in
-          span ps apos bpos (Ast.PEXP_vec (mutability, pexps))
+          span ps apos bpos (Ast.PEXP_vec (!mutability, pexps))
 
 
     | LIT_STR s ->