Commit a769a0f5 authored by René Schöne's avatar René Schöne
Browse files

WIP: Compiles again with mustache.

parent ffd6ff31
......@@ -74,12 +74,12 @@ task relast(type: JavaExec) {
inputs.files file("../libs/relast.jar"),
file("../relast.preprocessor/src/main/jastadd/RelAST.relast"),
file("src/main/jastadd/Ros2Rag.relast")
file("src/main/jastadd/MustacheNodes.relast")
file("./src/main/jastadd/Ros2Rag.relast")
file("./src/main/jastadd/MustacheNodes.relast")
outputs.files file("./src/gen/jastadd/Ros2Rag.ast"),
file("src/gen/jastadd/Ros2Rag.jadd"),
file("src/gen/jastadd/Ros2RagRefResolver.jadd"),
file('src/gen/jastadd/Ros2RagResolverStubs.jrag')
file("./src/gen/jastadd/Ros2Rag.jadd"),
file("./src/gen/jastadd/Ros2RagRefResolver.jadd"),
file('./src/gen/jastadd/Ros2RagResolverStubs.jrag')
}
jastadd {
......
//TypeComponentMustache ;
//rel TypeComponentMustache.TypeComponent -> TypeComponent ;
MRos2Rag ::= ReadDefinition:MReadDefinition* WriteDefinition:MWriteDefinition* MappingDefinition:MMappingDefinition* DependencyDefinition:MDependencyDefinition* TypeComponent:MTypeComponent*;
MUpdateDefinition ::= <FirstInputVarName>;
MRos2Rag ::= ReadDefinition:MReadDefinition* WriteDefinition:MWriteDefinition* MappingDefinition:MMappingDefinition* DependencyDefinition:MDependencyDefinition* RootTypeChildren:MTypeComponent* TokenComponent:MTokenComponent*;
abstract MUpdateDefinition ::= InnerMappingDefinition:MInnerMappingDefinition*;
MReadDefinition : MUpdateDefinition;
MWriteDefinition : MUpdateDefinition;
MMappingDefinition;
MInnerMappingDefinition;
MDependencyDefinition;
MTypeComponent;
MTokenComponent;
MUpdateDefinition.InnerMappingDefinition* -> MInnerMappingDefinition;
MInnerMappingDefinition.MappingDefinition -> MappingDefinition;
MReadDefinition.ReadFromMqttDefinition -> ReadFromMqttDefinition;
MWriteDefinition.WriteToMqttDefinition -> WriteToMqttDefinition;
MMappingDefinition.MappingDefinition -> MappingDefinition;
MDependencyDefinition.DependencyDefinition -> DependencyDefinition;
MTypeComponent.TypeComponent -> TypeComponent;
MTypeComponent.DependencyDefinition* -> MDependencyDefinition;
rel MRos2Rag.Ros2Rag -> Ros2Rag;
rel MInnerMappingDefinition.MappingDefinition -> MappingDefinition;
rel MReadDefinition.ReadFromMqttDefinition -> ReadFromMqttDefinition;
rel MWriteDefinition.WriteToMqttDefinition -> WriteToMqttDefinition;
rel MMappingDefinition.MappingDefinition -> MappingDefinition;
rel MDependencyDefinition.DependencyDefinition -> DependencyDefinition;
rel MTypeComponent.TypeComponent -> TypeComponent;
rel MTokenComponent.TokenComponent -> TokenComponent;
rel MTokenComponent.DependencyDefinition* -> MDependencyDefinition;
......@@ -2,10 +2,12 @@ aspect Navigation {
// --- program ---
eq Ros2Rag.getChild().program() = getProgram();
eq MRos2Rag.getChild().program() = getRos2Rag().program();
// --- ros2rag ---
inh Ros2Rag ASTNode.ros2rag();
eq Ros2Rag.getChild().ros2rag() = this;
eq MRos2Rag.getChild().ros2rag() = getRos2Rag();
// --- containedFile (first equation should be in preprocessor) ---
eq Program.getChild().containedFile() = null;
......@@ -32,6 +34,7 @@ aspect Navigation {
eq GrammarFile.getChild().containedFileName() = getFileName();
eq Ros2Rag.getChild().containedFileName() = getFileName();
eq Program.getChild().containedFileName() = null;
eq MRos2Rag.getChild().containedFileName() = null;
// --- isTokenUpdateDefinition ---
syn boolean UpdateDefinition.isTokenUpdateDefinition() = false;
......
......@@ -16,7 +16,7 @@ aspect MQTT {
}
inh MqttUpdater ASTNode.{{mqttUpdaterAttribute}}();
{{#rootTypeChildren}}
{{#RootTypeChildren}}
eq {{rootNodeName}}.get{{name}}().{{mqttUpdaterAttribute}}() = {{mqttUpdaterField}};
{{/rootTypeChildren}}
{{/RootTypeChildren}}
}
......@@ -2,8 +2,8 @@
{{mqttUpdaterAttribute}}().newConnection(topic, message -> {
{{> mappingApplication}}
{{#loggingEnabledForReads}}
System.out.println("[Read] " + topic + " -> {{TokenName}} = " + {{lastResult}});{{!lastResult has to be a new attribute}}
System.out.println("[Read] " + topic + " -> {{tokenName}} = " + {{lastResult}});{{!lastResult has to be a new attribute}}
{{/loggingEnabledForReads}}
set{{TokenName}}({{lastResult}});
set{{tokenName}}({{lastResult}});
});
}
{{> mqtt}}
aspect ROS2RAG {
{{#ReadDefinitions}}
{{> readDefinition}}
......
......@@ -18,7 +18,7 @@
protected void {{parentTypeName}}.{{writeMethod}}() {
{{#loggingEnabledForWrites}}
System.out.println("[Write] {{TokenName}} = " + get{{TokenName}}() + " -> {{writeTopic}});
System.out.println("[Write] {{tokenName}} = " + get{{tokenName}}() + " -> {{writeTopic}});
{{/loggingEnabledForWrites}}
{{mqttUpdateAttribute}}().publish({{writeTopic}}, {{lastValue}});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment