Eliminate some extraneous curly brackets inside invocations of macro_rules!
.
This commit is contained in:
parent
38891b91bf
commit
c74a442e86
9 changed files with 23 additions and 23 deletions
|
@ -65,7 +65,7 @@ fn from_value<A>(+val: A) -> Future<A> {
|
|||
}
|
||||
|
||||
macro_rules! move_it (
|
||||
{$x:expr} => { unsafe { let y <- *ptr::addr_of($x); y } }
|
||||
($x:expr) => { unsafe { let y <- *ptr::addr_of($x); y } }
|
||||
)
|
||||
|
||||
fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
|
||||
|
|
|
@ -1033,7 +1033,7 @@ fn kill_taskgroup(state: TaskGroupInner, me: *rust_task, is_main: bool) {
|
|||
// a proper closure because the #[test]s won't understand. Have to fake it.
|
||||
macro_rules! taskgroup_key (
|
||||
// Use a "code pointer" value that will never be a real code pointer.
|
||||
{} => (unsafe::transmute((-2 as uint, 0u)))
|
||||
() => (unsafe::transmute((-2 as uint, 0u)))
|
||||
)
|
||||
|
||||
fn gen_child_taskgroup(linked: bool, supervised: bool)
|
||||
|
|
|
@ -127,7 +127,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 pexpr(e);
|
||||
|
@ -142,26 +142,26 @@ macro_rules! maybe_whole_expr (
|
|||
)
|
||||
|
||||
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); }
|
||||
_ => ()
|
||||
}}
|
||||
|
|
|
@ -16,18 +16,18 @@ left.
|
|||
*/
|
||||
|
||||
macro_rules! html (
|
||||
{ $($body:tt)* } => (
|
||||
( $($body:tt)* ) => (
|
||||
parse_node!( []; []; $($body)* )
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! parse_node (
|
||||
{
|
||||
(
|
||||
[:$head:ident ($(:$head_nodes:expr),*)
|
||||
$(:$tags:ident ($(:$tag_nodes:expr),*))*];
|
||||
[$(:$nodes:expr),*];
|
||||
</$tag:ident> $($rest:tt)*
|
||||
} => (
|
||||
) => (
|
||||
parse_node!(
|
||||
[$(: $tags ($(:$tag_nodes),*))*];
|
||||
[$(:$head_nodes,)* :tag(stringify!($head), ~[$($nodes),*])];
|
||||
|
@ -35,11 +35,11 @@ macro_rules! parse_node (
|
|||
)
|
||||
);
|
||||
|
||||
{
|
||||
(
|
||||
[$(:$tags:ident ($(:$tag_nodes:expr),*) )*];
|
||||
[$(:$nodes:expr),*];
|
||||
<$tag:ident> $($rest:tt)*
|
||||
} => (
|
||||
) => (
|
||||
parse_node!(
|
||||
[:$tag ($(:$nodes)*) $(: $tags ($(:$tag_nodes),*) )*];
|
||||
[];
|
||||
|
@ -47,11 +47,11 @@ macro_rules! parse_node (
|
|||
)
|
||||
);
|
||||
|
||||
{
|
||||
(
|
||||
[$(:$tags:ident ($(:$tag_nodes:expr),*) )*];
|
||||
[$(:$nodes:expr),*];
|
||||
. $($rest:tt)*
|
||||
} => (
|
||||
) => (
|
||||
parse_node!(
|
||||
[$(: $tags ($(:$tag_nodes),*))*];
|
||||
[$(:$nodes,)* :text(~".")];
|
||||
|
@ -59,11 +59,11 @@ macro_rules! parse_node (
|
|||
)
|
||||
);
|
||||
|
||||
{
|
||||
(
|
||||
[$(:$tags:ident ($(:$tag_nodes:expr),*) )*];
|
||||
[$(:$nodes:expr),*];
|
||||
$word:ident $($rest:tt)*
|
||||
} => (
|
||||
) => (
|
||||
parse_node!(
|
||||
[$(: $tags ($(:$tag_nodes),*))*];
|
||||
[$(:$nodes,)* :text(stringify!($word))];
|
||||
|
@ -71,7 +71,7 @@ macro_rules! parse_node (
|
|||
)
|
||||
);
|
||||
|
||||
{ []; [:$e:expr]; } => ( $e );
|
||||
( []; [:$e:expr]; ) => ( $e );
|
||||
)
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,7 +10,7 @@ fn main() {
|
|||
assert (mylambda!(y, y * 2)(8) == 16);
|
||||
|
||||
macro_rules! mylambda_tt(
|
||||
{$x:ident, $body:expr} => {
|
||||
($x:ident, $body:expr) => {
|
||||
fn f($x: int) -> int { return $body; };
|
||||
f
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ fn main() {
|
|||
assert (trivial!() == 16);
|
||||
|
||||
macro_rules! trivial_tt(
|
||||
{} => {1*2*4*2*1}
|
||||
() => {1*2*4*2*1}
|
||||
)
|
||||
assert(trivial_tt!() == 16);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ fn main() {
|
|||
#macro[[#apply[f, [x, ...]], f(x, ...)]];
|
||||
|
||||
macro_rules! apply_tt(
|
||||
{$f:expr, ($($x:expr),*)} => {$f($($x),*)}
|
||||
($f:expr, ($($x:expr),*)) => {$f($($x),*)}
|
||||
)
|
||||
|
||||
fn add(a: int, b: int) -> int { return a + b; }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
macro_rules! overly_complicated (
|
||||
{$fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path} =>
|
||||
($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) =>
|
||||
{
|
||||
fn $fnname($arg: $ty) -> option<$ty> $body
|
||||
match $fnname($val) {
|
||||
|
|
|
@ -5,7 +5,7 @@ fn main() {
|
|||
assert (m1!(2) == 8);
|
||||
|
||||
macro_rules! m1tt (
|
||||
{$a:expr} => {$a*4}
|
||||
($a:expr) => {$a*4}
|
||||
);
|
||||
assert(m1tt!(2) == 8);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue