about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-01-14 16:05:07 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-01-17 10:08:16 -0800
commitc3bc8fada838c15e09e76a9d5d85438667c1636c (patch)
treee0ff1cb9ea73f7ee894e8ff3ab3180260f71aeac /src/libstd
parenta7bd817017c247edb0680936c6cf34ec4d8e7fc0 (diff)
Allow omission of the '.' after nullary tag patterns
This commit allows patterns like:

alt x { some(_) { ... } none { } }

without the '.' after none. The parser suspends judgment about
whether a bare ident is a tag or a new bound variable; instead,
the resolver disambiguates.

This means that any code after resolution that pattern-matches on
patterns needs to call pat_util::normalize_pat, which consults
an environment to do this disambiguation.

In addition, local variables are no longer allowed to shadow
tag names, so this required changing some code (e.g. renaming
variables named "mut", and renaming ast::sub to subtract).

The parser currently accepts patterns with and without the '.'.
Once the compiler and libraries are changed, it will no longer
accept the '.'.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rope.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index 8071ee72847..55175873f5a 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -1278,7 +1278,7 @@ mod node {
             while true {
                 alt(get_current_or_next_leaf(it)) {
                   option::none. { ret option::none; }
-                  option::some(leaf) {
+                  option::some(_) {
                     let next_char = get_next_char_in_leaf(it);
                     alt(next_char) {
                       option::none. {
@@ -1301,7 +1301,7 @@ mod node {
                 let next = leaf_iterator::next(it.leaf_iterator);
                 alt(next) {
                   option::none. { ret option::none }
-                  option::some(leaf) {
+                  option::some(_) {
                     it.leaf          = next;
                     it.leaf_byte_pos = 0u;
                     ret next;
@@ -1314,16 +1314,16 @@ mod node {
         fn get_next_char_in_leaf(it: t) -> option::t<char> {
             alt(it.leaf) {
               option::none. { ret option::none }
-              option::some(leaf) {
-                if it.leaf_byte_pos >= leaf.byte_len {
+              option::some(aleaf) {
+                if it.leaf_byte_pos >= aleaf.byte_len {
                     //We are actually past the end of the leaf
                     it.leaf = option::none;
                     ret option::none
                 } else {
                     let {ch, next} =
-                        str::char_range_at(*leaf.content,
-                                     it.leaf_byte_pos + leaf.byte_offset);
-                    it.leaf_byte_pos = next - leaf.byte_offset;
+                        str::char_range_at(*aleaf.content,
+                                     it.leaf_byte_pos + aleaf.byte_offset);
+                    it.leaf_byte_pos = next - aleaf.byte_offset;
                     ret option::some(ch)
                 }
               }