Properly build and pass in decisionToDFA

This commit is contained in:
Edir Garcia Lazo 2018-10-18 11:16:55 -07:00
parent 03a0a40835
commit 0af9611215
2 changed files with 15 additions and 3 deletions

View File

@ -192,4 +192,5 @@ YYYY/MM/DD, github id, Full name, email
2018/06/16, EternalPhane, Zongyuan Zuo, eternalphane@gmail.com
2018/07/03, jgoppert, James Goppert, james.goppert@gmail.com
2018/07/27, Maksim Novikov, mnovikov.work@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/18, edirgarcia, Edir García Lazo, edirgl@hotmail.com

View File

@ -31,6 +31,8 @@ namespace Antlr4.Runtime
private readonly string _grammarFileName;
private readonly ATN _atn;
private readonly Dfa.DFA[] _decisionToDFA;
protected internal readonly BitSet pushRecursionContextStates;
@ -61,8 +63,17 @@ namespace Antlr4.Runtime
this.pushRecursionContextStates.Set(state.stateNumber);
}
}
// get atn simulator that knows how to do predictions
Interpreter = new ParserATNSimulator(this, atn, null, null);
//init decision DFA
int numberofDecisions = atn.NumberOfDecisions;
this._decisionToDFA = new Dfa.DFA[numberofDecisions];
for (int i = 0; i < numberofDecisions; i++)
{
DecisionState decisionState = atn.GetDecisionState(i);
_decisionToDFA[i] = new Dfa.DFA(decisionState, i);
}
// get atn simulator that knows how to do predictions
Interpreter = new ParserATNSimulator(this, atn, _decisionToDFA, null);
}
public override ATN Atn