Syn: real example

Hello,
I only found examples for parsing one item using syn !!!
But I need to parse:

my_macro! {
    struct S{}
    const MY_CONST: i32 = 0;
    static ref USERNAME: Regex = {
        println!("Compiling username regex...");
        let result = Regex::new("^[a-z0-9_-]{3,16}$").unwrap();
        let matchz = result.is_match("name");
        println!("{}", matchz);
        result
    };
    enum E {
        r,s
    }
}

where static item comes from lazy_static macro example in syn doc.

Parsing is very well documented, but starting using this lib is the most difficult part.
I can't find a way to continue parsing items and even quote items that don't need to be updated.

Thank you in advance for your answer.

Ideally your macro should be pretty contained and not try to parse a whole Rust program.

If however you really need this, you could use ParseBuffer::fork to try to parse a LazyStatic item without advancing the buffer, then if it succeeds you can actually advance the original buffer using Speculative::advance_to (which, as you can see from the module name, is discouraged!) and if it fails you just fall back to parsing an Item with the original ParseBuffer. Then repeat until the ParseBuffer is empty.