-
Notifications
You must be signed in to change notification settings - Fork 20
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
Class ParseTreeProperty #7
Comments
I left this implementation out because it's just a utility map class, and PHP provides native support for that. I believe that SplObjectStorate has a perfect fit for this use case, or I am missing something? The only benefit I see in shipping it as part of the runtime is making it easier for people coming from other targets to reproduce the tutorials out there (a new section in the docs may work as well). In that sense, we can implement the PHP version of What your thoughts? |
O, perfect, didn't know SplObjectStorage ::blushblush::, but that is exactly it. I'd prefer to wrap that in a ParseTreeProperty-class, so people can easily use it when reading material about ANTLR that is not specifically for PHP, like section 7.5 inTerrence Parr's book (about Sharing Information Among Event Methods). |
Contributions are welcome! Feel free to open a PR :) |
When no value for a node is stored, null is returned. |
In the API for the runtime, as documented for Java in https://www.antlr.org/api/Java, we have a Class ParseTreeProperty in the Tree-package. It is to easily attach a value to a node in the parse tree. Java uses an IdentityHashMap for that, with the node / parse tree as key. In PHP we don't have such a datastructure, where we can use an object as key. That is probably why you left this class out in the PHP runtime?
My thoughts:
My preference is option nr. 1, as it conforms the general API. Shall I make a proof of concept?
Maybe I'm overlooking something here and is this a non-issue... Please let me know your thoughts.
The text was updated successfully, but these errors were encountered: