- absyn.printpy("# module_1")
- params = p[7]
- clsname = [Leaf(token.NAME, 'class'),
- Leaf(token.NAME, p[4], prefix=' '),
- Leaf(token.COLON, ':')]
- pass_stmt = Node(syms.pass_stmt, [Leaf(token.NAME, "pass"),])
- if params:
- params = [Leaf(token.LPAR, '(')] + params + [Leaf(token.RPAR, ')')]
- fn = [Leaf(token.NAME, 'def'),
- Leaf(token.NAME, '__init__', prefix=' '),
- Node(syms.parameters, params),
- Leaf(token.COLON, ':')]
- fndef = Node(syms.funcdef, fn)
- stmts = Node(syms.stmt, [fndef])
- else:
- stmts = Node(syms.small_stmt, [pass_stmt, Leaf(token.NEWLINE, '\n')])
- stmts = Node(syms.stmt, [stmts])
-
- ports = p[8]
- for port in ports:
- stmts.children.append(Leaf(token.INDENT, indent*2))
- stmts.children.append(Leaf(token.STRING, port))
-
- suite = Node(syms.suite, [Leaf(token.NEWLINE, '\n'),
- Leaf(token.INDENT, ' '),
- stmts,
- Leaf(token.DEDENT, '')
- ])
- clsdecl = Node(syms.classdef, clsname + [suite])
- clsdecl = Node(syms.compound_stmt, [clsdecl])
- absyn.printpy("#clsdecl"+ repr(clsdecl))
- absyn.printpy("#clsstr:")
- absyn.printpy(str(clsdecl))