def visitArray_lit(self, ctx: BKITParser.Array_litContext): res = [] indexINT = 0 indexFLOAT = 0 indexSTRING = 0 indexBOOL = 0 for i in range(1, ctx.getChildCount() - 1, 2): temp = ctx.getChild(i) if isinstance(temp, BKITParser.Array_litContext): res = res + [self.visit(ctx.getChild(i))] else: if ctx.getChild(i) == ctx.INT_LIT(indexINT): res = res + [ IntLiteral( self.IntegerStandardization( ctx.INT_LIT(indexINT).getText())) ] indexINT += 1 elif ctx.getChild(i) == ctx.FLOAT_LIT(indexFLOAT): res = res + [ FloatLiteral(float( ctx.FLOAT_LIT(indexFLOAT).getText())) ] indexFLOAT += 1 elif ctx.getChild(i) == ctx.BOOL_LIT(indexBOOL): temp = ctx.BOOL_LIT(indexBOOL).getText() if temp == 'True': res = res + [BooleanLiteral(True)] else: res = res + [BooleanLiteral(False)] indexBOOL += 1 else: res = res + [ StringLiteral(ctx.STRING_LIT(indexSTRING).getText()) ] indexSTRING += 1 return ArrayLiteral(res)
def visitArray_lit(self, ctx: BKITParser.Array_litContext): return ArrayLiteral(self.visit(ctx.getChild(1)))