Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
Tagging
Commits
a6d389d2
Commit
a6d389d2
authored
Jun 29, 2018
by
Ferdinand Alexander Mehlan
Browse files
cleaning and extending tagchema grammar
parent
13998800
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/grammars/de/monticore/lang/TagSchema.mc4
View file @
a6d389d2
...
...
@@ -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
||
","
)+;
...
...
src/test/java/de/monticore/lang/tagging/GeneratorTest.java
View file @
a6d389d2
...
...
@@ -50,7 +50,7 @@ public class GeneratorTest {
Map
<
String
,
String
>
symbolScopeMap
=
new
LinkedHashMap
<>();
symbolScopeMap
.
put
(
"Component"
,
"NameScope"
);
symbolScopeMap
.
put
(
"Port"
,
"NameScope"
);
symbolScopeMap
.
put
(
"
Expanded
ComponentInstance"
,
"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
(
"
Expanded
ComponentInstance"
,
"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
(
"
Expanded
ComponentInstance"
,
"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
(
"
Expanded
ComponentInstance"
,
"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
(
"
Expanded
ComponentInstance"
,
"NameScope"
);
symbolScopeMap
.
put
(
"ComponentInstance"
,
"NameScope"
);
symbolScopeMap
.
put
(
"Connector"
,
"ConnectorScope"
);
generator
.
generate
(
Paths
.
get
(
"CompPower"
),
Paths
.
get
(
"src/test/resources/nfp/"
),
symbolScopeMap
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment