Merge pull request #2121 from ewanmellor/swift-fix-interpreter-dfas

[Swift] Fix initialization of {Lexer,Parser}Interpreter.decisionToDFA.
This commit is contained in:
Terence Parr 2017-11-29 09:55:38 -08:00 committed by GitHub
commit 756fcdd5ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -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)

View File

@ -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..<decisionToDFALength {
self.decisionToDFA = [DFA]()
for i in 0 ..< atn.getNumberOfDecisions() {
decisionToDFA[i] = DFA(atn.getDecisionState(i)!, i)
}