GNATbench Project File Editor

GNATbench provides a simple syntax-oriented editor for GNAT Project Files. Although the GUI interface discussed elsewhere is likely more convenient in most cases, occasionally you may want to edit the file directly.

The editor is associated with files having an extension of ".gpr" (standing for "Gnat PRoject" and is thus invoked by double-clicking on the project file itself. If the default system editor is invoked, you can reassign the GNATbench editor by selecting "Open With -> GNAT Project File Editor" in the contextual menu.

Project files are simply text files with an Ada-like syntax. The purpose of the editor is facilitate making syntactically correct changes to these files. To that end, the primary feature of the editor is syntax-driven entity coloring. Reserved words and punctuation (e.g., semicolons and parenthesis) appear in black text, string literals appear in blue, predefined entities (e.g., package names and switch names) appear in green, and user-defined names appear in brown.

An example project file illustrating this coloring is shown in the figure below.

project file editor debug-release example

Note that, as far as these colors go, the predefined names are case-sensitive so they will not appear in the expected colors unless the letter casing is maintained. The required casing is to capitalize the first letter of an identifier and the first letter following an underscore. This behavior is intended to promote consistency. However, the syntax of project files is not really case-sensitive; only this editor applies this sensitivity for choosing the color to apply.