Remove '.' after nullary tags in patterns

Does what it says on the tin.

The next commit will remove support for this syntax.
This commit is contained in:
Tim Chevalier 2012-01-18 22:37:22 -08:00
parent ca7cfbe3d0
commit 04a2887f87
96 changed files with 1410 additions and 1410 deletions

View file

@ -12,13 +12,13 @@ tag bottle { none; dual; single; multiple(int); }
fn show(b: bottle) {
alt b {
none. {
none {
#debug("No more bottles of beer on the wall, \
no more bottles of beer,");
#debug("Go to the store and buy some more, \
99 bottles of beer on the wall.");
}
single. {
single {
#debug("1 bottle of beer on the wall, 1 bottle of beer,");
#debug("Take one down and pass it around, \
no more bottles of beer on the wall.");
@ -38,8 +38,8 @@ fn show(b: bottle) {
fn next(b: bottle) -> bottle {
alt b {
none. { ret none; }
single. { ret none; }
none { ret none; }
single { ret none; }
dual. { ret single; }
multiple(3) { ret dual; }
multiple(n) { ret multiple(n - 1); }
@ -48,7 +48,7 @@ fn next(b: bottle) -> bottle {
// Won't need this when tags can be compared with ==
fn more(b: bottle) -> bool { alt b { none. { ret false; } _ { ret true; } } }
fn more(b: bottle) -> bool { alt b { none { ret false; } _ { ret true; } } }
fn main() {
let b: bottle = multiple(99);

View file

@ -5,7 +5,7 @@ tag tree { nil; node(~tree, ~tree, int); }
fn item_check(t: ~tree) -> int {
alt *t {
nil. { ret 0; }
nil { ret 0; }
node(left, right, item) {
ret item + item_check(left) - item_check(right);
}

View file

@ -37,7 +37,7 @@ fn map(&&filename: [u8], emit: map_reduce::putter<[u8], int>) {
while true {
alt read_word(f) {
some(w) { emit(str::bytes(w), 1); }
none. { break; }
none { break; }
}
}
}
@ -45,7 +45,7 @@ fn map(&&filename: [u8], emit: map_reduce::putter<[u8], int>) {
fn reduce(&&_word: [u8], get: map_reduce::getter<int>) {
let count = 0;
while true { alt get() { some(_) { count += 1; } none. { break; } } }
while true { alt get() { some(_) { count += 1; } none { break; } } }
}
mod map_reduce {
@ -97,7 +97,7 @@ mod map_reduce {
let c;
alt treemap::find(im, key) {
some(_c) { c = _c; }
none. {
none {
let p = port();
send(ctrl, find_reducer(key, chan(p)));
c = recv(p);
@ -136,7 +136,7 @@ mod map_reduce {
// #error("received %d", v);
ret some(v);
}
done. {
done {
// #error("all done");
is_done = true;
}
@ -166,7 +166,7 @@ mod map_reduce {
while num_mappers > 0 {
alt recv(ctrl) {
mapper_done. {
mapper_done {
// #error("received mapper terminated.");
num_mappers -= 1;
}
@ -179,7 +179,7 @@ mod map_reduce {
// "reusing existing reducer for " + k);
c = _c;
}
none. {
none {
// log(error, "creating new reducer for " + k);
let p = port();
let ch = chan(p);

View file

@ -26,14 +26,14 @@ fn map(input: str, emit: map_reduce::putter) {
while true {
alt read_word(f) { some(w) { emit(w, 1); } none. { break; } }
alt read_word(f) { some(w) { emit(w, 1); } none { break; } }
}
}
fn reduce(_word: str, get: map_reduce::getter) {
let count = 0;
while true { alt get() { some(_) { count += 1; } none. { break; } } }
while true { alt get() { some(_) { count += 1; } none { break; } } }
}
mod map_reduce {
@ -78,7 +78,7 @@ mod map_reduce {
some(_c) {
c = _c;
}
none. {
none {
let p = port();
send(ctrl, find_reducer(key, chan(p)));
c = recv(p);
@ -112,7 +112,7 @@ mod map_reduce {
// #error("received %d", v);
ret some(v);
}
done. {
done {
// #error("all done");
state.is_done = true;
}
@ -141,7 +141,7 @@ mod map_reduce {
while num_mappers > 0 {
alt recv(ctrl) {
mapper_done. {
mapper_done {
// #error("received mapper terminated.");
num_mappers -= 1;
}
@ -154,7 +154,7 @@ mod map_reduce {
// "reusing existing reducer for " + k);
c = _c;
}
none. {
none {
// log(error, "creating new reducer for " + k);
let p = port();
let ch = chan(p);

View file

@ -46,7 +46,7 @@ mod map_reduce {
let c;
alt im.find(key) {
some(_c) { c = _c }
none. {
none {
let p = port();
#error("sending find_reducer");
send(ctrl, find_reducer(str::bytes(key), chan(p)));
@ -78,12 +78,12 @@ mod map_reduce {
while num_mappers > 0 {
alt recv(ctrl) {
mapper_done. { num_mappers -= 1; }
mapper_done { num_mappers -= 1; }
find_reducer(k, cc) {
let c;
alt reducers.find(str::unsafe_from_bytes(k)) {
some(_c) { c = _c; }
none. { c = 0; }
none { c = 0; }
}
send(cc, c);
}

View file

@ -14,7 +14,7 @@ iface to_str {
impl <T: to_str> of to_str for option<T> {
fn to_str() -> str {
alt self {
none. { "none" }
none { "none" }
some(t) { "some(" + t.to_str() + ")" }
}
}

View file

@ -3,7 +3,7 @@ use std;
import std::list::*;
pure fn pure_length_go<T: copy>(ls: list<T>, acc: uint) -> uint {
alt ls { nil. { acc } cons(_, tl) { pure_length_go(*tl, acc + 1u) } }
alt ls { nil { acc } cons(_, tl) { pure_length_go(*tl, acc + 1u) } }
}
pure fn pure_length<T: copy>(ls: list<T>) -> uint { pure_length_go(ls, 0u) }

View file

@ -9,7 +9,7 @@ import std::list::*;
// no syntax for specifying that f is pure.
fn pure_foldl<T: copy, U: copy>(ls: list<T>, u: U, f: block(T, U) -> U) -> U {
alt ls {
nil. { u }
nil { u }
cons(hd, tl) { f(hd, pure_foldl(*tl, f(hd, u), f)) }
}
}