summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/spec.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 7c09af4c21..16b61236a9 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2015,10 +2015,13 @@ class SpecLexer(spack.parse.Lexer):
(r'\s+', lambda scanner, val: None)])
+# Lexer is always the same for every parser.
+_lexer = SpecLexer()
+
class SpecParser(spack.parse.Parser):
def __init__(self):
- super(SpecParser, self).__init__(SpecLexer())
+ super(SpecParser, self).__init__(_lexer)
self.previous = None
def do_parse(self):