Reformat evaluator #1
This commit is contained in:
13
smnp/runtime/tools.py
Normal file
13
smnp/runtime/tools.py
Normal file
@@ -0,0 +1,13 @@
|
||||
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
|
||||
Reference in New Issue
Block a user