Lines Matching +full:multi +full:- +full:tt

1 // SPDX-License-Identifier: Apache-2.0 OR MIT
3 /// Define a type that supports parsing and printing a multi-character symbol
13 /// any built-in punctuation token.
15 /// - [Peeking] — `input.peek(LeftRightArrow)`
17 /// - [Parsing] — `input.parse::<LeftRightArrow>()?`
19 /// - [Printing] — `quote!( ... #lrarrow ... )`
21 /// - Construction from a [`Span`] — `let lrarrow = LeftRightArrow(sp)`
23 /// - Construction from multiple [`Span`] — `let lrarrow = LeftRightArrow([sp, sp, sp])`
25 /// - Field access to its spans — `let spans = lrarrow.spans`
48 /// fn parse(input: ParseStream) -> Result<Self> {
65 /// fn parse_until<E: Peek>(input: ParseStream, end: E) -> Result<TokenStream> {
81 ($ident:ident, $($tt:tt)+) => {
84 pub spans: $crate::custom_punctuation_repr!($($tt)+),
89 pub fn $ident<__S: $crate::__private::IntoSpans<$crate::custom_punctuation_repr!($($tt)+)>>(
91 ) -> $ident {
92 let _validate_len = 0 $(+ $crate::custom_punctuation_len!(strict, $tt))*;
100 fn default() -> Self {
105 $crate::impl_parse_for_custom_punctuation!($ident, $($tt)+);
106 $crate::impl_to_tokens_for_custom_punctuation!($ident, $($tt)+);
107 $crate::impl_clone_for_custom_punctuation!($ident, $($tt)+);
108 $crate::impl_extra_traits_for_custom_punctuation!($ident, $($tt)+);
118 ($ident:ident, $($tt:tt)+) => {
120 fn peek(cursor: $crate::buffer::Cursor) -> $crate::__private::bool {
121 $crate::__private::peek_punct(cursor, $crate::stringify_punct!($($tt)+))
124 fn display() -> &'static $crate::__private::str {
125 $crate::__private::concat!("`", $crate::stringify_punct!($($tt)+), "`")
130 fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> {
131 let spans: $crate::custom_punctuation_repr!($($tt)+) =
132 $crate::__private::parse_punct(input, $crate::stringify_punct!($($tt)+))?;
144 ($ident:ident, $($tt:tt)+) => {};
152 ($ident:ident, $($tt:tt)+) => {
155 … $crate::__private::print_punct($crate::stringify_punct!($($tt)+), &self.spans, tokens)
166 ($ident:ident, $($tt:tt)+) => {};
170 #[cfg(feature = "clone-impls")]
174 ($ident:ident, $($tt:tt)+) => {
179 fn clone(&self) -> Self {
187 #[cfg(not(feature = "clone-impls"))]
191 ($ident:ident, $($tt:tt)+) => {};
195 #[cfg(feature = "extra-traits")]
199 ($ident:ident, $($tt:tt)+) => {
201 fn fmt(&self, f: &mut $crate::__private::Formatter) -> $crate::__private::FmtResult {
209 fn eq(&self, _other: &Self) -> $crate::__private::bool {
221 #[cfg(not(feature = "extra-traits"))]
225 ($ident:ident, $($tt:tt)+) => {};
232 ($($tt:tt)+) => {
233 [$crate::__private::Span; 0 $(+ $crate::custom_punctuation_len!(lenient, $tt))+]
260 ($mode:ident, <-) => { 2 };
263 ($mode:ident, -) => { 1 };
264 ($mode:ident, -=) => { 2 };
277 ($mode:ident, ->) => { 2 };
288 (lenient, $tt:tt) => { 0 };
289 (strict, $tt:tt) => {{ $crate::custom_punctuation_unexpected!($tt); 0 }};
303 ($($tt:tt)+) => {
304 $crate::__private::concat!($($crate::__private::stringify!($tt)),+)