Page tree
Skip to end of metadata
Go to start of metadata

Language analysis in the Universal Analyzer is governed by the xxxMetaModel.xml file. This file contains information that the Universal Analyzer uses when analyzing the source code of your language - this includes:

  • Object definition (what objects will be identified, will they be stored in the CAST Analysis Service, can they be displayed in CAST Enlighten…)
  • Link definition (what links will be identified, will they be stored in the CAST Analysis Service, can they be displayed in CAST Enlighten…)

However, this information needs to be defined and manually entered into the file before you can analyze a specific language.

Main categories used by the Universal Analyzer

Before defining a language and the type of objects/links that exist in that language, you should get to know the main existing categories that can be used. Here is a non-exhaustive list:

Categories

Description

CsvLanguage

The base category for a language.

UniversalLanguage

The base category for a language that should be handled by the Universal Analyzer (i.e. raw source code).

UniversalImporterThe base category for a language that should be handled by the Universal Importer (i.e. when you have .UAX files). This category also requires that the language inherits from the "UniversalLanguage" category.

UAProject

See section below - UAObject and UAProject categories

UAObject

See section below - UAObject and UAProject categories

identification

The name, description and full name of an object.

persistent

Is the object persistent (saved in the CAST Knowledge Base) or not?

bookmark

The source of an object (e.g. the file for a Java class).

POSITIONABLE

The position of an object as a bookmark list. A bookmark contains the following information: source file, starting line, starting column, ending line, ending column.

metric

The metrics of an object: Lines of code, lines of comment (header and body).

METRICABLE

Indicates if metrics can be calculated or not on objects of that type.

APM All Artifacts

Triggers the use of diagnostics associated with Copy/Paste metrics for all METRICABLE objects (<inheritedCategory name="APM All Artifacts"/>)

object

The parent and the children of an object.

EnlightenBrowsable

Indicates that the object is displayed in the object browser in CAST Enlighten.

EnlightenGraphable

Indicates that the object is displayed in the views in CAST Enlighten.

WithEnlightenProperties

Indicates that object properties can be displayed in the property window in CAST Enlighten.

CastSystemViews

Indicates that the item will be visible in the CAST System Views. Please note that this category MUST always be specified for each item – omitting it can lead to data corruption.

Shell

For files and directories, specify the full path and relative path (if a root path exists).

ID assignment scheme

Each category and type defined in the xxxMetaModel.xml file must be assigned an ID. The ID assignment scheme is designed so that ID conflicts between languages are easy to resolve: each item is given a relative ID (rid) within a particular metamodel, while each metamodel file is assigned a file number (file_no) that acts as an ID base. A range of 1000 IDs is reserved per file number.

Example:

<metaModel file_level="client" file_no="2" > 
   <category name="TEST" rid="0" >
...
   </category>
   <type name="testFunction" rid="1" >
...
   </type>
</metaModel>

In older versions of CAST, the ID assignment scheme was based on absolute IDs; conversion to relative IDs is relatively simple and uses the following formula: id = 2,000,000 + 1,000 * file_no + rid. For instance, id 2,003,007 is relocated to rid 7 within file number 3.

Please note that when creating an xxxMetaModel.xml file for your own custome language, you must make sure that the file_level attribute:

  • either does not exist
  • or is set to file_level="client"

ID ranges

  • When assembling several custom metamodel files within a single CAST Analysis Service, always ensure that each metamodel file number is unique within the set. Otherwise installation will fail due to unique ID constraint violation.
  • In addition, ensure that you use the correct ID ranges as listed below and that all IDs are unique across all metamodels - in otherwords do not use the same IDs in different custom metamodels. Multiple metamodels containing identical IDs can cause an error during analysis

See Managing ID ranges for custom extensions to view the available ID ranges.

UAObject and UAProject categories

 

The UAObject and UAProject categories MUST always be used to replace a whole set of standard Universal Analyzer categories. Examples of this use are shown in the sections Language project "type" and Language object types located in Defining a new language.

UAObject

The <inheritedCategory name="UAObject"/> will replace the following object categories:

<inheritedCategory name="KB object" />
<inheritedCategory name="withCode" />
<inheritedCategory name="EnlightenStandard" />
<inheritedCategory name="ESCALATION_ALL" />
<inheritedCategory name="CastSystemViews" />

In other words, using <inheritedCategory name="UAObject"/> will mean that the categories listed above ALSO apply for the object in question.

UAProject

You can use the <inheritedCategory name="UAProject"/> to replace the following project categories:

<inheritedCategory name="project" />
<inheritedCategory name="KB object" />
<inheritedCategory name="CastSystemViews" />

In other words, using <inheritedCategory name="UAProject"/> will mean that the categories listed above ALSO apply for the project in question.

Replaced categories

The following categories are automatically assigned to an object/project by the UAObject and UAProject categories. They have the following values:

KB object

<category name="KB object" id="2500">
<description>objects enabled for repository saving</description>
<inheritedCategory name="object"/>
<inheritedCategory name="identification"/>
<inheritedCategory name="persistent"/>
<inheritedCategory name="CAST_Guid_FatherReady"/>
<inheritedCategory name="CAST_Guid_ProjectReady"/>
</category>

withCode

<category name="withCode" id="1107">
<description>object with source code</description>
<inheritedCategory name="comment"/>
<inheritedCategory name="bookmark"/>
<inheritedCategory name="POSITIONABLE"/>
<inheritedCategory name="metric"/>
<inheritedCategory name="checksum"/>
</category>

EnlightenStandard

<category name="EnlightenStandard" id="5026">
<description>default Enlighten behaviour</description>
<inheritedCategory name="EnlightenBrowsable"/>
<inheritedCategory name="EnlightenGraphable"/>
<inheritedCategory name="WithEnlightenProperties"/>
</category>

ESCALATION_ALL

<category name="ESCALATION_ALL" id="6508">
<description>To be part of escalation</description>
<inheritedCategory name="ESCALATION_AS_CALLER_CHILD" />
<inheritedCategory name="ESCALATION_AS_CALLEE_CHILD" />
<inheritedCategory name="ESCALATION_AS_CALLER_PARENT" />
<inheritedCategory name="ESCALATION_AS_CALLEE_PARENT" />
</category>

CastSystemViews

<category name="CastSystemViews" id="6060">
<description>Cast System Views Calculation</description>
</category>

project

<category name="project" id="1013">
<description>project</description>
<property name="merged" type="integer" id="102">
<description>merged</description>
<attribute name="ACCESS_APPVIEW" intValue="1" />
<attribute name="ACCESS_CVS" intValue="1" />
<attribute name="ACCESS_HTML" intValue="1" />
<attribute name="INF_TYPE" intValue="37000" />
<attribute name="INF_SUB_TYPE" intValue="102" />
</property>
<property name="projectClass" type="integer" id="122">
<description>projectClass</description>
<attribute name="INF_TYPE" intValue="37000" />
<attribute name="INF_SUB_TYPE" intValue="122" />
</property>
</category>
  • No labels