LF Fortran 95

Syntax Coloring

Syntax coloring provides the ability to differentiate code elements based on color. For example, a keyword may appear in blue, comments may appear in green, while character strings might be maroon. The Fortran language allows variables and procedures to have the same names as keywords, and this can pose a problem for colorizers that do not have a strong parsing ability. Since the parser used in the Lahey colorizer is derived from a Fortran compiler, it is unlikely that is would be confused by an identifier with the same name as a keyword. In order for the parser to work correctly, source should be free of coding errors.

Colorizing Categories

The Fortran integration package provides the following categories of code elements which are elegible for colorization:

Colorization Categories

Code Element

Options Dialog Display Item

Default Color

Fixed form continuation column 6

Fortran column 6 (fixed form)



Fortran comment



Fortran keyword

Bold blue


Fortran identifier

Default Text Color


Fortran label

Default Text Color


Fortran number

Default Text Color


Fortran operator

Default Text Color

Fixed form past column 72

Fortran past column 72 (fixed form)

Light gray


Fortran string



Fortran text

Default Text Color

* - Text is everything not covered by one of the other categories.

In addition to these categories, there are other categories provided by Visual Studio, such as "Selected Text" and "Brace Matching". Changing these will affect all language packages, not just the Fortran Language package.

Changing Default Colors

Colors of the display items listed in the table above can be changed by selecting the "Tools->Options..." menu selection, selecting "Fonts and Colors" from the "Environment" category, and scrolling to the "Fortran xxx" items:

Highlight a Fortran display item, and select new colors from the "Item foreground" and "Item background" lists.

Restoring Default Colors

Individual display items have a "Default" color setting in the "Item foreground" and "Item background" lists. The default color scheme for all items can be restored by pressing the "Use Defaults" button in the upper right corner of the "Fonts and Colors" dialog page.