Skip to content
Snippets Groups Projects
Commit 821e74d6 authored by René Schöne's avatar René Schöne
Browse files

3.0.0

- prepare new release
- remove deprecated inclusion/exclusion
parent 87ede88c
No related branches found
No related tags found
1 merge request!133.0.1
aspect Frontend { aspect Frontend {
// --- match{In,Ex}cludePatternCollection ---
syn PatternCollection BuildConfig.matchIncludePatternCollection(String typeName) {
for (TypePatternCollectionMapping mapping : getIncludeTypePatternList()) {
if (matches(mapping.typePattern(), typeName)) {
return mapping.getPatternCollection();
}
}
return null;
}
syn PatternCollection BuildConfig.matchExcludePatternCollection(String typeName) {
for (TypePatternCollectionMapping mapping : getExcludeTypePatternList()) {
if (matches(mapping.typePattern(), typeName)) {
return mapping.getPatternCollection();
}
}
return null;
}
static StyleInformation StyleInformation.createDefault() { static StyleInformation StyleInformation.createDefault() {
StyleInformation result = new StyleInformation(); StyleInformation result = new StyleInformation();
result.setComputedColor("blue"); result.setComputedColor("blue");
......
...@@ -453,26 +453,12 @@ aspect Transform { ...@@ -453,26 +453,12 @@ aspect Transform {
node.setTextColor(style.getTextColor()); node.setTextColor(style.getTextColor());
} }
// TODO: add new attributes for: {token,child,relation,attribute,nta}Enabled(String parentType, String name). 1) just move implementation into this attribute. 2) add include/exclude on type-level to it.
// --- isTypeEnabled --- // --- isTypeEnabled ---
syn boolean DumpAst.isTypeEnabled(String typeName) { syn boolean DumpAst.isTypeEnabled(String typeName) {
return !matches(getBuildConfig().typeIgnorePattern(), typeName); return !getBuildConfig().typeIgnorePattern().matcher(typeName).matches();
} }
// --- typeIgnorePattern ---
// --- {typeIgnore,child,token,relation,attribute,nta}Pattern ---
syn java.util.regex.Pattern BuildConfig.typeIgnorePattern() = java.util.regex.Pattern.compile(getTypeIgnorePattern()); syn java.util.regex.Pattern BuildConfig.typeIgnorePattern() = java.util.regex.Pattern.compile(getTypeIgnorePattern());
syn java.util.regex.Pattern PatternCollection.childPattern() = java.util.regex.Pattern.compile(getChildPattern());
syn java.util.regex.Pattern PatternCollection.tokenPattern() = java.util.regex.Pattern.compile(getTokenPattern());
syn java.util.regex.Pattern PatternCollection.relationPattern() = java.util.regex.Pattern.compile(getRelationPattern());
syn java.util.regex.Pattern PatternCollection.attributePattern() = java.util.regex.Pattern.compile(getAttributePattern());
syn java.util.regex.Pattern PatternCollection.ntaPattern() = java.util.regex.Pattern.compile(getNonterminalAttributePattern());
syn java.util.regex.Pattern TypePatternCollectionMapping.typePattern() = java.util.regex.Pattern.compile(getTypeRegex());
// --- matches ---
static boolean ASTNode.matches(java.util.regex.Pattern p, String input) {
return p.matcher(input).matches();
}
class TransformationTransferInformation { class TransformationTransferInformation {
java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>(); java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>();
......
aspect Util { aspect Util {
// --- find{In,Ex}cludePatternCollection ---
syn PatternCollection BuildConfig.findIncludePatternCollection(String typeRegex) {
for (TypePatternCollectionMapping mapping : getIncludeTypePatternList()) {
if (mapping.getTypeRegex().equals(typeRegex)) {
return mapping.getPatternCollection();
}
}
return null;
}
syn PatternCollection BuildConfig.findExcludePatternCollection(String typeRegex) {
for (TypePatternCollectionMapping mapping : getExcludeTypePatternList()) {
if (mapping.getTypeRegex().equals(typeRegex)) {
return mapping.getPatternCollection();
}
}
return null;
}
private String DumpAst.titleCase(String s) { private String DumpAst.titleCase(String s) {
if (s.isEmpty()) { if (s.isEmpty()) {
return s; return s;
......
...@@ -39,12 +39,3 @@ aspect GrammarGlobal { ...@@ -39,12 +39,3 @@ aspect GrammarGlobal {
return result; return result;
} }
} }
aspect GrammarTypeLevel {
syn int AbstractT.simpleAttr() = 43;
syn nta A AbstractT.getCalculated() {
A result = new A();
result.setName("Calculated-" + getName());
return result;
}
}
...@@ -14,17 +14,6 @@ rel C.biA1 <-> A.biC1 ; ...@@ -14,17 +14,6 @@ rel C.biA1 <-> A.biC1 ;
rel C.biA2* <-> A.biC2 ; rel C.biA2* <-> A.biC2 ;
rel C.biA3? <-> A.biC3 ; rel C.biA3? <-> A.biC3 ;
// testcases with type-level inclusion/exclusion
TRoot : Nameable ::= A T1 T2 T3 ;
abstract AbstractT : Nameable ::= B Bee:B* <SomeValue> <Unwanted:int> ;
T1 : AbstractT ;
T2 : AbstractT ;
T3 : AbstractT ;
rel AbstractT.oneA -> A ;
rel AbstractT.maybeA? -> A ;
rel AbstractT.manyA* -> A ;
Position : Nameable ::= <X:double> <Y:double> <Z:double>; Position : Nameable ::= <X:double> <Y:double> <Z:double>;
Size : Nameable ::= <Length:double> <Width:double> <Height:double>; Size : Nameable ::= <Length:double> <Width:double> <Height:double>;
Orientation : Nameable ::= <X:double> <Y:double> <Z:double> <W:double>; Orientation : Nameable ::= <X:double> <Y:double> <Z:double> <W:double>;
......
...@@ -30,7 +30,6 @@ public class TestUtils { ...@@ -30,7 +30,6 @@ public class TestUtils {
public static final String T1_NAME = "T1" + Integer.toHexString(rand.nextInt(0xFFFFFF)); public static final String T1_NAME = "T1" + Integer.toHexString(rand.nextInt(0xFFFFFF));
public static final String T2_NAME = "T2" + Integer.toHexString(rand.nextInt(0xFFFFFF)); public static final String T2_NAME = "T2" + Integer.toHexString(rand.nextInt(0xFFFFFF));
public static final String T3_NAME = "T3" + Integer.toHexString(rand.nextInt(0xFFFFFF)); public static final String T3_NAME = "T3" + Integer.toHexString(rand.nextInt(0xFFFFFF));
public static final String[] Tx_NAMES = {T1_NAME, T2_NAME, T3_NAME};
public static Root createRoot(A a, C c, B... bs) { public static Root createRoot(A a, C c, B... bs) {
Root result = new Root(); Root result = new Root();
...@@ -92,47 +91,6 @@ public class TestUtils { ...@@ -92,47 +91,6 @@ public class TestUtils {
return result; return result;
} }
public static TRoot createTRoot(A a, T1 t1, T2 t2, T3 t3) {
TRoot result = new TRoot();
result.setName(ROOT_NAME);
if (a != null) {
result.setA(a);
}
if (t1 != null) {
result.setT1(t1);
}
if (t2 != null) {
result.setT2(t2);
}
if (t3 != null) {
result.setT3(t3);
}
return result;
}
@SafeVarargs
public static T1 createT1(Consumer<AbstractT>... additionalSettings) {
return setupAbstractT(new T1(), T1_NAME, additionalSettings);
}
@SafeVarargs
public static T2 createT2(Consumer<AbstractT>... additionalSettings) {
return setupAbstractT(new T2(), T2_NAME, additionalSettings);
}
@SafeVarargs
public static T3 createT3(Consumer<AbstractT>... additionalSettings) {
return setupAbstractT(new T3(), T3_NAME, additionalSettings);
}
private static <T extends AbstractT> T setupAbstractT(T t, String name, Consumer<AbstractT>[] additionalSettings) {
t.setName(name);
for (Consumer<AbstractT> setting : additionalSettings) {
setting.accept(t);
}
return t;
}
public static final Function<DumpNode, String> NAME_EXTRACTOR = node -> { public static final Function<DumpNode, String> NAME_EXTRACTOR = node -> {
for (DumpToken dumpToken : node.getDumpTokenList()) { for (DumpToken dumpToken : node.getDumpTokenList()) {
if (dumpToken.getName().equals("Name")) { if (dumpToken.getName().equals("Name")) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment