Skip to content

Commit

Permalink
Use identifiers to denote internal macro patterns
Browse files Browse the repository at this point in the history
I believe this is something fixed by
rust-lang/rust#42913 in Rust 1.20, but we still
need to support Rust 1.15.
  • Loading branch information
hcpl committed Apr 8, 2018
1 parent 9f29ae3 commit 5643271
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,20 @@ macro_rules! simple_derive {
(
$iname:ident impl $path:path { $($rest:tt)* }
) => {
simple_derive!(@I [$iname, $path] { $($rest)* } [] []);
simple_derive!(__I [$iname, $path] { $($rest)* } [] []);
};

// Adding a filter block
(
@I $opt:tt {
__I $opt:tt {
filter($s:ident) {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
@I $opt { $($rest)* } [$($done)*] [
__I $opt { $($rest)* } [$($done)*] [
$($filter)*
[
st_name = $s,
Expand All @@ -280,15 +280,15 @@ macro_rules! simple_derive {

// &self bound method
(
@I $opt:tt {
__I $opt:tt {
fn $fn_name:ident (&self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
@I $opt { $($rest)* } [
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
Expand All @@ -307,15 +307,15 @@ macro_rules! simple_derive {

// &mut self bound method
(
@I $opt:tt {
__I $opt:tt {
fn $fn_name:ident (&mut self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
@I $opt { $($rest)* } [
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
Expand All @@ -334,15 +334,15 @@ macro_rules! simple_derive {

// self bound method
(
@I $opt:tt {
__I $opt:tt {
fn $fn_name:ident (self as $s:ident $($params:tt)*) $(-> $t:ty)* {
$($body:tt)*
}
$($rest:tt)*
} [$($done:tt)*] [$($filter:tt)*]
) => {
simple_derive!(
@I $opt { $($rest)* } [
__I $opt { $($rest)* } [
$($done)*
[
st_name = $s,
Expand All @@ -363,7 +363,7 @@ macro_rules! simple_derive {

// codegen after data collection
(
@I [$iname:ident, $path:path] {} [$(
__I [$iname:ident, $path:path] {} [$(
[
st_name = $st_name:ident,
bind_style = $bind_style:ident,
Expand Down

0 comments on commit 5643271

Please sign in to comment.