예제 #1
0
    def visitArray(self, ctx: BKITParser.ArrayContext):
        ret = []
        if ctx.array_elelist():
            ret = ctx.array_elelist().accept(self)


        return ArrayLiteral(ret)
예제 #2
0
 def visitArray(self, ctx: BKITParser.ArrayContext):
     if ctx.INTERGER():
         return ArrayLiteral(
             [IntLiteral(int(x.getText(), 0)) for x in ctx.INTERGER()])
     if ctx.FLOAT():
         return ArrayLiteral(
             [FloatLiteral(float(x.getText())) for x in ctx.FLOAT()])
     if ctx.STRING():
         return ArrayLiteral(
             [StringLiteral(x.getText()) for x in ctx.STRING()])
     if ctx.BOOLEAN():
         return ArrayLiteral(
             [BooleanLiteral(x.getText() == 'True') for x in ctx.BOOLEAN()])
     return ArrayLiteral([self.visit(x) for x in ctx.array()])
예제 #3
0
 def visitArray(self, ctx: BKITParser.ArrayContext):
     array = []
     for x in ctx.literal():
         lit = self.visit(x)
         if type(lit) == type([]):
             array = array + lit
         else:
             array.append(lit)
     return ArrayLiteral(array)
예제 #4
0
 def visitArray(self, ctx: BKITParser.ArrayContext):
     return [ctx.INTLIT().getText()]
예제 #5
0
 def visitArray(self, ctx: BKITParser.ArrayContext):
     if ctx.getChildCount() == 2: return ArrayLiteral([])
     else: return ArrayLiteral(self.visit(ctx.unit_array()))
예제 #6
0
 def visitArray(self, ctx: BKITParser.ArrayContext):
     listOfArrayLit = [self.visit(i) for i in ctx.arrayList()]
     return ArrayLiteral(listOfArrayLit)
예제 #7
0
 def visitArray(self,ctx:BKITParser.ArrayContext):
     if ctx.DECIMAL():
         return IntLiteral(int(ctx.DECIMAL().getText(),0))
     elif ctx.OCTAL():
         return IntLiteral(int(ctx.OCTAL().getText(),0))
     elif ctx.HEXA():
         return IntLiteral(int(ctx.HEXA().getText(),0))
     elif ctx.FLOAT():
         return FloatLiteral(float(ctx.FLOAT().getText()))
     elif ctx.STRING():
         return StringLiteral(ctx.STRING().getText())
     elif ctx.BOOL():
         return BooleanLiteral(ctx.BOOL().getText())
     elif ctx.array_list():
         return self.visit(ctx.array_list())