Skip to content
Snippets Groups Projects
Commit 04ecc8b9 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Made 'words' variable static.

parent 9084b7f4
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,10 @@ class Parser(BisonParser):
docstrings. Scanner rules are in the 'lexscript' attribute.
"""
# Words to be ignored by preprocessor
words = zip(*filter(lambda (s, op): TOKEN_MAP[op] == 'FUNCTION', \
OP_MAP.iteritems()))[0] + ('raise', 'graph')
# Output directory of generated pybison files, including a trailing slash.
buildDirectory = PYBISON_BUILD + '/'
......@@ -154,14 +158,11 @@ class Parser(BisonParser):
+ '|([a-z])\s*([0-9])' # match: a4 result: a ^ 4
+ '|([0-9])\s+([0-9]))') # match: 4 4 result: 4 * 4
words = zip(*filter(lambda (s, op): TOKEN_MAP[op] == 'FUNCTION', \
OP_MAP.iteritems()))[0] + ('raise', 'graph')
def preprocess_data(match):
left, right = filter(None, match.groups())
# Filter words (otherwise they will be preprocessed as well)
if left + right in words:
if left + right in Parser.words:
return left + right
# If all characters on the right are numbers. e.g. "a4", the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment