osa1 / lexgen

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

lua5_1.rs example contains return_() and continue_() missing from Lexer? #66

Closed nalply closed 10 months ago

nalply commented 10 months ago

I tried to get started and copied the line 180 with the return_() method, but it didn't work.

I then studied the source code of Lexer and discovered that there is no such method, and used SemtanticActionResult::Return(token) instead.

It seems that the example is outdated. Right?

nalply commented 10 months ago

I had this line use lexgen_utils::*; in the code and removed it, then it worked.

Sorry, I don't understand what lexgen_utils does.

nalply commented 10 months ago

I found out, the Readme.md code at the top is missing use statements at the top, so I had to find out which one to insert and I got lost.

osa1 commented 10 months ago

I've updated README with the use statements. If you just copy-paste that code into a fn main() { <HERE> } it should work.

lexgen_util is the runtime library for lexgen-generated lexers. It contains types used commonly in all lexers. As the readme mentions, you should add lexgen_util as a dependency with the same version of lexgen. E.g.

[dependencies]
lexgen = "0.15.0"
lexgen_util = "0.15.0" # <--- need to be the same version as `lexgen`

Feel free to open a PR with clarifications if you find README confusing on this.

nalply commented 10 months ago

Thanks for the amazing work! Let me work a little bit more then I might send you a pull request to clarify the Readme.