Skip to content

Implement Advanced DSL#385

Draft
Entenwilli wants to merge 10 commits intomainfrom
dsl-extension
Draft

Implement Advanced DSL#385
Entenwilli wants to merge 10 commits intomainfrom
dsl-extension

Conversation

@Entenwilli
Copy link
Copy Markdown
Member

This PR implements the advanced DSL with the syntax we discussed:

  • Multiple Flow Types: neverFlows, flows, alwaysFlows and notAlwaysFlows
  • Additional Selectors: any, vertexName and dataName
  • Additional matching functionality: Support for contains for names

The new prefix for instances of the DSL is *

Examples

* test1: data A.B neverFlows data C.D
* test2: vertex A.B neverFlows vertex C.D"
* test3: data A.B flows vertex C.D
* test4: data A.B alwaysFlows vertex C.D
* test5: data A.B notAlwaysFlows vertex C.D
* test6: data A.B neverFlows vertex any
* test7: data A.B neverFlows data any
* test8: data dataName contains Test neverFlows vertex C.D
* test9: data dataName Test neverFlows vertex C.D
* test10: data A.B neverFlows vertex vertexName Test
* test11: data A.B neverFlows vertex vertexName contains Test

@Entenwilli Entenwilli added this to the 5.1.0 milestone Mar 30, 2026
@Entenwilli Entenwilli self-assigned this Mar 30, 2026
@Entenwilli Entenwilli added enhancement New feature or request core Related to the core DFD/PCM data flow analysis editor Related to the web editor labels Mar 30, 2026
}

public static ParseResult<DestinationSelectors> fromString(StringView string, DSLContext context) {
string.skipWhitespace();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the string.skipWhitespace() gets called 5 times in a row without the string changing is this corect/intended?

public final class SourceSelectors extends AbstractParseable {
private final Optional<DataSourceSelectors> dataSourceSelectors;
private final Optional<VertexSourceSelectors> vertexSourceSelectors;
private final DataSourceSelectors dataSourceSelectors;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this now requires the dsl to specify both data and vertex Selectors? so smth like data neverflows vertex internal !logging is no longer allowed?

private static final String DSL_OPERATOR = "&&";

private final AbstractSelector lhs;
private final AbstractSelector rhs;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don´t use acronyms, lefthandside and righthandside?

if (string.startsWith(DSL_OPERATOR)) {
return string.expect(DSL_OPERATOR);
}
string.skipWhitespace();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same skipWhitespace as above, i belive the first call in fromString is skip whitespace

if (string.empty() || string.invalid()) {
return ParseResult.error("Not a valid constraint");
}
string.skipWhitespace();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repetive skipWhitespace, i will not comment every occurence of this

return this.inverted ? DSL_INVERTED_SYMBOL + DSL_KEYWORD + " " + this.name : DSL_KEYWORD + " " + this.name;
StringBuilder stringBuilder = new StringBuilder();
if (this.inverted)
stringBuilder.append(DSL_INVERTED_SYMBOL + " ");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add brackets to if (maybe we want to add this to the formatter)

}

public AdvancedAnalysisConstraint(String name,
org.dataflowanalysis.analysis.dsl.groups.SourceSelectors sourceSelectors, FlowType flowType,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don´t use the "simple" type instead of the complete declaration?

this.dataSourceSelectors = new DataSourceSelectors();
this.vertexDestinationSelectors = new VertexDestinationSelectors();
this.conditionalSelectors = new ConditionalSelectors();
this.sourceSelectors = new org.dataflowanalysis.analysis.dsl.groups.SourceSelectors();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use the complete type?


public SimpleAnalysisConstraint(String name,
org.dataflowanalysis.analysis.dsl.groups.SourceSelectors sourceSelectors,
DestinationSelectors destinationSelectors,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

complete type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the core DFD/PCM data flow analysis editor Related to the web editor enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants