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
13998800
Commit
13998800
authored
Jun 15, 2018
by
Evgeny Kusmenko
Browse files
Merge branch 'richter-dev' into 'master'
Richter dev See merge request
!2
parents
f07c3256
c74789fc
Pipeline
#55649
passed with stage
in 1 minute and 27 seconds
Changes
33
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
13998800
...
...
@@ -21,131 +21,124 @@
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<!-- == PROJECT COORDINATES ============================================= -->
<groupId>
de.monticore.lang
</groupId>
<artifactId>
Tagging
</artifactId>
<version>
0.0.2
</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>
4.5.4.08.11.2017
</monticore.version>
<se-commons.version>
1.7.7
</se-commons.version>
<mc.grammars.assembly.version>
0.0.6-SNAPSHOT
</mc.grammars.assembly.version>
<!-- .. Libraries .................................................. -->
<guava.version>
18.0
</guava.version>
<junit.version>
4.12
</junit.version>
<logback.version>
1.1.2
</logback.version>
<jscience.version>
4.3.1
</jscience.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>
4.5.3-SNAPSHOT
</monticore.plugin>
<assembly.plugin>
2.5.4
</assembly.plugin>
<compiler.plugin>
3.3
</compiler.plugin>
<source.plugin>
2.4
</source.plugin>
<shade.plugin>
2.4.3
</shade.plugin>
<!-- Classifiers -->
<grammars.classifier>
grammars
</grammars.classifier>
<cli.classifier>
cli
</cli.classifier>
<!-- .. Misc .......................................................... -->
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<github.global.server>
github
</github.global.server>
</properties>
<dependencies>
<dependency>
<groupId>
org.antlr
</groupId>
<artifactId>
antlr4-runtime
</artifactId>
<version>
4.7.1
</version>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-logging
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${guava.version}
</version>
</dependency>
<!-- MontiCore Dependencies -->
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-groovy
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<dependency>
<groupId>
org.jscience
</groupId>
<artifactId>
jscience
</artifactId>
<version>
4.3.1
</version>
</dependency>
<!-- .. Test Libraries ............................................... -->
<!-- .. Test Libraries ............................................... -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
${logback.version}
</version>
</dependency>
<dependency>
<groupId>
org.jscience
</groupId>
<artifactId>
jscience
</artifactId>
<version>
${jscience.version}
</version>
</dependency>
</dependencies>
<!-- == PROJECT BUILD SETTINGS =========================================== -->
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<!-- == PROJECT COORDINATES ============================================= -->
<groupId>
de.monticore.lang
</groupId>
<artifactId>
Tagging
</artifactId>
<version>
0.0.3-SNAPSHOT
</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>
5.0.0
</monticore.version>
<se-commons.version>
1.7.7
</se-commons.version>
<mc.grammars.assembly.version>
0.0.6-SNAPSHOT
</mc.grammars.assembly.version>
<!-- .. Libraries .................................................. -->
<guava.version>
18.0
</guava.version>
<junit.version>
4.12
</junit.version>
<logback.version>
1.1.2
</logback.version>
<jscience.version>
4.3.1
</jscience.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>
5.0.0
</monticore.plugin>
<assembly.plugin>
2.5.4
</assembly.plugin>
<compiler.plugin>
3.3
</compiler.plugin>
<source.plugin>
2.4
</source.plugin>
<shade.plugin>
2.4.3
</shade.plugin>
<!-- Classifiers -->
<grammars.classifier>
grammars
</grammars.classifier>
<cli.classifier>
cli
</cli.classifier>
<!-- .. Misc .......................................................... -->
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<github.global.server>
github
</github.global.server>
</properties>
<dependencies>
<dependency>
<groupId>
org.antlr
</groupId>
<artifactId>
antlr4-runtime
</artifactId>
<version>
4.7.1
</version>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-logging
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${guava.version}
</version>
</dependency>
<!-- MontiCore Dependencies -->
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-groovy
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
${logback.version}
</version>
</dependency>
<dependency>
<groupId>
org.jscience
</groupId>
<artifactId>
jscience
</artifactId>
<version>
${jscience.version}
</version>
</dependency>
</dependencies>
<!-- == PROJECT BUILD SETTINGS =========================================== -->
<build>
<plugins>
...
...
@@ -275,7 +268,7 @@
</execution>
</executions>
</plugin>
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
...
...
@@ -299,34 +292,34 @@
<!-- aggregated reports for multi-module projects -->
<aggregate>
true
</aggregate>
</configuration>
</plugin>
</plugin>
</plugins>
</build>
<!--
<!--
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${project.build.directory}/external-dependencies</url>
</repository>
<snapshotRepository>
<id>internal.repo</id>
<url>file://${project.build.directory}/external-dependencies</url>
</snapshotRepository>
</distributionManagement>
-->
<!-- == DISTRIBUTION ==================================================== -->
<distributionManagement>
<repository>
<id>internal.repo</id>
<name>Temporary Staging Repository</name>
<url>file://${project.build.directory}/external-dependencies</url>
<id>
se-nexus
</id>
<url>
https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-releases/
</url>
</repository>
<snapshotRepository>
<id>
internal.repo
</id>
<url>
file://${project.build.directory}/external-dependencies
</url>
<id>
se-nexus
</id>
<url>
https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
-->
<!-- == DISTRIBUTION ==================================================== -->
<distributionManagement>
<repository>
<id>
se-nexus
</id>
<url>
https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-releases/
</url>
</repository>
<snapshotRepository>
<id>
se-nexus
</id>
<url>
https://nexus.se.rwth-aachen.de/content/repositories/embeddedmontiarc-snapshots/
</url>
</snapshotRepository>
</distributionManagement>
</project>
src/main/grammars/de/monticore/lang/Tagging.mc4
View file @
13998800
...
...
@@ -37,9 +37,9 @@ grammar Tagging extends de.monticore.common.Common {
method
public
String
toString
(){
String
arrayPart
=
""
;
arrayPart
+=
start
.
isPresent
()
?
""
+
start
.
get
().
getValue
()
:
""
;
arrayPart
+=
step
.
isPresent
()
?
":"
+
step
.
get
().
getValue
()
:
""
;
arrayPart
+=
end
.
isPresent
()
?
":"
+
end
.
get
().
getValue
()
:
""
;
arrayPart
+=
getStartOpt
()
.
isPresent
()
?
""
+
getStartOpt
()
.
get
().
getValue
()
:
""
;
arrayPart
+=
getStepOpt
()
.
isPresent
()
?
":"
+
getStepOpt
()
.
get
().
getValue
()
:
""
;
arrayPart
+=
getEndOpt
()
.
isPresent
()
?
":"
+
getEndOpt
()
.
get
().
getValue
()
:
""
;
return
name
+
(
arrayPart
.
equals
(
""
)
?
""
:
"["
+
arrayPart
+
"]"
);
};
...
...
@@ -47,7 +47,7 @@ grammar Tagging extends de.monticore.common.Common {
QualifiedNameWithArray
=
parts
:(
NameWithArray
||
"."
)+;
ast
QualifiedNameWithArray
=
method
public
String
toString
(){
return
de
.
se_rwth
.
commons
.
Joiners
.
DOT
.
join
(
getParts
());
return
de
.
se_rwth
.
commons
.
Joiners
.
DOT
.
join
(
getParts
List
());
};
...
...
src/main/java/de/monticore/lang/tagging/_ast/ASTTagElement.java
View file @
13998800
...
...
@@ -20,8 +20,11 @@
*/
package
de.monticore.lang.tagging._ast
;
import
java.util.Optional
;
public
class
ASTTagElement
extends
ASTTagElementTOP
{
protected
ASTTagElement
(
String
name
,
String
tagValue
)
{
protected
ASTTagElement
(
String
name
,
Optional
<
String
>
tagValue
)
{
super
(
name
,
tagValue
);
}
...
...
src/main/java/de/monticore/lang/tagging/_symboltable/TaggingResolver.java
View file @
13998800
...
...
@@ -222,11 +222,6 @@ public class TaggingResolver implements Scope {
return
globalScope
.
resolveLocally
(
symbolKind
);
}
@Override
public
Optional
<?
extends
Symbol
>
resolve
(
SymbolPredicate
symbolPredicate
)
{
return
globalScope
.
resolve
(
symbolPredicate
);
}
@Override
public
<
T
extends
Symbol
>
Optional
<
T
>
resolveDown
(
String
s
,
SymbolKind
symbolKind
)
{
return
globalScope
.
resolveDown
(
s
,
symbolKind
);
...
...
@@ -262,12 +257,6 @@ public class TaggingResolver implements Scope {
return
globalScope
.
getLocalSymbols
();
}
/** @deprecated */
@Override
public
Map
<
String
,
Collection
<
Symbol
>>
getSymbols
()
{
return
globalScope
.
getSymbols
();
}
@Override
public
int
getSymbolsSize
()
{
return
globalScope
.
getSymbolsSize
();
...
...
src/main/java/de/monticore/lang/tagging/generator/TagSchemaGenerator.java
View file @
13998800
...
...
@@ -101,8 +101,8 @@ public class TagSchemaGenerator extends GeneratorEngine {
String
.
format
(
"Could not load tagschema '%s'"
,
tagSchemaLocation
.
toString
()));
List
<
String
>
tagTypeNames
=
new
ArrayList
<>();
String
packageName
=
Joiners
.
DOT
.
join
(
tagSchemaUnit
.
getPackage
());
List
<
ASTTagType
>
tagTypes
=
tagSchemaUnit
.
getTagType
s
();
String
packageName
=
Joiners
.
DOT
.
join
(
tagSchemaUnit
.
getPackage
List
());
List
<
ASTTagType
>
tagTypes
=
tagSchemaUnit
.
getTagType
List
();
for
(
ASTTagType
tagType
:
tagTypes
)
{
generateTagType
(
tagType
,
tagSchemaUnit
,
packageName
,
symbolScopeMap
);
tagTypeNames
.
add
(
tagType
.
getName
());
...
...
@@ -129,18 +129,18 @@ public class TagSchemaGenerator extends GeneratorEngine {
protected
void
generateValuedTagType
(
ASTValuedTagType
valuedTagType
,
ASTTagSchemaUnit
tagSchemaUnit
,
String
packageName
,
Map
<
String
,
String
>
symbolScopeMap
)
{
String
dataType
=
null
;
boolean
isUnit
=
false
;
if
(
valuedTagType
.
getBoolean
().
isPresent
())
{
if
(
valuedTagType
.
getBoolean
Opt
().
isPresent
())
{
dataType
=
"Boolean"
;
}
else
if
(
valuedTagType
.
getNumber
().
isPresent
())
{
else
if
(
valuedTagType
.
getNumber
Opt
().
isPresent
())
{
dataType
=
"Number"
;
}
else
if
(
valuedTagType
.
getString
().
isPresent
())
{
else
if
(
valuedTagType
.
getString
Opt
().
isPresent
())
{
dataType
=
"String"
;
}
else
if
(
valuedTagType
.
getUnitKind
().
isPresent
())
{
else
if
(
valuedTagType
.
getUnitKind
Opt
().
isPresent
())
{
isUnit
=
true
;
dataType
=
valuedTagType
.
getUnitKind
().
get
();
dataType
=
valuedTagType
.
getUnitKind
Opt
().
get
();
if
(!
UnitKinds
.
contains
(
dataType
))
{
Log
.
error
(
String
.
format
(
"Unit kind '%s' is not supported. Currently the following unit kinds are available '%s'"
,
dataType
,
UnitKinds
.
available
()),
valuedTagType
.
get_SourcePositionStart
());
...
...
@@ -152,7 +152,7 @@ public class TagSchemaGenerator extends GeneratorEngine {
Paths
.
get
(
createPackagePath
(
packageName
).
toString
(),
tagSchemaUnit
.
getName
(),
valuedTagType
.
getName
()
+
"Symbol.java"
),
tagSchemaUnit
,
packageName
,
tagSchemaUnit
.
getName
(),
valuedTagType
.
getName
(),
dataType
,
isUnit
);
String
importSymbols
=
"de.monticore.lang.montiarc._symboltable.*"
;
String
scopeSymbol
=
valuedTagType
.
getScope
().
get
().
getScopeIdentifier
s
().
get
(
0
).
getScopeName
();
String
scopeSymbol
=
valuedTagType
.
getScope
Opt
().
get
().
getScopeIdentifier
List
().
get
(
0
).
getScopeName
();
String
nameScopeType
=
Log
.
errorIfNull
(
symbolScopeMap
.
get
(
scopeSymbol
),
String
.
format
(
"For the scope symbol '%s' is no scope type defined."
,
scopeSymbol
));
generate
(
"templates.de.monticore.lang.tagschema.ValuedTagTypeCreator"
,
Paths
.
get
(
createPackagePath
(
packageName
).
toString
(),
tagSchemaUnit
.
getName
(),
valuedTagType
.
getName
()
+
"SymbolCreator.java"
),
...
...
@@ -174,7 +174,7 @@ public class TagSchemaGenerator extends GeneratorEngine {
Paths
.
get
(
createPackagePath
(
packageName
).
toString
(),
tagSchemaUnit
.
getName
(),
simpleTagType
.
getName
()
+
"Symbol.java"
),
tagSchemaUnit
,
packageName
,
tagSchemaUnit
.
getName
(),
simpleTagType
.
getName
());
String
importSymbols
=
"de.monticore.lang.montiarc._symboltable.*"
;
String
scopeSymbol
=
simpleTagType
.
getScope
().
get
().
getScopeIdentifier
s
().
get
(
0
).
getScopeName
();
String
scopeSymbol
=
simpleTagType
.
getScope
Opt
().
get
().
getScopeIdentifier
List
().
get
(
0
).
getScopeName
();
String
nameScopeType
=
Log
.
errorIfNull
(
symbolScopeMap
.
get
(
scopeSymbol
),
String
.
format
(
"For the scope symbol '%s' is no scope type defined."
,
scopeSymbol
));
generate
(
"templates.de.monticore.lang.tagschema.SimpleTagTypeCreator"
,
Paths
.
get
(
createPackagePath
(
packageName
).
toString
(),
tagSchemaUnit
.
getName
(),
simpleTagType
.
getName
()
+
"SymbolCreator.java"
),
...
...
src/main/java/de/monticore/lang/tagging/helper/RangeFixer.java
View file @
13998800
...
...
@@ -22,7 +22,6 @@ package de.monticore.lang.tagging.helper;
import
com.google.common.collect.Lists
;
import
de.monticore.lang.tagging._ast.*
;
import
de.monticore.literals.literals._ast.ASTIntLiteral
;
import
java.util.ArrayList
;
import
java.util.Collection
;
...
...
@@ -36,14 +35,14 @@ public class RangeFixer {
public
static
void
fixTaggingUnit
(
ASTTaggingUnit
astTaggingUnit
)
{
//Replace all range syntax scopes with expanded versions
astTaggingUnit
.
getTagBody
().
getTag
s
()
astTaggingUnit
.
getTagBody
().
getTag
List
()
.
forEach
(
tag
->
{
List
<
ASTScope
>
fixedScopes
=
tag
.
getScope
s
().
stream
()
List
<
ASTScope
>
fixedScopes
=
tag
.
getScope
List
().
stream
()
.
map
(
RangeFixer:
:
expandScopeWithRange
)
.
flatMap
(
Collection:
:
stream
)
.
collect
(
Collectors
.
toList
());
tag
.
setScope
s
(
fixedScopes
);
tag
.
setScope
List
(
fixedScopes
);
});
}
...
...
@@ -52,22 +51,22 @@ public class RangeFixer {
ASTNameScope
nameScope
=
(
ASTNameScope
)
scope
;
List
<
ASTQualifiedNameWithArray
>
qualifiedNames
=
new
ArrayList
<>();
//add empty start name
qualifiedNames
.
add
(
ASTQ
ualifiedNameWithArray
.
get
Builder
().
build
());
qualifiedNames
.
add
(
TaggingMill
.
q
ualifiedNameWithArrayBuilder
().
build
());
for
(
ASTNameWithArray
part
:
nameScope
.
getQualifiedName
().
getParts
())
{
for
(
ASTNameWithArray
part
:
nameScope
.
getQualifiedName
().
getParts
List
())
{
List
<
ASTNameWithArray
>
expandedParts
=
expandRangeInPart
(
part
);
List
<
ASTQualifiedNameWithArray
>
expandedNames
=
new
ArrayList
<>();
for
(
ASTNameWithArray
ep
:
expandedParts
)
{
for
(
ASTQualifiedNameWithArray
name
:
qualifiedNames
)
{
ASTQualifiedNameWithArray
tmpName
=
name
.
deepClone
();
tmpName
.
getParts
().
add
(
ep
);
tmpName
.
getParts
List
().
add
(
ep
);
expandedNames
.
add
(
tmpName
);
}
}
qualifiedNames
=
expandedNames
;
}
return
qualifiedNames
.
stream
().
map
(
name
->
ASTN
ameScope
.
get
Builder
().
q
ualifiedName
(
name
).
build
()).
collect
(
Collectors
.
toList
());
return
qualifiedNames
.
stream
().
map
(
name
->
TaggingMill
.
n
ameScopeBuilder
().
setQ
ualifiedName
(
name
).
build
()).
collect
(
Collectors
.
toList
());
}
else
{
return
Lists
.
newArrayList
(
scope
);
...
...
@@ -76,20 +75,20 @@ public class RangeFixer {
public
static
List
<
ASTNameWithArray
>
expandRangeInPart
(
ASTNameWithArray
part
)
{
//Not a range
if
(!
part
.
getStart
().
isPresent
()
||
!
part
.
getEnd
().
isPresent
())
{
if
(!
part
.
getStart
Opt
().
isPresent
()
||
!
part
.
getEnd
Opt
().
isPresent
())
{
return
Lists
.
newArrayList
(
part
);
}
List
<
ASTNameWithArray
>
result
=
new
ArrayList
<>();
int
step
=
part
.
getStep
().
isPresent
()
?
part
.
getStep
().
get
().
getValue
()
:
1
;
int
start
=
part
.
getStart
().
get
().
getValue
();
int
end
=
part
.
getEnd
().
get
().
getValue
();
int
step
=
part
.
getStep
Opt
().
isPresent
()
?
part
.
getStep
Opt
().
get
().
getValue
()
:
1
;
int
start
=
part
.
getStart
Opt
().
get
().
getValue
();
int
end
=
part
.
getEnd
Opt
().
get
().
getValue
();
for
(
int
i
=
start
;
i
<=
end
;
i
+=
step
)
{
ASTNameWithArray
tmpNameWithArray
=
ASTN
ameWithArray
.
get
Builder
()
.
n
ame
(
part
.
getName
())
.
start
(
ASTI
ntLiteral
.
get
Builder
().
source
(
""
+
i
).
build
())
ASTNameWithArray
tmpNameWithArray
=
TaggingMill
.
n
ameWithArrayBuilder
()
.
setN
ame
(
part
.
getName
())
.
s
etS
tart
(
TaggingMill
.
i
ntLiteralBuilder
().
s
etS
ource
(
""
+
i
).
build
())
.
build
();
result
.
add
(
tmpNameWithArray
);
}
...
...
src/main/java/de/monticore/lang/tagschema/_ast/ASTComplexTagType.java
View file @
13998800
...
...
@@ -20,6 +20,8 @@
*/
package
de.monticore.lang.tagschema._ast
;
import
java.util.Optional
;
/**
* Created by MichaelvonWenckstern on 28.06.2016.
*/
...
...
@@ -28,8 +30,8 @@ public class ASTComplexTagType extends ASTComplexTagTypeTOP {
super
();
}
public
ASTComplexTagType
(
String
name
,
ASTScope
scope
,
String
complexTag
Def
)
{
super
(
name
,
scope
,
complexTag
Def
);
public
ASTComplexTagType
(
String
name
,
Optional
<
ASTScope
>
scope
,
String
complexTag
)
{
super
(
name
,
scope
,
complexTag
);
}
public
void
setComplexTag
(
String
complexTag
)
{
...
...
src/main/java/de/monticore/lang/tagschema/_ast/ASTEnumeratedTagType.java
View file @
13998800
...
...
@@ -20,44 +20,44 @@
*/
package
de.monticore.lang.tagschema._ast
;
import
java.util.ArrayList
;
import
java.util.LinkedHashSet
;
import
java.util.
List
;
import
java.util.
Optional
;
import
java.util.Set
;
/**
* Created by MichaelvonWenckstern on 15.06.2016.
*/
public
class
ASTEnumeratedTagType
extends
ASTEnumeratedTagTypeTOP
{
protected
ASTEnumeratedTagType
()
{
super
();
}
protected
ASTEnumeratedTagType
()
{
super
();
}
protected
Set
<
String
>
enumValues
=
new
LinkedHashSet
<>();
protected
Set
<
String
>
enumValues
=
new
LinkedHashSet
<>();
protected
ASTEnumeratedTagType
(
String
name
,
String
enumText
,
ASTScope
scope
)
{
super
(
name
,
enumText
,
scope
);
}
protected
ASTEnumeratedTagType
(
String
name
,
String
enumText
,
Optional
<
ASTScope
>
scope
)
{
super
(
name
,
enumText
,
scope
);
this
.
enumValues
=
enumValues
;
}
public
void
setEnumText
(
String
enumText
)
{
if
(
enumText
!=
null
)
{
if
(
enumText
.
startsWith
(
"["
))
{
enumText
=
enumText
.
substring
(
1
);
}
if
(
enumText
.
endsWith
(
"]"
))
{
enumText
=
enumText
.
substring
(
0
,
enumText
.
length
()
-
1
);
}
enumText
=
enumText
.
trim
();
// TODO fix: now it also splits BC and D in A | "BC|D" | X
String
vs
[]
=
enumText
.
split
(
"\\|"
);
for
(
String
v
:
vs
)
{
enumValues
.
add
(
v
.
trim
());
}
public
void
setEnumText
(
String
enumText
)
{
if
(
enumText
!=
null
)
{
if
(
enumText
.
startsWith
(
"["
))
{
enumText
=
enumText
.
substring
(
1
);
}
if
(
enumText
.
endsWith
(
"]"
))
{
enumText
=
enumText
.
substring
(
0
,
enumText
.
length
()
-
1
);
}
enumText
=
enumText
.
trim
();
// TODO fix: now it also splits BC and D in A | "BC|D" | X
String
vs
[]
=
enumText
.
split
(
"\\|"
);
for
(
String
v
:
vs
)
{
enumValues
.
add
(
v
.
trim
());
}
}
super
.
setEnumText
(
enumText
);
}
super
.
setEnumText
(
enumText
);
}
public
Set
<
String
>
getEnumValues
()
{
return
enumValues
;
}
public
Set
<
String
>
getEnumValues
()
{