Merge pull request #2123 from ewanmellor/swift-fix-parse-cancellation
[Swift] Fix parse-cancellation in BailErrorStrategy.
This commit is contained in:
commit
b5e6147cd5
|
@ -290,8 +290,6 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
"let tree = try parser.<parserStartRuleName>()\n" +
|
||||
"<if(profile)>print(profiler.getDecisionInfo().description)<endif>\n" +
|
||||
"try ParseTreeWalker.DEFAULT.walk(TreeShapeListener(), tree)\n" +
|
||||
"}catch ANTLRException.cannotInvokeStartRule {\n" +
|
||||
" print(\"error occur: cannotInvokeStartRule\")\n" +
|
||||
"}catch ANTLRException.recognition(let e ) {\n" +
|
||||
" print(\"error occur\\(e)\")\n" +
|
||||
"}catch {\n" +
|
||||
|
@ -333,8 +331,6 @@ public class BaseSwiftTest implements RuntimeTestSupport {
|
|||
|
||||
"do {\n" +
|
||||
" try tokens.fill()\n" +
|
||||
"} catch ANTLRException.cannotInvokeStartRule {\n" +
|
||||
" print(\"error occur: cannotInvokeStartRule\")\n" +
|
||||
"} catch ANTLRException.recognition(let e ) {\n" +
|
||||
" print(\"error occur\\(e)\")\n" +
|
||||
"} catch {\n" +
|
||||
|
|
|
@ -49,7 +49,7 @@ open class BailErrorStrategy: DefaultErrorStrategy {
|
|||
context = (contextWrap.getParent() as? ParserRuleContext)
|
||||
}
|
||||
|
||||
throw ANTLRException.recognition(e: e)
|
||||
throw ANTLRException.parseCancellation(e: e)
|
||||
}
|
||||
|
||||
///
|
||||
|
@ -65,7 +65,7 @@ open class BailErrorStrategy: DefaultErrorStrategy {
|
|||
context = (contextWrap.getParent() as? ParserRuleContext)
|
||||
}
|
||||
|
||||
throw ANTLRException.recognition(e: e)
|
||||
throw ANTLRException.parseCancellation(e: e)
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -19,5 +19,4 @@ public enum ANTLRError: Error {
|
|||
case illegalState(msg:String)
|
||||
case illegalArgument(msg:String)
|
||||
case negativeArraySize(msg:String)
|
||||
case parseCancellation
|
||||
}
|
||||
|
|
|
@ -15,6 +15,6 @@
|
|||
import Foundation
|
||||
|
||||
public enum ANTLRException: Error {
|
||||
case cannotInvokeStartRule
|
||||
case parseCancellation(e: RecognitionException)
|
||||
case recognition(e: RecognitionException)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue