diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-09-07 16:58:27 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-09-07 16:58:36 -0700 |
| commit | e9f5a099dfcb42c7f2bb38974b57bbde7042ee9c (patch) | |
| tree | ee7269e1d1b3e9d79d8515e297768e72e0be1c59 /src/libsyntax | |
| parent | 249668f22396bde43523207117b3869e63b49c4f (diff) | |
| download | rust-e9f5a099dfcb42c7f2bb38974b57bbde7042ee9c.tar.gz rust-e9f5a099dfcb42c7f2bb38974b57bbde7042ee9c.zip | |
Add an ignore! macro, remove support for nested block comments, re: #2755.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 19 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 984ac9fb0e3..4558d0a1872 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -243,6 +243,7 @@ fn new_span(cx: ext_ctxt, sp: span) -> span { fn core_macros() -> ~str { return ~"{ + macro_rules! ignore (($($x:tt)*) => (())) #macro[[#error[f, ...], log(core::error, #fmt[f, ...])]]; #macro[[#warn[f, ...], log(core::warn, #fmt[f, ...])]]; #macro[[#info[f, ...], log(core::info, #fmt[f, ...])]]; 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. |
