Beispiel #1
0
    def visitVariable(self, ctx: BKITParser.VariableContext):
        id = Id(ctx.ID().getText())
        init = []
        if ctx.INT_LIT():
            init = list(
                map(lambda lit: self.visitINT_LIT(lit.getText()),
                    ctx.INT_LIT()))

        return (id, init)
Beispiel #2
0
    def visitVariable(self, ctx: BKITParser.VariableContext):
        varDimen = []
        varInit = self.visit(ctx.literal()) if ctx.literal() else None
        variable = Id(ctx.ID().getText())
        if ctx.dimen():
            for x in ctx.dimen():
                varDimen.append(self.visitDimen(x))

        return [(variable, varDimen, varInit)]
Beispiel #3
0
 def visitVariable(self, ctx: BKITParser.VariableContext):
     initValue = None
     if ctx.literal():
         initValue = self.visit(ctx.literal())
     if ctx.ID():
         return VarDecl(Id(ctx.ID().getText()), [], initValue)
     else:
         dimenArray = []
         dimenArray = self.visit(ctx.compositevar())
         return VarDecl(Id(dimenArray[0].getText()), dimenArray[1:],
                        initValue)
    def visitVariable(self, ctx: BKITParser.VariableContext):
        #One value
        if ctx.scalar():
            variable, varDimen = ctx.scalar().accept(self)
            varInit = None
            if ctx.literal():
                varInit = ctx.literal().accept(self)

            return VarDecl(variable, varDimen, varInit)

        if ctx.composite():
            variable, varDimen = ctx.composite().accept(self)
            varInit = None
            if ctx.literal():
                varInit = ctx.literal().accept(self)

            return VarDecl(variable, varDimen, varInit)
 def visitVariable(self,ctx:BKITParser.VariableContext):
     return (Id(ctx.ID().getText()), ctx.dimensions().accept(self) )
 def visitVariable(self, ctx: BKITParser.VariableContext):
     variable = Id(ctx.ID().getText())
     varDimen = self.visit(ctx.dimension()) if ctx.dimension() else []
     varInit = self.visit(ctx.literal()) if ctx.literal() else None
     return VarDecl(variable, varDimen, varInit)
Beispiel #7
0
 def visitVariable(self, ctx: BKITParser.VariableContext):
     return [self.visit(ctx.getChild(0))]
Beispiel #8
0
 def visitVariable(self, ctx: BKITParser.VariableContext):
     if ctx.ID():
         return Id(ctx.ID().getText())
     return self.visit(ctx.elmexp())
Beispiel #9
0
 def visitVariable(self,ctx:BKITParser.VariableContext):
     if ctx.scalar_variable():
         return self.visit(ctx.scalar_variable())
     else: return self.visit(ctx.composite())