dabeaz / sly

Sly Lex Yacc
Other
825 stars 109 forks source link

Support for inclusive lexing states #50

Closed SeanDS closed 3 years ago

SeanDS commented 4 years ago

Is there support in SLY for the equivalent of PLY's inclusive lexing states? It seems the default behaviour in SLY is equivalent to PLY's 'exclusive'. I find no mention of "exclusive" or "inclusive" in the source code.

EDIT: perhaps the idea is that, no, there is no inclusive lexing, but the lexer you define for the new state can inherit from the base one to get its tokens?

PyPublishing commented 3 years ago

Very, very late, but nonetheless:

You might find a solution in the CHANGES document.

Search "Version 0.3" changes, "4/1/2018 Support for Lexer inheritance added."

This should work on top of the (exclusive) "4/1/2018 Better support for lexing states."

SeanDS commented 3 years ago

Thanks for the reply. I'm glad this is now in SLY. I ended up just writing my own parser, as I think most people who need advanced features end up doing, but SLY was a great guide as to how to do it.