forked from jasder/antlr
Merge pull request #2445 from WalterCouto/master
C++: fix bug in PredictionContext::mergeArrays
This commit is contained in:
commit
fa466c42a1
|
@ -209,4 +209,5 @@ YYYY/MM/DD, github id, Full name, email
|
|||
2018/11/12, vinoski, Steve Vinoski, vinoski@ieee.org
|
||||
2018/11/14, nxtstep, Adriaan (Arjan) Duz, codewithadriaan[et]gmail[dot]com
|
||||
2018/11/15, amykyta3, Alex Mykyta, amykyta3@users.noreply.github.com
|
||||
2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com
|
||||
2018/11/29, hannemann-tamas, Ralf Hannemann-Tamas, ralf.ht@gmail.com
|
||||
2018/12/20, WalterCouto, Walter Couto, WalterCouto@users.noreply.github.com
|
|
@ -272,7 +272,7 @@ ssize_t BufferedTokenStream::previousTokenOnChannel(size_t i, size_t channel) {
|
|||
}
|
||||
|
||||
if (i == 0)
|
||||
break;
|
||||
return -1;
|
||||
i--;
|
||||
}
|
||||
return i;
|
||||
|
|
|
@ -278,7 +278,7 @@ Ref<PredictionContext> PredictionContext::mergeArrays(const Ref<ArrayPredictionC
|
|||
// same payload (stack tops are equal), must yield merged singleton
|
||||
size_t payload = a->returnStates[i];
|
||||
// $+$ = $
|
||||
bool both$ = payload == EMPTY_RETURN_STATE && a_parent && b_parent;
|
||||
bool both$ = payload == EMPTY_RETURN_STATE && !a_parent && !b_parent;
|
||||
bool ax_ax = (a_parent && b_parent) && *a_parent == *b_parent; // ax+ax -> ax
|
||||
if (both$ || ax_ax) {
|
||||
mergedParents[k] = a_parent; // choose left
|
||||
|
|
Loading…
Reference in New Issue