aboutsummaryrefslogtreecommitdiff
path: root/src/boot/fe
diff options
context:
space:
mode:
authorTohava <tohava@tohava-laptop.(none)>2010-08-06 16:11:15 +0300
committerTohava <tohava@tohava-laptop.(none)>2010-08-06 16:11:15 +0300
commit4bc173fd3c66bb5b072b6452df8cb383b789c464 (patch)
treecebd24a54856c689392ff44cbec0d60d59635e02 /src/boot/fe
parentMerge branch 'master' of git://github.com/graydon/rust (diff)
downloadrust-4bc173fd3c66bb5b072b6452df8cb383b789c464.tar.xz
rust-4bc173fd3c66bb5b072b6452df8cb383b789c464.zip
Added AST pretty printing for slice expression
Diffstat (limited to 'src/boot/fe')
-rw-r--r--src/boot/fe/ast.ml29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/boot/fe/ast.ml b/src/boot/fe/ast.ml
index d4ace045..9cad5ce5 100644
--- a/src/boot/fe/ast.ml
+++ b/src/boot/fe/ast.ml
@@ -1237,7 +1237,13 @@ and fmt_stmt_body (ff:Format.formatter) (s:stmt) : unit =
| STMT_alt_port _ -> fmt ff "?stmt_alt_port?"
| STMT_note _ -> fmt ff "?stmt_note?"
- | STMT_slice _ -> fmt ff "?stmt_slice?"
+ | STMT_slice (dst, src, slice) ->
+ fmt_lval ff dst;
+ fmt ff " = ";
+ fmt_lval ff src;
+ fmt ff ".";
+ fmt_slice ff slice;
+ fmt ff ";";
end
and fmt_arm
@@ -1275,6 +1281,27 @@ and fmt_pat (ff:Format.formatter) (pat:pat) : unit =
| PAT_wild ->
fmt ff "_"
+and fmt_slice (ff:Format.formatter) (slice:slice) : unit =
+ let fmt_slice_start = (match slice.slice_start with
+ None -> (fun ff -> fmt ff "0")
+ | Some atom -> (fun ff -> fmt_atom ff atom)) in
+ fmt ff "(@[";
+ fmt_slice_start ff;
+ begin
+ match slice.slice_len with
+ None -> fmt ff ","
+ | Some slice_len ->
+ fmt ff ",@ @[";
+ fmt_slice_start ff;
+ fmt ff " +@ ";
+ fmt_atom ff slice_len;
+ fmt ff "@]";
+ end;
+ fmt ff "@])";
+
+
+
+
and fmt_decl_param (ff:Format.formatter) (param:ty_param) : unit =
let (ident, (i, e)) = param in
fmt_effect ff e;