def visit_cpp_reference(self, expr, context, ident, **kwargs): ctx = [] CppVisitor.visit_cpp_reference(self, expr, context=ctx, ident=ident, **kwargs) context.append('&(' + ''.join(ctx) + ')')
def visit_cpp_indirection(self, expr, context, ident, **kwargs): ctx = [] CppVisitor.visit_cpp_indirection(self, expr, context=ctx, ident=ident, **kwargs) context.append('*(' + ''.join(ctx) + ')')
def visit_cpp_assignment(self, expr, context, ident, **kwargs): assert(expr.lhs is not None) assert(expr.rhs is not None) ctx = [] CppVisitor.visit_cpp_assignment(self, expr, ident=0, context=ctx, **kwargs) string = ctx[0] + CppSerializerVisitor.ident + '=' \ + CppSerializerVisitor.ident + ctx[1] context.append(self.get_ident(ident) + string)
def visit_cpp_block(self, expr, context, ident, **kwargs): ctx = [] ident = ident + (1 if expr.scoped else 0) CppVisitor.visit_cpp_block(self, expr, ident=ident, context=ctx, **kwargs) if ctx: block = string_semicolon(expr, ctx) if expr.scoped: lblockident = self.get_ident(ident - 1) context.append('{\n' + '\n'.join(block) + '\n' + lblockident + '}') else: context.append('\n'.join(block)) elif expr.scoped: context.append('{}')
def visit_cpp_return(self, expr, context, **kwargs): ctx = [] CppVisitor.visit_cpp_return(self, expr, context=ctx, **kwargs) context.append('return ' + ' '.join(ctx))
def visit_cpp_or(self, expr, context, **kwargs): ctx = [] CppVisitor.visit_cpp_or(self, expr, context=ctx, **kwargs) context.append('(' + ' || '.join(ctx) + ')')