Commit a6d389d2 authored by Ferdinand Alexander Mehlan's avatar Ferdinand Alexander Mehlan
Browse files

cleaning and extending tagchema grammar

parent 13998800
......@@ -7,51 +7,40 @@ package de.monticore.lang;
*/
grammar TagSchema extends de.monticore.common.Common {
TagSchemaUnit =
("package" package:(Name& || ".")+ ";")?
(ImportStatement)*
"tagschema" Name "{" TagType+ "}";
TagSchemaUnit =
("package" package:(Name& || ".")+ ";")?
(ImportStatement)*
"tagschema" Name "{" TagType+ "}";
interface TagType;
//ComplexTagType | EnumeratedTagType | ValuedTagType | SimpleTagType;
//ComplexTagType | EnumeratedTagType | ValuedTagType | SimpleTagType;
ast TagType =
method public String getName() {
return "undefined";
};
interface ScopeIdentifier;
ScopeIdentifier =
component:"Component" |
componentInstance:"ComponentInstance" |
port:"Port" |
portInstance:"PortInstance" |
connector:"Connector" |
connectorInstance:"ConnectorInstance";
ast ScopeIdentifier =
method public String getScopeName() {
return "undefined";
if(isPresentComponent()) return getComponent();
if(isPresentComponentInstance()) return getComponentInstance();
if(isPresentPort()) return getPort();
if(isPresentPortInstance()) return getPortInstance();
if(isPresentConnector()) return getConnector();
if(isPresentConnectorInstance()) return getConnectorInstance();
return "undefined";
};
/** maybe this should be moved into the MontiArc grammar, b/c MontiArc knows what is taggable */
ComponentScope implements ScopeIdentifier = "Component";
ast ComponentScope =
method public String getScopeName() {
return "Component";
};
PortScope implements ScopeIdentifier = "Port";
ast PortScope =
method public String getScopeName() {
return "Port";
};
ConnectorScope implements ScopeIdentifier = "Connector";
ast ConnectorScope =
method public String getScopeName() {
return "Connector";
};
ComponentInstanceScope implements ScopeIdentifier = "ComponentInstance";
ast ComponentInstanceScope =
method public String getScopeName() {
return "ExpandedComponentInstance";
};
// ScopeIdentifier = Name;
//ScopeIdentifier = Name;
Scope = "for" (ScopeIdentifier || ",")+;
......
......@@ -50,7 +50,7 @@ public class GeneratorTest {
Map<String, String> symbolScopeMap = new LinkedHashMap<>();
symbolScopeMap.put("Component", "NameScope");
symbolScopeMap.put("Port", "NameScope");
symbolScopeMap.put("ExpandedComponentInstance", "NameScope");
symbolScopeMap.put("ComponentInstance", "NameScope");
symbolScopeMap.put("Connector", "ConnectorScope");
generator.generate(Paths.get("TraceabilityTagSchema"), Paths.get("src/test/resources/nfp/"), symbolScopeMap);
}
......@@ -78,7 +78,7 @@ public class GeneratorTest {
Map<String, String> symbolScopeMap = new LinkedHashMap<>();
symbolScopeMap.put("Component", "NameScope");
symbolScopeMap.put("Port", "NameScope");
symbolScopeMap.put("ExpandedComponentInstance", "NameScope");
symbolScopeMap.put("ComponentInstance", "NameScope");
symbolScopeMap.put("Connector", "ConnectorScope");
generator.generate(Paths.get("PowerConsumptionTagSchema"), Paths.get("src/test/resources/nfp/"), symbolScopeMap);
}
......@@ -92,7 +92,7 @@ public class GeneratorTest {
Map<String, String> symbolScopeMap = new LinkedHashMap<>();
symbolScopeMap.put("Component", "NameScope");
symbolScopeMap.put("Port", "NameScope");
symbolScopeMap.put("ExpandedComponentInstance", "NameScope");
symbolScopeMap.put("ComponentInstance", "NameScope");
symbolScopeMap.put("Connector", "ConnectorScope");
generator.generate(Paths.get("LatencyTagSchema"), Paths.get("src/test/resources/nfp/"), symbolScopeMap);
}
......@@ -106,7 +106,7 @@ public class GeneratorTest {
Map<String, String> symbolScopeMap = new LinkedHashMap<>();
symbolScopeMap.put("Component", "NameScope");
symbolScopeMap.put("Port", "NameScope");
symbolScopeMap.put("ExpandedComponentInstance", "NameScope");
symbolScopeMap.put("ComponentInstance", "NameScope");
symbolScopeMap.put("Connector", "ConnectorScope");
generator.generate(Paths.get("TransmissionCostsTagSchema"), Paths.get("src/test/resources/nfp/"), symbolScopeMap);
}
......@@ -120,7 +120,7 @@ public class GeneratorTest {
Map<String, String> symbolScopeMap = new LinkedHashMap<>();
symbolScopeMap.put("Component", "NameScope");
symbolScopeMap.put("Port", "NameScope");
symbolScopeMap.put("ExpandedComponentInstance", "NameScope");
symbolScopeMap.put("ComponentInstance", "NameScope");
symbolScopeMap.put("Connector", "ConnectorScope");
generator.generate(Paths.get("CompPower"), Paths.get("src/test/resources/nfp/"), symbolScopeMap);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment