Files
smnp-py/smnp/runtime/tools.py
Bartłomiej Pluta 34a0eda199 Reformat evaluator #1
2019-07-04 17:57:12 +02:00

14 lines
389 B
Python

def flatListNode(listNode):
if len(listNode.children[0].children) == 1:
return []
return _flatListNode(listNode.children[0], [])
def _flatListNode(listItemNode, list = []):
if len(listItemNode.children) == 2:
value = listItemNode.children[0]
next = listItemNode.children[1]
list.append(value)
_flatListNode(next, list)
return list