コード例 #1
0
ファイル: grammar.py プロジェクト: jepler/yapps
def cleanup_sequence(rule, lst):
    if len(lst) == 1: return lst[0]
    return parsetree.Sequence(rule, *tuple(lst))
コード例 #2
0
ファイル: grammar.py プロジェクト: jepler/yapps
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))