No longer parse the delimiters of the RHS of a macro as part of the expansion.

This commit is contained in:
Paul Stansifer 2012-11-19 23:53:52 -05:00 committed by Graydon Hoare
parent ba354b1726
commit 9814e58815
6 changed files with 28 additions and 21 deletions

View file

@ -120,7 +120,7 @@ enum view_item_parse_mode {
The important thing is to make sure that lookahead doesn't balk
at INTERPOLATED tokens */
macro_rules! maybe_whole_expr (
($p:expr) => { match copy $p.token {
($p:expr) => ( match copy $p.token {
INTERPOLATED(token::nt_expr(e)) => {
$p.bump();
return e;
@ -131,33 +131,33 @@ macro_rules! maybe_whole_expr (
expr_path(pt));
}
_ => ()
}}
})
)
macro_rules! maybe_whole (
($p:expr, $constructor:ident) => { match copy $p.token {
($p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return x; }
_ => ()
}} ;
(deref $p:expr, $constructor:ident) => { match copy $p.token {
}) ;
(deref $p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return *x; }
_ => ()
}} ;
(Some $p:expr, $constructor:ident) => { match copy $p.token {
}) ;
(Some $p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return Some(x); }
_ => ()
}} ;
(iovi $p:expr, $constructor:ident) => { match copy $p.token {
}) ;
(iovi $p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(x)) => {
$p.bump();
return iovi_item(x);
}
_ => ()
}} ;
(pair_empty $p:expr, $constructor:ident) => { match copy $p.token {
}) ;
(pair_empty $p:expr, $constructor:ident) => ( match copy $p.token {
INTERPOLATED(token::$constructor(x)) => { $p.bump(); return (~[], x); }
_ => ()
}}
})
)