コード例 #1
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     if ctx.BREAK():
         return Break
     elif ctx.CONTINUE():
         return Continue
     elif ctx.RETURN():
         return Return
     elif ctx.call():
         return self.visit(ctx.call())
     elif ctx.expr():
         return self.visit(ctx.expr())
     elif ctx.ifstate():
         return self.visit(ctx.ifstate())
     elif ctx.whilestate():
         return self.visit(ctx.whilestate())
     elif ctx.forstate():
         return self.visit(ctx.forstate())
     else:
         return self.visit(ctx.blockstate())
コード例 #2
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     return self.visit(ctx.getChild(0))
コード例 #3
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     if ctx.if_stmt(): return self.visit(ctx.if_stmt())
     elif ctx.for_stmt(): return self.visit(ctx.for_stmt())
     elif ctx.do_while_stmt(): return self.visit(ctx.do_while_stmt())
     elif ctx.break_stmt(): return self.visit(ctx.break_stmt())
     elif ctx.cont_stmt(): return self.visit(ctx.cont_stmt())
     elif ctx.return_stmt(): return self.visit(ctx.return_stmt())
     elif ctx.expr_stmt(): return self.visit(ctx.expr_stmt())
     else: return self.visit(ctx.block_stmt())
コード例 #4
0
ファイル: ASTGeneration.py プロジェクト: nhthang99/cse-ppl
 def visitStmt(self, ctx:MCParser.StmtContext):
     if ctx.exp():
         return self.visitExp(ctx.exp())
     else:
         return self.visitChildren(ctx)
コード例 #5
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     if ctx.if_stmt():
         return self.visit(ctx.if_stmt())
     if ctx.for_stmt():
         return self.visit(ctx.for_stmt())
     if ctx.while_stmt():
         return self.visit(ctx.while_stmt())
     if ctx.break_stmt():
         return self.visit(ctx.break_stmt())
     if ctx.continue_stmt():
         return self.visit(ctx.continue_stmt())
     if ctx.return_stmt():
         return self.visit(ctx.return_stmt())
     if ctx.exp_stmt():
         return self.visit(ctx.exp_stmt())
     if ctx.block_stmt():
         return self.visit(ctx.block_stmt())
コード例 #6
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     #stmt: ifStmt | dowhileStmt | forStmt | breakStmt | contStmt | returnStmt | expStmt | blockStmt ;
     return self.visit(ctx.getChild(0))
コード例 #7
0
 def visitStmt(self, ctx: MCParser.StmtContext):
     return [self.visit(ctx.getChild(0))
             ]  # must convert to list like var_dec