SDA SE Wiki

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

User Tools

Site Tools



foreachT (#id, #parent, #encl, #param, #expression, #body)

Java 5 Syntax Element

Represents the for each statement.

Attributes

#id: id
the unique ID assigned to this fact.

#parent: id
ID of the parent node.

#encl: methodT, constructorT, classInitializerT
ID of the enclosing element.

#param, paramT
ID of the local parameter of this for statement.

#expression expression
ID of the expression (of type list or array) in this for statement.

#body: statement
ID of the body of this for statement.

Sample Java Source

int[] array = {1, 2, 3};
for (int i : array) {
  ...
}

Its PEF Representation

localT(#Array, #Block, #Method, type(basic, int, 1), array, #NewArray)
foreachT(#ForEach, #Block, #Method, #Param, #Ident, #BlockFor),
paramT(#Param, #ForEach, type(basic, int, 0), 'd'),
identT(#Ident, #ForEach, #Method, 'array', #Array),
blockT(#BlockFor, #ForEach, #Method, [...]),
...

AST Specification

ast_node_def('Java',foreachT,[
     ast_arg(id,     mult(1,1,no ), id,  [foreachT]),
     ast_arg(parent, mult(1,1,no ), id,  [id]),
     ast_arg(encl,   mult(1,1,no ), id,  [methodT, constructorT, classInitializerT]),
     ast_arg(inits,  mult(1,1,no ), id,  [paramT]),
     ast_arg(expr,   mult(1,1,no ), id,  [expressionType]),
     ast_arg(body,   mult(1,1,no ), id,  [blockT,statementType])
]).
research/jtransformer/api/java/pefs/3.0/foreacht.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2018