diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java index 90dc05245..530782e86 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/swift/BaseSwiftTest.java @@ -290,8 +290,6 @@ public class BaseSwiftTest implements RuntimeTestSupport { "let tree = try parser.()\n" + "print(profiler.getDecisionInfo().description)\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" + diff --git a/runtime/Swift/Sources/Antlr4/BailErrorStrategy.swift b/runtime/Swift/Sources/Antlr4/BailErrorStrategy.swift index d1e81140c..cb4db3a49 100644 --- a/runtime/Swift/Sources/Antlr4/BailErrorStrategy.swift +++ b/runtime/Swift/Sources/Antlr4/BailErrorStrategy.swift @@ -47,7 +47,7 @@ public class BailErrorStrategy: DefaultErrorStrategy { context = (contextWrap.getParent() as? ParserRuleContext) } - throw ANTLRException.recognition(e: e) + throw ANTLRException.parseCancellation(e: e) } /// @@ -63,7 +63,7 @@ public class BailErrorStrategy: DefaultErrorStrategy { context = (contextWrap.getParent() as? ParserRuleContext) } - throw ANTLRException.recognition(e: e) + throw ANTLRException.parseCancellation(e: e) } /// diff --git a/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRError.swift b/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRError.swift index c9df3022e..729e2e939 100644 --- a/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRError.swift +++ b/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRError.swift @@ -19,5 +19,4 @@ public enum ANTLRError: Error { case illegalState(msg:String) case illegalArgument(msg:String) case negativeArraySize(msg:String) - case parseCancellation } diff --git a/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRException.swift b/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRException.swift index c4453384d..739c2fc8f 100644 --- a/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRException.swift +++ b/runtime/Swift/Sources/Antlr4/misc/exception/ANTLRException.swift @@ -15,6 +15,6 @@ import Foundation public enum ANTLRException: Error { - case cannotInvokeStartRule + case parseCancellation(e: RecognitionException) case recognition(e: RecognitionException) }