Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/vendor/syn-2.0.119/src/verbatim.rs # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / vendor / syn-2.0.119 / src / verbatim.rs` 32 lines ยท 1164 bytes Raw Blame History 1 use crate::buffer::Cursor; 2 use crate::ext::TokenStreamExt as _; 3 use core::cmp::Ordering; 4 use proc_macro2::{Delimiter, TokenStream}; 5 6 pub(crate) fn between(begin: Cursor, end: Cursor) -> TokenStream { 7 let mut cursor = begin; 8 assert!(crate::buffer::same_buffer(end, cursor)); 9 10 let mut tokens = TokenStream::new(); 11 while cursor != end { 12 let (tt, next) = cursor.token_tree().unwrap(); 13 14 if crate::buffer::cmp_assuming_same_buffer(end, next) == Ordering::Less { 15 // A syntax node can cross the boundary of a None-delimited group 16 // due to such groups being transparent to the parser in most cases. 17 // Any time this occurs the group is known to be semantically 18 // irrelevant. https://github.com/dtolnay/syn/issues/1235 19 if let Some((inside, _span, after)) = cursor.group(Delimiter::None) { 20 assert!(next == after); 21 cursor = inside; 22 continue; 23 } else { 24 panic!("verbatim end must not be inside a delimited group"); 25 } 26 } 27 28 tokens.append(tt); 29 cursor = next; 30 } 31 tokens 32 }