New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser inheritance #142
Comments
Defining parsers as classes was never the primary mechanism of creating a parser in PLY. I've never written any projects that use parser inheritance nor are they any tests for it. It wouldn't surprise if it didn't work at all. The error above is being caused by two parsers being defined in the same file. It might work if you split things into multiple files. There still might be issues with any kind of inheritance working though. |
It looks like problem linked with I've done dirt hack: add
|
A more elegant solution doesn't break anything except test: only two line patch making a warning in case of multiple
More simple variant can be used: check special |
I have used |
Some problem with disabling lexer rules then token list changed in inherited lexer:
need some trick to remove elements from inherited parser |
I'm closing this without changing behavior. Mainly this is because PLY is really in a maintenance-only mode and I'm afraid to add features that extend it's functionality in new directions--especially with regards to inheritance (which might have far-reaching consequences). |
I'm trying to use multiple parsers in one program, encapsulated into classes:
https://github.com/ponyatov/DLR/blob/PLY_issue142/inher.py
VM lexer class works ok in both ways: as described in PLY manual, and with my init (commented).
But when I try to use inherited FORTH class (redefine newline rule for example) I got an error:
Is any way exists to use inheritance?
Lexer defined using closures in compiler() method works fine until I try to use static class member in inherited FORTH:
https://github.com/ponyatov/DLR/blob/PLY_issue142/VM.py
The text was updated successfully, but these errors were encountered: