Пример #1
0
 def print(self):
     TokList.printIndent()
     print('while ', end='')
     self.cond.print()
     print(' begin')
     TokList.increaseIndent()
     self.stmt_seq.print()
     TokList.decreaseIndent()
     TokList.printIndent()
     print('endwhile;')
Пример #2
0
 def print(self):
     print("program")
     TokList.increaseIndent()
     self.decl_seq.print()
     TokList.decreaseIndent()
     print("begin")
     TokList.increaseIndent()
     self.stmt_seq.print()
     TokList.decreaseIndent()
     print("end")
Пример #3
0
 def print(self):
     TokList.printIndent()
     print('if ', end='')
     self.cond.print()
     print(' then')
     TokList.increaseIndent()
     self.stmt_seq_then.print()
     if self.stmt_seq_else is not None:
         TokList.decreaseIndent()
         TokList.printIndent()
         print('else')
         TokList.increaseIndent()
         self.stmt_seq_else.print()
     TokList.decreaseIndent()
     TokList.printIndent()
     print('endif;')
Пример #4
0
 def print(self):
     TokList.printIndent()
     print('case ', end='')
     self.id.print()
     print(' of')
     TokList.increaseIndent()
     TokList.printIndent()
     self.case_line.print()
     #Necessary for new line printings
     print()
     TokList.printIndent()
     print('else ', end='')
     self.expr.print()
     print()
     TokList.decreaseIndent()
     TokList.printIndent()
     print('end;')