Skip to content

Commit

Permalink
Fix trace_macros so that it works.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstansifer committed Nov 27, 2012
1 parent 0c8a009 commit 22ec209
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/libsyntax/ext/trace_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ fn expand_trace_macros(cx: ext_ctxt, sp: span,
let rdr = tt_rdr as reader;
let rust_parser = Parser(sess, cfg, rdr.dup());

let arg = cx.str_of(rust_parser.parse_ident());
match arg {
~"true" => cx.set_trace_macros(true),
~"false" => cx.set_trace_macros(false),
_ => cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`")
if rust_parser.is_keyword(~"true") {
cx.set_trace_macros(true);
} else if rust_parser.is_keyword(~"false") {
cx.set_trace_macros(false);
} else {
cx.span_fatal(sp, ~"trace_macros! only accepts `true` or `false`")
}

rust_parser.bump();

let rust_parser = Parser(sess, cfg, rdr.dup());
let result = rust_parser.parse_expr();
base::mr_expr(result)
Expand Down

0 comments on commit 22ec209

Please sign in to comment.