def visitOperand(self, ctx:MCParser.OperandContext):
     value = ctx.getChild(0).getText()
     if ctx.INTLIT():
         return IntLiteral(int(value))
     elif ctx.FLOATLIT():
         return FloatLiteral(float(value))
     elif ctx.STRINGLIT():
         return StringLiteral(value)
     elif ctx.BOOLLIT():
         if value == "true":
             return BooleanLiteral(True)
         else:
             return BooleanLiteral(False)
     else:
         return Id(ctx.ID().getText())
Ejemplo n.º 2
0
 def visitOperand(self, ctx: MCParser.OperandContext):
     return self.visit(ctx.getChild(0))