| 1 |
<HTML> |
| 2 |
<HEAD><TITLE>Configuration of Syntax Highlighting</TITLE></HEAD> |
| 3 |
<BODY> |
| 4 |
Syntax: |
| 5 |
<PRE> |
| 6 |
<B>colorize</B> <I>Mode</I>[<B>:</B><I>Parent</I>] <B>{</B> <I><A HREF="#settings">Settings</A></I> <B>}</B> |
| 7 |
</PRE> |
| 8 |
|
| 9 |
<H1><A NAME="settings">Settings</A></H1> |
| 10 |
|
| 11 |
<UL> |
| 12 |
<LI>SyntaxParser |
| 13 |
<P>Syntax: |
| 14 |
<PRE> |
| 15 |
<B>SyntaxParser = "</B><I>Parser</I><B>";</B> |
| 16 |
</PRE> |
| 17 |
|
| 18 |
<P>Activates the specified syntax parser for highlighting mode. |
| 19 |
Value of <TT><I>Parser</I></TT> can be chosen from:<P> |
| 20 |
<DL> |
| 21 |
<DT>PLAIN<DD>No syntax parser, only <A HREF="#hl_keyword">keyword highlighting</A> |
| 22 |
is available. |
| 23 |
<DT>SIMPLE<DD><A HREF="#hl_simple">User configurable syntax parser</A> |
| 24 |
will be defined. |
| 25 |
<DT>C |
| 26 |
<DT>REXX |
| 27 |
<DT>HTML |
| 28 |
<DT>PERL |
| 29 |
<DT>MAKE |
| 30 |
<DT>DIFF<DD>For viewing output of <B>diff</B>. |
| 31 |
<DT>MERGE<DD>For editing output of <B>rcsmerge</B> (RCS, CVS). |
| 32 |
<DT>IPF |
| 33 |
<DT>Ada |
| 34 |
<DT>MSG<DD>For editing E-Mail, |
| 35 |
<DT>SH |
| 36 |
<DT>PASCAL |
| 37 |
<DT>TEX |
| 38 |
<DT>FTE |
| 39 |
<DT>CATBS<DD>For <B>VIEWING ONLY</B> of <B>nroff</B> formatted |
| 40 |
man-pages (formatted with backspaces). |
| 41 |
</DL> |
| 42 |
<P> |
| 43 |
<LI><A NAME="hl_keyword">Keywords</A> |
| 44 |
<P>Syntax: |
| 45 |
<PRE> |
| 46 |
<B>keyword "</B><A HREF="colors.html"><I>color_specification</I></A><B>" { |
| 47 |
"</B><I>keyword</I><B>"</B>, ... |
| 48 |
<B>};</B> |
| 49 |
</PRE> |
| 50 |
Multiple keyword sets with different colors can be defined. |
| 51 |
<P> |
| 52 |
<LI><A NAME="hl_color">Colors</A> |
| 53 |
<P>Syntax: |
| 54 |
<PRE> |
| 55 |
<B>color { |
| 56 |
"</B><I>color_name</I><B>", "</B><A HREF="colors.html"><I>color_specification</I></A><B>"</B> |
| 57 |
... |
| 58 |
<B>};</B> |
| 59 |
</PRE> |
| 60 |
|
| 61 |
<P> The following color-names are available, which ones |
| 62 |
will actually be used depends on the SyntaxParser setting used:<P> |
| 63 |
<UL> |
| 64 |
<LI>TODO: make color names dynamic at least for user defined parsers. |
| 65 |
</UL> |
| 66 |
</UL> |
| 67 |
<H1><A NAME="hl_simple">Configurable Syntax Parser</A></H1> |
| 68 |
|
| 69 |
<B>This is not fully stabilized yet. Might change in the future.</B> |
| 70 |
<P> |
| 71 |
When <B>SyntaxParser</B> is set to "SIMPLE", the following commands |
| 72 |
can be used to configure the state machine used for parsing the |
| 73 |
text. |
| 74 |
|
| 75 |
<DL> |
| 76 |
<DT><B>h_state</B> |
| 77 |
<DD>Defines a new state for the state machine |
| 78 |
<P> |
| 79 |
<PRE> |
| 80 |
<B>h_state</B> <I>state_number</I> <B>{</B> |
| 81 |
<B>"</B><A HREF="#hl_color"><I>default_color_name</I></A><B>"</B> |
| 82 |
<B>}</B> |
| 83 |
</PRE> |
| 84 |
|
| 85 |
<B>h_state</B> command takes the following parameters: |
| 86 |
<P> |
| 87 |
<DL> |
| 88 |
<DT><TT><I>state_number</I></TT> |
| 89 |
<DD>States must be numbered sequentially from 0 without skipping any |
| 90 |
number. |
| 91 |
|
| 92 |
<DT><TT><I>default_color_name</I></TT> |
| 93 |
<DD>Contains the name of default color used for characters that are not |
| 94 |
matched by any transition string or keyword. |
| 95 |
|
| 96 |
</DL> |
| 97 |
<P> |
| 98 |
<DT><B>h_wtype</B> |
| 99 |
<DD>Specifies the keyword matching parameters for current |
| 100 |
state. There can be only one <B>h_wtype</B> keyword per state. |
| 101 |
|
| 102 |
<PRE> |
| 103 |
<B>h_wtype {</B> |
| 104 |
<I>next_state_if_matched</I><B>,</B> |
| 105 |
<I>next_state_if_not_matched</I><B>,</B> |
| 106 |
<I>next_state_if_no_keyword</I><B>,</B> |
| 107 |
<B>"</B><I>state_flags</I><B>",</B> |
| 108 |
<B>"</B><I>keyword_charset</I><B>"</B> |
| 109 |
<B>}</B> |
| 110 |
</PRE> |
| 111 |
|
| 112 |
<B>h_wtype</B> takes the following arguments: |
| 113 |
<P> |
| 114 |
<DL> |
| 115 |
<DT><TT><I>next_state_if_matched</I></TT> |
| 116 |
<DD>The number of the next state if any keyword is matched. Can |
| 117 |
be -1 to keep current state. |
| 118 |
|
| 119 |
<DT><TT><I>next_state_if_not_matched</I></TT> |
| 120 |
<DD>The number of the next state if no keyword is matched. Can |
| 121 |
be -1 to keep current state. |
| 122 |
|
| 123 |
<DT><TT><I>next_state_if_no_keyword</I></TT> |
| 124 |
<DD>The number of next state if no keyword is found at all. Can |
| 125 |
be -1 to keep current state. |
| 126 |
|
| 127 |
<DT><TT><I>state_flags</I></TT> |
| 128 |
<DD>String containing zero or more of the following characters: |
| 129 |
<P> |
| 130 |
<DL> |
| 131 |
<DT><B>i</B> |
| 132 |
<DD>Keyword matching is performed case-insensitively. |
| 133 |
</DL> |
| 134 |
</DL> |
| 135 |
<P> |
| 136 |
<DT><B>h_trans</B> |
| 137 |
<DD>Defines a new state transition for current state. |
| 138 |
|
| 139 |
<PRE> |
| 140 |
<B>h_trans {</B> |
| 141 |
<I>next_state</I><B>,</B> |
| 142 |
<I>trans_flags</I><B>,</B> |
| 143 |
<I>trans_match</I><B>,</B> |
| 144 |
<I>color_name</I> |
| 145 |
<B>}</B> |
| 146 |
</PRE> |
| 147 |
<P> |
| 148 |
<B>h_trans</B> command takes the following parameters: |
| 149 |
<P> |
| 150 |
<DL> |
| 151 |
<DT><TT><I>next_state</I></TT> |
| 152 |
<DD>The number of next state to go if a match is successful. |
| 153 |
|
| 154 |
<DT><TT><I>trans_flags</I></TT> |
| 155 |
<DD>Determines options for matching. Can contain zero or more of the |
| 156 |
following characters: |
| 157 |
<P> |
| 158 |
<DL> |
| 159 |
<DT><B>^</B> |
| 160 |
<DD>Matches only at the beginning of the line. |
| 161 |
<DT><B>$</B> |
| 162 |
<DD>Matches only at the end of the line. |
| 163 |
<DT><B>i</B> |
| 164 |
<DD>Match is case-insensitive. |
| 165 |
<DT><B>s</B> |
| 166 |
<DD><TT><I>trans_match</I></TT> is a character set. Matches only if the |
| 167 |
next character is part of the set. |
| 168 |
<DT><B>S</B> |
| 169 |
<DD>Same as 's' but next character must not be part of the set. |
| 170 |
<DT><B>x</B> |
| 171 |
<DD><TT><I>trans_match</I></TT> is a regular expression. If some part of expression |
| 172 |
is enclosed in parentheses, pointer is advanced up to the start of parenthesized |
| 173 |
match (WARNING: this can cause infinite loops). |
| 174 |
<DT><B>-</B> |
| 175 |
<DD>After successfull match, the pointer is not advanced, matching |
| 176 |
will resume at the same position in next state. (WARNING: this |
| 177 |
can cause infinite loops). |
| 178 |
<DT><B><</B> |
| 179 |
<DD>The matched character(s) are tagged with current state number. |
| 180 |
This is important for proper operation of <B><A HREF="command.html#ec.MatchBracket">MatchBracket</A></B> command. |
| 181 |
MatchBracket will only match braces tagged with same state number. |
| 182 |
<DT><B>></B> |
| 183 |
<DD>The matched character(s) are tagged with next state number. |
| 184 |
<DT><B>q</B> |
| 185 |
<DD>On successful match quote the next character (the next character |
| 186 |
is not used for matching). |
| 187 |
<DT><B>Q</B> |
| 188 |
<DD>On successful match quote the end of line (the end of line |
| 189 |
is not used for matching). |
| 190 |
</DL> |
| 191 |
|
| 192 |
<DT><TT><I>trans_match</I></TT> |
| 193 |
<DD>When <B>S</B> or <B>s</B> option is used, a character set to be matched. When |
| 194 |
<B>S</B> or <B>s</B> options are not used, a string to be matched. |
| 195 |
|
| 196 |
</DL> |
| 197 |
<P> |
| 198 |
<DT><B>h_words</B> |
| 199 |
<DD>Specifies the set of keywords to match in this state. All |
| 200 |
characters in keywords must be part of the <TT><I>keyword_charset</I></TT> |
| 201 |
in <B>h_wtype</B> command for this mode. |
| 202 |
|
| 203 |
<P> |
| 204 |
<PRE> |
| 205 |
<B>h_words "</B><A HREF="colors.html">color_specification</A><B>" {</B> |
| 206 |
<B>"</B><I>keyword</I><B>",</B> ... |
| 207 |
<B>}</B> |
| 208 |
</PRE> |
| 209 |
|
| 210 |
<P> Works the same way as the <B><A HREF="#hl_keyword">keyword</A></B> but keywords |
| 211 |
are for current state only. |
| 212 |
|
| 213 |
<P> Multiple keyword sets with different colors can be defined. |
| 214 |
<P> '-' can be used for color specifier do use the default keyword |
| 215 |
color specified in global settings. |
| 216 |
</DL> |
| 217 |
|
| 218 |
</BODY> |
| 219 |
</HTML> |