def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.primetype():
         return self.visit(ctx.primetype())
     elif ctx.arraypointer():
         return self.visit(ctx.arraypointer())
     else:
         return VoidType()
Пример #2
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.VOID():
         return VoidType()
     elif ctx.LS():
         return ArrayPointerType(self.visit(ctx.primitive_type()))
     else:
         return self.visit(ctx.primitive_type())
Пример #3
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.INTTYPE():
         return IntType
     elif ctx.FLOATLIT():
         return FloatType
     elif ctx.STRINGLIT():
         return StringType
     else:
         return BoolType
Пример #4
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.VOIDTYPE():
         return VoidType()
     else:
         return self.visit(ctx.getChild(0))
Пример #5
0
 def visitMctype(self,ctx:MCParser.MctypeContext):
     if ctx.INTTYPE():
         return IntType()
     else:
         return FloatType()
Пример #6
0
 def visitMctype(self, ctx:MCParser.MctypeContext):
     return 5 + self.visitMctype(ctx.mctype()) if ctx.getChildCount() != 1 else 1
Пример #7
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     return 1 + self.visitMctype(ctx.mctype()) if ctx.mctype() else 0
Пример #8
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.getChildCount() == 6:
         return 0  # return number of leaf nodes from the third right hand side
     else:
         return 0  # return number of leaf nodes from the first or second right hand side
Пример #9
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     # return IntType() or FloatType()
     if ctx.INTTYPE(): return IntType()
     if ctx.FLOATTYPE(): return FloatType()
Пример #10
0
 def visitMctype(self,ctx:MCParser.MctypeContext):
     return IntType() if (ctx.INTTYPE()) else FloatType()