Closed kaby76 closed 1 year ago
Oh, it seems we may have a circular reference. Hasher doesn't handle such cases, indeed.
Can you check if it holds? If so, is circular reference expected, or is it the root cause?
Java's hashCode
implementation doesn't seem to handle circular references, either. So I believe that it should not be happening there.
Not sure what the problem is yet. But, it runs differently under the debugger (program completes). Double-checking the build. I may have to rely on prints to find the problem. Doesn't seem like there's any odd parameters on the xdebug spawn either.
So far, I've verified a circular parent chain for PredictionContext. That's why hashing crashes.
After implementing code to find strongly connected cycles in the PredictionContext data structures, and finding nothing, I did a search for the error message and found that it's caused by Xdebug not configured correctly. Add this to your php.ini file:
[xdebug]
xdebug.max_nesting_level=1000
Everything is now starting to work.
I'm going through as many of the v4 grammars as possible with my fix for #12. But, I failed on an infinite loop in the lazy computation for the acme grammar, first example input, on a PredictionContext objects. (In Java and CSharp, the has code is computed immediately at the time of construction of a PredictionContext object (looks like for ArrayPredictionContext). I've verified it for for the current "dev" branch. Note, the grammar contains both
identifier
andIDENTIFIER
, so one needs to be renamed. I chose to renameidentifier
using ` trparse *.g4 | trrename -r 'identifier,identifier' | trsponge -c`._