mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Add fix for Region.from_expression case with )(
This commit is contained in:
parent
5f31e12443
commit
f9ba350e1c
1 changed files with 9 additions and 3 deletions
|
|
@ -116,14 +116,20 @@ class Region(ABC):
|
|||
# For everything other than intersection, add the operator
|
||||
# to the list of tokens
|
||||
tokens.append(expression[i])
|
||||
|
||||
# If two parentheses appear immediately adjacent to one
|
||||
# another, we need an intersection between them
|
||||
if expression[i:i+2] == ')(':
|
||||
tokens.append(' ')
|
||||
else:
|
||||
# Find next non-space character
|
||||
while expression[i+1] == ' ':
|
||||
i += 1
|
||||
|
||||
# If previous token is a halfspace or right parenthesis and next token
|
||||
# is not a left parenthese or union operator, that implies that the
|
||||
# whitespace is to be interpreted as an intersection operator
|
||||
# If previous token is a halfspace or right parenthesis and
|
||||
# next token is not a left parenthesis or union operator,
|
||||
# that implies that the whitespace is to be interpreted as
|
||||
# an intersection operator
|
||||
if (i_start >= 0 or tokens[-1] == ')') and \
|
||||
expression[i+1] not in ')|':
|
||||
tokens.append(' ')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue