Пример #1
0
 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 + ' ] '
Пример #2
0
 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 = ""
Пример #3
0
 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) + ' '
Пример #4
0
 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) + ' '
Пример #5
0
 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) + ' '
Пример #6
0
 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) + ' '
Пример #7
0
 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) + ' '
Пример #8
0
 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) + ' '
Пример #9
0
 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) + ' '
Пример #10
0
 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) + ' '
Пример #11
0
 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) + ' '
Пример #12
0
 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) + ' '
Пример #13
0
 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) + ' '
Пример #14
0
 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) + ' '
Пример #15
0
 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) + ' '
Пример #16
0
 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) + ' '
Пример #17
0
 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) + ' '
Пример #18
0
 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) + ' '