goffrie / plex

a parser and lexer generator as a Rust procedural macro
Apache License 2.0
410 stars 28 forks source link

No way to pass additional args to the lexer #38

Open martin-t opened 5 years ago

martin-t commented 5 years ago

I needed to pass an interner to the lexer (to avoid calling .to_owned() for idents) but there doesn't seem to be a way to add it to the signature without making the proc macro panic.

goffrie commented 5 years ago

Yup, this is just a limitation at the moment.

I think the best way to fix this would be to make lexer! not define a new function, but just an expression. I think I'm a bit too busy these days to fix that right now, though... (hence the 3 week response time, sorry.)