Packages, Compilation Units and Imports | Annotations | Declarations | Type Elements & Relations | Expressions | Statements | Body Level Attributes |
|---|
tryT (#id, #parent, #encl, #body, [#catcher_1,...], #finalizer)
Represents the try statement.
Arguments
#id: id
the unique ID assigned to this fact.
#parent: id
ID of the parent node.
#encl: methodT, constructorT, classInitializerT
ID of the enclosing method declaration.
#body: blockT
ID of the body, guarded by the try-catch statement.
[#catcher_1,…]: catchT
list of the exception catchers.
#finalizer: blockT,null
ID of the block containing the statements of the finally part.
Sample Java Source
void myTryCatch() { String filename = "/Users/myfilename"; try { // corresponding code line to tryT new File(filename).createNewFile(); } catch (IOException e) {//catchT System.out.println("Unable to create " + filename + ": "+ e.getMessage()); } }
Its PEF Representation
tryT(#id, #parent, #enclMethod, #body, [#catcher_1], 'null'). blockT(#parent, #enclMethod, #enclMethod, [..., #id]). methodT(#enclMethod, ..., 'myTryCatch', [], type(basic, void, 0), [], #parent). blockT(#body, #id, #enclMethod, [...]). catchT(#catcher_1, #id, #enclMethod, ..., ...).
AST Specification
ast_node_def('Java',tryT,[
ast_arg(id, mult(1,1,no ), id, [tryT]), % <-- convention!!!
ast_arg(parent, mult(1,1,no ), id, [id]), % <-- convention!!!
ast_arg(encl, mult(1,1,no ), id, [methodT, constructorT, classInitializerT]),
ast_arg(block, mult(1,1,no ), id, [blockT]),
ast_arg(catchers,mult(1,*,ord), id, [catchT]),
ast_arg(finalize,mult(0,1,no), id, [blockT,nullType])
]).


