Skip to content

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

@LRGH

Description

@LRGH

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions