You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are cases when third-party parsers produce a structure of AST, where some parent node contains a list of children of the same type among other children of different types. This list varies in size. Therefore, while creating transformation rules it is impossible to specify such structure of the initial subtree in a single rule.
An example is given below.
The source code in Java:
class P {
public Object myMethod(int i, String s, java.lang.Object o) {
int val = getVal(i, s);
return o.addValue(val);
}
}
The AST produced by JavaParser creates the following subtree from the method declaration:
Where children 3 - 5 are arguments from the method's argument block.
In similar cases the amount of arguments, therefore children, may differ.
It is proposed to develop and implement a special syntax to make it possible to explicitly indicate with the DSL that it is requested to take all children (for example, all children with type Parameter) of a same type and put them in a separate block in the target AST.
For example to create such a subtree:
There are cases when third-party parsers produce a structure of AST, where some parent node contains a list of children of the same type among other children of different types. This list varies in size. Therefore, while creating transformation rules it is impossible to specify such structure of the initial subtree in a single rule.
An example is given below.
The source code in Java:
The AST produced by JavaParser creates the following subtree from the method declaration:
Where children 3 - 5 are arguments from the method's argument block.
In similar cases the amount of arguments, therefore children, may differ.
It is proposed to develop and implement a special syntax to make it possible to explicitly indicate with the DSL that it is requested to take all children (for example, all children with type
Parameter
) of a same type and put them in a separate block in the target AST.For example to create such a subtree:
The text was updated successfully, but these errors were encountered: