Skip to content

Logics.dump() should not use print #40

@phorward

Description

@phorward

Here's a better implementation by @bb-mausbrand

def logics_dump(l):
    def _dump(a, level=0):
        if a.emit:
            res = f"""{' '*level}{a.emit}"""
            if a.match and a.match != a.emit:
                res += f""" {a.match}"""
            yield res 
        level += 1
        for child in a.children:
            if child:
                yield from _dump(child, level=level)
    return list(_dump(l.ast))

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions