UoY-RoboStar / robosim-textual

This repository contains the plugins for the RoboSim textual editor.
Eclipse Public License 2.0
0 stars 0 forks source link

Revision on the use of Communications class in RoboSim #15

Closed pefribeiro closed 3 years ago

pefribeiro commented 3 years ago

This pull request contains changes to support the changes to the Communication class as merged in https://github.com/UoY-RoboStar/robochart-metamodel/pull/8, where the attribute event is now mandatory.

The solution is to consider that in RoboSim the only event permitted in a Communication, which can only be used in triggers of Transitions, must be exec.

From an implementation standpoint, as the event attribute is a reference it needs to point to an instance of Event. Therefore, we define a new library under lib/robosim/score.rst of this plug-in that contains a package named robosim__core with one interface events that contains the only event exec.

The RoboSimRuntimeModule.xtend class has been changed to make use of a new RoboSimImportURIGlobalScopeProvider and RoboSimImportedNamespaceAwareLocalScopeProvider, which subclass their RoboChart counterparts, to ensure that the resource lib/robosim/score.rst is loaded in the ResourceSet and that exec is in scope. The RoboSim scope provider has been changed to ensure the event exec of an ExecTrigger can be found in this library.

The key changes in the Xtext grammar is that ExecTrigger now has the rule: event=[Event|'exec']. This allows the exec keyword to be used, while still encoding a cross-reference to the appropriate event. (I did experiment with alternatives to auto-populate this attribute behind the scenes, but the serializer, which is crucial for the work with Epsilon, wouldn't be able to handle it if implemented differently). Note that the ability to handle this kind of terminal in Xtext is only possible from version 2.22 onwards.

ExecStatement has the same rule as before, which uses the keyword exec.

So in conclusion the textual representation, and metamodel, are the same as before. I've checked this works properly with a local Eclipse installation. The only difference regarding the work with Epsilon is that when an ExecTrigger element is created it needs to be populated with the correct exec Event. I have also tested that this is possible and have let @madielfilho know of the impending changes.

After this is merged further updates are required to the following RoboSim plug-ins: graphical, assertions and generator-csp.

pefribeiro commented 3 years ago

Thanks @jameseb7 for your comments. Merging this.