else:
stack[level].extend(l)
else:
- stack[level].append(l)
+ if opconvert and stack[level] and stack[level][-1] == '||':
+ stack[level][-1] = ['||'] + l
+ else:
+ stack[level].append(l)
if l and not ignore:
#The current list is not empty and we don't want to ignore it because
"|| ( A B ) C",
opconvert = True,
expected_result = [['||', 'A', 'B'], 'C']),
-
- # ['A', '||', ['B', 'C']] != ['A', ['||', 'B', 'C']]
- #UseReduceTestCase(
- # "A || ( B C )",
- # opconvert = True,
- # expected_result = ['A', ['||', 'B', 'C']]),
+ UseReduceTestCase(
+ "A || ( B C )",
+ opconvert = True,
+ expected_result = ['A', ['||', 'B', 'C']]),
UseReduceTestCase(
"|| ( A )",