cetus.hir
Class ExceptionHandler

java.lang.Object
  extended by cetus.hir.Statement
      extended by cetus.hir.CompoundStatement
          extended by cetus.hir.ExceptionHandler
All Implemented Interfaces:
Annotatable, Printable, SymbolTable, Traversable, java.lang.Cloneable

public class ExceptionHandler
extends CompoundStatement

Represents an exception handling block (try-catch-finally block) in a C++ or Java program. This class is derived from CompoundStatement because in C++ it is legal to have a procedure whose body is an exception handler. An exception handler has a try block followed by at least one catch block followed optionally by a finally block.


Field Summary
 
Fields inherited from class cetus.hir.Statement
annotations, children, line_number, object_print_method, parent
 
Constructor Summary
ExceptionHandler(CompoundStatement try_block, java.util.List catch_blocks)
          Creates an exception handler.
ExceptionHandler(CompoundStatement try_block, java.util.List catch_blocks, CompoundStatement finally_block)
          Creates an exception handler.
 
Method Summary
 void addCatchBlock(CompoundStatement catch_block)
          Appends a catch block to the list of catch blocks.
 void addFinallyBlock(CompoundStatement finally_block)
           
static void defaultPrint(ExceptionHandler stmt, java.io.OutputStream stream)
          Prints a statement to a stream.
 java.lang.String toString()
          Returns a string representation of this compound statement.
 
Methods inherited from class cetus.hir.CompoundStatement
addDeclaration, addDeclarationAfter, addDeclarationBefore, addStatement, addStatementAfter, addStatementBefore, clone, countStatements, defaultPrint, findSymbol, getParentTables, getTable, removeChild
 
Methods inherited from class cetus.hir.Statement
annotate, annotateAfter, annotateBefore, annotationToString, containsAnnotation, detach, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getChildren, getParent, getProcedure, print, removeAnnotations, removeAnnotations, setChild, setLineNumber, setParent, setPrintMethod, swapWith, toAnnotatedString, verify, where
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExceptionHandler

public ExceptionHandler(CompoundStatement try_block,
                        java.util.List catch_blocks)
Creates an exception handler.


ExceptionHandler

public ExceptionHandler(CompoundStatement try_block,
                        java.util.List catch_blocks,
                        CompoundStatement finally_block)
Creates an exception handler.

Method Detail

addCatchBlock

public void addCatchBlock(CompoundStatement catch_block)
Appends a catch block to the list of catch blocks.

Parameters:
catch_block - The block to add.

addFinallyBlock

public void addFinallyBlock(CompoundStatement finally_block)

defaultPrint

public static void defaultPrint(ExceptionHandler stmt,
                                java.io.OutputStream stream)
Prints a statement to a stream.

Parameters:
stmt - The statement to print.
stream - The stream on which to print the statement.

toString

public java.lang.String toString()
Description copied from class: CompoundStatement
Returns a string representation of this compound statement. Printing of children's annotations are controlled in this method.

Overrides:
toString in class CompoundStatement