Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Adds support for documentation at the container level, although this …
Browse files Browse the repository at this point in the history
…isn't included in the language reference yet as there is no support for rendering it.
  • Loading branch information
simonbrowndotje committed Jan 5, 2023
1 parent 375f457 commit d54f4c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/structurizr/dsl/AdrsParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ void parse(SoftwareSystemDslContext context, File dslFile, Tokens tokens) {
parse(context, context.getSoftwareSystem(), dslFile, tokens);
}

void parse(ContainerDslContext context, File dslFile, Tokens tokens) {
parse(context, context.getContainer(), dslFile, tokens);
}

private void parse(DslContext context, Documentable documentable, File dslFile, Tokens tokens) {
// !adrs <path>

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/structurizr/dsl/DocsParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ void parse(SoftwareSystemDslContext context, File dslFile, Tokens tokens) {
parse(context, context.getSoftwareSystem(), dslFile, tokens);
}

void parse(ContainerDslContext context, File dslFile, Tokens tokens) {
parse(context, context.getContainer(), dslFile, tokens);
}

private void parse(DslContext context, Documentable documentable, File dslFile, Tokens tokens) {
// !docs <path>

Expand Down
10 changes: 10 additions & 0 deletions src/main/java/com/structurizr/dsl/StructurizrDslParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ void parse(List<String> lines, File dslFile) throws StructurizrDslParserExceptio
new DocsParser().parse(getContext(SoftwareSystemDslContext.class), dslFile, tokens);
}

} else if (DOCS_TOKEN.equalsIgnoreCase(firstToken) && inContext(ContainerDslContext.class)) {
if (!restricted) {
new DocsParser().parse(getContext(ContainerDslContext.class), dslFile, tokens);
}

} else if (ADRS_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.class)) {
if (!restricted) {
new AdrsParser().parse(getContext(WorkspaceDslContext.class), dslFile, tokens);
Expand All @@ -712,6 +717,11 @@ void parse(List<String> lines, File dslFile) throws StructurizrDslParserExceptio
new AdrsParser().parse(getContext(SoftwareSystemDslContext.class), dslFile, tokens);
}

} else if (ADRS_TOKEN.equalsIgnoreCase(firstToken) && inContext(ContainerDslContext.class)) {
if (!restricted) {
new AdrsParser().parse(getContext(ContainerDslContext.class), dslFile, tokens);
}

} else if (CONSTANT_TOKEN.equalsIgnoreCase(firstToken)) {
Constant constant = new ConstantParser().parse(getContext(), tokens);
constants.put(constant.getName(), constant);
Expand Down

0 comments on commit d54f4c1

Please sign in to comment.