Skip to content

Implement Advanced DSL#385

Open
Entenwilli wants to merge 14 commits into
mainfrom
dsl-extension
Open

Implement Advanced DSL#385
Entenwilli wants to merge 14 commits into
mainfrom
dsl-extension

Conversation

@Entenwilli

@Entenwilli Entenwilli commented Mar 30, 2026

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, vertex name and data name
  • 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

Data C.D from any TFG does not flow to a vertex that also has data A.B

* test2: vertex A.B neverFlows vertex C.D"

Any flow from a vertex with label A.B to a vertex with label C.D does not exists

* test3: data A.B flows vertex C.D

Data A.B must flow to a vertex C.D in at least one TFG

* test4: data A.B alwaysFlows vertex C.D

Data A.B must flow to a vertex C.D in all TFGs

* test5: data A.B notAlwaysFlows vertex C.D

Data A.B must not flow to a vertex C.D in at least one TFG

* test6: data A.B neverFlows vertex any
* test7: data A.B neverFlows data any

Any selectors always match

* test8: data name contains Test neverFlows vertex C.D
* test9: data name Test neverFlows vertex C.D
* test10: data A.B neverFlows vertex name Test
* test11: data A.B neverFlows vertex name contains Test

Names of data and names can be matched exactly or via contains

* test12: data A.B and data C.D neverFlows vertex C.D
* test13: data A.B neverFlows (vertex C.D or vertex E.F) and data G.H

Boolean operations and braces are supported via and, or and xor as well as not for negation

For Testing

Test with the online editor and its backend by replacing line 138 in Converter.java in the backend with

StringView string = new StringView("* " + it.name() + ": " + it.constraint().replace("\n ", ""));

@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

@Entenwilli Entenwilli marked this pull request as ready for review June 2, 2026 11:11
@Entenwilli Entenwilli linked an issue Jun 24, 2026 that may be closed by this pull request
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.

Allow analysis of cross transpose flow graph streams in DSL

2 participants