Package definition
A user-defined Universal Analyzer language must be created in the form of a language package. A package consists of a folder whose name is the same as the language name (represented by xxx below). This directory must contain certain files (marked as obligatory below) and can contain other optional files:
File name | Description | Is this file obligatory in the Language Package? |
---|---|---|
xxxMetaModel.xml | A metamodel that describes objects defined in the language together with their characteristics and properties. See xxxMetaModel.xml file for more information. | |
xxxLanguagePattern.xml | A language pattern file that describes how to recognize objects within source files using regular expressions. See xxxLanguagePattern.xml - defining how to analyze a language for more information. | |
xxxInformationTracking.xml | An optional file used to reduce the number of incorrect links detected during the analysis of your language with CAST Universal Analyzer. See xxxInformationTracking.xml file for more information. | |
A set of image icons | The icons associated with your language's objects for display in CAST Enlighten and in the CAST Discovery Portal - icons are located in a Res subdirectory (a subdirectory of the main package folder). The title of the icon file must match the name of the object. See Binding icons and pictures to object types in Defining a new language for more information. | |
xxxCastMetrics.xml | An optional file used to define custom grep based metrics using regular expressions. See xxxCastMetrics.xml - defining new metrics for a UA language for more information. | |
prepro\launch.bat | An optional file used to pre-process your source code just prior to analysis. This file will contain instructions that will launch a pre-processing action if your source code needs any sort of pre-processing before analysis. See Configuring code pre-processing for your Universal Analyzer language for more information. | |
plugin\launch.bat | An optional file used to execute a third party tool that can analyze source code and generate Quality Rule data. See Configuring a plugin for your Universal Analyzer language for more information. |
For example, for the fictitious language "test":
Directory name | TEST |
MetaModel name | TESTMetaModel.xml |
LanguagePattern name | TESTLanguagePattern.xml |
InformationTracking name | TESTInformationTracking.xml |
CastMetrics name | TESTCastMetrics.xml |
Preprocessing name | prepro\launch.bat - plus any additional files used in the pre-processing action. |
Plugin name | plugin\launch.bat - plus any additional files used in the plugin. |
Icon image names | EnlightenTEST.ICO, TESTClass.ICO, TESTFunction.ICO, TESTInterface.ICO, TESTMember.ICO, TESTMethod.ICO, TESTProject.ICO |
XML file encoding
All XML files used in the Language Package must use the UTF-8 encoding as follows:
- The XML declaration (the first line of the file) must include the UTF-8 encoding attribute:
- All XML files must be saved in UTF-8 format
Package handling
Instructions for creating and editing the various configuration files are provided in forthcoming pages.
Once your package has been developed, you need to validate it and then include the package files in your custom SDK extension. Please see Configuring CAST to accept your Universal Analyzer language package for more detailed information about this.