Implement Advanced DSL#385
Conversation
| } | ||
|
|
||
| public static ParseResult<DestinationSelectors> fromString(StringView string, DSLContext context) { | ||
| string.skipWhitespace(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Don´t use acronyms, lefthandside and righthandside?
| if (string.startsWith(DSL_OPERATOR)) { | ||
| return string.expect(DSL_OPERATOR); | ||
| } | ||
| string.skipWhitespace(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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 + " "); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Why do you use the complete type?
|
|
||
| public SimpleAnalysisConstraint(String name, | ||
| org.dataflowanalysis.analysis.dsl.groups.SourceSelectors sourceSelectors, | ||
| DestinationSelectors destinationSelectors, |
This PR implements the advanced DSL with the syntax we discussed:
neverFlows,flows,alwaysFlowsandnotAlwaysFlowsany,vertex nameanddata namecontainsfor namesThe new prefix for instances of the DSL is
*Examples
Data C.D from any TFG does not flow to a vertex that also has data A.B
Any flow from a vertex with label A.B to a vertex with label C.D does not exists
Data A.B must flow to a vertex C.D in at least one TFG
Data A.B must flow to a vertex C.D in all TFGs
Data A.B must not flow to a vertex C.D in at least one TFG
Any selectors always match
Names of data and names can be matched exactly or via contains
Boolean operations and braces are supported via
and,orandxoras well asnotfor negationFor Testing
Test with the online editor and its backend by replacing line 138 in Converter.java in the backend with