(name, obj)
| 93 | ) |
| 94 | |
| 95 | def asdl_of(name, obj): |
| 96 | if isinstance(obj, asdl.Product) or isinstance(obj, asdl.Constructor): |
| 97 | fields = ", ".join(map(str, obj.fields)) |
| 98 | if fields: |
| 99 | fields = "({})".format(fields) |
| 100 | return "{}{}".format(name, fields) |
| 101 | else: |
| 102 | if is_simple(obj): |
| 103 | types = " | ".join(type.name for type in obj.types) |
| 104 | else: |
| 105 | sep = "\n{}| ".format(" " * (len(name) + 1)) |
| 106 | types = sep.join( |
| 107 | asdl_of(type.name, type) for type in obj.types |
| 108 | ) |
| 109 | return "{} = {}".format(name, types) |
| 110 | |
| 111 | class EmitVisitor(asdl.VisitorBase): |
| 112 | """Visit that emits lines""" |
no test coverage detected
searching dependent graphs…