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
파일: Count.py 프로젝트: nhthang99/cse-ppl
 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()