aboutsummaryrefslogtreecommitdiff
path: root/src/boot/fe/ast.ml
diff options
context:
space:
mode:
authorOr Brostovski <[email protected]>2010-08-21 02:41:43 +0300
committerOr Brostovski <[email protected]>2010-08-21 02:41:43 +0300
commit0830b5bf24a7117130e0089754cd96e51411284d (patch)
tree007dbef82fb2e6e63ac0c8153393c0902c22c5be /src/boot/fe/ast.ml
parentMerge branch 'master' of git://github.com/graydon/rust (diff)
downloadrust-0830b5bf24a7117130e0089754cd96e51411284d.tar.xz
rust-0830b5bf24a7117130e0089754cd96e51411284d.zip
Modified parser to handle alt type andadded a few tests
ast.ml - modified arm types for easier polymorphism - fixed a bug in fmt_type_arm dead.ml - modified arm types for easier polymorphism common.ml - added 'either' - added some useful auxiliary functions item.ml - modified arm code to be more polymorphic and handle both alt-tag and alt-type, also fixed the problematic case in bad-alt.rs Makefile - added XFAIL for new alt-type test bad-alt.rs - added test for invalid alt syntax alt-type-simple.rs - added simple test for alt type
Diffstat (limited to 'src/boot/fe/ast.ml')
-rw-r--r--src/boot/fe/ast.ml9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index 6cd1114a..3f3d5145 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -322,7 +322,7 @@ and pat =
and tag_arm' = pat * block
and tag_arm = tag_arm' identified
-and type_arm' = ident * slot * block
+and type_arm' = (ident * slot) * block
and type_arm = type_arm' identified
and port_arm' = port_case * block
@@ -1305,8 +1305,11 @@ and fmt_tag_arm (ff:Format.formatter) (tag_arm:tag_arm) : unit =
fmt_arm ff (fun ff -> fmt_pat ff pat) block;
and fmt_type_arm (ff:Format.formatter) (type_arm:type_arm) : unit =
- let (_, slot, block) = type_arm.node in
- fmt_arm ff (fun ff -> fmt_slot ff slot) block;
+ let ((ident, slot), block) = type_arm.node in
+ let fmt_type_arm_case (ff:Format.formatter) =
+ fmt_slot ff slot; fmt ff " "; fmt_ident ff ident
+ in
+ fmt_arm ff fmt_type_arm_case block;
and fmt_port_arm (ff:Format.formatter) (port_arm:port_arm) : unit =
let (port_case, block) = port_arm.node in