Skip to content

Commit

Permalink
Merge baee51c into 13b9e5e
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Nov 15, 2018
2 parents 13b9e5e + baee51c commit 468c17d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions nineml/abstraction/expressions/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sympy
from sympy.parsing.sympy_parser import (
parse_expr as sympy_parse, standard_transformations, convert_xor)
from sympy.parsing.sympy_tokenize import NAME, OP
from tokenize import NAME, OP
import operator
import re
from nineml.exceptions import NineMLMathParseError
Expand Down Expand Up @@ -118,14 +118,10 @@ def _preprocess(self, tokens):
# Unescape relationals escaped in _parse_relationals
elif tokval.endswith('__'):
tokval = tokval[:-2]
# Handle multiple negations
elif toknum == OP and tokval.startswith('!'):
# NB: Multiple !'s are grouped into the one token
assert all(t == '!' for t in tokval)
if len(tokval) % 2:
tokval = '~' # odd number of negation symbols
else:
continue # even number of negation symbols, cancel out
# Handle C89 negations
elif tokval == '!':
toknum = OP
tokval = '~'
result.append((toknum, tokval))
new_result = []
# Loop through pairwise combinations
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'future>=0.16.0',
'h5py>=2.7.0',
'PyYAML>=3.1',
'sympy>=1.1'],
'sympy>=1.2'],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, <4',
tests_require=['nose', 'numpy']
)

0 comments on commit 468c17d

Please sign in to comment.