use of claw.tatsu.xcodeml.abstraction.InsertionPosition in project claw-compiler by C2SM-RCM.
the class ClawPragma method generateLayoutFromOver.
/**
* Generate a layout from the over clause information.
*
* @param over Over clause as a list of String (dimension ids).
* @return A list of dimension definition used as a layout.
*/
private List<DimensionDefinition> generateLayoutFromOver(List<String> over) {
boolean hasMiddleInsertion = getNbOfBaseDimensions(over) > 1;
List<DimensionDefinition> overLayout = new ArrayList<>();
InsertionPosition crt = InsertionPosition.BEFORE;
for (String d : over) {
if (d.equals(DimensionDefinition.BASE_DIM)) {
crt = crt.getNext(hasMiddleInsertion);
} else {
if (_localModelConfig.hasDimension(d)) {
DimensionDefinition newDimension = _localModelConfig.getDimension(d).copy();
newDimension.setInsertionPosition(crt);
overLayout.add(newDimension);
} else {
_errors.add(String.format("Dimension %s is not defined", d));
}
}
}
return overLayout;
}
Aggregations