Searching for text -- regular expressions – Crunch CRiSP File Editor 6 User Manual

Page 47

Advertising
background image

Page 47

15

COL_BG_STRINGS

Background color for string literals.

16

COL_FG_KEYWORDS

Foreground color for language keywords.

17

COL_BG_KEYWORDS

Background color for language keywords.

18

COL_FG_MODIFIED

Foreground color for modified lines.

19

COL_BG_MODIFIED

Background color for modified lines.

20

COL_FG_HASH

Foreground color for directives.

21

COL_BG_HASH

Background color for directives.

22

COL_LINE_NOS

Foreground color for line numbers.

On a non-GUI version of CRiSP the set of color names is built into CRiSP - corresponding to the 16 colors
normally available on a serial terminal (e.g. a DOS display using ANSI.SYS or a VT340). On an X11 version
of CRiSP you can use any colors available in your systems rgb.txt file (as long as you do not run out of
pixels in your colormap).

The coloring system is divided into two logical parts -- the colors described above which are normally at the
discretion of the user (and setup with the Color Setup menu) and the color palette. The color palette is a
set of colors which may be allocated at any time but which the macro programmer will refer to using color
numbers. For example, the window_color() primitive may be used to allow each window on the screen to
have a background color different from the COL_BACKGROUND parameter described above. Instead of
allocating a color by name, colors are referred to using a color value (loosely corresponding to an X11 pixel
definition).

CRiSP supports by default 16 colors in the color palette. The macro programmer can define these colors
and then refer to them by the color number 0..15.

Colors in the palette and the screen objects are created using the set_color() primitive. This function is
passed a list of colors corresponding to the colors to allocate. Colors are specified by name and CRiSP will
attempt to map the color-strings into the color system supported by the system CRiSP is running on. CRiSP
supports a set of 16 standard color names which applications can fall back on if they detect that a non-GUI
version of CRiSP is running.

Searching for text -- Regular Expressions

A Regular expression is a term used to describe a string of characters used in pattern matching. Regular
expressions allow certain classes of strings to be matched, and provide a flexible way of matching 'token's.
CRiSP provides a variety of features when performing pattern matching:

o literal pattern matching.
o character class matching
o wild-card matching
o grouping
o alternation
o repeated expressions
o matching over line boundaries

Many non-alphanumeric characters have a special purpose in a regular expression, indicating a special
action to perform. The following table shows the regular expression matching idioms available, with the
highest priority at the top of the table. are as follows:

Character

Meaning

\x

treat x as a normal character.

@

matches zero or more of the previous expressions.

+

matches one or more of the previous expressions.

{..}

groups a regular expression.

|

performs alternation.

Advertising