Exemplo n.º 1
0
def cleanup_sequence(rule, lst):
    if len(lst) == 1: return lst[0]
    return parsetree.Sequence(rule, *tuple(lst))
Exemplo n.º 2
0
def cleanup_choice(rule, lst):
    if len(lst) == 0: return parsetree.Sequence(rule, [])
    if len(lst) == 1: return lst[0]
    return parsetree.Choice(rule, *tuple(lst))