Exemplo n.º 1
0
 def handleNode(self, row):
     lineType = getCSVRowType(row)
     if self._isInFunction():
         self.handleNodeInFunction(row)
     else:
         if lineType == 'func':
             self._initCFG(row)
Exemplo n.º 2
0
 def enterScope(self, row):
     # TODO: simplify: just push nodeId and row
     currentNodeId = self.currentCFG.getCurrentNodeId()
     level = int(getCSVRowLevel(row))
     nodeType = getCSVRowType(row)
     self.scopeStack.append((currentNodeId, nodeType, level))
     self.currentLevel = level + 1
Exemplo n.º 3
0
 def handleNode(self, row):
     lineType = getCSVRowType(row)
     if self._isInFunction():
         self.handleNodeInFunction(row)
     else:
         if lineType == "func":
             self._initCFG(row)
Exemplo n.º 4
0
 def enterScope(self, row):
     # TODO: simplify: just push nodeId and row
     currentNodeId = self.currentCFG.getCurrentNodeId()
     level = int(getCSVRowLevel(row))
     nodeType = getCSVRowType(row)
     self.scopeStack.append((currentNodeId, nodeType, level))
     self.currentLevel = level + 1
Exemplo n.º 5
0
 def handleControlStatement(self, row, level):
     currentNodeId = self.currentCFG.getCurrentNodeId()
     rowType = getCSVRowType(row)
     
     if rowType == returnNode:
         self.returnStack.append(currentNodeId)
     elif rowType in breakOrContinue:
         self.breakContinueStack.append((currentNodeId, rowType, level))
     elif rowType == gotoNode:
         self.gotoList.append((currentNodeId, row))
     
     self.currentCFG.appendToLatestNode(row)
Exemplo n.º 6
0
    def handleControlStatement(self, row, level):
        currentNodeId = self.currentCFG.getCurrentNodeId()
        rowType = getCSVRowType(row)

        if rowType == returnNode:
            self.returnStack.append(currentNodeId)
        elif rowType in breakOrContinue:
            self.breakContinueStack.append((currentNodeId, rowType, level))
        elif rowType == gotoNode:
            self.gotoList.append((currentNodeId, row))

        self.currentCFG.appendToLatestNode(row)
Exemplo n.º 7
0
 def handleScopeIncreaseNode(self, row, level):
     
     currentNodeId = self.currentCFG.getCurrentNodeId()
     nodeType = getCSVRowType(row)
     currentNode = self.currentCFG.getNodeById(currentNodeId)
     
     if nodeType == elseNode:
         self.handleElseNode(currentNodeId, row)
         return
     
     if currentNode.rows != [] and nodeType != conditionNode:
         self.createAndConnectNode(row)
     else:
         self.currentCFG.appendToLatestNode(row)
     
     self.enterScope(row)
Exemplo n.º 8
0
    def handleScopeIncreaseNode(self, row, level):

        currentNodeId = self.currentCFG.getCurrentNodeId()
        nodeType = getCSVRowType(row)
        currentNode = self.currentCFG.getNodeById(currentNodeId)

        if nodeType == elseNode:
            self.handleElseNode(currentNodeId, row)
            return

        if currentNode.rows != [] and nodeType != conditionNode:
            self.createAndConnectNode(row)
        else:
            self.currentCFG.appendToLatestNode(row)

        self.enterScope(row)
Exemplo n.º 9
0
 def isLabelNode(self, row):
     return getCSVRowType(row) == labelNode
Exemplo n.º 10
0
 def isControlStatementNode(self, row):
     return getCSVRowType(row) in controlStatementNodes
Exemplo n.º 11
0
 def isScopeIncreaseNode(self, row):
     return getCSVRowType(row) in scopeIncreaseNodes
Exemplo n.º 12
0
 def isLabelNode(self, row):
     return getCSVRowType(row) == labelNode
Exemplo n.º 13
0
 def isControlStatementNode(self, row):
     return getCSVRowType(row) in controlStatementNodes
Exemplo n.º 14
0
 def isScopeIncreaseNode(self, row):
     return getCSVRowType(row) in scopeIncreaseNodes