diff --git a/contributors.txt b/contributors.txt index d081c5482..f4f4010c0 100644 --- a/contributors.txt +++ b/contributors.txt @@ -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 \ No newline at end of file diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/ParserInterpreter.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/ParserInterpreter.cs index ff50eafd7..e7b0c701b 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/ParserInterpreter.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/ParserInterpreter.cs @@ -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