summary refs log tree commit diff
path: root/src/comp/syntax/ext
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2011-08-12 07:15:18 -0700
committerGraydon Hoare <graydon@mozilla.com>2011-08-16 15:05:56 -0700
commite4a0f997fb01b9cbb650532fea1278159faff064 (patch)
tree6544a660e7af2a2485a14d200730d38e08ef29e4 /src/comp/syntax/ext
parentf764f9a8cf52e686ba6e54b594e6bbbdd5bc7b32 (diff)
Port the compiler to the typaram foo<T> syntax.
Diffstat (limited to 'src/comp/syntax/ext')
-rw-r--r--src/comp/syntax/ext/base.rs6
-rw-r--r--src/comp/syntax/ext/concat_idents.rs2
-rw-r--r--src/comp/syntax/ext/env.rs4
-rw-r--r--src/comp/syntax/ext/expand.rs2
-rw-r--r--src/comp/syntax/ext/fmt.rs2
-rw-r--r--src/comp/syntax/ext/ident_to_str.rs2
-rw-r--r--src/comp/syntax/ext/log_syntax.rs4
-rw-r--r--src/comp/syntax/ext/simplext.rs48
8 files changed, 35 insertions, 35 deletions
diff --git a/src/comp/syntax/ext/base.rs b/src/comp/syntax/ext/base.rs
index 47048ed1951..5a9b3ac1d19 100644
--- a/src/comp/syntax/ext/base.rs
+++ b/src/comp/syntax/ext/base.rs
@@ -7,10 +7,10 @@ import std::map::new_str_hash;
 import codemap;
 
 type syntax_expander =
-    fn(&ext_ctxt, span, @ast::expr, option::t[str]) -> @ast::expr ;
+    fn(&ext_ctxt, span, @ast::expr, option::t<str>) -> @ast::expr ;
 type macro_def = {ident: str, ext: syntax_extension};
 type macro_definer =
-    fn(&ext_ctxt, span, @ast::expr, option::t[str]) -> macro_def ;
+    fn(&ext_ctxt, span, @ast::expr, option::t<str>) -> macro_def ;
 
 tag syntax_extension {
     normal(syntax_expander);
@@ -19,7 +19,7 @@ tag syntax_extension {
 
 // A temporary hard-coded map of methods for expanding syntax extension
 // AST nodes into full ASTs
-fn syntax_expander_table() -> hashmap[str, syntax_extension] {
+fn syntax_expander_table() -> hashmap<str, syntax_extension> {
     let syntax_expanders = new_str_hash[syntax_extension]();
     syntax_expanders.insert("fmt", normal(ext::fmt::expand_syntax_ext));
     syntax_expanders.insert("env", normal(ext::env::expand_syntax_ext));
diff --git a/src/comp/syntax/ext/concat_idents.rs b/src/comp/syntax/ext/concat_idents.rs
index f21af93668f..43ec2488816 100644
--- a/src/comp/syntax/ext/concat_idents.rs
+++ b/src/comp/syntax/ext/concat_idents.rs
@@ -3,7 +3,7 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     body: option::t[str]) -> @ast::expr {
+                     body: option::t<str>) -> @ast::expr {
     let args: [@ast::expr] = alt arg.node {
       ast::expr_vec(elts, _, _) { elts }
       _ { cx.span_fatal(sp, "#concat_idents requires a vector argument .") }
diff --git a/src/comp/syntax/ext/env.rs b/src/comp/syntax/ext/env.rs
index 5a53f26a007..498792b80b0 100644
--- a/src/comp/syntax/ext/env.rs
+++ b/src/comp/syntax/ext/env.rs
@@ -11,7 +11,7 @@ import base::*;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     body: option::t[str]) -> @ast::expr {
+                     body: option::t<str>) -> @ast::expr {
     let args: [@ast::expr] = alt arg.node {
       ast::expr_vec(elts, _, _) { elts }
       _ { cx.span_fatal(sp, "#env requires arguments of the form `[...]`.") }
@@ -20,7 +20,7 @@ fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
         cx.span_fatal(sp, "malformed #env call");
     }
     // FIXME: if this was more thorough it would manufacture an
-    // option::t[str] rather than just an maybe-empty string.
+    // option::t<str> rather than just an maybe-empty string.
 
     let var = expr_to_str(cx, args.(0), "#env requires a string");
     alt generic_os::getenv(var) {
diff --git a/src/comp/syntax/ext/expand.rs b/src/comp/syntax/ext/expand.rs
index d5e9fda2c84..044bee4ba2b 100644
--- a/src/comp/syntax/ext/expand.rs
+++ b/src/comp/syntax/ext/expand.rs
@@ -14,7 +14,7 @@ import syntax::fold::*;
 import syntax::ext::base::*;
 
 
-fn expand_expr(exts: &hashmap[str, syntax_extension], cx: &ext_ctxt,
+fn expand_expr(exts: &hashmap<str, syntax_extension>, cx: &ext_ctxt,
                e: &expr_, fld: ast_fold,
                orig: &fn(&expr_, ast_fold) -> expr_ ) -> expr_ {
     ret alt e {
diff --git a/src/comp/syntax/ext/fmt.rs b/src/comp/syntax/ext/fmt.rs
index b8ab57303df..fd0ba7d4d01 100644
--- a/src/comp/syntax/ext/fmt.rs
+++ b/src/comp/syntax/ext/fmt.rs
@@ -16,7 +16,7 @@ import codemap::span;
 export expand_syntax_ext;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: span, arg: @ast::expr,
-                     body: option::t[str]) -> @ast::expr {
+                     body: option::t<str>) -> @ast::expr {
     let args: [@ast::expr] = alt arg.node {
       ast::expr_vec(elts, _, _) { elts }
       _ { cx.span_fatal(sp, "#fmt requires arguments of the form `[...]`.") }
diff --git a/src/comp/syntax/ext/ident_to_str.rs b/src/comp/syntax/ext/ident_to_str.rs
index c32acaf05b3..841f8221e3e 100644
--- a/src/comp/syntax/ext/ident_to_str.rs
+++ b/src/comp/syntax/ext/ident_to_str.rs
@@ -4,7 +4,7 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     body: option::t[str]) -> @ast::expr {
+                     body: option::t<str>) -> @ast::expr {
     let args: [@ast::expr] = alt arg.node {
       ast::expr_vec(elts, _, _) { elts }
       _ { cx.span_fatal(sp, "#ident_to_str requires a vector argument .") }
diff --git a/src/comp/syntax/ext/log_syntax.rs b/src/comp/syntax/ext/log_syntax.rs
index 9cd745f07f7..34c240a985c 100644
--- a/src/comp/syntax/ext/log_syntax.rs
+++ b/src/comp/syntax/ext/log_syntax.rs
@@ -3,11 +3,11 @@ import base::*;
 import syntax::ast;
 
 fn expand_syntax_ext(cx: &ext_ctxt, sp: codemap::span, arg: @ast::expr,
-                     body: option::t[str]) -> @ast::expr {
+                     body: option::t<str>) -> @ast::expr {
 
     cx.print_backtrace();
     std::io::stdout().write_line(print::pprust::expr_to_str(arg));
 
     //trivial expression
     ret @{id: cx.next_id(), node: ast::expr_rec(~[], option::none), span: sp};
-}
\ No newline at end of file
+}
diff --git a/src/comp/syntax/ext/simplext.rs b/src/comp/syntax/ext/simplext.rs
index 29f474b7878..aae2404f57b 100644
--- a/src/comp/syntax/ext/simplext.rs
+++ b/src/comp/syntax/ext/simplext.rs
@@ -32,7 +32,7 @@ import ast::mac_invoc;
 
 export add_new_extension;
 
-fn path_to_ident(pth: &path) -> option::t[ident] {
+fn path_to_ident(pth: &path) -> option::t<ident> {
     if vec::len(pth.node.idents) == 1u && vec::len(pth.node.types) == 0u {
         ret some(pth.node.idents.(0u));
     }
@@ -43,13 +43,13 @@ fn path_to_ident(pth: &path) -> option::t[ident] {
 type clause = {params: binders, body: @expr};
 
 /* logically, an arb_depth should contain only one kind of matchable */
-tag arb_depth[T] { leaf(T); seq(@[arb_depth[T]], span); }
+tag arb_depth[T] { leaf(T); seq(@[arb_depth<T>], span); }
 
 
 tag matchable {
     match_expr(@expr);
     match_path(path);
-    match_ident(ast::spanned[ident]);
+    match_ident(ast::spanned<ident>);
     match_ty(@ty);
     match_block(ast::blk);
     match_exact; /* don't bind anything, just verify the AST traversal */
@@ -88,11 +88,11 @@ fn match_error(cx: &ext_ctxt, m: &matchable, expected: &str) -> ! {
 // If we want better match failure error messages (like in Fortifying Syntax),
 // we'll want to return something indicating amount of progress and location
 // of failure instead of `none`.
-type match_result = option::t[arb_depth[matchable]];
+type match_result = option::t<arb_depth<matchable>>;
 type selector = fn(&matchable) -> match_result ;
 
 fn elts_to_ell(cx: &ext_ctxt, elts: &[@expr])
-    -> {pre: [@expr], rep: option::t[@expr], post: [@expr]} {
+    -> {pre: [@expr], rep: option::t<@expr>, post: [@expr]} {
     let idx: uint = 0u;
     let res = none;
     for elt: @expr in elts {
@@ -121,8 +121,8 @@ fn elts_to_ell(cx: &ext_ctxt, elts: &[@expr])
     }
 }
 
-fn option_flatten_map[T, U](f: &fn(&T) -> option::t[U] , v: &[T]) ->
-   option::t[[U]] {
+fn option_flatten_map[T, U](f: &fn(&T) -> option::t<U>, v: &[T]) ->
+   option::t<[U]> {
     let res = ~[];
     for elem: T in v {
         alt f(elem) { none. { ret none; } some(fv) { res += ~[fv]; } }
@@ -130,7 +130,7 @@ fn option_flatten_map[T, U](f: &fn(&T) -> option::t[U] , v: &[T]) ->
     ret some(res);
 }
 
-fn a_d_map(ad: &arb_depth[matchable], f: &selector) -> match_result {
+fn a_d_map(ad: &arb_depth<matchable>, f: &selector) -> match_result {
     alt ad {
       leaf(x) { ret f(x); }
       seq(ads, span) {
@@ -155,9 +155,9 @@ fn compose_sels(s1: selector, s2: selector) -> selector {
 
 
 type binders =
-    {real_binders: hashmap[ident, selector],
+    {real_binders: hashmap<ident, selector>,
      mutable literal_ast_matchers: [selector]};
-type bindings = hashmap[ident, arb_depth[matchable]];
+type bindings = hashmap<ident, arb_depth<matchable>>;
 
 fn acumm_bindings(cx: &ext_ctxt, b_dest: &bindings, b_src: &bindings) { }
 
@@ -182,8 +182,8 @@ fn pattern_to_selectors(cx: &ext_ctxt, e: @expr) -> binders {
 bindings. Most of the work is done in p_t_s, which generates the
 selectors. */
 
-fn use_selectors_to_bind(b: &binders, e: @expr) -> option::t[bindings] {
-    let res = new_str_hash[arb_depth[matchable]]();
+fn use_selectors_to_bind(b: &binders, e: @expr) -> option::t<bindings> {
+    let res = new_str_hash[arb_depth<matchable>]();
     //need to do this first, to check vec lengths.
     for sel: selector in b.literal_ast_matchers {
         alt sel(match_expr(e)) { none. { ret none; } _ { } }
@@ -230,9 +230,9 @@ fn transcribe(cx: &ext_ctxt, b: &bindings, body: @expr) -> @expr {
 
 
 /* helper: descend into a matcher */
-fn follow(m: &arb_depth[matchable], idx_path: @mutable [uint]) ->
-   arb_depth[matchable] {
-    let res: arb_depth[matchable] = m;
+fn follow(m: &arb_depth<matchable>, idx_path: @mutable [uint]) ->
+   arb_depth<matchable> {
+    let res: arb_depth<matchable> = m;
     for idx: uint in *idx_path {
         alt res {
           leaf(_) { ret res;/* end of the line */ }
@@ -242,8 +242,8 @@ fn follow(m: &arb_depth[matchable], idx_path: @mutable [uint]) ->
     ret res;
 }
 
-fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t[arb_depth[matchable]],
-                    idx_path: @mutable [uint]) -> option::t[matchable] {
+fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t<arb_depth<matchable>>,
+                    idx_path: @mutable [uint]) -> option::t<matchable> {
     alt mmaybe {
       none. { ret none }
       some(m) {
@@ -262,9 +262,9 @@ fn follow_for_trans(cx: &ext_ctxt, mmaybe: &option::t[arb_depth[matchable]],
 
 /* helper for transcribe_exprs: what vars from `b` occur in `e`? */
 iter free_vars(b: &bindings, e: @expr) -> ident {
-    let idents: hashmap[ident, ()] = new_str_hash[()]();
+    let idents: hashmap<ident, ()> = new_str_hash[()]();
     fn mark_ident(i: &ident, fld: ast_fold, b: &bindings,
-                  idents: &hashmap[ident, ()]) -> ident {
+                  idents: &hashmap<ident, ()>) -> ident {
         if b.contains_key(i) { idents.insert(i, ()); }
         ret i;
     }
@@ -290,7 +290,7 @@ fn transcribe_exprs(cx: &ext_ctxt, b: &bindings, idx_path: @mutable [uint],
         alt repeat_me_maybe {
           none. {}
           some(repeat_me) {
-            let repeat: option::t[{rep_count: uint, name: ident}] = none;
+            let repeat: option::t<{rep_count: uint, name: ident}> = none;
             /* we need to walk over all the free vars in lockstep, except for
             the leaves, which are just duplicated */
             for each fv: ident in free_vars(b, repeat_me) {
@@ -533,7 +533,7 @@ fn p_t_s_r_path(cx: &ext_ctxt, p: &path, s: &selector, b: &binders) {
     }
 }
 
-fn block_to_ident(blk: &blk_) -> option::t[ident] {
+fn block_to_ident(blk: &blk_) -> option::t<ident> {
     if vec::len(blk.stmts) != 0u { ret none; }
     ret alt blk.expr {
           some(expr) {
@@ -676,7 +676,7 @@ fn p_t_s_r_actual_vector(cx: &ext_ctxt, elts: [@expr], repeat_after: bool,
 }
 
 fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                     body: option::t[str]) -> base::macro_def {
+                     body: option::t<str>) -> base::macro_def {
     let args: [@ast::expr] = alt arg.node {
       ast::expr_vec(elts, _, _) { elts }
       _ {
@@ -684,7 +684,7 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
       }
     };
 
-    let macro_name: option::t[str] = none;
+    let macro_name: option::t<str> = none;
     let clauses: [@clause] = ~[];
     for arg: @expr in args {
         alt arg.node {
@@ -753,7 +753,7 @@ fn add_new_extension(cx: &ext_ctxt, sp: span, arg: @expr,
          ext: normal(ext)};
 
     fn generic_extension(cx: &ext_ctxt, sp: span, arg: @expr,
-                         body: option::t[str], clauses: [@clause]) -> @expr {
+                         body: option::t<str>, clauses: [@clause]) -> @expr {
         for c: @clause in clauses {
             alt use_selectors_to_bind(c.params, arg) {
               some(bindings) {