about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2012-09-07 16:58:27 -0700
committerGraydon Hoare <graydon@mozilla.com>2012-09-07 16:58:36 -0700
commite9f5a099dfcb42c7f2bb38974b57bbde7042ee9c (patch)
treeee7269e1d1b3e9d79d8515e297768e72e0be1c59 /src/libsyntax/parse
parent249668f22396bde43523207117b3869e63b49c4f (diff)
downloadrust-e9f5a099dfcb42c7f2bb38974b57bbde7042ee9c.tar.gz
rust-e9f5a099dfcb42c7f2bb38974b57bbde7042ee9c.zip
Add an ignore! macro, remove support for nested block comments, re: #2755.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs
index e4c5d233867..e93f3cfe9c6 100644
--- a/src/libsyntax/parse/lexer.rs
+++ b/src/libsyntax/parse/lexer.rs
@@ -267,21 +267,16 @@ fn consume_block_comment(rdr: string_reader)
                 sp: ast_util::mk_sp(start_chpos, rdr.chpos)
             });
         }
-    }
-
-    let mut level: int = 1;
-    while level > 0 {
-        if is_eof(rdr) { rdr.fatal(~"unterminated block comment"); }
-        if rdr.curr == '/' && nextch(rdr) == '*' {
-            bump(rdr);
-            bump(rdr);
-            level += 1;
-        } else {
+    } else {
+        loop {
+            if is_eof(rdr) { rdr.fatal(~"unterminated block comment"); }
             if rdr.curr == '*' && nextch(rdr) == '/' {
                 bump(rdr);
                 bump(rdr);
-                level -= 1;
-            } else { bump(rdr); }
+                break;
+            } else {
+                bump(rdr);
+            }
         }
     }
     // restart whitespace munch.