www.delorie.com/gnu/docs/a2ps/a2ps_94.html search
General Purpose PostScript Generating Utility

 [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

### 7.6.6 Declaring the keywords and the operators

Basically, keywords and operators are lists of rules. The syntax is:
 keywords are rules end keywords 

or
 keywords in face-keyword are rules end keywords 

in which case the default face is set to face-keyword.

As an example:
 keywords in Keyword_strong are /foo*/, "bar" "BAR" Keyword, -> \rightarrow end keywords 

is valid.

The syntax for the operators is the same, and both constructs can be qualified with an optional flag, in which case they are taken into account in the heavy highlighting mode (see section 3.1.7 Pretty Printing Options).

This is an extract of the C style sheet:
 optional operators are -> \rightarrow, && \wedge, || \vee, != \neq, == \equiv, # We need to protect these, so that <= is not replaced in <<= <<=, >>=, <= \leq, >= \geq, ! \not end operators 

Note how <<=' and >>=' are protected (there are defined to be written as is when met in the source). This is to prevent the two last characters of <<=' from being converted into a less or equal' sign.

The order in which you define the elements of a category (but the sequences) does not matter. But since a2ps sorts them at run time, it may save time if the alphabetical C-order is more or less followed.

You should be aware that when declaring a keyword with a regular expression as lhs, then a2ps automatically makes this expression matching only if there are no character of the first alphabet both just before, and just after the string.

In term of implementation, it means that
 keywords are /foo|bar/ end keywords 

is exactly the same as
 operators are /\\b(foo|bar)\\b/ end operators 

This can cause problems if you use anchors (e.g. \$, or ^) in keywords: the matcher will be broken. In this particular case, define your keywords as operators, taking care of the \\b' by yourself.

See section Match-word-boundary Operator' in Regex manual, for details on `\b'.

 [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]

 webmaster delorie software   privacy Copyright © 2003   by The Free Software Foundation Updated Jun 2003