diff --git a/runtime/Swift/Sources/Antlr4/LexerInterpreter.swift b/runtime/Swift/Sources/Antlr4/LexerInterpreter.swift index 815ee5c3a..dd279b3a2 100644 --- a/runtime/Swift/Sources/Antlr4/LexerInterpreter.swift +++ b/runtime/Swift/Sources/Antlr4/LexerInterpreter.swift @@ -27,9 +27,8 @@ public class LexerInterpreter: Lexer { self.modeNames = modeNames self.vocabulary = vocabulary - self._decisionToDFA = [DFA]() //new DFA[atn.getNumberOfDecisions()]; - let _decisionToDFALength = _decisionToDFA.count - for i in 0..<_decisionToDFALength { + self._decisionToDFA = [DFA]() + for i in 0 ..< atn.getNumberOfDecisions() { _decisionToDFA[i] = DFA(atn.getDecisionState(i)!, i) } super.init(input) diff --git a/runtime/Swift/Sources/Antlr4/ParserInterpreter.swift b/runtime/Swift/Sources/Antlr4/ParserInterpreter.swift index 1e760fc84..6ee51ff53 100644 --- a/runtime/Swift/Sources/Antlr4/ParserInterpreter.swift +++ b/runtime/Swift/Sources/Antlr4/ParserInterpreter.swift @@ -75,9 +75,8 @@ public class ParserInterpreter: Parser { self.atn = atn self.ruleNames = ruleNames self.vocabulary = vocabulary - self.decisionToDFA = [DFA]() //new DFA[atn.getNumberOfDecisions()]; - let decisionToDFALength = decisionToDFA.count - for i in 0..