forked from jasder/antlr
[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:
parent
e2f4cdc68d
commit
6cc35ad677
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue