SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

research:jtransformer:api:java:pefs:2.9:tryt [2018/05/09 01:59] (current)
Line 1: Line 1:
 +{{page>​prologast_bodypef_index&​fullpage&​nofooter}}
 +----
 +
 +=== 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|methodT]],​ [[constructorT|constructorT]],​ [[classInitializerT|classInitializerT]]\\ ​
 +ID of the enclosing method declaration.
 +
 +**#body:** [[blockt|blockT]]\\ ​
 +ID of the body, guarded by the try-catch statement.
 +
 +**[#​catcher_1,​...]:​** [[catcht|catchT]]\\ ​
 +list of the exception catchers.
 +
 +**#​finalizer:​** [[blockt|blockT]],​null\\  ​
 +ID of the block containing the statements of the finally part.
 +
 +=== Sample Java Source ===
 +== ==
 +<Code lang-java>​
 +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());​
 + }
 +}
 +</​Code>​
 +
 +
 +=== Its PEF Representation ===
 +== ==
 +<Code lang-prolog>​
 +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,​ ..., ...).
 +</​Code>​
 +
 +=== AST Specification ===
 +== ==
 +<​Code>​
 +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])
 +]).
 +</​Code>​
 + 
 + 
 +
  
research/jtransformer/api/java/pefs/2.9/tryt.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019