Implementing a new language frontend (parser)

  1. Create a plug-in project that will contain the implementation of the business logic. This plug-in will contain enough information to be directly used by the CLI.
    • The plug-in should depend on cern.plcverif.base.models, cern.plcverif.base.interfaces and cern.plcverif.base.extensions. (META-INF/MANIFEST.MF file, Dependencies tab, Required Plug-ins field)
    • The plug-in should define extension for the cern.plcverif.base.extensions.parser extension point
      • class: the class that will implement the IParserExtension interface
      • cmd_id: the unique command ID that will identify this language frontend. For example, this ID will be used when defining the language frontend to be used (-lf=<cmd_id>)
    • Implement the IParserExtension interface in a class. This factory will have to create the parser instances which will actually parse the program code. This class should be the one set for class above.
      • The getSupportedExtensions() method should return the list of supported file extensions, or empty list if it is not defined. It will be used on the GUI to suggest files to the user.
      • The getDefaultParser() method should return a pre-configured parser that can parse the given files, or empty, if such parser cannot be returned.
      • See more details in the API documentation.
    • Implement the IParser interface in a class. The above implementation of IParserExtension shall create instances of this class.
  2. If the language frontend plug-in has settings, implement the settings handling as described for the backend plug-ins.
  3. If desired to be used from the GUI (verification case editor), create a plug-in project that will contain the GUI representation of the language frontend.
    • The plug-in should depend on the previously created core plug-in, as well as on cern.plcverif.verif.extensions.gui. (META-INF/MANIFEST.MF file, Dependencies tab, Required Plug-ins field)
    • The plug-in should define extension for the cern.plcverif.verif.extensions.gui.part extension point. This will represent the part of the verification case editor that corresponds to this given language frontend.
    • Updating the verification case context. The language frontend GUI plug-ins are expected to subscribe to the context updated event of the verification case context given by the platform via the IPvGuiPart<VerificationCaseContext>.createPart() method. If the registered listener is called with updateID equals to VerificationCaseContext.FILES_ID, then the GUI plug-in is expected to parse the new set of files, and update the context (VerificationCaseContext) with the appropriate set of variables (setVariables()) and assertions (setAssertions()). In addition, the same update is expected when the current plug-in is made enabled via the IPvGuiPart<VerificationCaseContext>.setEnabled() method.
    • The rest of the details of creating a GUI plug-in can be found in the general part of the plug-in development documentation.
  4. If desired, it is possible to create a preference page that serves as GUI representation of the installation-specific settings of the plug-in. Check the general part of the plug-in development documentation for details and examples.

results matching ""

    No results matching ""