Parser Integration
The action language is integrated within the FW Profile and is implemented as part of the FW Profile plug-In. The output of the javacc tool (Java source files) generated by the javacc tool are generated as the ch.ethz.profile.parser package of the FW Profile plug-in.
Whenever the model validation is performed within the Eclipse UML2 Editor plug-in, the FW Profile Validator is activated and action language constructs are parsed. Expr is used as a start symbol when validating the guard constraint. Action is used as a start symbol when validating transition effects, state entry actions, and state exit actions. The parsing is started by call of the Expr() or Action() methods passing the string to be parsed.
Whenever parser finds an identifier it analyses the identifier context. It checks that the identifier is used in legal context. In particular the following is forced:
-
The method or attribute has to declared in a container class or its superclass (in superclass it has to be declared as public, protected, or default (none access modifier))
-
The method or attribute right to the ‘.’ operator in the right-hand side of the Navigation1 rule has to be declared as public in the class that corresponds to the object type left to the ‘.’ operator
-
The method or attribute that is an operand in an expression (all non-terminals except ArgumentList is treated as expression) is type checked. For elementary data types (integer and boolean) strict type equality is required. For reference data types the usual UML2class hierarchy is used to decide on the type compatibility.
-
The type of the expression passed as a parameter to a method is type checked. Again, for elementary data types (integer and boolean) strict type equality is required. For reference data types the usual UML2class hierarchy is used to decide on the type compatibility.
To enforce all the above constraints the callback methods of the dedicated class in the Profile Plug-In (see section Profile Enforcement) are called. These methods uses UML2 API to query the model and are defined in the ch.ethz.profile.utils.EthFWProfileValidatorHelper class.