Epsilon is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML (including Cameo/MagicDraw), Simulink, XML and other types of models.
This pull request adds support for partial enumeration literals, in the style of ATL. If you have a model M with a TrafficLight from package traffic with a state which can take the enumeration value RED, now you can use:
m.state = #RED;
m.state = M!#RED;
m.state = M!TrafficLight#RED;
m.state = M!traffic::TrafficLight#RED;
m.state = TrafficLight#RED;
m.state = traffic::TrafficLight#RED;
The new logic is distributed between several places:
The EMC driver is responsible for understanding these partial enumeration literals and reporting ambiguous references within a single model. The current PR extends the EMF EMC driver in this regard.
The ModelRepository aggregates results across models: if there are matches from multiple models that are not exactly the same object, it will report it as an ambiguous result as well.
The enumeration literal evaluator understands the new special AmbiguousEnumerationValue return type from the EMC driver and/or the ModelRepository and reports warnings in those cases.
The EOL grammar was changed to support these new enumeration literals. The enum part of the pathName rule was dropped, leaving it as just:
This pull request adds support for partial enumeration literals, in the style of ATL. If you have a model
M
with aTrafficLight
from packagetraffic
with astate
which can take the enumeration valueRED
, now you can use:m.state = #RED;
m.state = M!#RED;
m.state = M!TrafficLight#RED;
m.state = M!traffic::TrafficLight#RED;
m.state = TrafficLight#RED;
m.state = traffic::TrafficLight#RED;
The new logic is distributed between several places:
ModelRepository
aggregates results across models: if there are matches from multiple models that are not exactly the same object, it will report it as an ambiguous result as well.AmbiguousEnumerationValue
return type from the EMC driver and/or the ModelRepository and reports warnings in those cases.The EOL grammar was changed to support these new enumeration literals. The enum part of the
pathName
rule was dropped, leaving it as just:A new
enumLiteral
rule was added:A bit of custom lookahead was needed to resolve the ambiguity between
enumLiteral
,featureCall
, andpathName
: