Syntax Coloring
Source code is colored in the DVT editor. Some language constructs are colored based on a syntactical analysis of the code, while others require a more elaborate semantic analysis, as detailed in the table below. Semantic coloring is only performed when the source code is compiled.
Category |
Requires compilation |
Details |
---|---|---|
Arguments |
y |
Function arguments |
Comment Hyperlinks |
||
Comment Pragmas |
y |
Compilation is required for Custom Pragmas |
Comments |
||
Constants |
y |
Const fields, enum members and predefined constants like TRUE, FALSE |
Default |
Any word which does not belong to other categories |
|
Define Groups |
Syntactical category tag of a define as or define as computed macro |
|
Events |
y |
|
Expansion Literals |
||
Expansion Replacements |
||
Fields |
y |
Struct fields and union fields |
HDL Paths |
||
Javadoc Tags |
||
Keyphrases |
Combination of keywords: “is a”, “keep for each” |
|
Keywords |
||
Labels |
y |
|
Methods |
y |
Methods and time consuming methods |
Numbers |
||
Ports - Input, Inout |
y |
|
Ports - Output |
y |
|
Preprocessing |
Preprocessing #macros |
|
Replacement Terms |
Constructs like <any>, <exp>, <type> |
|
Section Start/End |
Begin or end of code section <’ and ‘> |
|
String Literals |
||
Task Tags |
||
Types |
y |
scalar types, units, structs |
Template Identifiers |
||
Time Units |
Time units like ms, ns or ps |
|
Variables |
y |
You can change the coloring style for each of the categories. Go to Window > Preferences > DVT > e Language > Editor > Syntax Coloring, select the category you wish to modify from the list and set the color and font style.
A code sample in the Syntax Coloring preference page helps you preview the changes instantly. The default style is shown below:
Note
Inside macro definitions and macro calls, only syntactic coloring is performed.