osa1 / lexgen

A fully-featured lexer generator, implemented as a proc macro
MIT License
63 stars 7 forks source link

Allow state type to have lifetime parameters #53

Closed alan-j-hu closed 2 years ago

alan-j-hu commented 2 years ago

This is a preliminary PR to implement https://github.com/osa1/lexgen/issues/52.

alan-j-hu commented 2 years ago

It seems like in the tests 'input is always 'static. Should we test the case where 'input is not 'static? In practice 'input is only 'static in tests, in actual uses it's never 'static. So it might be a good idea to make sure the generated code makes sense and is usable when input lifetime is not 'static.

I've just added a test for this.

As this PR stands, the generated code emits compiler warnings because of the 'input: 'static hack due to https://github.com/osa1/lexgen/issues/54. Shall this PR be merged, then the Default issue fixed separately?

osa1 commented 2 years ago

Thanks!