usecrate::parse::ParseStream; use proc_macro2::{Delimiter, TokenStream}; use std::cmp::Ordering; use std::iter;
pub(crate) fn between<'a>(begin: ParseStream<'a>, end: ParseStream<'a>) -> TokenStream { let end = end.cursor(); letmut cursor = begin.cursor();
assert!(crate::buffer::same_buffer(end, cursor));
letmut tokens = TokenStream::new(); while cursor != end { let (tt, next) = cursor.token_tree().unwrap();
ifcrate::buffer::cmp_assuming_same_buffer(end, next) == Ordering::Less { // A syntax node can cross the boundary of a None-delimited group // due to such groups being transparent to the parser in most cases. // Any time this occurs the group is known to be semantically // irrelevant. https://github.com/dtolnay/syn/issues/1235 iflet Some((inside, _span, after)) = cursor.group(Delimiter::None) {
assert!(next == after);
cursor = inside; continue;
} else {
panic!("verbatim end must not be inside a delimited group");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.