Crunch CRiSP File Editor 6 User Manual
Page 69

Page 69
definition is needed to tell CRiSP how to perform colorization of keywords for files of a particular type.
CRiSP comes with a variety of supported languages, but you can use this dialog to create your own or to
modify a supplied definition. For example, you might be programming in C and want to add custom function
libraries so that they are colored in a different color.
In order to create a colorizer there are three types of things you need to define:
Special parsing characters
Global attributes
Keywords
The list of keywords to define is relatively obvious. What is not obvious are the other two categories. In
general you only need to modify the other two as you detect that things are not 100% accurate.
When you pop up the keyword builder dialog it will show you the current colorizer definition for the file you
are viewiing.
Character classes
The character classes are used to define what a keyword looks like. For instance, in the C language, the
acceptable characters making up a symbol are the upper and lower case letters, the digits (0-9) and the
underscore. ABC_DEF is a perfectly valid symbol name. In some other language, maybe the underscore is
not valid; in shell scripts, the dollar sign is used to introduce a symbol but can also terminate a symbol
name, e.g. $HOST$PWD.
The character class definitions are pseudo-regular expressions containing character classes using the [..]
notation. Refer to the Colorizer Character class(pg. 72). section for more details.
Global attributes
The global attributes describe aspects of the language you are about to colorize. For instance all keywords
may be specified as case independent, or a special language syntax needs to be catered for. The attributes
which you can specify are described in the flags(pg. 74). section.
Keywords
The term keyword is used to refer to the objects you want to be colored In your document. This includes
string literals, comments, operators and normal keywords. You need to describe the keyword, give it a type
(e.g. a comment) and specify any particular keyword specific attributes (such as comment ends at end of
line). For plain textual keywords, things are easy - you just list the keyword, e.g. default, or switch.
Some keywords require more complexity in describing them; for example string literals in a program file
cannot be described by simply listing the quote character. You need to tell CRiSP that a string literal is a
sequence of characters starting with an open quote and terminating in the next non-backslashed quote.
The attributes which describe a keyword are similar to the global attributes, but sometimes have a slightly
different interpretation. See the keyword flags(pg. 75). section for details on each of the available flags.
Creating a new colorizer
To create a new colorizer, follow these steps:
Invoke the Keyword Builder dialog.
Select the New button to create a blank dialog
Enter your language name in the Language input field.
Type in your keywords, setting the appropriate Type and flags for the keyword. Press Add to add
the keyword to the keyword list. To modify a word already displayed in the table, double click on it
to display the keyword. If necessary you can modify the word and add it in again or Remove it.
If you need to change the character class information or global attributes then select the
appropriate tab of the dialog box.
When you have finished, select the Save button to save the colorizer associated with the previously
specified language name.
Dialog box buttons