diff options
| author | Paul Stansifer <paul.stansifer@gmail.com> | 2012-11-26 22:34:01 -0500 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-11-29 12:09:11 -0800 |
| commit | 7051d622c0536718816152b14ff04a0072884d7e (patch) | |
| tree | 49938aac8f8067d5de9fead51cc4a291cfc84909 /src/libsyntax/ext | |
| parent | 9ff8d1876630e7e3d1b0eef6c0c51610a19c4b98 (diff) | |
| download | rust-7051d622c0536718816152b14ff04a0072884d7e.tar.gz rust-7051d622c0536718816152b14ff04a0072884d7e.zip | |
Properly sync macro_parser.rs after it escapes out to the Rust parser. Closes #3201.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index f56f6e26ba6..a9390914829 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -349,10 +349,15 @@ 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, ...])]]; - #macro[[#debug[f, ...], log(core::debug, #fmt[f, ...])]]; + + macro_rules! error ( ($( $arg:expr ),+) => ( + log(core::error, fmt!( $($arg),+ )) )) + macro_rules! warn ( ($( $arg:expr ),+) => ( + log(core::warn, fmt!( $($arg),+ )) )) + macro_rules! info ( ($( $arg:expr ),+) => ( + log(core::info, fmt!( $($arg),+ )) )) + macro_rules! debug ( ($( $arg:expr ),+) => ( + log(core::debug, fmt!( $($arg),+ )) )) macro_rules! die( ($msg: expr) => ( diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 86218acb5a1..13d9e87f26e 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -368,11 +368,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher]) } cur_eis.push(move ei); - /* this would fail if zero-length tokens existed */ - while rdr.peek().sp.lo < rust_parser.span.lo { - rdr.next_token(); - } /* except for EOF... */ - while rust_parser.token == EOF && rdr.peek().tok != EOF { + for rust_parser.tokens_consumed.times() || { rdr.next_token(); } } |
