Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pyparsing broke backwards compatibility starting with version 3.0.x #92

Open
LRGH opened this issue Mar 2, 2024 · 0 comments
Open

pyparsing broke backwards compatibility starting with version 3.0.x #92

LRGH opened this issue Mar 2, 2024 · 0 comments

Comments

@LRGH
Copy link
Contributor

LRGH commented Mar 2, 2024

The people at pyparsing broke backwards compatibility with no valid reasons (one of the things I really don't like...)
I use the patch below for amoco, which allows to work either with old or recent versions of pyparsing.

diff --git a/amoco/arch/msp430/parsers.py b/amoco/arch/msp430/parsers.py
index 9c25189..6c75a7d 100644
--- a/amoco/arch/msp430/parsers.py
+++ b/amoco/arch/msp430/parsers.py
@@ -6,6 +6,9 @@
 # published under GPLv2 license
 
 import pyparsing as pp
+if not hasattr(pp, 'operatorPrecedence'):
+  # backward compatibility, needed since version 3.0.x
+  pp.operatorPrecedence = pp.infixNotation
 
 from amoco.logger import Log
 
diff --git a/amoco/arch/sparc/parsers.py b/amoco/arch/sparc/parsers.py
index 602720a..8902242 100644
--- a/amoco/arch/sparc/parsers.py
+++ b/amoco/arch/sparc/parsers.py
@@ -6,6 +6,9 @@
 # published under GPLv2 license
 
 import pyparsing as pp
+if not hasattr(pp, 'operatorPrecedence'):
+  # backward compatibility, needed since version 3.0.x
+  pp.operatorPrecedence = pp.infixNotation
 
 from amoco.logger import Log
 
diff --git a/amoco/arch/x86/parsers.py b/amoco/arch/x86/parsers.py
index 65651cd..9bbccbe 100644
--- a/amoco/arch/x86/parsers.py
+++ b/amoco/arch/x86/parsers.py
@@ -2,6 +2,9 @@
 # -*- coding: utf-8 -*-
 
 import pyparsing as pp
+if not hasattr(pp, 'operatorPrecedence'):
+  # backward compatibility, needed since version 3.0.x
+  pp.operatorPrecedence = pp.infixNotation
 
 from amoco.arch.x86 import spec_ia32, spec_fpu, spec_sse
 from amoco.logger import Log
diff --git a/amoco/cas/parser.py b/amoco/cas/parser.py
index 3c8b8f7..87dabac 100644
--- a/amoco/cas/parser.py
+++ b/amoco/cas/parser.py
@@ -15,6 +15,9 @@ from .expressions import bot, top, reg, ext
 # -------------------
 
 import pyparsing as pp
+if not hasattr(pp, 'operatorPrecedence'):
+  # backward compatibility, needed since version 3.0.x
+  pp.operatorPrecedence = pp.infixNotation
 
 # terminals:
 p_bottop = pp.oneOf("⊥ T")
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant