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