aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs501
1 files changed, 410 insertions, 91 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 3341a16..356e43a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,3 +1,11 @@
+//! [![github]](https://github.com/dtolnay/quote) [![crates-io]](https://crates.io/crates/quote) [![docs-rs]](https://docs.rs/quote)
+//!
+//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
+//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
+//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
+//!
+//! <br>
+//!
//! This crate provides the [`quote!`] macro for turning Rust syntax tree data
//! structures into tokens of source code.
//!
@@ -73,7 +81,13 @@
//! ```
// Quote types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/quote/1.0.2")]
+#![doc(html_root_url = "https://docs.rs/quote/1.0.9")]
+#![allow(
+ clippy::doc_markdown,
+ clippy::missing_errors_doc,
+ clippy::missing_panics_doc,
+ clippy::module_name_repetitions
+)]
#[cfg(all(
not(all(target_arch = "wasm32", target_os = "unknown")),
@@ -89,7 +103,7 @@ mod to_tokens;
// Not public API.
#[doc(hidden)]
#[path = "runtime.rs"]
-pub mod __rt;
+pub mod __private;
pub use crate::ext::TokenStreamExt;
pub use crate::ident_fragment::IdentFragment;
@@ -462,9 +476,14 @@ pub mod spanned;
/// ```
#[macro_export]
macro_rules! quote {
- ($($tt:tt)*) => {
- $crate::quote_spanned!($crate::__rt::Span::call_site()=> $($tt)*)
+ () => {
+ $crate::__private::TokenStream::new()
};
+ ($($tt:tt)*) => {{
+ let mut _s = $crate::__private::TokenStream::new();
+ $crate::quote_each_token!(_s $($tt)*);
+ _s
+ }};
}
/// Same as `quote!`, but applies a given span to all tokens originating within
@@ -550,7 +569,7 @@ macro_rules! quote {
/// ```
///
/// If the assertion fails, the user will see an error like the following. The
-/// input span of their type is hightlighted in the error.
+/// input span of their type is highlighted in the error.
///
/// ```text
/// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied
@@ -565,10 +584,14 @@ macro_rules! quote {
/// placed appropriately by the compiler.
#[macro_export]
macro_rules! quote_spanned {
+ ($span:expr=>) => {{
+ let _: $crate::__private::Span = $span;
+ $crate::__private::TokenStream::new()
+ }};
($span:expr=> $($tt:tt)*) => {{
- let mut _s = $crate::__rt::TokenStream::new();
- let _span: $crate::__rt::Span = $span;
- $crate::quote_each_token!(_s _span $($tt)*);
+ let mut _s = $crate::__private::TokenStream::new();
+ let _span: $crate::__private::Span = $span;
+ $crate::quote_each_token_spanned!(_s _span $($tt)*);
_s
}};
}
@@ -638,7 +661,7 @@ macro_rules! quote_bind_into_iter {
macro_rules! quote_bind_next_or_break {
($var:ident) => {
let $var = match $var.next() {
- Some(_x) => $crate::__rt::RepInterp(_x),
+ Some(_x) => $crate::__private::RepInterp(_x),
None => break,
};
};
@@ -647,8 +670,24 @@ macro_rules! quote_bind_next_or_break {
#[macro_export]
#[doc(hidden)]
macro_rules! quote_each_token {
+ ($tokens:ident $($tts:tt)*) => {
+ $crate::quote_tokens_with_context!($tokens
+ (@ @ @ @ @ @ $($tts)*)
+ (@ @ @ @ @ $($tts)* @)
+ (@ @ @ @ $($tts)* @ @)
+ (@ @ @ $(($tts))* @ @ @)
+ (@ @ $($tts)* @ @ @ @)
+ (@ $($tts)* @ @ @ @ @)
+ ($($tts)* @ @ @ @ @ @)
+ );
+ };
+}
+
+#[macro_export]
+#[doc(hidden)]
+macro_rules! quote_each_token_spanned {
($tokens:ident $span:ident $($tts:tt)*) => {
- $crate::quote_tokens_with_context!($tokens $span
+ $crate::quote_tokens_with_context_spanned!($tokens $span
(@ @ @ @ @ @ $($tts)*)
(@ @ @ @ @ $($tts)* @)
(@ @ @ @ $($tts)* @ @)
@@ -663,13 +702,27 @@ macro_rules! quote_each_token {
#[macro_export]
#[doc(hidden)]
macro_rules! quote_tokens_with_context {
+ ($tokens:ident
+ ($($b3:tt)*) ($($b2:tt)*) ($($b1:tt)*)
+ ($($curr:tt)*)
+ ($($a1:tt)*) ($($a2:tt)*) ($($a3:tt)*)
+ ) => {
+ $(
+ $crate::quote_token_with_context!($tokens $b3 $b2 $b1 $curr $a1 $a2 $a3);
+ )*
+ };
+}
+
+#[macro_export]
+#[doc(hidden)]
+macro_rules! quote_tokens_with_context_spanned {
($tokens:ident $span:ident
($($b3:tt)*) ($($b2:tt)*) ($($b1:tt)*)
($($curr:tt)*)
($($a1:tt)*) ($($a2:tt)*) ($($a3:tt)*)
) => {
$(
- $crate::quote_token_with_context!($tokens $span $b3 $b2 $b1 $curr $a1 $a2 $a3);
+ $crate::quote_token_with_context_spanned!($tokens $span $b3 $b2 $b1 $curr $a1 $a2 $a3);
)*
};
}
@@ -677,13 +730,69 @@ macro_rules! quote_tokens_with_context {
#[macro_export]
#[doc(hidden)]
macro_rules! quote_token_with_context {
+ ($tokens:ident $b3:tt $b2:tt $b1:tt @ $a1:tt $a2:tt $a3:tt) => {};
+
+ ($tokens:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) * $a3:tt) => {{
+ use $crate::__private::ext::*;
+ let has_iter = $crate::__private::ThereIsNoIteratorInRepetition;
+ $crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*);
+ let _: $crate::__private::HasIterator = has_iter;
+ // This is `while true` instead of `loop` because if there are no
+ // iterators used inside of this repetition then the body would not
+ // contain any `break`, so the compiler would emit unreachable code
+ // warnings on anything below the loop. We use has_iter to detect and
+ // fail to compile when there are no iterators, so here we just work
+ // around the unneeded extra warning.
+ while true {
+ $crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*);
+ $crate::quote_each_token!($tokens $($inner)*);
+ }
+ }};
+ ($tokens:ident $b3:tt $b2:tt # (( $($inner:tt)* )) * $a2:tt $a3:tt) => {};
+ ($tokens:ident $b3:tt # ( $($inner:tt)* ) (*) $a1:tt $a2:tt $a3:tt) => {};
+
+ ($tokens:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) $sep:tt *) => {{
+ use $crate::__private::ext::*;
+ let mut _i = 0usize;
+ let has_iter = $crate::__private::ThereIsNoIteratorInRepetition;
+ $crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*);
+ let _: $crate::__private::HasIterator = has_iter;
+ while true {
+ $crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*);
+ if _i > 0 {
+ $crate::quote_token!($tokens $sep);
+ }
+ _i += 1;
+ $crate::quote_each_token!($tokens $($inner)*);
+ }
+ }};
+ ($tokens:ident $b3:tt $b2:tt # (( $($inner:tt)* )) $sep:tt * $a3:tt) => {};
+ ($tokens:ident $b3:tt # ( $($inner:tt)* ) ($sep:tt) * $a2:tt $a3:tt) => {};
+ ($tokens:ident # ( $($inner:tt)* ) * (*) $a1:tt $a2:tt $a3:tt) => {
+ // https://github.com/dtolnay/quote/issues/130
+ $crate::quote_token!($tokens *);
+ };
+ ($tokens:ident # ( $($inner:tt)* ) $sep:tt (*) $a1:tt $a2:tt $a3:tt) => {};
+
+ ($tokens:ident $b3:tt $b2:tt $b1:tt (#) $var:ident $a2:tt $a3:tt) => {
+ $crate::ToTokens::to_tokens(&$var, &mut $tokens);
+ };
+ ($tokens:ident $b3:tt $b2:tt # ($var:ident) $a1:tt $a2:tt $a3:tt) => {};
+ ($tokens:ident $b3:tt $b2:tt $b1:tt ($curr:tt) $a1:tt $a2:tt $a3:tt) => {
+ $crate::quote_token!($tokens $curr);
+ };
+}
+
+#[macro_export]
+#[doc(hidden)]
+macro_rules! quote_token_with_context_spanned {
($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt @ $a1:tt $a2:tt $a3:tt) => {};
($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) * $a3:tt) => {{
- use $crate::__rt::ext::*;
- let has_iter = $crate::__rt::ThereIsNoIteratorInRepetition;
+ use $crate::__private::ext::*;
+ let has_iter = $crate::__private::ThereIsNoIteratorInRepetition;
$crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*);
- let _: $crate::__rt::HasIterator = has_iter;
+ let _: $crate::__private::HasIterator = has_iter;
// This is `while true` instead of `loop` because if there are no
// iterators used inside of this repetition then the body would not
// contain any `break`, so the compiler would emit unreachable code
@@ -692,32 +801,32 @@ macro_rules! quote_token_with_context {
// around the unneeded extra warning.
while true {
$crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*);
- $crate::quote_each_token!($tokens $span $($inner)*);
+ $crate::quote_each_token_spanned!($tokens $span $($inner)*);
}
}};
($tokens:ident $span:ident $b3:tt $b2:tt # (( $($inner:tt)* )) * $a2:tt $a3:tt) => {};
($tokens:ident $span:ident $b3:tt # ( $($inner:tt)* ) (*) $a1:tt $a2:tt $a3:tt) => {};
($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) $sep:tt *) => {{
- use $crate::__rt::ext::*;
+ use $crate::__private::ext::*;
let mut _i = 0usize;
- let has_iter = $crate::__rt::ThereIsNoIteratorInRepetition;
+ let has_iter = $crate::__private::ThereIsNoIteratorInRepetition;
$crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*);
- let _: $crate::__rt::HasIterator = has_iter;
+ let _: $crate::__private::HasIterator = has_iter;
while true {
$crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*);
if _i > 0 {
- $crate::quote_token!($tokens $span $sep);
+ $crate::quote_token_spanned!($tokens $span $sep);
}
_i += 1;
- $crate::quote_each_token!($tokens $span $($inner)*);
+ $crate::quote_each_token_spanned!($tokens $span $($inner)*);
}
}};
($tokens:ident $span:ident $b3:tt $b2:tt # (( $($inner:tt)* )) $sep:tt * $a3:tt) => {};
($tokens:ident $span:ident $b3:tt # ( $($inner:tt)* ) ($sep:tt) * $a2:tt $a3:tt) => {};
($tokens:ident $span:ident # ( $($inner:tt)* ) * (*) $a1:tt $a2:tt $a3:tt) => {
// https://github.com/dtolnay/quote/issues/130
- $crate::quote_token!($tokens $span *);
+ $crate::quote_token_spanned!($tokens $span *);
};
($tokens:ident $span:ident # ( $($inner:tt)* ) $sep:tt (*) $a1:tt $a2:tt $a3:tt) => {};
@@ -726,223 +835,433 @@ macro_rules! quote_token_with_context {
};
($tokens:ident $span:ident $b3:tt $b2:tt # ($var:ident) $a1:tt $a2:tt $a3:tt) => {};
($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt ($curr:tt) $a1:tt $a2:tt $a3:tt) => {
- $crate::quote_token!($tokens $span $curr);
+ $crate::quote_token_spanned!($tokens $span $curr);
};
}
#[macro_export]
#[doc(hidden)]
macro_rules! quote_token {
+ ($tokens:ident ( $($inner:tt)* )) => {
+ $crate::__private::push_group(
+ &mut $tokens,
+ $crate::__private::Delimiter::Parenthesis,
+ $crate::quote!($($inner)*),
+ );
+ };
+
+ ($tokens:ident [ $($inner:tt)* ]) => {
+ $crate::__private::push_group(
+ &mut $tokens,
+ $crate::__private::Delimiter::Bracket,
+ $crate::quote!($($inner)*),
+ );
+ };
+
+ ($tokens:ident { $($inner:tt)* }) => {
+ $crate::__private::push_group(
+ &mut $tokens,
+ $crate::__private::Delimiter::Brace,
+ $crate::quote!($($inner)*),
+ );
+ };
+
+ ($tokens:ident +) => {
+ $crate::__private::push_add(&mut $tokens);
+ };
+
+ ($tokens:ident +=) => {
+ $crate::__private::push_add_eq(&mut $tokens);
+ };
+
+ ($tokens:ident &) => {
+ $crate::__private::push_and(&mut $tokens);
+ };
+
+ ($tokens:ident &&) => {
+ $crate::__private::push_and_and(&mut $tokens);
+ };
+
+ ($tokens:ident &=) => {
+ $crate::__private::push_and_eq(&mut $tokens);
+ };
+
+ ($tokens:ident @) => {
+ $crate::__private::push_at(&mut $tokens);
+ };
+
+ ($tokens:ident !) => {
+ $crate::__private::push_bang(&mut $tokens);
+ };
+
+ ($tokens:ident ^) => {
+ $crate::__private::push_caret(&mut $tokens);
+ };
+
+ ($tokens:ident ^=) => {
+ $crate::__private::push_caret_eq(&mut $tokens);
+ };
+
+ ($tokens:ident :) => {
+ $crate::__private::push_colon(&mut $tokens);
+ };
+
+ ($tokens:ident ::) => {
+ $crate::__private::push_colon2(&mut $tokens);
+ };
+
+ ($tokens:ident ,) => {
+ $crate::__private::push_comma(&mut $tokens);
+ };
+
+ ($tokens:ident /) => {
+ $crate::__private::push_div(&mut $tokens);
+ };
+
+ ($tokens:ident /=) => {
+ $crate::__private::push_div_eq(&mut $tokens);
+ };
+
+ ($tokens:ident .) => {
+ $crate::__private::push_dot(&mut $tokens);
+ };
+
+ ($tokens:ident ..) => {
+ $crate::__private::push_dot2(&mut $tokens);
+ };
+
+ ($tokens:ident ...) => {
+ $crate::__private::push_dot3(&mut $tokens);
+ };
+
+ ($tokens:ident ..=) => {
+ $crate::__private::push_dot_dot_eq(&mut $tokens);
+ };
+
+ ($tokens:ident =) => {
+ $crate::__private::push_eq(&mut $tokens);
+ };
+
+ ($tokens:ident ==) => {
+ $crate::__private::push_eq_eq(&mut $tokens);
+ };
+
+ ($tokens:ident >=) => {
+ $crate::__private::push_ge(&mut $tokens);
+ };
+
+ ($tokens:ident >) => {
+ $crate::__private::push_gt(&mut $tokens);
+ };
+
+ ($tokens:ident <=) => {
+ $crate::__private::push_le(&mut $tokens);
+ };
+
+ ($tokens:ident <) => {
+ $crate::__private::push_lt(&mut $tokens);
+ };
+
+ ($tokens:ident *=) => {
+ $crate::__private::push_mul_eq(&mut $tokens);
+ };
+
+ ($tokens:ident !=) => {
+ $crate::__private::push_ne(&mut $tokens);
+ };
+
+ ($tokens:ident |) => {
+ $crate::__private::push_or(&mut $tokens);
+ };
+
+ ($tokens:ident |=) => {
+ $crate::__private::push_or_eq(&mut $tokens);
+ };
+
+ ($tokens:ident ||) => {
+ $crate::__private::push_or_or(&mut $tokens);
+ };
+
+ ($tokens:ident #) => {
+ $crate::__private::push_pound(&mut $tokens);
+ };
+
+ ($tokens:ident ?) => {
+ $crate::__private::push_question(&mut $tokens);
+ };
+
+ ($tokens:ident ->) => {
+ $crate::__private::push_rarrow(&mut $tokens);
+ };
+
+ ($tokens:ident <-) => {
+ $crate::__private::push_larrow(&mut $tokens);
+ };
+
+ ($tokens:ident %) => {
+ $crate::__private::push_rem(&mut $tokens);
+ };
+
+ ($tokens:ident %=) => {
+ $crate::__private::push_rem_eq(&mut $tokens);
+ };
+
+ ($tokens:ident =>) => {
+ $crate::__private::push_fat_arrow(&mut $tokens);
+ };
+
+ ($tokens:ident ;) => {
+ $crate::__private::push_semi(&mut $tokens);
+ };
+
+ ($tokens:ident <<) => {
+ $crate::__private::push_shl(&mut $tokens);
+ };
+
+ ($tokens:ident <<=) => {
+ $crate::__private::push_shl_eq(&mut $tokens);
+ };
+
+ ($tokens:ident >>) => {
+ $crate::__private::push_shr(&mut $tokens);
+ };
+
+ ($tokens:ident >>=) => {
+ $crate::__private::push_shr_eq(&mut $tokens);
+ };
+
+ ($tokens:ident *) => {
+ $crate::__private::push_star(&mut $tokens);
+ };
+
+ ($tokens:ident -) => {
+ $crate::__private::push_sub(&mut $tokens);
+ };
+
+ ($tokens:ident -=) => {
+ $crate::__private::push_sub_eq(&mut $tokens);
+ };
+
+ ($tokens:ident $ident:ident) => {
+ $crate::__private::push_ident(&mut $tokens, stringify!($ident));
+ };
+
+ ($tokens:ident $other:tt) => {
+ $crate::__private::parse(&mut $tokens, stringify!($other));
+ };
+}
+
+#[macro_export]
+#[doc(hidden)]
+macro_rules! quote_token_spanned {
($tokens:ident $span:ident ( $($inner:tt)* )) => {
- $tokens.extend({
- let mut g = $crate::__rt::Group::new(
- $crate::__rt::Delimiter::Parenthesis,
- $crate::quote_spanned!($span=> $($inner)*),
- );
- g.set_span($span);
- Some($crate::__rt::TokenTree::from(g))
- });
+ $crate::__private::push_group_spanned(
+ &mut $tokens,
+ $span,
+ $crate::__private::Delimiter::Parenthesis,
+ $crate::quote_spanned!($span=> $($inner)*),
+ );
};
($tokens:ident $span:ident [ $($inner:tt)* ]) => {
- $tokens.extend({
- let mut g = $crate::__rt::Group::new(
- $crate::__rt::Delimiter::Bracket,
- $crate::quote_spanned!($span=> $($inner)*),
- );
- g.set_span($span);
- Some($crate::__rt::TokenTree::from(g))
- });
+ $crate::__private::push_group_spanned(
+ &mut $tokens,
+ $span,
+ $crate::__private::Delimiter::Bracket,
+ $crate::quote_spanned!($span=> $($inner)*),
+ );
};
($tokens:ident $span:ident { $($inner:tt)* }) => {
- $tokens.extend({
- let mut g = $crate::__rt::Group::new(
- $crate::__rt::Delimiter::Brace,
- $crate::quote_spanned!($span=> $($inner)*),
- );
- g.set_span($span);
- Some($crate::__rt::TokenTree::from(g))
- });
+ $crate::__private::push_group_spanned(
+ &mut $tokens,
+ $span,
+ $crate::__private::Delimiter::Brace,
+ $crate::quote_spanned!($span=> $($inner)*),
+ );
};
($tokens:ident $span:ident +) => {
- $crate::__rt::push_add(&mut $tokens, $span);
+ $crate::__private::push_add_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident +=) => {
- $crate::__rt::push_add_eq(&mut $tokens, $span);
+ $crate::__private::push_add_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident &) => {
- $crate::__rt::push_and(&mut $tokens, $span);
+ $crate::__private::push_and_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident &&) => {
- $crate::__rt::push_and_and(&mut $tokens, $span);
+ $crate::__private::push_and_and_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident &=) => {
- $crate::__rt::push_and_eq(&mut $tokens, $span);
+ $crate::__private::push_and_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident @) => {
- $crate::__rt::push_at(&mut $tokens, $span);
+ $crate::__private::push_at_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident !) => {
- $crate::__rt::push_bang(&mut $tokens, $span);
+ $crate::__private::push_bang_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ^) => {
- $crate::__rt::push_caret(&mut $tokens, $span);
+ $crate::__private::push_caret_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ^=) => {
- $crate::__rt::push_caret_eq(&mut $tokens, $span);
+ $crate::__private::push_caret_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident :) => {
- $crate::__rt::push_colon(&mut $tokens, $span);
+ $crate::__private::push_colon_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ::) => {
- $crate::__rt::push_colon2(&mut $tokens, $span);
+ $crate::__private::push_colon2_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ,) => {
- $crate::__rt::push_comma(&mut $tokens, $span);
+ $crate::__private::push_comma_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident /) => {
- $crate::__rt::push_div(&mut $tokens, $span);
+ $crate::__private::push_div_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident /=) => {
- $crate::__rt::push_div_eq(&mut $tokens, $span);
+ $crate::__private::push_div_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident .) => {
- $crate::__rt::push_dot(&mut $tokens, $span);
+ $crate::__private::push_dot_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ..) => {
- $crate::__rt::push_dot2(&mut $tokens, $span);
+ $crate::__private::push_dot2_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ...) => {
- $crate::__rt::push_dot3(&mut $tokens, $span);
+ $crate::__private::push_dot3_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ..=) => {
- $crate::__rt::push_dot_dot_eq(&mut $tokens, $span);
+ $crate::__private::push_dot_dot_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident =) => {
- $crate::__rt::push_eq(&mut $tokens, $span);
+ $crate::__private::push_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ==) => {
- $crate::__rt::push_eq_eq(&mut $tokens, $span);
+ $crate::__private::push_eq_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident >=) => {
- $crate::__rt::push_ge(&mut $tokens, $span);
+ $crate::__private::push_ge_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident >) => {
- $crate::__rt::push_gt(&mut $tokens, $span);
+ $crate::__private::push_gt_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident <=) => {
- $crate::__rt::push_le(&mut $tokens, $span);
+ $crate::__private::push_le_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident <) => {
- $crate::__rt::push_lt(&mut $tokens, $span);
+ $crate::__private::push_lt_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident *=) => {
- $crate::__rt::push_mul_eq(&mut $tokens, $span);
+ $crate::__private::push_mul_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident !=) => {
- $crate::__rt::push_ne(&mut $tokens, $span);
+ $crate::__private::push_ne_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident |) => {
- $crate::__rt::push_or(&mut $tokens, $span);
+ $crate::__private::push_or_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident |=) => {
- $crate::__rt::push_or_eq(&mut $tokens, $span);
+ $crate::__private::push_or_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ||) => {
- $crate::__rt::push_or_or(&mut $tokens, $span);
+ $crate::__private::push_or_or_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident #) => {
- $crate::__rt::push_pound(&mut $tokens, $span);
+ $crate::__private::push_pound_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ?) => {
- $crate::__rt::push_question(&mut $tokens, $span);
+ $crate::__private::push_question_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ->) => {
- $crate::__rt::push_rarrow(&mut $tokens, $span);
+ $crate::__private::push_rarrow_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident <-) => {
- $crate::__rt::push_larrow(&mut $tokens, $span);
+ $crate::__private::push_larrow_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident %) => {
- $crate::__rt::push_rem(&mut $tokens, $span);
+ $crate::__private::push_rem_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident %=) => {
- $crate::__rt::push_rem_eq(&mut $tokens, $span);
+ $crate::__private::push_rem_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident =>) => {
- $crate::__rt::push_fat_arrow(&mut $tokens, $span);
+ $crate::__private::push_fat_arrow_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident ;) => {
- $crate::__rt::push_semi(&mut $tokens, $span);
+ $crate::__private::push_semi_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident <<) => {
- $crate::__rt::push_shl(&mut $tokens, $span);
+ $crate::__private::push_shl_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident <<=) => {
- $crate::__rt::push_shl_eq(&mut $tokens, $span);
+ $crate::__private::push_shl_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident >>) => {
- $crate::__rt::push_shr(&mut $tokens, $span);
+ $crate::__private::push_shr_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident >>=) => {
- $crate::__rt::push_shr_eq(&mut $tokens, $span);
+ $crate::__private::push_shr_eq_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident *) => {
- $crate::__rt::push_star(&mut $tokens, $span);
+ $crate::__private::push_star_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident -) => {
- $crate::__rt::push_sub(&mut $tokens, $span);
+ $crate::__private::push_sub_spanned(&mut $tokens, $span);
};
($tokens:ident $span:ident -=) => {
- $crate::__rt::push_sub_eq(&mut $tokens, $span);
+ $crate::__private::push_sub_eq_spanned(&mut $tokens, $span);
+ };
+
+ ($tokens:ident $span:ident $ident:ident) => {
+ $crate::__private::push_ident_spanned(&mut $tokens, $span, stringify!($ident));
};
($tokens:ident $span:ident $other:tt) => {
- $crate::__rt::parse(&mut $tokens, $span, stringify!($other));
+ $crate::__private::parse_spanned(&mut $tokens, $span, stringify!($other));
};
}