You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Formulae such as --("A"="B") cause IndexError in koala/ast/__init__.py:build_ast due to "double operator"
Workaround until fix: replace -- with 1* in workbook
def build_ast(expression, debug = False):
"""build an AST from an Excel formula expression in reverse polish notation"""
#use a directed graph to store the tree
G = DiGraph()
stack = []
for n in expression:
# Since the graph does not maintain the order of adding nodes/edges
# add an extra attribute 'pos' so we can always sort to the correct order
if isinstance(n,OperatorNode):
if n.ttype == "operator-infix":
arg2 = stack.pop()
arg1 = stack.pop()
# Hack to write the name of sheet in 2argument address
if(n.tvalue == ':'):
if '!' in arg1.tvalue and arg2.ttype == 'operand' and '!' not in arg2.tvalue:
arg2.tvalue = arg1.tvalue.split('!')[0] + '!' + arg2.tvalue
G.add_node(arg1,pos = 1)
G.add_node(arg2,pos = 2)
G.add_edge(arg1, n)
G.add_edge(arg2, n)
else:
> arg1 = stack.pop()
E IndexError: pop from empty list
.venv/lib/python3.7/site-packages/koala/ast/__init__.py:295: IndexError
The text was updated successfully, but these errors were encountered:
Formulae such as
--("A"="B")
causeIndexError
inkoala/ast/__init__.py:build_ast
due to "double operator"Workaround until fix: replace
--
with1*
in workbookExample minimum reproduction: double_minus.xlsx
The text was updated successfully, but these errors were encountered: