summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-20 12:23:37 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-26 15:56:16 -0700
commit8337fa1a545e7958389c6025661990eedd9c1b91 (patch)
treec8156400e412fe7e4441a42592f2687915d8f2fa /src/libsyntax/ext/tt
parentd9a6a6365327ac156ef3102e2b7efae1b2be5934 (diff)
downloadrust-8337fa1a545e7958389c6025661990eedd9c1b91.tar.gz
rust-8337fa1a545e7958389c6025661990eedd9c1b91.zip
Camel case the option type
Diffstat (limited to 'src/libsyntax/ext/tt')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs22
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs16
-rw-r--r--src/libsyntax/ext/tt/transcribe.rs28
3 files changed, 33 insertions, 33 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 04f0e5f0a83..3b04fd502f4 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -85,19 +85,19 @@ eof: [a $( a )* a b ยท]
 nonempty body. */
 
 enum matcher_pos_up { /* to break a circularity */
-    matcher_pos_up(option<matcher_pos>)
+    matcher_pos_up(Option<matcher_pos>)
 }
 
 fn is_some(&&mpu: matcher_pos_up) -> bool {
     match mpu {
-      matcher_pos_up(none) => false,
+      matcher_pos_up(None) => false,
       _ => true
     }
 }
 
 type matcher_pos = ~{
     elts: ~[ast::matcher], // maybe should be /&? Need to understand regions.
-    sep: option<token>,
+    sep: Option<token>,
     mut idx: uint,
     mut up: matcher_pos_up, // mutable for swapping only
     matches: ~[DVec<@named_match>],
@@ -107,7 +107,7 @@ type matcher_pos = ~{
 
 fn copy_up(&& mpu: matcher_pos_up) -> matcher_pos {
     match mpu {
-      matcher_pos_up(some(mp)) => copy mp,
+      matcher_pos_up(Some(mp)) => copy mp,
       _ => fail
     }
 }
@@ -122,7 +122,7 @@ fn count_names(ms: &[matcher]) -> uint {
 }
 
 #[allow(non_implicitly_copyable_typarams)]
-fn initial_matcher_pos(ms: ~[matcher], sep: option<token>, lo: uint)
+fn initial_matcher_pos(ms: ~[matcher], sep: Option<token>, lo: uint)
     -> matcher_pos {
     let mut match_idx_hi = 0u;
     for ms.each() |elt| {
@@ -136,7 +136,7 @@ fn initial_matcher_pos(ms: ~[matcher], sep: option<token>, lo: uint)
           }
         }
     }
-    ~{elts: ms, sep: sep, mut idx: 0u, mut up: matcher_pos_up(none),
+    ~{elts: ms, sep: sep, mut idx: 0u, mut up: matcher_pos_up(None),
       matches: copy vec::from_fn(count_names(ms), |_i| dvec::dvec()),
       match_lo: 0u, match_hi: match_idx_hi, sp_lo: lo}
 }
@@ -208,7 +208,7 @@ fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
 fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
     -> parse_result {
     let mut cur_eis = ~[];
-    vec::push(cur_eis, initial_matcher_pos(ms, none, rdr.peek().sp.lo));
+    vec::push(cur_eis, initial_matcher_pos(ms, None, rdr.peek().sp.lo));
 
     loop {
         let mut bb_eis = ~[]; // black-box parsed by parser.rs
@@ -263,7 +263,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
 
                     // the *_t vars are workarounds for the lack of unary move
                     match copy ei.sep {
-                      some(t) if idx == len => { // we need a separator
+                      Some(t) if idx == len => { // we need a separator
                         if tok == t { //pass the separator
                             let ei_t <- ei;
                             ei_t.idx += 1u;
@@ -300,7 +300,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
                     let ei_t <- ei;
                     vec::push(cur_eis, ~{
                         elts: matchers, sep: sep, mut idx: 0u,
-                        mut up: matcher_pos_up(some(ei_t)),
+                        mut up: matcher_pos_up(Some(ei_t)),
                         matches: matches,
                         match_lo: match_idx_lo, match_hi: match_idx_hi,
                         sp_lo: sp.lo
@@ -381,8 +381,8 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
 fn parse_nt(p: parser, name: ~str) -> nonterminal {
     match name {
       ~"item" => match p.parse_item(~[]) {
-        some(i) => token::nt_item(i),
-        none => p.fatal(~"expected an item keyword")
+        Some(i) => token::nt_item(i),
+        None => p.fatal(~"expected an item keyword")
       },
       ~"block" => token::nt_block(p.parse_block()),
       ~"stmt" => token::nt_stmt(p.parse_stmt(~[])),
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index 5b5a631f248..1fd2f880595 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -14,7 +14,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                      arg: ~[ast::token_tree]) -> base::mac_result {
     // these spans won't matter, anyways
     fn ms(m: matcher_) -> matcher {
-        {node: m, span: {lo: 0u, hi: 0u, expn_info: none}}
+        {node: m, span: {lo: 0u, hi: 0u, expn_info: None}}
     }
 
     let lhs_nm =  cx.parse_sess().interner.gensym(@~"lhs");
@@ -28,15 +28,15 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
             ms(match_nonterminal(lhs_nm, special_idents::matchers, 0u)),
             ms(match_tok(FAT_ARROW)),
             ms(match_nonterminal(rhs_nm, special_idents::tt, 1u)),
-        ], some(SEMI), false, 0u, 2u)),
+        ], Some(SEMI), false, 0u, 2u)),
         //to phase into semicolon-termination instead of
         //semicolon-separation
-        ms(match_seq(~[ms(match_tok(SEMI))], none, true, 2u, 2u))];
+        ms(match_seq(~[ms(match_tok(SEMI))], None, true, 2u, 2u))];
 
 
     // Parse the macro_rules! invocation (`none` is for no interpolations):
     let arg_reader = new_tt_reader(cx.parse_sess().span_diagnostic,
-                                   cx.parse_sess().interner, none, arg);
+                                   cx.parse_sess().interner, None, arg);
     let argument_map = parse_or_else(cx.parse_sess(), cx.cfg(),
                                      arg_reader as reader, argument_gram);
 
@@ -65,7 +65,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
         }
 
         // Which arm's failure should we report? (the one furthest along)
-        let mut best_fail_spot = {lo: 0u, hi: 0u, expn_info: none};
+        let mut best_fail_spot = {lo: 0u, hi: 0u, expn_info: None};
         let mut best_fail_msg = ~"internal error: ran no matchers";
 
         let s_d = cx.parse_sess().span_diagnostic;
@@ -75,7 +75,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
             match lhs {
               @matched_nonterminal(nt_matchers(mtcs)) => {
                 // `none` is because we're not interpolating
-                let arg_rdr = new_tt_reader(s_d, itr, none, arg) as reader;
+                let arg_rdr = new_tt_reader(s_d, itr, None, arg) as reader;
                 match parse(cx.parse_sess(), cx.cfg(), arg_rdr, mtcs) {
                   success(named_matches) => {
                     let rhs = match rhses[i] {
@@ -84,7 +84,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
                       _ => cx.span_bug(sp, ~"bad thing in rhs")
                     };
                     // rhs has holes ( `$id` and `$(...)` that need filled)
-                    let trncbr = new_tt_reader(s_d, itr, some(named_matches),
+                    let trncbr = new_tt_reader(s_d, itr, Some(named_matches),
                                                ~[rhs]);
                     let p = parser(cx.parse_sess(), cx.cfg(),
                                    trncbr as reader, SOURCE_FILE);
@@ -109,6 +109,6 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
 
     return mr_def({
         name: *cx.parse_sess().interner.get(name),
-        ext: expr_tt({expander: exp, span: some(sp)})
+        ext: expr_tt({expander: exp, span: Some(sp)})
     });
 }
\ No newline at end of file
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 8755e0d7d59..f353eecb926 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -9,7 +9,7 @@ import std::map::{hashmap, box_str_hash};
 export tt_reader,  new_tt_reader, dup_tt_reader, tt_next_token;
 
 enum tt_frame_up { /* to break a circularity */
-    tt_frame_up(option<tt_frame>)
+    tt_frame_up(Option<tt_frame>)
 }
 
 /* FIXME #2811: figure out how to have a uniquely linked stack, and change to
@@ -19,7 +19,7 @@ type tt_frame = @{
     readme: ~[ast::token_tree],
     mut idx: uint,
     dotdotdoted: bool,
-    sep: option<token>,
+    sep: Option<token>,
     up: tt_frame_up,
 };
 
@@ -40,15 +40,15 @@ type tt_reader = @{
  *  `src` contains no `tt_seq`s and `tt_nonterminal`s, `interp` can (and
  *  should) be none. */
 fn new_tt_reader(sp_diag: span_handler, itr: ident_interner,
-                 interp: option<std::map::hashmap<ident,@named_match>>,
+                 interp: Option<std::map::hashmap<ident,@named_match>>,
                  src: ~[ast::token_tree])
     -> tt_reader {
     let r = @{sp_diag: sp_diag, interner: itr,
               mut cur: @{readme: src, mut idx: 0u, dotdotdoted: false,
-                         sep: none, up: tt_frame_up(option::none)},
+                         sep: None, up: tt_frame_up(option::None)},
               interpolations: match interp { /* just a convienience */
-                none => std::map::uint_hash::<@named_match>(),
-                some(x) => x
+                None => std::map::uint_hash::<@named_match>(),
+                Some(x) => x
               },
               mut repeat_idx: ~[mut], mut repeat_len: ~[],
               /* dummy values, never read: */
@@ -62,8 +62,8 @@ fn new_tt_reader(sp_diag: span_handler, itr: ident_interner,
 pure fn dup_tt_frame(&&f: tt_frame) -> tt_frame {
     @{readme: f.readme, mut idx: f.idx, dotdotdoted: f.dotdotdoted,
       sep: f.sep, up: match f.up {
-        tt_frame_up(some(up_frame)) => {
-          tt_frame_up(some(dup_tt_frame(up_frame)))
+        tt_frame_up(Some(up_frame)) => {
+          tt_frame_up(Some(dup_tt_frame(up_frame)))
         }
         tt_frame_up(none) => tt_frame_up(none)
       }
@@ -141,11 +141,11 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
             || r.repeat_idx.last() == r.repeat_len.last() - 1 {
 
             match r.cur.up {
-              tt_frame_up(none) => {
+              tt_frame_up(None) => {
                 r.cur_tok = EOF;
                 return ret_val;
               }
-              tt_frame_up(some(tt_f)) => {
+              tt_frame_up(Some(tt_f)) => {
                 if r.cur.dotdotdoted {
                     vec::pop(r.repeat_idx); vec::pop(r.repeat_len);
                 }
@@ -159,11 +159,11 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
             r.cur.idx = 0u;
             r.repeat_idx[r.repeat_idx.len() - 1u] += 1u;
             match r.cur.sep {
-              some(tk) => {
+              Some(tk) => {
                 r.cur_tok = tk; /* repeat same span, I guess */
                 return ret_val;
               }
-              none => ()
+              None => ()
             }
         }
     }
@@ -172,7 +172,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
         match r.cur.readme[r.cur.idx] {
           tt_delim(tts) => {
             r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: false,
-                      sep: none, up: tt_frame_up(option::some(r.cur)) };
+                      sep: None, up: tt_frame_up(option::Some(r.cur)) };
             // if this could be 0-length, we'd need to potentially recur here
           }
           tt_tok(sp, tok) => {
@@ -207,7 +207,7 @@ fn tt_next_token(&&r: tt_reader) -> {tok: token, sp: span} {
                     vec::push(r.repeat_len, len);
                     vec::push(r.repeat_idx, 0u);
                     r.cur = @{readme: tts, mut idx: 0u, dotdotdoted: true,
-                              sep: sep, up: tt_frame_up(option::some(r.cur))};
+                              sep: sep, up: tt_frame_up(option::Some(r.cur))};
                 }
               }
             }