forked from jasder/antlr
Fix PredictionContext.mergeRoot placing states in the wrong order
This commit is contained in:
parent
e14e7663b5
commit
9cea095d81
|
@ -234,15 +234,15 @@ public abstract class PredictionContext implements Iterable<SingletonPredictionC
|
||||||
else {
|
else {
|
||||||
if ( a == EMPTY && b == EMPTY ) return EMPTY; // $ + $ = $
|
if ( a == EMPTY && b == EMPTY ) return EMPTY; // $ + $ = $
|
||||||
if ( a == EMPTY ) { // $ + x = [$,x]
|
if ( a == EMPTY ) { // $ + x = [$,x]
|
||||||
int[] payloads = {EMPTY_FULL_CTX_INVOKING_STATE, b.invokingState};
|
int[] payloads = {b.invokingState, EMPTY_FULL_CTX_INVOKING_STATE};
|
||||||
PredictionContext[] parents = {null, b.parent};
|
PredictionContext[] parents = {b.parent, null};
|
||||||
PredictionContext joined =
|
PredictionContext joined =
|
||||||
new ArrayPredictionContext(parents, payloads);
|
new ArrayPredictionContext(parents, payloads);
|
||||||
return joined;
|
return joined;
|
||||||
}
|
}
|
||||||
if ( b == EMPTY ) { // x + $ = [$,x] ($ is always first if present)
|
if ( b == EMPTY ) { // x + $ = [$,x] ($ is always first if present)
|
||||||
int[] payloads = {EMPTY_FULL_CTX_INVOKING_STATE, a.invokingState};
|
int[] payloads = {a.invokingState, EMPTY_FULL_CTX_INVOKING_STATE};
|
||||||
PredictionContext[] parents = {null, a.parent};
|
PredictionContext[] parents = {a.parent, null};
|
||||||
PredictionContext joined =
|
PredictionContext joined =
|
||||||
new ArrayPredictionContext(parents, payloads);
|
new ArrayPredictionContext(parents, payloads);
|
||||||
return joined;
|
return joined;
|
||||||
|
|
Loading…
Reference in New Issue