[Swift] Remove pointless do block from LexerATNSimulator.

Remove pointless do block from LexerATNSimulator.  This is a translation
from Java of a try/finally block, but we have the finally clause in a
defer block so we don't need the do block.
This commit is contained in:
Ewan Mellor 2017-11-10 17:40:41 -08:00
parent e2f4cdc68d
commit 6cc35ad677
No known key found for this signature in database
GPG Key ID: 7CE1C6BC9EC8645D
1 changed files with 12 additions and 13 deletions

View File

@ -114,24 +114,23 @@ open class LexerATNSimulator: ATNSimulator {
open func match(_ input: CharStream, _ mode: Int) throws -> Int {
LexerATNSimulator.match_calls += 1
self.mode = mode
var mark = input.mark()
do {
self.startIndex = input.index()
self.prevAccept.reset()
var dfa = decisionToDFA[mode]
defer {
try! input.release(mark)
}
if dfa.s0 == nil {
return try matchATN(input)
} else {
return try execATN(input, dfa.s0!)
}
defer {
try! input.release(mark)
}
self.startIndex = input.index()
self.prevAccept.reset()
let dfa = decisionToDFA[mode]
if let s0 = dfa.s0 {
return try execATN(input, s0)
}
else {
return try matchATN(input)
}
}
override