Merge pull request #2382 from edirgarcia/master

Properly build decisionToDFA
This commit is contained in:
Terence Parr 2019-06-23 15:45:21 -07:00 committed by GitHub
commit a770ff26cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -203,6 +203,8 @@ 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/10/18, edirgarcia, Edir García Lazo, edirgl@hotmail.com
2018/07/31, Lucas Henrqiue, lucashenrique580@gmail.com
2018/08/03, ENDOH takanao, djmchl@gmail.com
2018/10/29, chrisaycock, Christopher Aycock, chris[at]chrisaycock[dot]com
@ -215,4 +217,4 @@ YYYY/MM/DD, github id, Full name, email
2019/02/06, ralucado, Cristina Raluca Vijulie, ralucris.v[at]gmail[dot]com
2019/03/13, base698, Justin Thomas, justin.thomas1@gmail.com
2019/03/18, carlodri, Carlo Dri, carlo.dri@gmail.com
2019/05/02, askingalot, Andy Collins, askingalot@gmail.com
2019/05/02, askingalot, Andy Collins, askingalot@gmail.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