-
Notifications
You must be signed in to change notification settings - Fork 55
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
Support Inheritance on Grammars and Visitors, enhance Visitor Definition #69
Comments
Hi Robert, Thanks for the suggestions. I think that many of what you proposed make sense. Grammar/Visitor inheritance is definitely something that would be useful. Also I agree that I'm not sure that I'm following your thoughts on point 4. What would be the purpose of At first thought, one way to attack on this would be to create a new parser class. Like we have now I'll leave this issue open as a feature request so will play with it when find some time or if you or someone from the community wants to contribute please comment here. |
Dear Igor, for point 4 - I tried to archive that Visitors can be subclassed, and that the name of the methods do not collide. maybe something like that :
I think that can be a good solution, what do You think ? |
I love Arpeggio, but now when really working with it, I would like to have certain features :
since I do Parsers for many different Formats, there are some Grammars which are repeating over and Over again - so i want to put them into a class, inherit them, monkey patch them etc. - thats working at the moment like this :
So my proposals are :
do not only store the function name of grammar definitions in the parse nodes, but the Object specification - so we dont get name confusions. At the moment You can not use the same names in
GrammarBasic
andGrammarSpecific
.get rif of the
visit_
prefix in the Visitor Class - its useless. You can look out for both for backward compatibility (with deprecation warning)Grammars should be able to be defined as standard methods of the class, not as
@staticmethod
Visitors definition should be better like :
So the name of the Visitor.method can be chosen as You like, and the correct method of the Visitor should be called, even it is inherited from another Visitor super().....
In short :
grammars defined in Classes should not collide, even if they have the same name as a method in their Base Class
Visitors definition should be not ambiguouse , by not using the Method Name, but the rule object to define/map it.
I hope I made myself clear, here an example :
what do You developers think - any chances for that ?
do You think its a bad/good idea, and why ?
Maybe there are easier ways and I use it wrong ?
yours sincerely and
желим вам пријатан дан Igor !
Robert
The text was updated successfully, but these errors were encountered: