use of org.lara.language.specification.dsl.Parameter in project lara-framework by specs-feup.
the class NodeFactory method toNode.
private static ActionNode toNode(Action action) {
DeclarationNode declNode = toNode(action.getDeclaration());
ActionNode actionNode = new ActionNode(declNode);
action.getToolTip().ifPresent(actionNode::setToolTip);
for (Parameter parameter : action.getParameters()) {
ParameterNode paramNode = toNode(parameter);
actionNode.addChild(paramNode);
}
return actionNode;
}
use of org.lara.language.specification.dsl.Parameter in project lara-framework by specs-feup.
the class LangSpecsXmlParser method convertActions.
private static List<Action> convertActions(LanguageSpecificationV2 langSpecV2, List<XmlElement> actionNodes) {
List<Action> newActions = new ArrayList<>();
for (var action : actionNodes) {
var parameterNodes = action.getElementsByName("parameter");
List<Parameter> declarations = new ArrayList<>();
for (var param : parameterNodes) {
IType type = langSpecV2.getType(getType(param));
String defaultValue = param.getAttribute("default");
declarations.add(new Parameter(type, param.getAttribute("name"), defaultValue));
}
Action newAction = new Action(langSpecV2.getType(action.getAttribute("return", "void")), action.getAttribute("name"), declarations);
setOptional(action.getAttribute("tooltip"), newAction::setToolTip);
newActions.add(newAction);
}
Collections.sort(newActions);
return newActions;
}