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()
Example #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())
Example #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
Example #4
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     if ctx.VOIDTYPE():
         return VoidType()
     else:
         return self.visit(ctx.getChild(0))
Example #5
0
 def visitMctype(self,ctx:MCParser.MctypeContext):
     if ctx.INTTYPE():
         return IntType()
     else:
         return FloatType()
Example #6
0
 def visitMctype(self, ctx:MCParser.MctypeContext):
     return 5 + self.visitMctype(ctx.mctype()) if ctx.getChildCount() != 1 else 1
Example #7
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     return 1 + self.visitMctype(ctx.mctype()) if ctx.mctype() else 0
Example #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
Example #9
0
 def visitMctype(self, ctx: MCParser.MctypeContext):
     # return IntType() or FloatType()
     if ctx.INTTYPE(): return IntType()
     if ctx.FLOATTYPE(): return FloatType()
Example #10
0
 def visitMctype(self,ctx:MCParser.MctypeContext):
     return IntType() if (ctx.INTTYPE()) else FloatType()