antlr3/antlr-python-3.1.2-version.patch
Miloš Jakubíček 32c82cb3a1 - Patch the Python runtime to print just a warning in case of version
mismatch instead of raising an exception (since there is a good change
    it will work).
2010-05-01 12:02:41 +00:00

38 lines
1.9 KiB
Diff

--- antlr_python_runtime-3.1.2/antlr3/recognizers.py.orig 2010-05-01 13:30:01.000000000 +0200
+++ antlr_python_runtime-3.1.2/antlr3/recognizers.py 2010-05-01 13:36:00.000000000 +0200
@@ -164,24 +164,20 @@
self._state = state
if self.antlr_version > runtime_version:
- raise RuntimeError(
- "ANTLR version mismatch: "
- "The recognizer has been generated by V%s, but this runtime "
- "is V%s. Please use the V%s runtime or higher."
- % (self.antlr_version_str,
- runtime_version_str,
- self.antlr_version_str))
+ print >> sys.stderr, """
+ WARNING: ANTLR version mismatch:
+ The recognizer has been generated by V%s, but this runtime
+ is V%s, this may not work correctly. Please use the V%s runtime or higher.""" % (
+ self.antlr_version_str, runtime_version_str, self.antlr_version_str)
elif (self.antlr_version < (3, 1, 0, 0) and
self.antlr_version != runtime_version):
# FIXME: make the runtime compatible with 3.0.1 codegen
# and remove this block.
- raise RuntimeError(
- "ANTLR version mismatch: "
- "The recognizer has been generated by V%s, but this runtime "
- "is V%s. Please use the V%s runtime."
- % (self.antlr_version_str,
- runtime_version_str,
- self.antlr_version_str))
+ print >> sys.stderr, """
+ WARNING ANTLR version mismatch:
+ The recognizer has been generated by V%s, but this runtime
+ is V%s, this may not work correctly. Please use the V%s runtime.""" % (
+ self.antlr_version_str, runtime_version_str, self.antlr_version_str)
# this one only exists to shut up pylint :(
def setInput(self, input):