Crunch CRiSP File Editor 6 User Manual

Page 70

Advertising
background image

Page 70

New

Clears the dialog in preparation for typing in a new definition. You are prompted to save
any changes before the dialog box is cleared out.

Save

Saves the current definition and closes the dialog box.

Add

Appends the current keyword along with the flags and type fields to the keyword table.

Remove

Deletes the currently selected word in the table.

.KWD Keyword File Format

Colorization:.kwd file format

CRiSP stores colorizer or keyword descriptions in a

special file, called a .KWD file. Keyword files have a .kwd file extension. You can see all the CRiSP supplied
colorizer descriptions in the installation directory under the src/keywords directory.

A keyword file is a plain text file, with the following syntax:

Comments are bracketed between /* and */. I.e. they are similar to C comments.

A keyword file can contain multiple keyword sections. Each section defines the colorizations for a
single file type. Each section starts off with the file type in square brackets.

Following the section name is a list of directives defining various attributes of the grammar. The
various keywords which make up this section can be provided in any order.

The following example is a cut down version of the C colorizer file illustrating many of the features of the
colorization process:

[c]
flags=c_hexadecimal c_floats

char_start="[A-Za-z_]"
char_next="[A-Za-z_0-9]"
char_new_token="[/*]"
char_operator="[/*]"

directive="^[ \t]*#*"

comment=accept_backslashes "//*.*$"
comment="/**.**/"

string=accept_backslashes "\"*.*\""
string=accept_backslashes "'*.*'"

/*******************************/
/* C keywords. */
/*******************************/
keyword="asm" "auto" "break" "case"
keyword="char" "const" "continue"

Comments

Keyword files can contain comments to help annotate what you are doing, or to put copyright or revision
history in. Comments are like C comments, they start with /* and everything up to the next */ constitutes the
comment. They do not nest.

Section Name

The section name appears on a line on its own inside square brackets. Generally speaking this name would
be the same as the basename of the filename without the file extension. E.g. C keywords are stored in
c.kwd and the section name is [c].

The section name and filename do not need to agree, but it is best to pick some scheme that won't lead to
confusion. For example, CRiSP macro files generally have a .cr file extension, but the keyword filename is
crisp.kwd, and the section name is [crisp]. In the language setup menu, you are presented a list of

Advertising