def visitIf_statement(self, ctx): self.rawCFG = self.rawCFG + '[ if_' node = MyNode(self.nodeIdCounter, ctx.children[1]) # if condition self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' ' self.rawCFG = self.rawCFG + '[ ' self.visit(ctx.children[3]) # if-true self.rawCFG = self.rawCFG + ' ] ' childCount = ctx.getChildCount() i = 4 while i < childCount - 2: ruleName = self.utility.helper.getRuleName(ctx.children[i]) if ruleName == 'elsif_part': self.rawCFG = self.rawCFG + '[ elsif_' node = MyNode(self.nodeIdCounter, ctx.children[i].children[1]) # elsif condition self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' ' self.rawCFG = self.rawCFG + '[ ' self.visit(ctx.children[i].children[3]) # elsif-true self.rawCFG = self.rawCFG + ' ] ] ' i = i + 1 # else parrt ruleName = self.utility.helper.getRuleName(ctx.children[childCount-3]) if ruleName == 'else_part': self.rawCFG = self.rawCFG + '[ ' self.visit(ctx.children[childCount-3].children[1]) # body of else self.rawCFG = self.rawCFG + ' ] ' else: node = MyNode(self.nodeIdCounter, None) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + ' [ '+ str(node.id) +' ] ' # empty body of else self.rawCFG = self.rawCFG + ' ] '
def __init__(self, parser, cfg, utility): self.cfg = cfg self.parser = parser self.utility = utility self.nodeIdCounter = 0 self.varDict = dict() self.cfg.addNode(MyNode(self.nodeIdCounter, None)) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = ""
def visitWait_nowait_part(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitCursor_declaration(self, ctx): # TODO: discussion for further procedure : CURSOR node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitClose_statement(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitParameter(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitVariable_declaration(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitGeneral_table_ref(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitStatic_returning_clause(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitSelect_statement(self, ctx): # TODO: discussion for further procedure : SELECT_STATEMENT node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitLock_table_element(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitMerge_insert_clause(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitSelected_tableview(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitMerge_update_delete_part(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitFor_update_options(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitOrder_by_elements(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitException_handler(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '
def visitFunction_call(self, ctx): node = MyNode(self.nodeIdCounter, ctx) self.cfg.addNode(node) self.nodeIdCounter = self.nodeIdCounter + 1 self.rawCFG = self.rawCFG + str(node.id) + ' '