Beispiel #1
0
 def visitVardecl(self,ctx:MCParser.VardeclContext):
     arr = []
     typ = ctx.mctype().accept(self)
     for x in ctx.manyvar().accept(self):
         if len(x) == 1:
             arr.append(str(VarDecl(typ, x)))
         else:
             arr.append(str(VarDecl(ArrayType(typ, x[1]), x[0])))
     return arr # return the list of VarDecl
Beispiel #2
0
 def visitVardecl(self, ctx:MCParser.VardeclContext):
     return 1 + self.visitMctype(ctx.mctype()) + self.visitIds(ctx.ids())
Beispiel #3
0
 def visitVardecl(self, ctx: MCParser.VardeclContext):
     return VarDecl(ctx.mctype().accept(self), ctx.ids().accept(self))
Beispiel #4
0
 def visitVardecl(self, ctx: MCParser.VardeclContext):
     return VarDecl(self.visit(ctx.mctype()),
                    self.visit(ctx.ids()))  # return VarDecl object
Beispiel #5
0
 def visitVardecl(self, ctx: MCParser.VardeclContext):
     lst = ctx.ids().accept(self)
     typ = ctx.mctype().accept(self)
     return [VarDecl(typ, i)
             for i in lst]  # return the list of VarDecl objects
Beispiel #6
0
 def visitVardecl(self,ctx:MCParser.VardeclContext):
     typ = self.visit(ctx.mctype())
     return None # return the list of VarDecl