eager2 complicated
This commit is contained in:
parent
9e7620db82
commit
6e2a99338b
@ -45,6 +45,31 @@ pub fn run_instruction(input: proc_macro::TokenStream) -> proc_macro::TokenStrea
|
|||||||
quote! { #f }.into()
|
quote! { #f }.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[proc_macro]
|
||||||
|
pub fn instruction_list(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
|
||||||
|
// Convert to proc_macro2::TokenStream for better iteration
|
||||||
|
let input2: proc_macro2::TokenStream = input.clone().into();
|
||||||
|
|
||||||
|
println!("Token stream analysis:");
|
||||||
|
for token in input2.into_iter() {
|
||||||
|
match token {
|
||||||
|
proc_macro2::TokenTree::Group(group) => println!(
|
||||||
|
"Group: delimiter={:?}, tokens={}",
|
||||||
|
group.delimiter(),
|
||||||
|
group.stream()
|
||||||
|
),
|
||||||
|
proc_macro2::TokenTree::Ident(ident) => println!("Identifier: {}", ident),
|
||||||
|
proc_macro2::TokenTree::Punct(punct) => println!(
|
||||||
|
"Punctuation: {} (spacing={:?})",
|
||||||
|
punct.as_char(),
|
||||||
|
punct.spacing()
|
||||||
|
),
|
||||||
|
proc_macro2::TokenTree::Literal(lit) => println!("Literal: {}", lit),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
input
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use rush::push::state::EMPTY_STATE;
|
use rush::push::state::EMPTY_STATE;
|
||||||
use rush_macro::run_instruction;
|
use rush_macro::{instruction_list, run_instruction};
|
||||||
|
|
||||||
fn iadd(x: i128, y: i128) -> Option<i128> {
|
fn iadd(x: i128, y: i128) -> Option<i128> {
|
||||||
Some(x + y)
|
Some(x + y)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user