Endpoints on rootNode cause problems
Endpoints defined on the nonterminal either defined as rootNode or being a root, causes a generated, inherited attribute for the handler access to fail.
In case of mqtt, the handler attribute is currently generated using:
{{#RootTypeComponents}}
{{#first}}inh MqttServerHandler ASTNode.{{mqttHandlerAttribute}}();{{/first}}
eq {{rootNodeName}}.get{{name}}().{{mqttHandlerAttribute}}() = {{mqttHandlerField}};
{{/RootTypeComponents}}
{{^RootTypeComponents}}
syn MqttServerHandler {{rootNodeName}}.{{mqttHandlerAttribute}}() = {{mqttHandlerField}};
{{/RootTypeComponents}}
Here, RootTypeComponents
is initialized in RagConnect.toMustache
in intermediate/Generation.jadd
:
for (Component child : rootNode.getComponentList()) {
if (child.isTypeComponent()) {
result.addRootTypeComponent(child.asTypeComponent().toMustache());
}
}
This fails for the example in the documentation, because RootTypeComponents is not empty containing the type component B:
A ::= <Input:String> /<OutputOnA:String>/ B* ;
B ::= /<OutputOnB:String>/ ;