Makes it possible to put templates in subdirectories

This commit is contained in:
Johan Maasing 2025-05-02 09:25:27 +02:00
parent 68dc70c176
commit 7e8aa018e9
Signed by: johan
GPG key ID: FFD31BABEE2DEED2
9 changed files with 109 additions and 53 deletions

View file

@ -203,11 +203,12 @@ One restriction is that a state and a messages may share have the same name, i.e
If the parser is successful it will hold the following data in the AST
```java
public record DocumentNode(
Map<String, String> config,
Set<TypeNode> typeDefinitions,
List<EndpointNode> endpoints,
Set<StateNode> states) {
public record GeneratorNode(
Map<String, String> config,
Set<TypeNode> typeDefinitions,
List<EndpointNode> endpoints,
Set<StateNode> states,
Meta meta) {
}
```
@ -304,3 +305,14 @@ public record TransitionNode(String message, String toState) {
```
* `name` is the message name.
* `toState` is the name of the target state.
### Meta
The meta container holds information about the template file used to generate the output file.
It holds the subdirectory below the given `templateDir` where the template was found.
This is useful to generate e.g. java `package`statements like this:
```injectedfreemarker
<#list meta.templateDirectories>package <#items as dir>${dir}<#sep>.</#items>;</#list>
```