Remove the log keyword (by renaming it to __log)

We can't quite remove logging from the language, but this hides the
keyword.
This commit is contained in:
Brian Anderson 2013-03-08 18:32:03 -08:00
parent cb37d09f50
commit 9c7e16e48d
4 changed files with 10 additions and 24 deletions

View file

@ -411,34 +411,34 @@ pub fn core_macros() -> ~str {
macro_rules! error (
($arg:expr) => (
log(1u32, fmt!( \"%?\", $arg ))
__log(1u32, fmt!( \"%?\", $arg ))
);
($( $arg:expr ),+) => (
log(1u32, fmt!( $($arg),+ ))
__log(1u32, fmt!( $($arg),+ ))
)
)
macro_rules! warn (
($arg:expr) => (
log(2u32, fmt!( \"%?\", $arg ))
__log(2u32, fmt!( \"%?\", $arg ))
);
($( $arg:expr ),+) => (
log(2u32, fmt!( $($arg),+ ))
__log(2u32, fmt!( $($arg),+ ))
)
)
macro_rules! info (
($arg:expr) => (
log(3u32, fmt!( \"%?\", $arg ))
__log(3u32, fmt!( \"%?\", $arg ))
);
($( $arg:expr ),+) => (
log(3u32, fmt!( $($arg),+ ))
__log(3u32, fmt!( $($arg),+ ))
)
)
macro_rules! debug (
($arg:expr) => (
log(4u32, fmt!( \"%?\", $arg ))
__log(4u32, fmt!( \"%?\", $arg ))
);
($( $arg:expr ),+) => (
log(4u32, fmt!( $($arg),+ ))
__log(4u32, fmt!( $($arg),+ ))
)
)

View file

@ -1184,7 +1184,7 @@ pub impl Parser {
}
}
hi = self.span.hi;
} else if self.eat_keyword(&~"log") {
} else if self.eat_keyword(&~"__log") {
self.expect(&token::LPAREN);
let lvl = self.parse_expr();
self.expect(&token::COMMA);

View file

@ -495,7 +495,7 @@ pub fn strict_keyword_table() -> HashMap<~str, ()> {
~"else", ~"enum", ~"extern",
~"false", ~"fn", ~"for",
~"if", ~"impl",
~"let", ~"log", ~"loop",
~"let", ~"__log", ~"loop",
~"match", ~"mod", ~"mut",
~"once",
~"priv", ~"pub", ~"pure",

View file

@ -1,14 +0,0 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:roflcopter
fn main() {
log (fail!(~"roflcopter"), 2);
}