| 238 | self.emit("", depth) |
| 239 | |
| 240 | class SequenceDefVisitor(EmitVisitor): |
| 241 | def visitModule(self, mod): |
| 242 | for dfn in mod.dfns: |
| 243 | self.visit(dfn) |
| 244 | |
| 245 | def visitType(self, type, depth=0): |
| 246 | self.visit(type.value, type.name, depth) |
| 247 | |
| 248 | def visitSum(self, sum, name, depth): |
| 249 | if is_simple(sum): |
| 250 | return |
| 251 | self.emit_sequence_constructor(name, depth) |
| 252 | |
| 253 | def emit_sequence_constructor(self, name,depth): |
| 254 | ctype = get_c_type(name) |
| 255 | self.emit("""\ |
| 256 | typedef struct { |
| 257 | _ASDL_SEQ_HEAD |
| 258 | %(ctype)s typed_elements[1]; |
| 259 | } asdl_%(name)s_seq;""" % locals(), reflow=False, depth=depth) |
| 260 | self.emit("", depth) |
| 261 | self.emit("asdl_%(name)s_seq *_Py_asdl_%(name)s_seq_new(Py_ssize_t size, PyArena *arena);" % locals(), depth) |
| 262 | self.emit("", depth) |
| 263 | |
| 264 | def visitProduct(self, product, name, depth): |
| 265 | self.emit_sequence_constructor(name, depth) |
| 266 | |
| 267 | class StructVisitor(EmitVisitor): |
| 268 | """Visitor to generate typedefs for AST.""" |
no outgoing calls
no test coverage detected
searching dependent graphs…