1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #ifdef HAVE_CONFIG_H
31 #include "../config.h"
32 #endif
33
34 #include "highlightData.h"
35 #include "colorprofile.h"
36 #include "textBuf.h"
37 #include "nedit.h"
38 #include "highlight.h"
39 #include "regularExp.h"
40 #include "preferences.h"
41 #include "help.h"
42 #include "window.h"
43 #include "regexConvert.h"
44 #include "../util/misc.h"
45 #include "../util/DialogF.h"
46 #include "../util/managedList.h"
47 #include "../util/nedit_malloc.h"
48 #include "../util/colorchooser.h"
49
50 #include <stdio.h>
51 #include <string.h>
52 #include <limits.h>
53 #ifndef __MVS__
54 #include <sys/param.h>
55 #endif
56
57 #include <Xm/Xm.h>
58 #include <Xm/Form.h>
59 #include <Xm/Frame.h>
60 #include <Xm/Text.h>
61 #include <Xm/LabelG.h>
62 #include <Xm/PushB.h>
63 #include <Xm/ToggleB.h>
64 #include <Xm/RowColumn.h>
65 #include <Xm/SeparatoG.h>
66
67 #ifdef HAVE_DEBUG_H
68 #include "../debug.h"
69 #endif
70
71
72
73 #define MAX_HIGHLIGHT_STYLES 128
74
75
76
77 #define MAX_PATTERNS 127
78
79
80 #define N_FONT_TYPES 4
81 enum fontTypes {
PLAIN_FONT,
ITALIC_FONT,
BOLD_FONT,
BOLD_ITALIC_FONT};
82 static const char *FontTypeNames[
N_FONT_TYPES] =
83 {
"Plain",
"Italic",
"Bold",
"Bold Italic"};
84
85 static char *currentColorProfileName =
NULL;
86 static int currentColorProfileStyleType =
0;
87
88 static int styleError(
const char *stringStart,
const char *stoppedAt,
89 const char *message);
90 #if 0
91 static int lookupNamedPattern(patternSet *p,
char *patternName);
92 #endif
93 static int lookupNamedStyle(ColorProfile *colorProfile,
const char *styleName);
94 static highlightPattern *readHighlightPatterns(
char **inPtr,
int withBraces,
95 char **errMsg,
int *nPatterns);
96 static int readHighlightPattern(
char **inPtr,
char **errMsg,
97 highlightPattern *pattern);
98 static patternSet *readDefaultPatternSet(
const char *langModeName);
99 static int isDefaultPatternSet(patternSet *patSet);
100 static patternSet *readPatternSet(
char **inPtr,
int convertOld);
101 static patternSet *highlightError(
char *stringStart,
char *stoppedAt,
102 const char *message);
103 static char *intToStr(
int i);
104 static char *createPatternsString(patternSet *patSet,
char *indentStr);
105 static void setStyleByName(
const char *style);
106 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData);
107 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData);
108 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData);
109 static void hsCloseCB(Widget w, XtPointer clientData, XtPointer callData);
110 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs);
111 static void *hsGetDisplayedCB(
void *oldItem,
int explicitRequest,
int *abort,
112 void *cbArg);
113 static void hsSetDisplayedCB(
void *item,
void *cbArg);
114 static highlightStyleRec *readHSDialogFields(
int silent);
115 static void hsFreeItemCB(
void *item);
116 static void freeHighlightStyleRec(highlightStyleRec *hs);
117 static int hsDialogEmpty(
void);
118 static int updateHSList(
void);
119 static void updateHighlightStyleMenu(
void);
120 static void convertOldPatternSet(patternSet *patSet);
121 static void convertPatternExpr(
char **patternRE,
char *patSetName,
122 char *patName,
int isSubsExpr);
123 static Widget createHighlightStylesMenu(Widget parent);
124 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData);
125 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData);
126 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData);
127 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData);
128 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData);
129 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData);
130 static int checkHighlightDialogData(
void);
131 static void updateLabels(
void);
132 static void okCB(Widget w, XtPointer clientData, XtPointer callData);
133 static void applyCB(Widget w, XtPointer clientData, XtPointer callData);
134 static void checkCB(Widget w, XtPointer clientData, XtPointer callData);
135 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData);
136 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData);
137 static void closeCB(Widget w, XtPointer clientData, XtPointer callData);
138 static void helpCB(Widget w, XtPointer clientData, XtPointer callData);
139 static void *getDisplayedCB(
void *oldItem,
int explicitRequest,
int *abort,
140 void *cbArg);
141 static void setDisplayedCB(
void *item,
void *cbArg);
142 static void setStyleMenu(
const char *styleName);
143 static highlightPattern *readDialogFields(
int silent);
144 static int dialogEmpty(
void);
145 static int updatePatternSet(
void);
146 static patternSet *getDialogPatternSet(
void);
147 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2);
148 static highlightPattern *copyPatternSrc(highlightPattern *pat,
149 highlightPattern *copyTo);
150 static void freeItemCB(
void *item);
151 static void freePatternSrc(highlightPattern *pat,
int freeStruct);
152 static void freePatternSet(patternSet *p);
153
154
155 static int NHighlightStyles =
0;
156 static highlightStyleRec *HighlightStyles[
MAX_HIGHLIGHT_STYLES];
157
158
159 static struct {
160 Widget shell;
161 Widget nameW;
162 Widget colorW;
163 Widget bgColorW;
164 Widget plainW, boldW, italicW, boldItalicW;
165 Widget managedListW;
166 highlightStyleRec **highlightStyleList;
167 int nHighlightStyles;
168 char *colorProfileName;
169 } HSDialog = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
0};
170
171
172 static struct {
173 Widget shell;
174 Widget lmOptMenu;
175 Widget lmPulldown;
176 Widget styleOptMenu;
177 Widget stylePulldown;
178 Widget nameW;
179 Widget topLevelW;
180 Widget deferredW;
181 Widget subPatW;
182 Widget colorPatW;
183 Widget simpleW;
184 Widget rangeW;
185 Widget parentW;
186 Widget startW;
187 Widget endW;
188 Widget errorW;
189 Widget lineContextW;
190 Widget charContextW;
191 Widget managedListW;
192 Widget parentLbl;
193 Widget startLbl;
194 Widget endLbl;
195 Widget errorLbl;
196 Widget matchLbl;
197 char *langModeName;
198 int nPatterns;
199 highlightPattern **patterns;
200 } HighlightDialog = {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
201 NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
202 NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL };
203
204
205 static int NPatternSets =
0;
206 static patternSet *PatternSets[
MAX_LANGUAGE_MODES];
207
208 static char *DefaultPatternSets[] = {
209 "Ada:1:0{\n\
210 Comments:\"--\":\"$\"::Comment::\n\
211 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
212 Character Literals:\"''(?:[^\\\\]|\\\\.)''\":::Character Const::\n\
213 Ada Attributes:\"(?i''size\\s+(use)>)|''\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
214 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
215 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
216 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
217 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
218 Withs Use:\"(?#Make \\s work across newlines)(?n(?iwith|use)(?#Leading W/S)\\s+(?#First package name)(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]*)*)(?#Additional package names [optional])(?:\\s*,\\s*(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*))*(?#Trailing W/S)\\s*;)+\":::Preprocessor::\n\
219 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
220 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
221 Reserved Words:\"(?i(?=[a-gil-pr-uwx]))<(?iabort|abs|accept|access|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)>\":::Keyword::D\n\
222 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
223 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
224 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
225 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
226 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
227 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
228 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
229 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
230 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
231 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
232 "Awk:2:0{\n\
233 Comment:\"#\":\"$\"::Comment::\n\
234 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
235 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
236 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
237 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
238 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
239 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
240 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
241 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
242 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
243 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
244 Numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
245 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
246 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
247 newline escape:\"\\\\$\":::Preprocessor1::\n\
248 Function:\"function\":::Preprocessor1::D}",
249 "C++:1:0{\n\
250 comment:\"/\\*\":\"\\*/\"::Comment::\n\
251 cplus comment:\"//\":\"(?<!\\\\)$\"::Comment::\n\
252 string:\"(?:L|u|U|u8|R)?\"\"\":\"\"\"\":\"\\n\":String::\n\
253 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
254 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
255 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
256 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
257 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
258 preprocessor string:\"(?:L|u|U|u8|R)?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
259 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
260 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC|STDC_HOSTED|func)__>\":::Preprocessor::\n\
261 numeric constant:\"(?<!\\Y)(?:(?:0b[0-1][0-1'']*)|(?:0(?:x|X)[0-9a-fA-F][0-9a-fA-F'']*)|(?:(?:[0-9][0-9'']*\\.?[0-9'']*)|(?:\\.[0-9'']+))(?:(?:e|E)(?:\\+|-)?[0-9'']+)?)(?:LL?|ll?|ULL?|ull?|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
262 character constant:\"(?:L|u|U|u8)?''\":\"''\":\"[^\\\\].{10}\":Character Const::D\n\
263 keywords 1 - storage:\"<(?:register|static|extern|thread_local|mutable)>\":::Storage Type::D\n\
264 keywords 2 - declerations:\"<(?:class|typename|template|friend|virtual|inline|explicit|operator|public|private|protected|const|volatile|typedef|struct|union|enum|asm|override|final|decltype|constexpr|constinit|consteval|noexcept|export|import|module|using|namespace|concept|requires)>\":::Keyword::D\n\
265 keywords 3 - types:\"<(?:auto|unsigned|signed|char|double|float|int|long|short|bool|wchar_t|void|nullptr_t|char8_t|char16_t|char32_t)>\":::Storage Type::D\n\
266 keywords 4 - control flow:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|try|catch|throw)>\":::Keyword::D\n\
267 keywords 5 - misc:\"<(?:new|delete|this|sizeof|true|false|dynamic_cast|static_cast|reinterpret_cast|const_cast|nullptr|static_assert|alignof|alignas|typeid|default)>\":::Keyword::D\n\
268 keywords 6 - alternate operators:\"<(?:bitand|bitor|and|and_eq|compl|not|not_eq|or|or_eq|xor|xor_eq)>\":::Operator::D\n\
269 keywords 7 - co-routines:\"<co_(?:await|return|yield)>\":::Keyword::D\n\
270 braces:\"[{}]\":::Keyword::D}",
271 "C:1:0 {\n\
272 comment:\"/\\*\":\"\\*/\"::Comment::\n\
273 c99 comment:\"//\":\"(?<!\\\\)$\"::Comment::\n\
274 string:\"(?:L|u|U|u8)?\"\"\":\"\"\"\":\"\\n\":String::\n\
275 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
276 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
277 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
278 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
279 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
280 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
281 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__|_Pragma>\":::Preprocessor::\n\
282 character constant:\"(?:L|u|U|u8)?''\":\"''\":\"[^\\\\].{10}\":Character Const::D\n\
283 numeric constant:\"(?<!\\Y)(?:(?:0b[0-1][0-1'']*)|(?:0(?:x|X)[0-9a-fA-F][0-9a-fA-F'']*)|(?:(?:[0-9][0-9'']*\\.?[0-9'']*)|(?:\\.[0-9'']+))(?:(?:e|E)(?:\\+|-)?[0-9'']+)?)(?:LL?|ll?|ULL?|ull?|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
284 keywords 1 - storage:\"<(?:extern|auto|register|static|unsigned|signed|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
285 keywords 2 - declerations:\"<(?:const|volatile|typedef|struct|union|enum|inline|restrict)>\":::Keyword::D\n\
286 keywords 3 - types:\"<(?:unsigned|signed|char|double|float|int|long|short|void|wchar_t|char16_t|char32_t|char8_t)>\":::Storage Type::D\n\
287 keywords 4 - starting underscore:\"<_(?:Alignas|Alignof|Atomic|Bool|Complex|Decimal128|Decimal32|Decimal64|Generic|Imaginary|Noreturn|Satic_assert|Thread_local)>\":::Keyword::D\n\
288 keywords 5 - control flow:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for)>\":::Keyword::D\n\
289 keywords 6 - misc:\"<(?:sizeof|typeof|asm|fortran)>\":::Keyword::D\n\
290 keywords 7 - convenience macros:\"<(?:alignas|alignof|noreturn|static_assert|thread_local)>\":::Keyword::D\n\
291 keywords 8 - convenience type macros:\"<(?:bool|complex|imaginary)>\":::Storage Type::D\n\
292 keywords 9 - atomic macros:\"<atomic_(?:[us]?char|double|float|[u]?int|u?l?long|u?short|bool)>\":::Storage Type::D\n\
293 keywords 10 - convenience posix types:\"<[a-zA-Z0-9_]*_t>\":::Storage Type::D\n\
294 keywords 11 - convenience constants:\"<[A-Z0-9_]*>\":::Preprocessor2::D\n\
295 braces:\"[{}]\":::Keyword::D}",
296 "CSS:1:0{\n\
297 comment:\"/\\*\":\"\\*/\"::Comment::\n\
298 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
299 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
300 import url:\"\\1\":::Subroutine1:import rule:C\n\
301 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
302 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
303 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
304 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
305 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
306 charset name:\"\\1\":::String:charset rule:C\n\
307 font-face rule:\"@font-face\":::Preprocessor::\n\
308 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
309 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
310 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
311 declaration:\"\\{\":\"\\}\"::Warning::\n\
312 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
313 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
314 property:\"<(azimuth|background(-(attachment|color|image|position|repeat))?|border(-(bottom(-(color|style|width))?|-(color|style|width)|collapse|color|left(-(color|style|width))?|right(-(color|style|width))?|spacing|style|top(-(color|style|width))?|width))?|bottom|caption-side|clear|clip|color|content|counter-(increment|reset)|cue(-(after|before))?|cursor|direction|display|elevation|empty-cells|float|font(-(family|size|size-adjust|stretch|style|variant|weight))?|height|left|letter-spacing|line-height|list-style(-(image|position|type))?|margin(-(bottom|left|right|top))?|marker-offset|marks|max-(height|width)|min-(height|width)|orphans|outline(-(color|style|width))?|overflow|padding(-(bottom|left|right|top))?|page(-break-(after|before|inside))?|pause(-(after|before))?|pitch(-range)?|play-during|position|quotes|richness|right|size|speak(-(header|numeral|punctuation))?|speech-rate|stress|table-layout|text(-(align|decoration|indent|shadow|transform))|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index)>\":::Identifier1:declaration:\n\
315 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
316 value delims:\"&\":\"&\"::Keyword:value:C\n\
317 value modifier:\"!important|inherit\":::Keyword:value:\n\
318 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
319 clip value:\"<rect\\(\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*\\)\":::Subroutine:value:\n\
320 function value:\"<attr\\([^)]+\\)|<counter\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)|<counters\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*,\\s*(\"\"[^\"\"]*\"\"|''[^'']*'')\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)\":::Subroutine:value:\n\
321 color value:\"(#[A-Fa-f\\d]{6}>|#[A-Fa-f\\d]{3}>|rgb\\(([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\)|rgb\\(([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\)|<(?iaqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)>|<transparent>)\":::Text Arg2:value:\n\
322 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
323 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
324 named value:\"<(100|200|300|400|500|600|700|800|900|above|absolute|always|armenian|auto|avoid|baseline|behind|below|bidi-override|blink|block|bold|bolder|both|bottom|capitalize|caption|center(?:-left|-right)?|child|circle|cjk-ideographic|close-quote|code|collapse|compact|condensed|continuous|crop|cross(?:hair)?|cursive|dashed|decimal(?:-leading-zero)?|default|digits|disc|dotted|double|e-resize|embed|expanded|extra(?:-condensed|-expanded)|fantasy|far(?:-left|-right)|fast(?:er)?|female|fixed|georgian|groove|hebrew|help|hidden|hide|high(?:er)?|hiragana(?:-iroha)?|icon|inherit|inline(?:-table)?|inset|inside|italic|justify|katakana(?:-iroha)?|landscape|larger?|left(?:-side|wards)?|level|lighter|line-through|list-item|loud|low(?:er(?:-alpha|-greek|-latin|-roman|case)?)?|ltr|male|marker|medium|menu|message-box|middle|mix|monospace|move|n-resize|narrower|ne-resize|no(?:-close-quote|-open-quote|-repeat)|none|normal|nowrap|nw-resize|oblique|once|open-quote|out(?:set|side)|overline|pointer|portrait|pre|relative|repeat(?:-x|-y)?|ridge|right(?:-side|wards)?|rtl|run-in|s-resize|sans-serif|scroll|se-resize|semi(?:-condensed|-expanded)|separate|serif|show|silent|slow(?:er)?|small(?:-caps|-caption|er)?|soft|solid|spell-out|square|static|status-bar|sub|super|sw-resize|table(?:-caption|-cell|-column(?:-group)?|-footer-group|-header-group|-row(?:-group)?)?|text(?:-bottom|-top)?|thick|thin|top|ultra(?:-condensed|-expanded)|underline|upper(?:-alpha|-latin|-roman|case)|visible|w-resize|wait|wider|x-(?:fast|high|large|loud|low|slow|small|soft)|xx-(large|small))>\":::Text Arg2:value:\n\
325 integer value:\"<\\d+>\":::Numeric Const:value:\n\
326 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
327 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
328 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
329 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
330 sq string value:\"''\":\"''\":\"\\n\":String:value:\n\
331 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
332 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
333 operators:\"[,/]\":::Keyword:value:\n\
334 selector id:\"#[-\\w]+>\":::Pointer::\n\
335 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
336 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
337 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
338 selector operators:\"[,>*+]\":::Keyword::\n\
339 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
340 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
341 free text:\".\":::Warning::\n\
342 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
343 "Csh:1:0{\n\
344 Comment:\"#\":\"$\"::Comment::\n\
345 Single Quote String:\"''\":\"([^\\\\]''|^'')\":\"\\n\":String::\n\
346 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
347 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
348 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
349 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
350 Variable Ref:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1::\n\
351 Variable in String:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1:Double Quote String:\n\
352 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
353 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
354 Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alias|bg|break|breaksw|case|cd|chdir|continue|default|echo|eval|exec|exit|fg|goto|glob|hashstat|history|jobs|kill|limit|login|logout|nohup|notify|nice|onintr|popd|pushd|printenv|read|rehash|repeat|set|setenv|shift|source|suspend|time|umask|unalias|unhash|unlimit|unset|unsetenv|wait)>\":::Keyword::D\n\
355 Tcsh Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alloc|bindkey|builtins|complete|echotc|filetest|hup|log|sched|settc|setty|stop|telltc|uncomplete|where|which|dirs|ls-F)>\":::Keyword::D\n\
356 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
357 "Fortran:2:0{\n\
358 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
359 Bang Comment:\"!\":\"$\"::Comment::\n\
360 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
361 String:\"''\":\"''\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
362 Keywords:\"<(?iaccept|automatic|backspace|block|call|close|common|continue|data|decode|delete|dimension|do|else|elseif|encode|enddo|end *file|endif|end|entry|equivalence|exit|external|format|function|go *to|if|implicit|include|inquire|intrinsic|logical|map|none|on|open|parameter|pause|pointer|print|program|read|record|return|rewind|save|static|stop|structure|subroutine|system|then|type|union|unlock|virtual|volatile|while|write)>\":::Keyword::D\n\
363 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
364 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
365 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
366 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
367 "Java:3:0{\n\
368 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
369 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
370 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
371 comment:\"/\\*\":\"\\*/\"::Comment::\n\
372 cplus comment:\"//\":\"$\"::Comment::\n\
373 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
374 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr''\"\"\\\\])\":::String1:string:\n\
375 single quoted:\"''\":\"''\":\"\\n\":String::\n\
376 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr''\"\"\\\\])(?='')\":::String1:single quoted:\n\
377 single quoted char:\".(?='')\":::String:single quoted:\n\
378 single quoted error:\".\":::Flag:single quoted:\n\
379 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
380 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
381 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
382 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
383 modules decl:\"<(?:(?:open )?module)>\":::Preprocessor::\n\
384 modules def:\"<(?:exports|uses|requires|provides)>\":\";\":\"\\n\":Preprocessor::\n\
385 classdef:\"<(?:class|interface|record)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
386 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
387 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
388 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
389 extends comma:\",\":::Keyword:extends:\n\
390 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
391 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
392 extends error:\".\":::Flag:extends:\n\
393 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
394 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
395 impl_throw comma:\",\":::Keyword:impl_throw:\n\
396 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
397 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
398 impl_throw error:\".\":::Flag:impl_throw:\n\
399 case:\"<case>\":\":\"::Label::\n\
400 case single quoted:\"''\\\\?[^'']''\":::Character Const:case:\n\
401 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
402 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
403 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
404 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
405 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
406 case error:\".\":::Flag:case:\n\
407 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
408 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
409 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
410 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
411 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
412 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
413 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
414 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
415 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
416 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
417 keyword - modifiers:\"<(?:abstract|final|sealed|native|private|protected|public|static|transient|synchronized|volatile|var)>\":::Keyword::\n\
418 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
419 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
420 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
421 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
422 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
423 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
424 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
425 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
426 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
427 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
428 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
429 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
430 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
431 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
432 error:\".\":::Flag::D}",
433 "JavaScript:1:0{\n\
434 DSComment:\"//\":\"$\"::Comment::\n\
435 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
436 DQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|#[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]\":::Text Arg1:DQStrings:\n\
437 SQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|(#)[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-F-af0-9]\":::Text Arg1:SQStrings:\n\
438 Numeric:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::\n\
439 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
440 Braces:\"[{}]\":::Keyword::\n\
441 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
442 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
443 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
444 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
445 Parentheses:\"[\\(\\)]\":::Plain::\n\
446 BuiltInObjectType:\"<(anchor|Applet|Area|Array|button|checkbox|Date|document|elements|FileUpload|form|frame|Function|hidden|history|Image|link|location|Math|navigator|Option|password|Plugin|radio|reset|select|string|submit|text|textarea|window)>\":::Storage Type::\n\
447 SQStrings:\"''\":\"''\":\"\\n\":String::\n\
448 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
449 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
450 PredefinedMethods:\"<(abs|acos|alert|anchor|asin|atan|atan2|back|big|blink|blur|bold|ceil|charAt|clear|clearTimeout|click|close|confirm|cos|escape|eval|exp|fixed|floor|focus|fontcolor|fontsize|forward|getDate|getDay|getHours|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getYear|go|indexOf|isNaN|italics|javaEnabled|join|lastIndexOf|link|log|max|min|open|parse|parseFloat|parseInt|pow|prompt|random|reload|replace|reset|reverse|round|scroll|select|setDate|setHours|setMinutes|setMonth|setSeconds|setTimeout|setTime|setYear|sin|small|sort|split|sqrt|strike|sub|submit|substring|sup|taint|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|unescape|untaint|UTC|write|writeln)>\":::Keyword::\n\
451 Properties:\"<(action|alinkColor|anchors|appCodeName|appName|appVersion|bgColor|border|checked|complete|cookie|defaultChecked|defaultSelected|defaultStatus|defaultValue|description|E|elements|enabledPlugin|encoding|fgColor|filename|forms|frames|hash|height|host|hostname|href|hspace|index|lastModified|length|linkColor|links|LN2|LN10|LOG2E|LOG10E|lowsrc|method|name|opener|options|parent|pathname|PI|port|protocol|prototype|referrer|search|selected|selectedIndex|self|SQRT1_2|SQRT2|src|status|target|text|title|top|type|URL|userAgent|value|vlinkColor|vspace|width|window)>\":::Storage Type::\n\
452 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
453 "LaTeX:1:0{\n\
454 Comment:\"%\":\"$\"::Text Comment::\n\
455 Parameter:\"#[0-9]*\":::Text Arg::\n\
456 Special Chars:\"[{}&]\":::Keyword::\n\
457 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
458 Super Sub 1 Char:\"(?:\\^|_)(?:\\\\\\l+|#\\d|[^{\\\\])\":::Text Arg2::\n\
459 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
460 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
461 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
462 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
463 Inline Math:\"(?<!#\\d)(?:\\$|\\\\\\()\":\"\\$|\\\\\\)\":\"\\\\\\(|(?n[^\\\\]%)\":LaTeX Math::\n\
464 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
465 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
466 No Arg Command:\"\\\\(?:left|right)[\\[\\]{}()]\":::Text Key::\n\
467 Command:\"[_^]|[\\\\@](?:a''|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_=''`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
468 Cmd Brace Args:\"\\{\":\"}\":\"(?<=^%)|\\\\]|\\$\\$|\\\\end\\{equation\\}\":Text Arg2:Command:\n\
469 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
470 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
471 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
472 Cmd Bracket Args:\"\\[\":\"\\]\":\"$|\\\\\\]\":Text Arg2:Command:\n\
473 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
474 Sub Cmd Bracket Args Esc:\"\\\\\\}\":::Plain:Sub Cmd Bracket Args:\n\
475 Sub Cmd Bracket Args:\"\\{\":\"\\}\":\"$|\\\\\\]\":Preprocessor1:Cmd Bracket Args:\n\
476 Sub Command:\"(?:[_^]|(?:[\\\\@](?:[A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
477 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
478 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
479 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
480 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
481 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
482 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
483 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
484 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
485 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
486 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
487 "Lex:1:0{\n\
488 comment:\"/\\*\":\"\\*/\"::Comment::\n\
489 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
490 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
491 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
492 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
493 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
494 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
495 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
496 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
497 character constant:\"''\":\"''\":\"[^\\\\][^'']\":Character Const::\n\
498 numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
499 storage keyword:\"<(const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
500 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
501 lex keyword:\"<(yylval|yytext|input|unput|output|lex_input|lex_output|yylex|yymore|yyless|yyin|yyout|yyleng|yywtext|yywleng|yyterminate|REJECT|ECHO|BEGIN|YY_NEW_FILE|yy_create_buffer|yy_switch_to_buffer|yy_delete_buffer|YY_CURRENT_BUFFER|YY_BUFFER_STATE|YY_DECL|YY_INPUT|yywrap|YY_USER_ACTION|YY_USER_INIT|YY_BREAK)>\":::Text Arg::D\n\
502 stdlib:\"<(BUFSIZ|CHAR_BIT|CHAR_MAX|CHAR_MIN|CLOCKS_PER_SEC|DBL_DIG|DBL_EPSILON|DBL_MANT_DIG|DBL_MAX|DBL_MAX_10_EXP|DBL_MAX_EXP|DBL_MIN|DBL_MIN_10_EXP|DBL_MIN_EXP|EDOM|EOF|ERANGE|EXIT_FAILURE|EXIT_SUCCESS|FILE|FILENAME_MAX|FLT_DIG|FLT_EPSILON|FLT_MANT_DIG|FLT_MAX|FLT_MAX_10_EXP|FLT_MAX_EXP|FLT_MIN|FLT_MIN_10_EXP|FLT_MIN_EXP|FLT_RADIX|FLT_ROUNDS|FOPEN_MAX|HUGE_VAL|INT_MAX|INT_MIN|LC_ALL|LC_COLLATE|LC_CTYPE|LC_MONETARY|LC_NUMERIC|LC_TIME|LDBL_DIG|LDBL_EPSILON|LDBL_MANT_DIG|LDBL_MAX|LDBL_MAX_10_EXP|LDBL_MAX_EXP|LDBL_MIN|LDBL_MIN_10_EXP|LDBL_MIN_EXP|LONG_MAX|LONG_MIN|L_tmpnam|MB_CUR_MAX|MB_LEN_MAX|NULL|RAND_MAX|SCHAR_MAX|SCHAR_MIN|SEEK_CUR|SEEK_END|SEEK_SET|SHRT_MAX|SHRT_MIN|SIGABRT|SIGFPE|SIGILL|SIGINT|SIGSEGV|SIGTERM|SIG_DFL|SIG_ERR|SIG_IGN|TMP_MAX|UCHAR_MAX|UINT_MAX|ULONG_MAX|USHRT_MAX|WCHAR_MAX|WCHAR_MIN|WEOF|_IOFBF|_IOLBF|_IONBF|abort|abs|acos|asctime|asin|assert|atan|atan2|atexit|atof|atoi|atol|bsearch|btowc|calloc|ceil|clearerr|clock|clock_t|cos|cosh|ctime|difftime|div|div_t|errno|exit|exp|fabs|fclose|feof|ferror|fflush|fgetc|fgetpos|fgets|fgetwc|fgetws|floor|fmod|fopen|fpos_t|fprintf|fputc|fputs|fputwc|fputws|fread|free|freopen|frexp|fscanf|fseek|fsetpos|ftell|fwide|fwprintf|fwrite|fwscanf|getc|getchar|getenv|gets|getwc|getwchar|gmtime|isalnum|isalpha|iscntrl|isdigit|isgraph|islower|isprint|ispunct|isspace|isupper|iswalnum|iswalpha|iswcntrl|iswctype|iswdigit|iswgraph|iswlower|iswprint|iswpunct|iswspace|iswupper|iswxdigit|isxdigit|jmp_buf|labs|lconv|ldexp|ldiv|ldiv_t|localeconv|localtime|log|log10|longjmp|malloc|mblen|mbrlen|mbrtowc|mbsinit|mbsrtowcs|mbstate_t|mbstowcs|mbtowc|memchr|memcmp|memcpy|memmove|memset|mktime|modf|offsetof|perror|pow|printf|ptrdiff_t|putc|puts|putwc|putwchar|qsort|raise|rand|realloc|remove|rename|rewind|scanf|setbuf|setjmp|setlocale|setvbuf|sig_atomic_t|signal|sin|sinh|size_t|sprintf|sqrt|srand|sscanf|stderr|stdin|stdout|strcat|strchr|strcmp|strcoll|strcpy|strcspn|strerror|strftime|strlen|strncat|strncmp|strncpy|stroul|strpbrk|strrchr|strspn|strstr|strtod|strtok|strtol|strxfrm|swprintf|swscanf|system|tan|tanh|time|time_t|tm|tmpfile|tmpnam|tolower|toupper|towctrans|towlower|towupper|ungetc|ungetwc|va_arg|va_end|va_list|va_start|vfwprintf|vprintf|vsprintf|vswprintf|vwprintf|wint_t|wmemchr|wmemcmp|wmemcpy|wmemmove|wmemset|wprintf|wscanf)>\":::Subroutine::D\n\
503 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
504 braces:\"[{}]\":::Keyword::D\n\
505 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
506 "Lua:1:0{\n\
507 String:\"''\":\"''\":\"\\n\":String::\n\
508 String2:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
509 LongString0:\"\\[\\[\":\"\\]\\]\"::String::\n\
510 LongString1:\"\\[=\\[\":\"\\]=\\]\"::String::\n\
511 LongString2:\"\\[==\\[\":\"\\]==\\]\"::String::\n\
512 LongString3:\"\\[===\\[\":\"\\]===\\]\"::String::\n\
513 LongString4:\"\\[====\\[\":\"\\]====\\]\"::String::\n\
514 LongString5:\"\\[=====\\[\":\"\\]=====\\]\"::String::\n\
515 LongString6:\"\\[======\\[\":\"\\]======\\]\"::String::\n\
516 LongString7:\"\\[=======\\[\":\"\\]=======\\]\"::String::\n\
517 LongString8:\"\\[========\\[\":\"\\]========\\]\"::String::\n\
518 LongString9:\"\\[=========\\[\":\"\\]=========\\]\"::String::\n\
519 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
520 Parentheses:\"\\(|\\)\":::Keyword::D\n\
521 X Parentheses:\"\\{|\\}\":::Keyword::D\n\
522 Long Comment:\"\\-\\-\\[\\[\":\"\\]\\]\"::Comment::\n\
523 Comment:\"--\":\"(?<!\\\\)$\"::Comment::\n\
524 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
525 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
526 Hexdecimal Values:\"0(?ix)[\\dA-Fa-z]+(\\.\[\\dA-Fa-z]+)?((e|E|p|P)(\\+|-)?\\d+)?\":::Numeric Const::D\n\
527 Reserved Words 1:\"<(?:end|do|else|elseif|function|return|for|if|repeat|then|until|while|break|goto)>\":::Keyword::D\n\
528 Reserved Words 2:\"<(?:local)>\":::Identifier::D\n\
529 Labels:\"^::[A-Za-z_][A-Z-a-z0-9_]*::$\":::Label::D\n\
530 Predefined Consts:\"<(?:false|nil|true)>\":::String1::D\n\
531 Predefined Func1:\"<(?:gettable_event|settable_event)>\":::Preprocessor::D\n\
532 Basic Functions:\"<(?:assert|collectgarbage|dofile|error|getmetatable|ipairs|load|loadfile|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|select|setmetatable|tonumber|tostring|type|xpcall)>\":::Text Arg2::D\n\
533 Coroutine Manipulation:\"coroutine\\.(create|resume|yield|wrap|running|status)\":::Text Arg2::D\n\
534 Modules:\"<(?:require|package\\.loadlib|package\\.searchpath)>\":::Text Arg2::D\n\
535 Package Variables:\"package\\.(config|cpath|loaded|path|preload|searchers)\":::Warning::D\n\
536 String Manipulation:\"string\\.(?:byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\":::Text Arg2::D\n\
537 Table Manipulation:\"table\\.(?:concat|insert|pack|remove|sort|unpack)\":::Text Arg2::D\n\
538 Mathematical Functions:\"math\\.(?:abs|acos|asin|atan|atan2|ceil|cos|cosh|deg|exp|floor|fmod|frexp|ldexp|log|max|min|modf|pow|rad|random|randomseed|sin|sinh|sqrt|tan|tanh)\":::Text Arg2::D\n\
539 Mathematical Variables:\"math\\.(?:huge|pi)\":::Warning::D\n\
540 Bitwise Operations:\"bit32\\.(?:arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\":::Text Arg2::D\n\
541 Input and Output Facilities:\"io\\.(?:close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\":::Text Arg2::D\n\
542 Operating System Facilities:\"os\\.(?:clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\":::Text Arg2::D\n\
543 Debug Library:\"debug\\.(?:debug|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\":::Text Arg2::D\n\
544 Internal Variables:\"_ENV|_G|_VERSION\":::Identifier::D\n\
545 Length Operator:\"#[A-Za-z][A-Za-z0-9]*\":::Identifier::D\n\
546 Assignment:\"=\":::Plain::D\n\
547 Metamethods:\"(?:__len|__concat|__tostring|__metatable|__ipairs|__pairs|__index|__add|__sub|__mul|__div|__mod|__pow|__unm|__eq|__lt|__le|__newindex|__call|__gc|__mode)\":::Warning::D\n\
548 Operators:\"<(?:and|in|not|or)>\":::Text Arg::D\n\
549 info:\"(?# version 0.1; based_on: Lua 5.2; author/maintainer: zeromacro, zeromacro@mailbox.org)\":::Plain::D}",
550 "Makefile:8:0{\n\
551 Comment:\"#\":\"$\"::Comment::\n\
552 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
553 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
554 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
555 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
556 Dependency Line:\"^( *| [ \\t]*)(.DEFAULT|.DELETE_ON_ERROR|.EXPORT_ALL_VARIABLES.IGNORE|.INTERMEDIATE|.PHONY|.POSIX|.PRECIOUS|.SECONDARY|.SILENT|.SUFFIXES)*(([A-Za-z0-9./$(){} _@^<*?%+-]*(\\\\\\n)){,8}[A-Za-z0-9./$(){} _@^<*?%+-]*)::?\":\"$|;\"::Text Key1::\n\
557 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
558 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
559 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
560 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
561 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
562 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
563 Continuation:\"\\\\$\":::Keyword::\n\
564 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
565 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
566 Escaped Dollar:\"\\$\\$\":::Comment::\n\
567 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
568 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
569 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
570 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
571 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
572 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
573 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
574 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
575 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
576 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
577 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
578 "Markdown:2:0{\n\
579 CodeBlock:\"^[ \\t]*```\":\"^[ \\t]*```\"::Text Escape::\n\
580 CodeBlock2:\"^[ \\t]*\\n( |\t)\":\"^<|^[ \\t]*$\"::Text Escape::\n\
581 Blockquote:\"^[ \\t]*\\>\":\"$\"::Comment::\n\
582 Link1:\"\\[.*?\\](\\[.*?\\])\":::Preprocessor1::\n\
583 Link2:\"\\[.*?\\](\\(.*?\\))\":::Preprocessor1::\n\
584 Link3:\"^[ \\t]*\\[.*?\\]:(.*)\":::Preprocessor1::\n\
585 Link4:\"\\[.*?\\]\":::Preprocessor1::D\n\
586 Link1Part:\"\\1\":\"\"::Text Comment:Link1:C\n\
587 Link2Part:\"\\1\":\"\"::Text Comment:Link2:C\n\
588 Link3Part:\"\\1\":\"\"::Text Comment:Link3:C\n\
589 Header:\"^#.*\":::Header::\n\
590 HeaderLine:\".*\\n(-----*|=====*)\":::Header::\n\
591 Strong1:\"\\*\\*.*?\\*\\*\":::Strong::\n\
592 Strong2:\"__.*?__\":::Strong::\n\
593 Emphasis1:\"\\*.*?\\*\":::Emphasis::D\n\
594 Emphasis2:\"_.*?_\":::Emphasis::D\n\
595 Code:\"`\":\"`\":\"$\":Text Comment::}",
596 "Matlab:1:0{\n\
597 Comment:\"%\":\"$\"::Comment::\n\
598 Comment in Octave:\"#\":\"$\"::Comment::\n\
599 Keyword:\"<(break|clear|else|elseif|for|function|global|if|return|then|while|end(if|for|while|function))>\":::Keyword::\n\
600 Transpose:\"[\\w.](''+)\":::Plain::\n\
601 Paren transposed:\"\\)(''+)\":::Keyword::\n\
602 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
603 Parentheses:\"[\\(\\)]\":::Keyword::\n\
604 Brackets transposed:\"\\](''+)\":::Text Key1::\n\
605 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
606 Brackets:\"[\\[\\]]\":::Text Key1::\n\
607 Braces transposed:\"\\}(''+)\":::Text Arg::\n\
608 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
609 Braces:\"[\\{\\}]\":::Text Arg::\n\
610 String:\"''\":\"''\"::String::\n\
611 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
612 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
613 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
614 Shell command:\"!\":\"$\"::String1::\n\
615 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
616 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
617 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
618 Logical operators:\"~|&|\\|\":::Text Arg2::}",
619 "NEdit Macro:2:0{\n\
620 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
621 Comment:\"#\":\"$\"::Comment::\n\
622 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line)>\":::Identifier::\n\
623 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
624 Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
625 Built-in Subrs:\"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>\":::Subroutine::\n\
626 Menu Actions:\"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
627 Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)>\":::Subroutine::\n\
628 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
629 Braces:\"[{}\\[\\]]\":::Keyword::\n\
630 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
631 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
632 String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
633 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
634 Macro Definition:\"(?<=define)\\s+\\w+\":::Subroutine1::\n\
635 Custom Macro:\"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])\":::Subroutine1::\n\
636 Variables:\"\\w+\":::Identifier1::D}",
637 "OCaml:1:0{\n\
638 comment:\"\\(\\*\":\"\\*\\)\"::Comment::\n\
639 string-literal:\"(?<!\\\\)\"\"\":\"\"\"\":\"\\n\":String::\n\
640 string-escape:\"\\\\(?:(?:(?#esc-named)[\\\\\"\"''ntbr ])|(?:(?#esc-dec)[0-9]{3})|(?:(?#esc-hex)x[0-9a-fA-F]{2})|(?:(?#esc-oct)o[0-3][0-7]{2})|(?:(?#esc-uni)u\\{[0-9a-fA-F]+\\})|(?:(?#esc-nl)\\n[ \\t]*))\":::String2:string-literal:\n\
641 label:\"[?~](?:(?#lowercase-ident)[a-z_](?:(?#ident-char)[A-Za-z0-9_''])*):\":::Label::D\n\
642 char-literal:\"''(?:(?:(?#regular-char)[^''\\\\])|\\\\(?:(?:(?#esc-named)[\\\\\"\"''ntbr ])|(?:(?#esc-dec)[0-9]{3})|(?:(?#esc-hex)x[0-9a-fA-F]{2})|(?:(?#esc-oct)o[0-3][0-7]{2})))''\":::Character Const::D\n\
643 float-literal-frac:\"-?(?:(?:(?#hex-prefix)0[xX])(?:(?#nibble)[0-9a-fA-F])(?:(?#nibble-underscore)[0-9a-fA-F_])*(?:(?#hex-frac)\\.[0-9a-fA-F_]*)(?:(?#hex-exp)[pP][-+]?[0-9][0-9_]*)?|(?:(?#digit)[0-9])(?:(?#digit-underscore)[0-9_])*(?:(?#dec-frac)\\.[0-9_]*)(?:(?#dec-exp)[eE][-+]?[0-9][0-9_]*)?)\":::Numeric Const::D\n\
644 float-literal-exp:\"-?(?:(?:(?#hex-prefix)0[xX])(?:(?#nibble)[0-9a-fA-F])(?:(?#nibble-underscore)[0-9a-fA-F_])*(?:(?#hex-exp)[pP][-+]?[0-9][0-9_]*)|(?:(?#digit)[0-9])(?:(?#digit-underscore)[0-9_])*(?:(?#dec-exp)[eE][-+]?[0-9][0-9_]*))\":::Numeric Const::D\n\
645 integer-literal:\"-?(?:(?:(?#hex-prefix)0[xX])(?:(?#nibble)[0-9a-fA-F])(?:(?#nibble-underscore)[0-9a-fA-F_])*|(?:(?#oct-prefix)0[oO])(?:(?#three-bits)[0-7])(?:(?#three-bits-underscore)[0-7_])*|(?:(?#bin-prefix)0[bB])(?:(?#bit)[01])(?:(?#bit-underscore)[01_])*|(?:(?#digit)[0-9])(?:(?#digit-underscore)[0-9_])*)(?:(?#int-suffix)[lLn])?\":::Numeric Const::D\n\
646 keyword-op-no-look-ahead:\"(?:''|,|::|:=|:\\>|:|;;|;|\\(|\\)|\\.\\.|\\.~|\\.|\\>\\]|\\>\\}|\\[\\<|\\[\\>|\\[\\||\\[|\\]|\\{\\<|\\{|\\|\\]|\\}|_|`)\":::Keyword::D\n\
647 keyword-op-look-ahead:\"(?:!=|#|=|\\&\\&|\\&|\\*|\\+|\\-\\.|\\-\\>|\\-|\\<\\-|\\<|\\>|\\?|\\|\\||\\||~)(?#operator-char-does-not-follow)(?!(?:(?#operator-char)[~!?$&*+\\-/=>@^|%<:.]))\":::Keyword::D\n\
648 infix-symbol:\"(?:(?:(?#core-operator-char)[$&*+\\-/=>@^|])|[%<])(?:(?#operator-char)[~!?$&*+\\-/=>@^|%<:.])*|#(?:(?#operator-char)[~!?$&*+\\-/=>@^|%<:.])+\":::Operator::D\n\
649 prefix-symbol:\"!(?:(?#operator-char)[~!?$&*+\\-/=>@^|%<:.])*|[?~](?:(?#operator-char)[~!?$&*+\\-/=>@^|%<:.])+\":::Operator::D\n\
650 keyword:\"<(?:and|as|asr|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false|for|fun|function|functor|if|in|include|inherit|initializer|land|lazy|let|lor|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|then|to|true|try|type|val|virtual|when|while|with)>\":::Keyword::D\n\
651 capitalized-ident:\"[A-Z](?:(?#ident-char)[A-Za-z0-9_''])*\":::Identifier::D\n\
652 lowercase-ident:\"[a-z_](?:(?#ident-char)[A-Za-z0-9_''])*\":::Identifier1::D}",
653 "Pascal:1:0{\n\
654 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
655 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
656 String:\"''\":\"''\":\"\\n\":String::D\n\
657 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
658 Parentheses:\"\\(|\\)\":::Keyword::D\n\
659 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
660 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
661 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
662 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
663 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
664 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
665 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
666 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
667 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
668 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
669 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
670 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
671 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
672 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
673 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
674 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
675 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
676 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
677 X Predefined Func:\"<(?iArg|Binding|Card|Cmplx|Date|Empty|Eq|Ge|Gt|Im|Index|LastPosition|Le|Length|Lt|Ne|Polar|Position|Re|SubStr|Time|Trim)>\":::Preprocessor1::D\n\
678 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
679 Assignment:\":=\":::Plain::D\n\
680 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
681 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
682 "Perl:2:0{\n\
683 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
684 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
685 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
686 dq here doc variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:dq here doc:\n\
687 dq here doc content:\".\":::String:dq here doc:\n\
688 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
689 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
690 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
691 dq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:dq string:\n\
692 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
693 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
694 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
695 gen dq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:gen dq string:\n\
696 sq here doc:\"(\\<\\<'')EOF(''.*)$\":\"^EOF>\"::Label::\n\
697 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
698 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
699 sq here doc content:\".\":::String1:sq here doc:\n\
700 sq string:\"(?<!\\Y)''\":\"''\":\"\\n\\s*\\n\":String1::\n\
701 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
702 sq string esc chars:\"\\\\(\\\\|'')\":::Text Escape:sq string:\n\
703 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
704 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
705 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
706 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
707 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
708 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
709 word list content:\".\":::String1:word list:\n\
710 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
711 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
712 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
713 bq here doc variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:bq here doc:\n\
714 bq here doc content:\".\":::String1:bq here doc:\n\
715 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
716 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
717 bq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:bq string:\n\
718 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
719 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
720 gen bq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:gen bq string:\n\
721 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
722 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
723 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
724 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
725 comment:\"#\":\"$\"::Comment::\n\
726 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
727 label identifier:\"\\2\\5\":::Label:label:C\n\
728 label keyword:\"\\3\\6\":::Keyword:label:C\n\
729 handle:\"(\\<)[A-Z_]+(\\>)|(bind|binmode|close(?:dir)?|connect|eof|fcntl|fileno|flock|getc|getpeername|getsockname|getsockopt|ioctl|listen|open(?:dir)?|recv|read(?:dir)?|rewinddir|seek(?:dir)?|send|setsockopt|shutdown|socket|sysopen|sysread|sysseek|syswrite|tell(?:dir)?|write)>\\s*(\\(?)\\s*[A-Z_]+>|<(accept|pipe|socketpair)>\\s*(\\(?)\\s*[A-Z_]+\\s*(,)\\s*[A-Z_]+>|(print|printf|select)>\\s*(\\(?)\\s*[A-Z_]+>(?!\\s*,)\":::Storage Type::\n\
730 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
731 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
732 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
733 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
734 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
735 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
736 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
737 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
738 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
739 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
740 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
741 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
742 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
743 variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1::\n\
744 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
745 library functions:\"<((?# arithmetic functions)abs|atan2|cos|exp|int|log|rand|sin|sqrt|srand|time|(?# conversion functions)chr|gmtime|hex|localtime|oct|ord|vec|(?# structure conversion)pack|unpack|(?# string functions)chomp|chop|crypt|eval(?=\\s*[^{])|index|lc|lcfirst|length|quotemeta|rindex|substr|uc|ucfirst|(?# array and hash functions)delete|each|exists|grep|join|keys|map|pop|push|reverse|scalar|shift|sort|splice|split|unshift|values|(?# search and replace functions)pos|study|(?# file operations)chmod|chown|link|lstat|mkdir|readlink|rename|rmdir|stat|symlink|truncate|unlink|utime|(?# input/output)binmode|close|eof|fcntl|fileno|flock|getc|ioctl|open|pipe|print|printf|read|readline|readpipe|seek|select|sprintf|sysopen|sysread|sysseek|syswrite|tell|(?# formats)formline|write|(?# tying variables)tie|tied|untie|(?# directory reading routines)closedir|opendir|readdir|rewinddir|seekdir|telldir|(?# system interaction)alarm|chdir|chroot|die|exec|exit|fork|getlogin|getpgrp|getppid|getpriority|glob|kill|setpgrp|setpriority|sleep|syscall|system|times|umask|wait|waitpid|warn|(?# networking)accept|bind|connect|getpeername|getsockname|getsockopt|listen|recv|send|setsockopt|shutdown|socket|socketpair|(?# system V ipc)msgctl|msgget|msgrcv|msgsnd|semctl|semget|semop|shmctl|shmget|shmread|shmwrite|(?# miscellaneous)defined|do|dump|eval(?=\\s*\\{)|local|my|ref|reset|undef|(?# informations from system databases)endpwent|getpwent|getpwnam|getpwuid|setpwent|endgrent|getgrent|getgrgid|getgrnam|setgrent|endnetent|getnetbyaddr|getnetbyname|getnetent|setnetent|endhostend|gethostbyaddr|gethostbyname|gethostent|sethostent|endservent|getservbyname|getservbyport|getservent|setservent|endprotoent|getprotobyname|getprotobynumber|getprotoent|setprotoent)>\":::Subroutine::\n\
746 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
747 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
748 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
749 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
750 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
751 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
752 end token delim:\"&\":::Preprocessor:end token:C\n\
753 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
754 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
755 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
756 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
757 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
758 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
759 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
760 re match variables:\"\\$([-_.,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:re match:\n\
761 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
762 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
763 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
764 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
765 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
766 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
767 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
768 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
769 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
770 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
771 re sub variables:\"\\$([-_.,\"\"\\\\*?#;!@$<>(%=~^|&`''+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:re sub:\n\
772 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
773 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
774 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
775 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
776 "PostScript:1:0{\n\
777 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
778 Comment:\"%\":\"$\"::Comment::\n\
779 string:\"\\(\":\"\\)\"::String::\n\
780 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
781 string2:\"\\(\":\"\\)\"::String:string:\n\
782 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
783 string3:\"\\(\":\"\\)\"::String:string2:\n\
784 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
785 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
786 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
787 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
788 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
789 Number:\"(?<!\\Y)((([2-9]|[1-2][0-9]|3[0-6])#[0-9a-zA-Z]*)|(((\\+|-)?[0-9]+\\.?[0-9]*)|((\\+|-)?\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(?!\\Y)\":::Numeric Const::D\n\
790 Array:\"[\\[\\]]\":::Storage Type::D\n\
791 Procedure:\"[{}]\":::Subroutine::D\n\
792 Operator1:\"(?<!\\Y)(=|==|abs|add|aload|anchorsearch|and|arc|arcn|arcto|array|ashow|astore|atan|awidthshow|begin|bind|bitshift|bytesavailable|cachestatus|ceiling|charpath|clear|cleardictstack|cleartomark|clip|clippath|closefile|closepath|concat|concatmatrix|copy|copypage|cos|count|countdictstack|countexecstack|counttomark|currentdash|currentdict|currentfile|currentflat|currentfont|currentgray|currenthsbcolor|currentlinecap|currentlinejoin|currentlinewidth|currentmatrix|currentmiterlimit|currentpoint|currentrgbcolor|currentscreen|currenttransfer|curveto|cvi|cvlit|cvn|cvr|cvrs|cvs|cvx|def|defaultmatrix|definefont|dict|dictstack|div|dtransform|dup|echo|eexec|end|eoclip|eofill|eq|erasepage|errordict|exch|exec|execstack|executeonly|executive|exit|exitserver|exp|false|file|fill|findfont|flattenpath|floor|flush|flushfile|FontDirectory|for|forall|ge|get|getinterval|grestore|grestoreall|gsave|gt|handleerror|identmatrix|idiv|idtransform|if|ifelse|image|imagemask|index|initclip|initgraphics|initmatrix|internaldict|invertmatrix|itransform|known|kshow|le|length|lineto|ln|load|log|loop|lt|makefont|mark|matrix|maxlength|mod|moveto|mul|ne|neg|newpath|noaccess|not|null|nulldevice|or|pathbbox|pathforall|pop|print|prompt|pstack|put|putinterval|quit|rand|rcheck|rcurveto|read|readhexstring|readline|readonly|readstring|repeat|resetfile|restore|reversepath|rlineto|rmoveto|roll|rotate|round|rrand|run|save|scale|scalefont|search|serverdict|setcachedevice|setcachelimit|setcharwidth|setdash|setflat|setfont|setgray|sethsbcolor|setlinecap|setlinejoin|setlinewidth|setmatrix|setmiterlimit|setrgbcolor|setscreen|settransfer|show|showpage|sin|sqrt|srand|stack|StandardEncoding|start|status|statusdict|stop|stopped|store|string|stringwidth|stroke|strokepath|sub|systemdict|token|transform|translate|true|truncate|type|userdict|usertime|version|vmstatus|wcheck|where|widthshow|write|writehexstring|writestring|xcheck|xor)(?!\\Y)\":::Keyword::D\n\
793 Operator2:\"<(arct|colorimage|cshow|currentblackgeneration|currentcacheparams|currentcmykcolor|currentcolor|currentcolorrendering|currentcolorscreen|currentcolorspace|currentcolortransfer|currentdevparams|currentglobal|currentgstate|currenthalftone|currentobjectformat|currentoverprint|currentpacking|currentpagedevice|currentshared|currentstrokeadjust|currentsystemparams|currentundercolorremoval|currentuserparams|defineresource|defineuserobject|deletefile|execform|execuserobject|filenameforall|fileposition|filter|findencoding|findresource|gcheck|globaldict|GlobalFontDirectory|glyphshow|gstate|ineofill|infill|instroke|inueofill|inufill|inustroke|ISOLatin1Encoding|languagelevel|makepattern|packedarray|printobject|product|realtime|rectclip|rectfill|rectstroke|renamefile|resourceforall|resourcestatus|revision|rootfont|scheck|selectfont|serialnumber|setbbox|setblackgeneration|setcachedevice2|setcacheparams|setcmykcolor|setcolor|setcolorrendering|setcolorscreen|setcolorspace|setcolortransfer|setdevparams|setfileposition|setglobal|setgstate|sethalftone|setobjectformat|setoverprint|setpacking|setpagedevice|setpattern|setshared|setstrokeadjust|setsystemparams|setucacheparams|setundercolorremoval|setuserparams|setvmthreshold|shareddict|SharedFontDirectory|startjob|uappend|ucache|ucachestatus|ueofill|ufill|undef|undefinefont|undefineresource|undefineuserobject|upath|UserObjects|ustroke|ustrokepath|vmreclaim|writeobject|xshow|xyshow|yshow)>\":::Keyword::D\n\
794 Operator3:\"<(GetHalftoneName|GetPageDeviceName|GetSubstituteCRD|StartData|addglyph|beginbfchar|beginbfrange|begincidchar|begincidrange|begincmap|begincodespacerange|beginnotdefchar|beginnotdefrange|beginrearrangedfont|beginusematrix|cliprestore|clipsave|composefont|currentsmoothness|currenttrapparams|endbfchar|endbfrange|endcidchar|endcidrange|endcmap|endcodespacerange|endnotdefchar|endnotdefrange|endrearrangedfont|endusematrix|findcolorrendering|removeall|removeglyphs|setsmoothness|settrapparams|settrapzone|shfill|usecmap|usefont)>\":::Keyword::D\n\
795 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
796 "Python:2:0{\n\
797 Comment:\"#\":\"$\"::Comment::\n\
798 String3s:\"[uU]?[rR]?''{3}\":\"''{3}\"::String::\n\
799 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
800 String1s:\"[uU]?[rR]?''\":\"''\":\"$\":String::\n\
801 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
802 String escape chars 3s:\"\\\\(?:\\n|\\\\|''|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String3s:\n\
803 String escape chars 3d:\"\\\\(?:\\n|\\\\|''|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String3d:\n\
804 String escape chars 1s:\"\\\\(?:\\n|\\\\|''|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String1s:\n\
805 String escape chars 1d:\"\\\\(?:\\n|\\\\|''|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String1d:\n\
806 Representation:\"`\":\"`\":\"$\":String2::\n\
807 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
808 Number:\"(?<!\\Y)(?:(?:(?:[1-9]\\d*|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[eE][\\-+]?\\d+|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[jJ]?|(?:[1-9]\\d*|0)[jJ]|(?:0|[1-9]\\d*|0[oO]?[0-7]+|0[xX][\\da-fA-F]+|0[bB][0-1]+)[lL]?)(?!\\Y)\":::Numeric Const::\n\
809 Multiline import:\"<from>.*?\\(\":\"\\)\"::Preprocessor::\n\
810 Multiline import comment:\"#\":\"$\"::Comment:Multiline import:\n\
811 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
812 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
813 Member definition:\"<(def)\\s+(?:(__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delete|delitem|div|divmod|enter|eq|exit|float|floordiv|format|ge|get|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ifloordiv|ilshift|imod|imul|index|init|int|invert|ior|ipow|irshift|isub|iter|itruediv|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|reversed|rfloordiv|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rtruediv|rxor|set|setattr|setitem|str|sub|truediv|unicode|xor)__)|((__bases__|__class__|__dict__|__doc__|__func__|__metaclass__|__module__|__name__|__self__|__slots__|co_argcount|co_cellvars|co_code|co_filename|co_firstlineno|co_flags|co_lnotab|co_name|co_names|co_nlocals|co_stacksize|co_varnames|f_back|f_builtins|f_code|f_exc_traceback|f_exc_type|f_exc_value|f_globals|f_lasti|f_restricted|f_trace|func_closure|func_code|func_defaults|func_dict|func_doc|func_globals|func_name|im_class|im_func|im_self|tb_frame|tb_lasti|tb_next)|(__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))(?=(?:\\s*(?:\\\\\\n\\s*)?\\(\\s*|\\s*\\(\\s*(?:\\\\?\\n\\s*)?)self>)\":::Plain::\n\
814 Member def color:\"\\1\":::Keyword:Member definition:C\n\
815 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
816 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
817 Member def error:\"\\7\":::Flag:Member definition:C\n\
818 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
819 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
820 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
821 Function definition:\"<(def)\\s+(?:(ArithmeticError|AssertionError|AttributeError|BaseException|BufferError|BytesWarning|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|all|any|apply|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|self|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
822 Function def color:\"\\1\":::Keyword:Function definition:C\n\
823 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
824 Function def error:\"\\3\":::Flag:Function definition:C\n\
825 Class definition:\"<(class)\\s+(?:(ArithmeticError|AssertionError|AttributeError|BaseException|BufferError|BytesWarning|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|all|any|apply|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|self|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
826 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
827 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
828 Class def error:\"\\3\":::Flag:Class definition:C\n\
829 Member reference:\"\\.\\s*(?:\\\\?\\n\\s*)?(?:((__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delete|delitem|div|divmod|enter|eq|exit|float|floordiv|format|ge|get|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ifloordiv|ilshift|imod|imul|index|init|int|invert|ior|ipow|irshift|isub|iter|itruediv|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|reversed|rfloordiv|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rtruediv|rxor|set|setattr|setitem|str|sub|truediv|unicode|xor)__)|(__(?:new)__))|((__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(__bases__|__class__|__dict__|__doc__|__func__|__metaclass__|__module__|__name__|__self__|__slots__|co_argcount|co_cellvars|co_code|co_filename|co_firstlineno|co_flags|co_lnotab|co_name|co_names|co_nlocals|co_stacksize|co_varnames|f_back|f_builtins|f_code|f_exc_traceback|f_exc_type|f_exc_value|f_globals|f_lasti|f_restricted|f_trace|func_closure|func_code|func_defaults|func_dict|func_doc|func_globals|func_name|im_class|im_func|im_self|tb_frame|tb_lasti|tb_next)|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
830 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
831 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
832 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
833 Member ref error:\"\\8\":::Flag:Member reference:C\n\
834 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
835 Keyword:\"<(?:and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield)>\":::Keyword::\n\
836 Built-in function:\"<(?:__import__|abs|all|any|basestring|bin|bool|bytearray|bytes|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
837 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
838 Built-in exceptions:\"<(?:ArithmeticError|AssertionError|AttributeError|BaseException|BufferError|EOFError|EnvironmentError|Exception|FloatingPointError|GeneratorExit|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StandardError|StopIteration|SyntaxError|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
839 Built-in warnings:\"<(?:BytesWarning|DeprecationWarning|FutureWarning|ImportWarning|PendingDeprecationWarning|RuntimeWarning|SyntaxWarning|UnicodeWarning|UserWarning|Warning)>\":::Identifier1::\n\
840 Deprecated function:\"<(?:apply|buffer|coerce|intern)>\":::Warning::\n\
841 Braces and parens:\"[[{()}\\]]\":::Keyword::D\n\
842 Decorator:\"(@)\":\"$\":\"#\":Preprocessor1::\n\
843 Decorator continuation:\"\\\\\\n\":::Preprocessor1:Decorator:\n\
844 Decorator marker:\"\\1\":::Storage Type:Decorator:C\n\
845 Operators:\"\\+|-|\\*|\\*\\*|/|//|%|\\<\\<|\\>\\>|\\&|\\||\\^|~|\\<|\\>|\\<=|\\>=|==|!=\":::Keyword::\n\
846 Delimiter:\"\\(|\\)|\\[|\\]|\\{|\\}|,|:|\\.|;|=|\\+=|-=|\\*=|/=|//=|%=|\\&=|\\|=|\\^=|\\>\\>=|\\<\\<=|\\*\\*=\":::Keyword::\n\
847 Invalid:\"\\$|\\?|<(?:0[bB]\\w+|0[xX]\\w+|(?:0|[1-9]\\d*)\\w+)>\":::Flag::}",
848 "Regex:1:0{\n\
849 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
850 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
851 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
852 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
853 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
854 Numeric Escape:\"(?#Negative lookahead is to exclude \\x0 and \\00)(?!\\\\[xX0]0*(?:[^\\da-fA-F]|$))\\\\(?:[xX]0*[1-9a-fA-F][\\da-fA-F]?|0*[1-3]?[0-7]?[0-7])\":::Numeric Const::\n\
855 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
856 Counting Quantifiers:\"(?#Properly limits range numbers to 0-65535)\\{(?:[0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])?(?:,(?:[0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])?)?\\}\\??\":::Numeric Const::\n\
857 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
858 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
859 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
860 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
861 "SGML HTML:6:0{\n\
862 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
863 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
864 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
865 markup declaration sq string:\"''\":\"''\"::String1:markup declaration:\n\
866 entity declaration:\"((?ientity))[ \\t\\n][ \\t]*\\n?[ \\t]*(%[ \\t\\n][ \\t]*\\n?[ \\t]*)?(\\l[\\l\\d\\-\\.]*|#((?idefault)))[ \\t\\n][ \\t]*\\n?[ \\t]*((?i[cs]data|pi|starttag|endtag|m[ds]))?\":::Preprocessor:markup declaration:\n\
867 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
868 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
869 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
870 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
871 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
872 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
873 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
874 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
875 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
876 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
877 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
878 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
879 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
880 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
881 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
882 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|''([^'']*\\n){,4}[^'']*''|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
883 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
884 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
885 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
886 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
887 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
888 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
889 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
890 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
891 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
892 "SQL:1:0{\n\
893 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
894 comment:\"--\":\"$\"::Comment::\n\
895 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
896 string:\"''\":\"''\"::String::\n\
897 keywords2:\"END IF;|(?<!\\Y)(CREATE|REPLACE|BEGIN|END|FUNCTION|RETURN|FETCH|OPEN|CLOSE| IS|NOTFOUND|CURSOR|IF|ELSE|THEN|INTO|IS|IN|WHEN|OTHERS|GRANT|ON|TO|EXCEPTION|SHOW|SET|OUT|PRAGMA|AS|PACKAGE)>\":::Preprocessor1::\n\
898 comment2:\"/\\*\":\"\\*/\"::Comment::}",
899 "Sh Ksh Bash:1:0{\n\
900 README:\"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
901 escaped special characters:\"\\\\[\\\\\"\"$`'']\":::Keyword::\n\
902 single quoted string:\"''\":\"''\"::String1::\n\
903 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
904 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
905 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
906 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
907 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
908 dqncs single quoted string:\"''\":\"''\"::String1:dq new command sub:\n\
909 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
910 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
911 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
912 ae escapes:\"\\\\[\\\\$`\"\"'']\":::String2:arithmetic expansion:\n\
913 ae single quoted string:\"''\":\"''\":\"\\)\\)\":String1:arithmetic expansion:\n\
914 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
915 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
916 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
917 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
918 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
919 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
920 command substitution:\"`\":\"`\"::Subroutine::\n\
921 cs escapes:\"\\\\[\\\\$`\"\"'']\":::Subroutine1:command substitution:\n\
922 cs single quoted string:\"''\":\"''\":\"`\":String1:command substitution:\n\
923 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
924 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
925 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
926 ncs new command substitution:\"\\$\\(\":\"\\)\"::Subroutine:new command substitution:\n\
927 ncs escapes:\"\\\\[\\\\$`\"\"'']\":::Subroutine1:new command substitution:\n\
928 ncs single quoted string:\"''\":\"''\"::String1:new command substitution:\n\
929 ncs double quoted string:\"\"\"\":\"\"\"\"::String1:new command substitution:\n\
930 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
931 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
932 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
933 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
934 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
935 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
936 comments in line:\"#\":\"$\"::Comment::\n\
937 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
938 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
939 command options:\"(?<=\\s)-[^ \\t{}[\\],()''\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
940 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
941 built ins:\"(?<!\\Y)(:|\\.|source|alias|bg|bind|break|builtin|cd|chdir|command|compgen|complete|continue|declare|dirs|disown|echo|enable|eval|exec|exit|export|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|print|printf|pushd|pwd|read|readonly|return|set|shift|shopt|stop|suspend|test|times|trap|type|typeset|ulimit|umask|unalias|unset|wait|whence)(?!\\Y)[\\s\\n;]\":::Subroutine1::D}",
942 "Tcl:1:0{\n\
943 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
944 Single Quote String:\"''\":\"''\":\"[^\\\\][^'']\":String::\n\
945 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
946 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
947 Comment:\"#\":\"$\"::Comment::\n\
948 Keywords:\"<(after\\s+(\\d+|cancel|idle|info)?|append|array\\s+(anymore|donesearch|exists|get|names|nextelement|set|size|startsearch|unset)|bell|bgerror|binary\\s+(format|scan)|bind(tags)?|body|break|case|catch|cd|class|clipboard\\s+(clear|append)|clock\\s+(clicks|format|scan|seconds)|close|code|common|concat|configbody|constructor|continue|delete\\s+(class|object|namespace)|destroy|destructor|else|elseif|encoding\\s+(convertfrom|convertto|names|system)|ensemble|eof|error|eval|event\\s+(add|delete|generate|info)|exec|exit|expr|fblocked|fconfigure|fcopy|file\\s+(atime|attributes|channels|copy|delete|dirname|executable|exists|extension|isdirectory|isfile|join|lstat|mkdir|mtime|nativename|owned|pathtype|readable|readlink|rename|rootname|size|split|stat|tail|type|volume|writable)|fileevent|find\\s+(classes|objects)|flush|focus|font\\s+(actual|configure|create|delete|families|measure|metrics|names)|foreach|format|gets|glob(al)?|grab\\s+(current|release|set|status|(-global\\s+)?\\w+)|grid(\\s+bbox|(column|row)?configure|forget|info|location|propagate|remove|size|slaves)?|history\\s+(add|change|clear|event|info|keep|nextid|redo)|if|image\\s+(create|delete|height|names|type|width)|incr|info\\s+(args|body|cmdcount|commands|complete|default|exists|globals|hostname|level|library|loaded|locals|nameofexecutable|patchlevel|procs|script|sharedlibextension|tclversion|vars)|inherit|interp\\s+(alias(es)?|create|delete|eval|exists|expose|hide|hidden|invokehidden|issafe|marktrusted|share|slaves|target|transfer)|join|lappend|lindex|linsert|list|llength|load|local|lrange|lreplace|lsearch|lsort|method|memory\\s+(info|(trace|validate)\\s+(on|off)|trace_on_at_malloc|break_on_malloc|display)|namespace\\s+(children|code|current|delete|eval|export|forget|import|inscope|origin|parent|qualifiers|tail|which)|open|option\\s+(add|clear|get|read(file))|pack\\s+(configure|forget|info|propagate|slaves)?|package\\s+(forget|ifneeded|names|present|provide|require|unknown|vcompare|versions|vsatisfies)|pid|place\\s+(configure|forget|info|slaves)?|proc|puts|pwd|raise|read|regexp|regsub|rename|resource\\s+(close|delete|files|list|open|read|types|write)|return|scan|scope(dobject)?|seek|selection\\s+(clear|get|handle|own)|send|set|socket|source|split|string\\s+(bytelength|compare|equal|first|index|is|last|length|map|match|range|repeat|replace|tolower|totitle|toupper|trim|trimleft|trimright|wordend|wordstart)|subst|switch|tell|time|tk\\s+(appname|scaling|useinputmethods)|tk_(bindForTraversal|bisque|chooseColor|chooseDirectory|dialog|focusFollowsMouse|focusNext|focusPrev|getOpenFile|getSaveFile|menuBar|messageBox|optionMenu|popup|setPalette)|tkerror|tkwait\\s+(variable|visibility|window)|trace\\s+(variable|vdelete|vinfo)|unknown|unset|update|uplevel|upvar|usual|variable|while|winfo\\s+(atom|atomname|cells|children|class|colormapfull|containing|depth|exists|fpixels|geometry|height|id|interp|ismapped|manager|name|parent|pathname|pixels|pointerx|pointerxy|pointery|reqheight|reqwidth|rgb|rootx|rooty|screen(cells|depth|height|mmheigth|mmidth|visual|width)?|server|toplevel|viewable|visual(id|savailable)?|vroot(height|width|x|y)|width|x|y)|wm\\s+(aspect|client|colormapwindows|command|deiconify|focusmodel|frame|geometry|grid|group|iconbitmap|icon(ify|mask|name|position|window)|(max|min)size|overrideredirect|positionfrom|protocol|resizable|sizefrom|state|title|transient|withdraw))(?!\\Y)\":::Keyword::D\n\
949 Widgets:\"<(button(box){0,1}|calendar|canvas(printbox|printdialog){0,1}|check(box|button)|combobox|date(entry|field)|dialog(shell){0,1}|entry(field){0,1}|(ext){0,1}fileselection(box|dialog)|feedback|finddialog|frame|hierarchy|hyperhelp|label(edframe|edwidget){0,1}|listbox|mainwindow|menu(bar|button){0,1}|message(box|dialog){0,1}|notebook|optionmenu|panedwindow|promptdialog|pushbutton|radio(box|button)|scale|scrollbar|scrolled(canvas|frame|html|listbox|text)|selection(box|dialog)|shell|spin(date|int|ner|time)|tab(notebook|set)|text|time(entry|field)|toolbar|toplevel|watch)>\":::Identifier::\n\
950 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
951 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
952 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
953 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
954 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
955 Namespace:\"\\w+::\":::Keyword::}",
956 "VHDL:1:0{\n\
957 Comments:\"--\":\"$\"::Comment::\n\
958 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
959 Vhdl Attributes:\"''[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
960 Character Literals:\"''\":\"''\":\"[^\\\\][^'']\":Character Const::\n\
961 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
962 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
963 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
964 Reserved Words:\"<(?iabs|access|after|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|disconnect|downto|else|elsif|end|entity|error|exit|failure|file|for|function|generate|generic|guarded|if|in|inout|is|label|library|linkage|loop|map|mod|nand|new|next|nor|not|note|null|of|on|open|or|others|out|package|port|procedure|process|range|record|register|rem|report|return|select|severity|then|to|transport|units|until|use|wait|warning|when|while|with|xor|group|impure|inertial|literal|postponed|pure|reject|rol|ror|shared|sla|sll|sra|srl|unaffected|xnor)>\":::Keyword::D\n\
965 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
966 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
967 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
968 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
969 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
970 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
971 "Verilog:1:0{\n\
972 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
973 cplus comment:\"//\":\"$\"::Comment::\n\
974 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
975 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
976 Reserved WordsA:\"(?<!\\Y)(module|endmodule|parameter|specify|endspecify|begin|end|initial|always|if|else|task|endtask|force|release|attribute|case|case[xz]|default|endattribute|endcase|endfunction|endprimitive|endtable|for|forever|function|primitive|table|while|;)(?!\\Y)\":::Keyword::\n\
977 Predefined Types:\"<(and|assign|buf|bufif[01]|cmos|deassign|defparam|disable|edge|event|force|fork|highz[01]|initial|inout|input|integer|join|large|macromodule|medium|nand|negedge|nmos|nor|not|notif[01]|or|output|parameter|pmos|posedge|pullup|rcmos|real|realtime|reg|release|repeat|rnmos|rpmos|rtran|rtranif[01]|scalered|signed|small|specparam|strength|strong[01]|supply[01]|time|tran|tranif[01]|tri[01]?|triand|trior|trireg|unsigned|vectored|wait|wand|weak[01]|wire|wor|xnor|xor)>\":::Storage Type::D\n\
978 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
979 Numeric Literals:\"(?<!\\Y)([0-9]*''[dD][0-9xz\\\\?_]+|[0-9]*''[hH][0-9a-fxz\\\\?_]+|[0-9]*''[oO][0-7xz\\\\?_]+|[0-9]*''[bB][01xz\\\\?_]+|[0-9.]+((e|E)(\\\\+|-)?)?[0-9]*|[0-9]+)(?!\\Y)\":::Numeric Const::\n\
980 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
981 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
982 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
983 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
984 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
985 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
986 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
987 "XML:1:0{\n\
988 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
989 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
990 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
991 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
992 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
993 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
994 declaration sq string:\"''\":\"''\":\"\\n\\n\":String1:declaration:\n\
995 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
996 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
997 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
998 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
999 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
1000 doctype root element:\"\\2\":::Identifier:doctype:C\n\
1001 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
1002 doctype sq string:\"''\":\"''\":\"\\n\\n\":String1:doctype:\n\
1003 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
1004 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
1005 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|(''[^'']*''))\":::Preprocessor:processing instruction:\n\
1006 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
1007 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
1008 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
1009 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
1010 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
1011 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
1012 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
1013 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
1014 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
1015 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
1016 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
1017 entity declaration sq string:\"''\":\"''\":\"\\n\\n\":String1:entity declaration:\n\
1018 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
1019 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
1020 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
1021 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
1022 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
1023 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
1024 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
1025 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
1026 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
1027 notation sq string:\"''\":\"''\":\"\\n\\n\":String1:notation:\n\
1028 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
1029 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
1030 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
1031 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
1032 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
1033 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
1034 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
1035 attribute declaration sq string:\"''\":\"''\":\"\\n\\n\":String1:attribute declaration:\n\
1036 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
1037 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
1038 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
1039 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
1040 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
1041 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
1042 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
1043 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
1044 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
1045 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
1046 element name:\"\\2\":::Identifier:element:C\n\
1047 element assign:\"=\":::Keyword:element:\n\
1048 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
1049 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
1050 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
1051 element sq string:\"''\":\"''\":\"\\n\\n\":String1:element:\n\
1052 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
1053 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
1054 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
1055 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
1056 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
1057 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
1058 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
1059 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
1060 "X Resources:2:0{\n\
1061 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
1062 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
1063 Comment:\"^\\s*!\":\"$\"::Comment::\n\
1064 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
1065 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
1066 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
1067 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
1068 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
1069 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
1070 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
1071 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
1072 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
1073 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
1074 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
1075 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
1076 Free Text:\"^.*$\":::Flag::}",
1077 "Yacc:1:0{\n\
1078 comment:\"/\\*\":\"\\*/\"::Comment::\n\
1079 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
1080 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
1081 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
1082 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
1083 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
1084 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
1085 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
1086 character constant:\"''\":\"''\":\"[^\\\\][^'']\":Character Const::\n\
1087 numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
1088 storage keyword:\"<(const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
1089 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
1090 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
1091 yacc keyword:\"<(error|YYABORT|YYACCEPT|YYBACKUP|YYERROR|YYINITDEPTH|YYLTYPE|YYMAXDEPTH|YYRECOVERING|YYSTYPE|yychar|yyclearin|yydebug|yyerrok|yyerror|yylex|yylval|yylloc|yynerrs|yyparse)>\":::Text Arg::D\n\
1092 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
1093 braces:\"[{}]\":::Keyword::D\n\
1094 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
1095 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
1096 };
1097
1098
1099 void SetColorProfileName(
const char *profileName)
1100 {
1101 NEditFree(currentColorProfileName);
1102 currentColorProfileName = profileName ? NEditStrdup(profileName) :
NULL;
1103 }
1104
1105 void SetColorProfileStyleType(
int profileStyleType)
1106 {
1107 currentColorProfileStyleType = profileStyleType;
1108 }
1109
1110 void ColorProfileLoadHighlightStyles(ColorProfile *profile)
1111 {
1112 if(profile->styleType !=
2) {
1113 profile->styles = HighlightStyles;
1114 profile->numStyles = NHighlightStyles;
1115 }
1116 profile->stylesLoaded = True;
1117 }
1118
1119
1120
1121
1122
1123
1124 int LoadStylesString(
char *inString, Boolean profile)
1125 {
1126 char *errMsg, *fontStr;
1127 char *inPtr = inString;
1128 ColorProfile *colorProfile =
NULL;
1129 highlightStyleRec *hs;
1130 int i;
1131
1132 for (;;) {
1133
1134
1135 inPtr += strspn(inPtr,
" \t");
1136
1137
1138 hs = (highlightStyleRec *)NEditMalloc(
sizeof(highlightStyleRec));
1139
1140
1141 if(profile) {
1142 char *profileName = ReadSymbolicField(&inPtr);
1143 if(!profileName) {
1144 return styleError(inString,inPtr,
"profile name required");
1145 }
1146 colorProfile = GetColorProfile(profileName);
1147 if(!colorProfile) {
1148 fprintf(stderr,
"XNEdit: Unknown color profile ''%s'' in styles string\n", profileName);
1149 NEditFree(profileName);
1150 return False;
1151 }
1152 NEditFree(profileName);
1153 if (!SkipDelimiter(&inPtr, &errMsg)) {
1154 NEditFree(hs);
1155 return styleError(inString,inPtr, errMsg);
1156 }
1157 }
1158
1159
1160 hs->name = ReadSymbolicField(&inPtr);
1161 if (hs->name ==
NULL) {
1162 NEditFree(hs);
1163 return styleError(inString,inPtr,
"style name required");
1164 }
1165
1166 if (!SkipDelimiter(&inPtr, &errMsg)) {
1167 NEditFree(hs->name);
1168 NEditFree(hs);
1169 return styleError(inString,inPtr, errMsg);
1170 }
1171
1172
1173 hs->color = ReadSymbolicField(&inPtr);
1174 if (hs->color ==
NULL) {
1175 NEditFree(hs->name);
1176 NEditFree(hs);
1177 return styleError(inString,inPtr,
"color name required");
1178 }
1179 hs->bgColor =
NULL;
1180 if (SkipOptSeparator(
'/', &inPtr)) {
1181
1182 hs->bgColor = ReadSymbolicField(&inPtr);
1183 }
1184 if (!SkipDelimiter(&inPtr, &errMsg)) {
1185 freeHighlightStyleRec(hs);
1186 return styleError(inString,inPtr, errMsg);
1187 }
1188
1189
1190 fontStr = ReadSymbolicField(&inPtr);
1191 for (i=
0; i<
N_FONT_TYPES; i++) {
1192 if (!strcmp(FontTypeNames[i], fontStr)) {
1193 hs->font = i;
1194 break;
1195 }
1196 }
1197 if (i ==
N_FONT_TYPES) {
1198 NEditFree(fontStr);
1199 freeHighlightStyleRec(hs);
1200 return styleError(inString, inPtr,
"unrecognized font type");
1201 }
1202 NEditFree(fontStr);
1203
1204
1205 if(!profile) {
1206 for (i=
0; i<NHighlightStyles; i++) {
1207 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1208 freeHighlightStyleRec(HighlightStyles[i]);
1209 HighlightStyles[i] = hs;
1210 break;
1211 }
1212 }
1213
1214 if (i == NHighlightStyles) {
1215 HighlightStyles[NHighlightStyles++] = hs;
1216 if (NHighlightStyles >
MAX_HIGHLIGHT_STYLES) {
1217 return styleError(inString, inPtr,
1218 "maximum allowable number of styles exceeded");
1219 }
1220 }
1221 }
else {
1222 if(colorProfile->numStyles == colorProfile->stylesAlloc) {
1223 if(colorProfile->stylesAlloc ==
0) {
1224 colorProfile->stylesAlloc =
64;
1225 }
else {
1226 colorProfile->stylesAlloc +=
16;
1227 }
1228 colorProfile->styles = NEditRealloc(
1229 colorProfile->styles,
1230 colorProfile->stylesAlloc *
sizeof(highlightStyleRec*));
1231 }
1232 colorProfile->styles[colorProfile->numStyles++] = hs;
1233
1234 }
1235
1236
1237 inPtr += strspn(inPtr,
" \t\n");
1238 if (*inPtr ==
'\0') {
1239 return True;
1240 }
1241 }
1242
1243 return False;
1244 }
1245
1246
1247
1248
1249
1250
1251 static int createStylesString(textBuffer *outBuf, highlightStyleRec **styles,
int nstyles,
const char *colorProfileName)
1252 {
1253 int i;
1254 highlightStyleRec *style;
1255
1256 for (i=
0; i<nstyles; i++) {
1257 style = styles[i];
1258 BufInsert(outBuf, outBuf->length,
"\t");
1259 if(colorProfileName) {
1260 BufInsert(outBuf, outBuf->length, colorProfileName);
1261 BufInsert(outBuf, outBuf->length,
":");
1262 }
1263 BufInsert(outBuf, outBuf->length, style->name);
1264 BufInsert(outBuf, outBuf->length,
":");
1265 BufInsert(outBuf, outBuf->length, style->color);
1266 if (style->bgColor) {
1267 BufInsert(outBuf, outBuf->length,
"/");
1268 BufInsert(outBuf, outBuf->length, style->bgColor);
1269 }
1270 BufInsert(outBuf, outBuf->length,
":");
1271 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1272 BufInsert(outBuf, outBuf->length,
"\\n\\\n");
1273 }
1274
1275 return i;
1276 }
1277
1278 char *WriteStylesString(
void)
1279 {
1280 textBuffer *outBuf = BufCreate();
1281 int i = createStylesString(outBuf, HighlightStyles, NHighlightStyles,
NULL);
1282
1283 char *outStr = BufGetRange(outBuf,
0, outBuf->length - (i==
1?
0:
4));
1284 BufFree(outBuf);
1285 return outStr;
1286 }
1287
1288 char *WriteColorProfileStylesString(
void)
1289 {
1290 textBuffer *outBuf = BufCreate();
1291 int i =
0;
1292
1293 ColorProfile *cp = GetColorProfiles();
1294 while(cp) {
1295 if(cp->styleType ==
2) {
1296 i += createStylesString(outBuf, cp->styles, cp->numStyles, cp->name);
1297 }
1298 cp = cp->next;
1299 }
1300
1301 char *outStr = BufGetRange(outBuf,
0, outBuf->length - (i==
1?
0:
4));
1302 BufFree(outBuf);
1303 return outStr;
1304 }
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315 int LoadHighlightString(
char *inString,
int convertOld)
1316 {
1317 char *inPtr = inString;
1318 patternSet *patSet;
1319 int i;
1320
1321 for (;;) {
1322
1323
1324 patSet = readPatternSet(&inPtr, convertOld);
1325 if (patSet ==
NULL)
1326 return False;
1327
1328
1329 for (i=
0; i<NPatternSets; i++) {
1330 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1331 freePatternSet(PatternSets[i]);
1332 PatternSets[i] = patSet;
1333 break;
1334 }
1335 }
1336 if (i == NPatternSets) {
1337 PatternSets[NPatternSets++] = patSet;
1338 if (NPatternSets >
MAX_LANGUAGE_MODES)
1339 return False;
1340 }
1341
1342
1343 inPtr += strspn(inPtr,
" \t\n");
1344 if (*inPtr ==
'\0')
1345 return True;
1346 }
1347 }
1348
1349
1350
1351
1352
1353
1354 char *WriteHighlightString(
void)
1355 {
1356 char *outStr, *str, *escapedStr;
1357 textBuffer *outBuf;
1358 int psn, written = False;
1359 patternSet *patSet;
1360
1361 outBuf = BufCreate();
1362 for (psn=
0; psn<NPatternSets; psn++) {
1363 patSet = PatternSets[psn];
1364 if (patSet->nPatterns ==
0)
1365 continue;
1366 written = True;
1367 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1368 BufInsert(outBuf, outBuf->length,
":");
1369 if (isDefaultPatternSet(patSet))
1370 BufInsert(outBuf, outBuf->length,
"Default\n\t");
1371 else {
1372 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1373 BufInsert(outBuf, outBuf->length,
":");
1374 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1375 BufInsert(outBuf, outBuf->length,
"{\n");
1376 BufInsert(outBuf, outBuf->length,
1377 str = createPatternsString(patSet,
"\t\t"));
1378 NEditFree(str);
1379 BufInsert(outBuf, outBuf->length,
"\t}\n\t");
1380 }
1381 }
1382
1383
1384 outStr = BufGetRange(outBuf,
0, outBuf->length - (written?
2:
0));
1385 BufFree(outBuf);
1386
1387
1388
1389 escapedStr = EscapeSensitiveChars(outStr);
1390 NEditFree(outStr);
1391 return escapedStr;
1392 }
1393
1394
1395
1396
1397
1398 static void convertOldPatternSet(patternSet *patSet)
1399 {
1400 int p;
1401 highlightPattern *pattern;
1402
1403 for (p=
0; p<patSet->nPatterns; p++) {
1404 pattern = &patSet->patterns[p];
1405 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1406 pattern->name, pattern->flags &
COLOR_ONLY);
1407 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1408 pattern->name, pattern->flags &
COLOR_ONLY);
1409 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1410 pattern->name, pattern->flags &
COLOR_ONLY);
1411 }
1412 }
1413
1414
1415
1416
1417
1418
1419
1420
1421 static void convertPatternExpr(
char **patternRE,
char *patSetName,
1422 char *patName,
int isSubsExpr)
1423 {
1424 char *newRE, *errorText;
1425
1426 if (*patternRE ==
NULL)
1427 return;
1428 if (isSubsExpr) {
1429 newRE = (
char*)NEditMalloc(strlen(*patternRE) +
5000);
1430 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) +
5000);
1431 NEditFree(*patternRE);
1432 *patternRE = NEditStrdup(newRE);
1433 NEditFree(newRE);
1434 }
else{
1435 newRE = ConvertRE(*patternRE, &errorText);
1436 if (newRE ==
NULL) {
1437 fprintf(stderr,
"XNEdit error converting old format regular "
1438 "expression in pattern set %s, pattern %s: %s\n",
1439 patSetName, patName, errorText);
1440 }
1441 NEditFree(*patternRE);
1442 *patternRE = newRE;
1443 }
1444 }
1445
1446
1447
1448
1449
1450
1451 NFont *FontOfNamedStyle(ColorProfile *colorProfile, WindowInfo *window,
const char *styleName)
1452 {
1453
1454 int styleNo=lookupNamedStyle(window->colorProfile, styleName);
1455 int fontNum;
1456 NFont *font;
1457
1458 if (styleNo<
0)
1459 return window->font;
1460 fontNum = colorProfile->styles[styleNo]->font;
1461 if (fontNum ==
BOLD_FONT)
1462 font = window->boldFont;
1463 else if (fontNum ==
ITALIC_FONT)
1464 font = window->italicFont;
1465 else if (fontNum ==
BOLD_ITALIC_FONT)
1466 font = window->boldItalicFont;
1467 else
1468 font = window->font;
1469
1470
1471 return font ==
NULL ? window->font : font;
1472 }
1473
1474 int FontOfNamedStyleIsBold(ColorProfile *colorProfile,
char *styleName)
1475 {
1476 int styleNo=lookupNamedStyle(colorProfile, styleName),fontNum;
1477
1478 if (styleNo<
0)
1479 return 0;
1480 fontNum = colorProfile->styles[styleNo]->font;
1481 return (fontNum ==
BOLD_FONT || fontNum ==
BOLD_ITALIC_FONT);
1482 }
1483
1484 int FontOfNamedStyleIsItalic(ColorProfile *colorProfile,
char *styleName)
1485 {
1486 int styleNo=lookupNamedStyle(colorProfile, styleName),fontNum;
1487
1488 if (styleNo<
0)
1489 return 0;
1490 fontNum = colorProfile->styles[styleNo]->font;
1491 return (fontNum ==
ITALIC_FONT || fontNum ==
BOLD_ITALIC_FONT);
1492 }
1493
1494
1495
1496
1497
1498
1499 char *ColorOfNamedStyle(ColorProfile *colorProfile,
const char *styleName)
1500 {
1501 int styleNo=lookupNamedStyle(colorProfile, styleName);
1502
1503 if (styleNo<
0)
1504 return "black";
1505 return colorProfile->styles[styleNo]->color;
1506 }
1507
1508
1509
1510
1511 char *BgColorOfNamedStyle(ColorProfile *colorProfile,
const char *styleName)
1512 {
1513 int styleNo=lookupNamedStyle(colorProfile, styleName);
1514
1515 if (styleNo<
0)
1516 return "";
1517 return colorProfile->styles[styleNo]->bgColor;
1518 }
1519
1520
1521
1522
1523 int NamedStyleExists(ColorProfile *colorProfile,
const char *styleName)
1524 {
1525 return lookupNamedStyle(colorProfile, styleName) != -
1;
1526 }
1527
1528
1529
1530
1531
1532 patternSet *FindPatternSet(
const char *langModeName)
1533 {
1534 int i;
1535
1536 if (langModeName ==
NULL)
1537 return NULL;
1538
1539 for (i=
0; i<NPatternSets; i++)
1540 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1541 return PatternSets[i];
1542 return NULL;
1543
1544 }
1545
1546
1547
1548
1549
1550 int LMHasHighlightPatterns(
const char *languageMode)
1551 {
1552 if (FindPatternSet(languageMode) !=
NULL)
1553 return True;
1554 return HighlightDialog.shell!=
NULL && !strcmp(HighlightDialog.langModeName,
1555 languageMode) && HighlightDialog.nPatterns !=
0;
1556 }
1557
1558
1559
1560
1561
1562
1563 void RenameHighlightPattern(
const char *oldName,
const char *newName)
1564 {
1565 int i;
1566
1567 for (i=
0; i<NPatternSets; i++) {
1568 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1569 NEditFree(PatternSets[i]->languageMode);
1570 PatternSets[i]->languageMode = NEditStrdup(newName);
1571 }
1572 }
1573 if (HighlightDialog.shell !=
NULL) {
1574 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1575 NEditFree(HighlightDialog.langModeName);
1576 HighlightDialog.langModeName = NEditStrdup(newName);
1577 }
1578 }
1579 }
1580
1581
1582
1583
1584
1585 static Widget createHighlightStylesMenu(Widget parent)
1586 {
1587 Widget menu;
1588 int i;
1589 XmString s1;
1590
1591 menu = CreatePulldownMenu(parent,
"highlightStyles",
NULL,
0);
1592 for (i=
0; i<NHighlightStyles; i++) {
1593 XtVaCreateManagedWidget(
"highlightStyles", xmPushButtonWidgetClass,menu,
1594 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1595 XmNuserData, (
void *)HighlightStyles[i]->name,
NULL);
1596 XmStringFree(s1);
1597 }
1598 return menu;
1599 }
1600
1601 static char *createPatternsString(patternSet *patSet,
char *indentStr)
1602 {
1603 char *outStr, *str;
1604 textBuffer *outBuf;
1605 int pn;
1606 highlightPattern *pat;
1607
1608 outBuf = BufCreate();
1609 for (pn=
0; pn<patSet->nPatterns; pn++) {
1610 pat = &patSet->patterns[pn];
1611 BufInsert(outBuf, outBuf->length, indentStr);
1612 BufInsert(outBuf, outBuf->length, pat->name);
1613 BufInsert(outBuf, outBuf->length,
":");
1614 if (pat->startRE !=
NULL) {
1615 BufInsert(outBuf, outBuf->length,
1616 str=MakeQuotedString(pat->startRE));
1617 NEditFree(str);
1618 }
1619 BufInsert(outBuf, outBuf->length,
":");
1620 if (pat->endRE !=
NULL) {
1621 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1622 NEditFree(str);
1623 }
1624 BufInsert(outBuf, outBuf->length,
":");
1625 if (pat->errorRE !=
NULL) {
1626 BufInsert(outBuf, outBuf->length,
1627 str=MakeQuotedString(pat->errorRE));
1628 NEditFree(str);
1629 }
1630 BufInsert(outBuf, outBuf->length,
":");
1631 BufInsert(outBuf, outBuf->length, pat->style);
1632 BufInsert(outBuf, outBuf->length,
":");
1633 if (pat->subPatternOf !=
NULL)
1634 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1635 BufInsert(outBuf, outBuf->length,
":");
1636 if (pat->flags &
DEFER_PARSING)
1637 BufInsert(outBuf, outBuf->length,
"D");
1638 if (pat->flags &
PARSE_SUBPATS_FROM_START)
1639 BufInsert(outBuf, outBuf->length,
"R");
1640 if (pat->flags &
COLOR_ONLY)
1641 BufInsert(outBuf, outBuf->length,
"C");
1642 BufInsert(outBuf, outBuf->length,
"\n");
1643 }
1644 outStr = BufGetAll(outBuf);
1645 BufFree(outBuf);
1646 return outStr;
1647 }
1648
1649
1650
1651
1652
1653 static patternSet *readPatternSet(
char **inPtr,
int convertOld)
1654 {
1655 char *errMsg, *stringStart = *inPtr;
1656 patternSet patSet, *retPatSet;
1657
1658
1659 *inPtr += strspn(*inPtr,
" \t\n");
1660
1661
1662 patSet.languageMode = ReadSymbolicField(inPtr);
1663 if (patSet.languageMode ==
NULL)
1664 return highlightError(stringStart, *inPtr,
1665 "language mode must be specified");
1666 if (!SkipDelimiter(inPtr, &errMsg))
1667 return highlightError(stringStart, *inPtr, errMsg);
1668
1669
1670
1671 if (!strncmp(*inPtr,
"Default",
7)) {
1672 *inPtr +=
7;
1673 retPatSet = readDefaultPatternSet(patSet.languageMode);
1674 NEditFree(patSet.languageMode);
1675 if (retPatSet ==
NULL)
1676 return highlightError(stringStart, *inPtr,
1677 "No default pattern set");
1678 return retPatSet;
1679 }
1680
1681
1682 if (!ReadNumericField(inPtr, &patSet.lineContext))
1683 return highlightError(stringStart, *inPtr,
1684 "unreadable line context field");
1685 if (!SkipDelimiter(inPtr, &errMsg))
1686 return highlightError(stringStart, *inPtr, errMsg);
1687
1688
1689 if (!ReadNumericField(inPtr, &patSet.charContext))
1690 return highlightError(stringStart, *inPtr,
1691 "unreadable character context field");
1692
1693
1694 patSet.patterns = readHighlightPatterns(inPtr,
1695 True, &errMsg, &patSet.nPatterns);
1696 if (patSet.patterns ==
NULL)
1697 return highlightError(stringStart, *inPtr, errMsg);
1698
1699
1700 retPatSet = (patternSet *)NEditMalloc(
sizeof(patternSet));
1701 memcpy(retPatSet, &patSet,
sizeof(patternSet));
1702
1703
1704
1705 if (convertOld)
1706 convertOldPatternSet(retPatSet);
1707
1708 return retPatSet;
1709 }
1710
1711
1712
1713
1714
1715
1716 static highlightPattern *readHighlightPatterns(
char **inPtr,
int withBraces,
1717 char **errMsg,
int *nPatterns)
1718 {
1719 highlightPattern *pat, *returnedList, patternList[
MAX_PATTERNS];
1720
1721
1722 *inPtr += strspn(*inPtr,
" \t\n");
1723
1724
1725 if (withBraces) {
1726 if (**inPtr !=
'{') {
1727 *errMsg =
"pattern list must begin with \"{\"";
1728 return False;
1729 }
1730 (*inPtr)++;
1731 }
1732
1733
1734
1735
1736 pat = patternList;
1737 while (True) {
1738 *inPtr += strspn(*inPtr,
" \t\n");
1739 if (**inPtr ==
'\0') {
1740 if (withBraces) {
1741 *errMsg =
"end of pattern list not found";
1742 return NULL;
1743 }
else
1744 break;
1745 }
else if (**inPtr ==
'}') {
1746 (*inPtr)++;
1747 break;
1748 }
1749 if (pat - patternList >=
MAX_PATTERNS) {
1750 *errMsg =
"max number of patterns exceeded\n";
1751 return NULL;
1752 }
1753 if (!readHighlightPattern(inPtr, errMsg, pat++))
1754 return NULL;
1755 }
1756
1757
1758 *nPatterns = pat - patternList;
1759 returnedList = (highlightPattern *)NEditMalloc(
1760 sizeof(highlightPattern) * *nPatterns);
1761 memcpy(returnedList, patternList,
sizeof(highlightPattern) * *nPatterns);
1762 return returnedList;
1763 }
1764
1765 static int readHighlightPattern(
char **inPtr,
char **errMsg,
1766 highlightPattern *pattern)
1767 {
1768
1769 pattern->name = ReadSymbolicField(inPtr);
1770 if (pattern->name ==
NULL) {
1771 *errMsg =
"pattern name is required";
1772 return False;
1773 }
1774 if (!SkipDelimiter(inPtr, errMsg))
1775 return False;
1776
1777
1778 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1779 return False;
1780 if (!SkipDelimiter(inPtr, errMsg))
1781 return False;
1782
1783
1784 if (**inPtr ==
':')
1785 pattern->endRE =
NULL;
1786 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1787 return False;
1788 if (!SkipDelimiter(inPtr, errMsg))
1789 return False;
1790
1791
1792 if (**inPtr ==
':')
1793 pattern->errorRE =
NULL;
1794 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1795 return False;
1796 if (!SkipDelimiter(inPtr, errMsg))
1797 return False;
1798
1799
1800 pattern->style = ReadSymbolicField(inPtr);
1801 if (pattern->style ==
NULL) {
1802 *errMsg =
"style field required in pattern";
1803 return False;
1804 }
1805 if (!SkipDelimiter(inPtr, errMsg))
1806 return False;
1807
1808
1809 pattern->subPatternOf = ReadSymbolicField(inPtr);
1810 if (!SkipDelimiter(inPtr, errMsg))
1811 return False;
1812
1813
1814 pattern->flags =
0;
1815 for (; **inPtr !=
'\n' && **inPtr !=
'}'; (*inPtr)++) {
1816 if (**inPtr ==
'D')
1817 pattern->flags |=
DEFER_PARSING;
1818 else if (**inPtr ==
'R')
1819 pattern->flags |=
PARSE_SUBPATS_FROM_START;
1820 else if (**inPtr ==
'C')
1821 pattern->flags |=
COLOR_ONLY;
1822 else if (**inPtr !=
' ' && **inPtr !=
'\t') {
1823 *errMsg =
"unreadable flag field";
1824 return False;
1825 }
1826 }
1827 return True;
1828 }
1829
1830
1831
1832
1833
1834
1835
1836 static patternSet *readDefaultPatternSet(
const char *langModeName)
1837 {
1838 int i;
1839 size_t modeNameLen;
1840 char *strPtr;
1841
1842 modeNameLen = strlen(langModeName);
1843 for (i=
0; i<(
int)XtNumber(DefaultPatternSets); i++) {
1844 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1845 DefaultPatternSets[i][modeNameLen] ==
':') {
1846 strPtr = DefaultPatternSets[i];
1847 return readPatternSet(&strPtr, False);
1848 }
1849 }
1850 return NULL;
1851 }
1852
1853
1854
1855
1856 static int isDefaultPatternSet(patternSet *patSet)
1857 {
1858 patternSet *defaultPatSet;
1859 int retVal;
1860
1861 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1862 if (defaultPatSet ==
NULL)
1863 return False;
1864 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1865 freePatternSet(defaultPatSet);
1866 return retVal;
1867 }
1868
1869
1870
1871
1872 static patternSet *highlightError(
char *stringStart,
char *stoppedAt,
1873 const char *message)
1874 {
1875 ParseError(
NULL, stringStart, stoppedAt,
"highlight pattern", message);
1876 return NULL;
1877 }
1878
1879
1880 static int styleError(
const char *stringStart,
const char *stoppedAt,
1881 const char *message)
1882 {
1883 ParseError(
NULL, stringStart, stoppedAt,
"style specification", message);
1884 return False;
1885 }
1886
1887
1888 static void updateCGchooser(Widget w, XtPointer clientData,
1889 XtPointer callData)
1890 {
1891 Widget button = clientData;
1892 char *str = XmTextGetString(w);
1893 int dummy;
1894 SetParseColorError(
0);
1895 Pixel color = AllocColor(button, str, &dummy, &dummy, &dummy);
1896 SetParseColorError(
1);
1897 XtVaSetValues(button, XmNbackground, color,
NULL);
1898 XtFree(str);
1899 }
1900
1901 static void selectColorCB(Widget w, XtPointer clientData, XtPointer callData)
1902 {
1903 Colormap cm;
1904 Pixel bg;
1905 Widget textfield =
NULL;
1906 XtVaGetValues(w, XtNcolormap, &cm, XmNbackground, &bg, XmNuserData, &textfield,
NULL);
1907
1908 if(!textfield)
return;
1909
1910 XColor xcolor;
1911 memset(&xcolor,
0,
sizeof(XColor));
1912 xcolor.pixel = bg;
1913 XQueryColor(XtDisplay(w), cm, &xcolor);
1914
1915 int r = xcolor.red;
1916 int g = xcolor.green;
1917 int b = xcolor.blue;
1918 if(ColorChooser(XtParent(w), &r, &g, &b)) {
1919 r /=
257;
1920 g /=
257;
1921 b /=
257;
1922 char buf[
32];
1923 snprintf(buf,
32,
"#%02x%02x%02x", r, g, b);
1924
1925
1926 XmTextSetString(textfield, buf);
1927 }
1928
1929 }
1930
1931
1932
1933
1934 void EditHighlightStyles(
const char *initialStyle)
1935 {
1936 #define HS_LIST_RIGHT 60
1937 #define HS_LEFT_MARGIN_POS 1
1938 #define HS_RIGHT_MARGIN_POS 99
1939 #define HS_H_MARGIN 10
1940 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1941 Widget fontBox, sep1, okBtn, applyBtn, closeBtn;
1942 XmString s1;
1943 int i, ac;
1944 Arg args[
20];
1945
1946
1947 if (HSDialog.shell !=
NULL) {
1948 if (initialStyle !=
NULL)
1949 setStyleByName(initialStyle);
1950 RaiseDialogWindow(HSDialog.shell);
1951 return;
1952 }
1953
1954 int hsDiagNHighlightStyles = NHighlightStyles;
1955 highlightStyleRec **hsDiagHighlightStyles = HighlightStyles;
1956 if(currentColorProfileName && currentColorProfileStyleType ==
2) {
1957 HSDialog.colorProfileName = NEditStrdup(currentColorProfileName);
1958 ColorProfile *colorProfile = GetColorProfile(currentColorProfileName);
1959 if(colorProfile && colorProfile->styles) {
1960 hsDiagNHighlightStyles = colorProfile->numStyles;
1961 hsDiagHighlightStyles = colorProfile->styles;
1962 }
1963 }
else {
1964 HSDialog.colorProfileName =
NULL;
1965 }
1966
1967
1968
1969 HSDialog.highlightStyleList = (highlightStyleRec **)NEditMalloc(
1970 sizeof(highlightStyleRec *) *
MAX_HIGHLIGHT_STYLES);
1971 for (i=
0; i<hsDiagNHighlightStyles; i++) {
1972 HSDialog.highlightStyleList[i] = copyHighlightStyleRec(hsDiagHighlightStyles[i]);
1973 }
1974 HSDialog.nHighlightStyles = hsDiagNHighlightStyles;
1975
1976
1977 ac =
0;
1978 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1979 XtSetArg(args[ac], XmNiconName,
"XNEdit Text Drawing Styles"); ac++;
1980 XtSetArg(args[ac], XmNtitle,
"Text Drawing Styles"); ac++;
1981 HSDialog.shell = CreateWidget(TheAppShell,
"textStyles",
1982 topLevelShellWidgetClass, args, ac);
1983 AddSmallIcon(HSDialog.shell);
1984 form = XtVaCreateManagedWidget(
"editHighlightStyles", xmFormWidgetClass,
1985 HSDialog.shell, XmNautoUnmanage, False,
1986 XmNresizePolicy, XmRESIZE_NONE,
NULL);
1987 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB,
NULL);
1988 AddMotifCloseCallback(HSDialog.shell, hsCloseCB,
NULL);
1989
1990 char *topLblStr =
1991 "To modify the properties of an existing highlight style, select the name\n\
1992 from the list on the left. Select \"New\" to add a new style to the list.";
1993
1994 if(currentColorProfileName && currentColorProfileStyleType ==
2) {
1995 size_t topLblStrLen = strlen(topLblStr);
1996 size_t currentColorProfileNameLen = strlen(currentColorProfileName);
1997 size_t tlStrAlloc = currentColorProfileNameLen + topLblStrLen +
20;
1998 char *tlStr = NEditMalloc(tlStrAlloc);
1999 snprintf(tlStr, tlStrAlloc,
"Color Profile: %s\n%s", currentColorProfileName, topLblStr);
2000 s1=
MKSTRING(tlStr);
2001 free(tlStr);
2002 }
else {
2003 s1=
MKSTRING(topLblStr);
2004 }
2005
2006 topLbl = XtVaCreateManagedWidget(
"topLabel", xmLabelGadgetClass, form,
2007 XmNlabelString, s1,
2008 XmNmnemonic,
'N',
2009 XmNtopAttachment, XmATTACH_POSITION,
2010 XmNtopPosition,
2,
2011 XmNleftAttachment, XmATTACH_POSITION,
2012 XmNleftPosition,
HS_LEFT_MARGIN_POS,
2013 XmNrightAttachment, XmATTACH_POSITION,
2014 XmNrightPosition,
HS_RIGHT_MARGIN_POS,
NULL);
2015 XmStringFree(s1);
2016
2017 nameLbl = XtVaCreateManagedWidget(
"nameLbl", xmLabelGadgetClass, form,
2018 XmNlabelString, s1=XmStringCreateSimple(
"Name:"),
2019 XmNmnemonic,
'm',
2020 XmNalignment, XmALIGNMENT_BEGINNING,
2021 XmNleftAttachment, XmATTACH_POSITION,
2022 XmNleftPosition,
HS_LIST_RIGHT,
2023 XmNtopAttachment, XmATTACH_WIDGET,
2024 XmNtopOffset,
HS_H_MARGIN,
2025 XmNtopWidget, topLbl,
NULL);
2026 XmStringFree(s1);
2027
2028 HSDialog.nameW = XtVaCreateManagedWidget(
"name", xmTextWidgetClass, form,
2029 XmNleftAttachment, XmATTACH_POSITION,
2030 XmNleftPosition,
HS_LIST_RIGHT,
2031 XmNtopAttachment, XmATTACH_WIDGET,
2032 XmNtopWidget, nameLbl,
2033 XmNrightAttachment, XmATTACH_POSITION,
2034 XmNrightPosition,
HS_RIGHT_MARGIN_POS,
NULL);
2035 RemapDeleteKey(HSDialog.nameW);
2036 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW,
NULL);
2037
2038 colorLbl = XtVaCreateManagedWidget(
"colorLbl", xmLabelGadgetClass, form,
2039 XmNlabelString, s1=XmStringCreateSimple(
"Foreground Color:"),
2040 XmNmnemonic,
'C',
2041 XmNalignment, XmALIGNMENT_BEGINNING,
2042 XmNleftAttachment, XmATTACH_POSITION,
2043 XmNleftPosition,
HS_LIST_RIGHT,
2044 XmNtopAttachment, XmATTACH_WIDGET,
2045 XmNtopOffset,
HS_H_MARGIN,
2046 XmNtopWidget, HSDialog.nameW,
NULL);
2047 XmStringFree(s1);
2048
2049 Widget fgColorChooserButton = XtVaCreateManagedWidget(
"colorChooser", xmPushButtonWidgetClass, form,
2050 XmNrightAttachment, XmATTACH_POSITION,
2051 XmNrightPosition,
HS_RIGHT_MARGIN_POS,
2052 XmNtopAttachment, XmATTACH_WIDGET,
2053 XmNtopWidget, colorLbl,
2054 XmNhighlightThickness,
2,
2055 XmNshadowThickness,
1,
2056 XmNbackground,
0,
2057 XmNlabelString, s1 = XmStringCreateSimple(
" "),
2058 NULL);
2059 XmStringFree(s1);
2060 XtAddCallback(fgColorChooserButton, XmNactivateCallback, selectColorCB,
NULL);
2061
2062 HSDialog.colorW = XtVaCreateManagedWidget(
"color", xmTextWidgetClass, form,
2063 XmNleftAttachment, XmATTACH_POSITION,
2064 XmNleftPosition,
HS_LIST_RIGHT,
2065 XmNtopAttachment, XmATTACH_WIDGET,
2066 XmNtopWidget, colorLbl,
2067 XmNrightAttachment, XmATTACH_WIDGET,
2068 XmNrightWidget, fgColorChooserButton,
NULL);
2069 RemapDeleteKey(HSDialog.colorW);
2070 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW,
NULL);
2071 XtAddCallback(HSDialog.colorW, XmNvalueChangedCallback,
2072 updateCGchooser, fgColorChooserButton);
2073
2074 Dimension shadowThickness =
1;
2075 XtVaGetValues(HSDialog.colorW, XmNshadowThickness, &shadowThickness,
NULL);
2076 XtVaSetValues(fgColorChooserButton,
2077 #if XmVersion >
2001
2078 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2079 XmNbottomWidget, HSDialog.colorW,
2080 #endif
2081 XmNshadowThickness, shadowThickness,
2082 XmNuserData, HSDialog.colorW,
NULL);
2083
2084 bgColorLbl = XtVaCreateManagedWidget(
"bgColorLbl", xmLabelGadgetClass, form,
2085 XmNlabelString,
2086 s1=XmStringCreateSimple(
"Background Color (optional)"),
2087 XmNmnemonic,
'g',
2088 XmNalignment, XmALIGNMENT_BEGINNING,
2089 XmNleftAttachment, XmATTACH_POSITION,
2090 XmNleftPosition,
HS_LIST_RIGHT,
2091 XmNtopAttachment, XmATTACH_WIDGET,
2092 XmNtopOffset,
HS_H_MARGIN,
2093 XmNtopWidget, HSDialog.colorW,
NULL);
2094 XmStringFree(s1);
2095
2096 Widget bgColorChooserButton = XtVaCreateManagedWidget(
"colorChooser", xmPushButtonWidgetClass, form,
2097 XmNrightAttachment, XmATTACH_POSITION,
2098 XmNrightPosition,
HS_RIGHT_MARGIN_POS,
2099 XmNtopAttachment, XmATTACH_WIDGET,
2100 XmNtopWidget, bgColorLbl,
2101 XmNhighlightThickness,
2,
2102 XmNshadowThickness,
1,
2103 XmNbackground,
0,
2104 XmNlabelString, s1 = XmStringCreateSimple(
" "),
2105 NULL);
2106 XmStringFree(s1);
2107 XtAddCallback(bgColorChooserButton, XmNactivateCallback, selectColorCB,
NULL);
2108
2109 HSDialog.bgColorW = XtVaCreateManagedWidget(
"bgColor",
2110 xmTextWidgetClass, form,
2111 XmNleftAttachment, XmATTACH_POSITION,
2112 XmNleftPosition,
HS_LIST_RIGHT,
2113 XmNtopAttachment, XmATTACH_WIDGET,
2114 XmNtopWidget, bgColorLbl,
2115 XmNrightAttachment, XmATTACH_WIDGET,
2116 XmNrightWidget, bgColorChooserButton,
NULL);
2117 RemapDeleteKey(HSDialog.bgColorW);
2118 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW,
NULL);
2119 XtAddCallback(HSDialog.bgColorW, XmNvalueChangedCallback,
2120 updateCGchooser, bgColorChooserButton);
2121
2122 XtVaSetValues(bgColorChooserButton,
2123 #if XmVersion >
2001
2124 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2125 XmNbottomWidget, HSDialog.bgColorW,
2126 #endif
2127 XmNshadowThickness, shadowThickness,
2128 XmNuserData, HSDialog.bgColorW,
NULL);
2129
2130 fontLbl = XtVaCreateManagedWidget(
"fontLbl", xmLabelGadgetClass, form,
2131 XmNlabelString, s1=XmStringCreateSimple(
"Font:"),
2132 XmNalignment, XmALIGNMENT_BEGINNING,
2133 XmNleftAttachment, XmATTACH_POSITION,
2134 XmNleftPosition,
HS_LIST_RIGHT,
2135 XmNtopAttachment, XmATTACH_WIDGET,
2136 XmNtopOffset,
HS_H_MARGIN,
2137 XmNtopWidget, HSDialog.bgColorW,
NULL);
2138 XmStringFree(s1);
2139
2140 fontBox = XtVaCreateManagedWidget(
"fontBox", xmRowColumnWidgetClass, form,
2141 XmNpacking, XmPACK_COLUMN,
2142 XmNnumColumns,
2,
2143 XmNradioBehavior, True,
2144 XmNleftAttachment, XmATTACH_POSITION,
2145 XmNleftPosition,
HS_LIST_RIGHT,
2146 XmNtopAttachment, XmATTACH_WIDGET,
2147 XmNtopWidget, fontLbl,
NULL);
2148 HSDialog.plainW = XtVaCreateManagedWidget(
"plain",
2149 xmToggleButtonWidgetClass, fontBox,
2150 XmNset, True,
2151 XmNlabelString, s1=XmStringCreateSimple(
"Plain"),
2152 XmNmnemonic,
'P',
NULL);
2153 XmStringFree(s1);
2154 HSDialog.boldW = XtVaCreateManagedWidget(
"bold",
2155 xmToggleButtonWidgetClass, fontBox,
2156 XmNlabelString, s1=XmStringCreateSimple(
"Bold"),
2157 XmNmnemonic,
'B',
NULL);
2158 XmStringFree(s1);
2159 HSDialog.italicW = XtVaCreateManagedWidget(
"italic",
2160 xmToggleButtonWidgetClass, fontBox,
2161 XmNlabelString, s1=XmStringCreateSimple(
"Italic"),
2162 XmNmnemonic,
'I',
NULL);
2163 XmStringFree(s1);
2164 HSDialog.boldItalicW = XtVaCreateManagedWidget(
"boldItalic",
2165 xmToggleButtonWidgetClass, fontBox,
2166 XmNlabelString, s1=XmStringCreateSimple(
"Bold Italic"),
2167 XmNmnemonic,
'o',
NULL);
2168 XmStringFree(s1);
2169
2170 okBtn = XtVaCreateManagedWidget(
"ok",xmPushButtonWidgetClass,form,
2171 XmNlabelString, s1=XmStringCreateSimple(
"OK"),
2172 XmNmarginWidth,
BUTTON_WIDTH_MARGIN,
2173 XmNleftAttachment, XmATTACH_POSITION,
2174 XmNleftPosition,
10,
2175 XmNrightAttachment, XmATTACH_POSITION,
2176 XmNrightPosition,
30,
2177 XmNbottomAttachment, XmATTACH_POSITION,
2178 XmNbottomPosition,
99,
NULL);
2179 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB,
NULL);
2180 XmStringFree(s1);
2181
2182 applyBtn = XtVaCreateManagedWidget(
"apply",xmPushButtonWidgetClass,form,
2183 XmNlabelString, s1=XmStringCreateSimple(
"Apply"),
2184 XmNmnemonic,
'A',
2185 XmNleftAttachment, XmATTACH_POSITION,
2186 XmNleftPosition,
40,
2187 XmNrightAttachment, XmATTACH_POSITION,
2188 XmNrightPosition,
60,
2189 XmNbottomAttachment, XmATTACH_POSITION,
2190 XmNbottomPosition,
99,
NULL);
2191 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB,
NULL);
2192 XmStringFree(s1);
2193
2194 closeBtn = XtVaCreateManagedWidget(
"close",
2195 xmPushButtonWidgetClass, form,
2196 XmNlabelString, s1=XmStringCreateSimple(
"Close"),
2197 XmNleftAttachment, XmATTACH_POSITION,
2198 XmNleftPosition,
70,
2199 XmNrightAttachment, XmATTACH_POSITION,
2200 XmNrightPosition,
90,
2201 XmNbottomAttachment, XmATTACH_POSITION,
2202 XmNbottomPosition,
99,
2203 NULL);
2204 XtAddCallback(closeBtn, XmNactivateCallback, hsCloseCB,
NULL);
2205 XmStringFree(s1);
2206
2207 sep1 = XtVaCreateManagedWidget(
"sep1", xmSeparatorGadgetClass, form,
2208 XmNleftAttachment, XmATTACH_FORM,
2209 XmNtopAttachment, XmATTACH_WIDGET,
2210 XmNtopWidget, fontBox,
2211 XmNtopOffset,
HS_H_MARGIN,
2212 XmNrightAttachment, XmATTACH_FORM,
2213 XmNbottomAttachment, XmATTACH_WIDGET,
2214 XmNbottomWidget, closeBtn,
2215 XmNbottomOffset,
HS_H_MARGIN,
NULL);
2216
2217 ac =
0;
2218 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
2219 XtSetArg(args[ac], XmNtopOffset,
HS_H_MARGIN); ac++;
2220 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
2221 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
2222 XtSetArg(args[ac], XmNleftPosition,
HS_LEFT_MARGIN_POS); ac++;
2223 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
2224 XtSetArg(args[ac], XmNrightPosition,
HS_LIST_RIGHT-
1); ac++;
2225 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
2226 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
2227 XtSetArg(args[ac], XmNbottomOffset,
HS_H_MARGIN); ac++;
2228 HSDialog.managedListW = CreateManagedList(form,
"list", args, ac,
2229 (
void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
2230 MAX_HIGHLIGHT_STYLES,
20, hsGetDisplayedCB,
NULL, hsSetDisplayedCB,
2231 form, hsFreeItemCB);
2232 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW,
NULL);
2233
2234
2235 XtVaSetValues(form, XmNdefaultButton, okBtn,
NULL);
2236 XtVaSetValues(form, XmNcancelButton, closeBtn,
NULL);
2237
2238
2239 if (initialStyle !=
NULL)
2240 setStyleByName(initialStyle);
2241
2242
2243 AddDialogMnemonicHandler(form,
FALSE);
2244
2245
2246 RealizeWithoutForcingPosition(HSDialog.shell);
2247 }
2248
2249 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
2250 {
2251 int i;
2252
2253 for (i=
0; i<HSDialog.nHighlightStyles; i++) {
2254 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
2255 }
2256 NEditFree(HSDialog.highlightStyleList);
2257 NEditFree(HSDialog.colorProfileName);
2258 }
2259
2260 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
2261 {
2262 if (!updateHSList())
2263 return;
2264
2265
2266 XtDestroyWidget(HSDialog.shell);
2267 HSDialog.shell =
NULL;
2268 }
2269
2270 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
2271 {
2272 updateHSList();
2273 }
2274
2275 static void hsCloseCB(Widget w, XtPointer clientData, XtPointer callData)
2276 {
2277
2278 XtDestroyWidget(HSDialog.shell);
2279 HSDialog.shell =
NULL;
2280 }
2281
2282 static void *hsGetDisplayedCB(
void *oldItem,
int explicitRequest,
int *abort,
2283 void *cbArg)
2284 {
2285 highlightStyleRec *hs;
2286
2287
2288
2289 if (oldItem ==
NULL && hsDialogEmpty())
2290 return NULL;
2291
2292
2293 hs = readHSDialogFields(True);
2294 if (hs !=
NULL)
2295 return hs;
2296
2297
2298
2299 if (!explicitRequest)
2300 {
2301 if (DialogF(
DF_WARN, HSDialog.shell,
2,
"Incomplete Style",
2302 "Discard incomplete entry\nfor current highlight style?",
2303 "Keep",
"Discard") ==
2)
2304 {
2305 return oldItem ==
NULL
2306 ?
NULL
2307 : copyHighlightStyleRec((highlightStyleRec *)oldItem);
2308 }
2309 }
2310
2311
2312 (
void)readHSDialogFields(False);
2313 *abort = True;
2314 return NULL;
2315 }
2316
2317 static void hsSetDisplayedCB(
void *item,
void *cbArg)
2318 {
2319 highlightStyleRec *hs = (highlightStyleRec *)item;
2320
2321 if (item ==
NULL) {
2322 XmTextSetString(HSDialog.nameW,
"");
2323 XmTextSetString(HSDialog.colorW,
"");
2324 XmTextSetString(HSDialog.bgColorW,
"");
2325 RadioButtonChangeState(HSDialog.plainW, True, False);
2326 RadioButtonChangeState(HSDialog.boldW, False, False);
2327 RadioButtonChangeState(HSDialog.italicW, False, False);
2328 RadioButtonChangeState(HSDialog.boldItalicW, False, False);
2329 }
else {
2330 if (strcmp(hs->name,
"Plain") ==
0) {
2331
2332 int i, others =
0;
2333 int nList = HSDialog.nHighlightStyles;
2334 highlightStyleRec **list = HSDialog.highlightStyleList;
2335
2336 for (i =
0; i < nList; i++) {
2337 if (list[i] != hs && strcmp(list[i]->name,
"Plain") ==
0) {
2338 others++;
2339 }
2340 }
2341 if (others ==
0) {
2342
2343 Widget form = (Widget)cbArg;
2344 Widget deleteBtn = XtNameToWidget(form,
"*delete");
2345
2346 if (deleteBtn) {
2347 XtSetSensitive(deleteBtn, False);
2348 }
2349 }
2350 }
2351 XmTextSetString(HSDialog.nameW, hs->name);
2352 XmTextSetString(HSDialog.colorW, hs->color);
2353 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor :
"");
2354 RadioButtonChangeState(HSDialog.plainW, hs->font==
PLAIN_FONT, False);
2355 RadioButtonChangeState(HSDialog.boldW, hs->font==
BOLD_FONT, False);
2356 RadioButtonChangeState(HSDialog.italicW, hs->font==
ITALIC_FONT, False);
2357 RadioButtonChangeState(HSDialog.boldItalicW, hs->font==
BOLD_ITALIC_FONT,
2358 False);
2359 }
2360 }
2361
2362 static void hsFreeItemCB(
void *item)
2363 {
2364 freeHighlightStyleRec((highlightStyleRec *)item);
2365 }
2366
2367 static highlightStyleRec *readHSDialogFields(
int silent)
2368 {
2369 highlightStyleRec *hs;
2370 Display *display = XtDisplay(HSDialog.shell);
2371 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2372 XColor rgb;
2373
2374
2375 hs = (highlightStyleRec *)NEditMalloc(
sizeof(highlightStyleRec));
2376
2377
2378 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2379 "highlight style name", silent);
2380 if (hs->name ==
NULL) {
2381 NEditFree(hs);
2382 return NULL;
2383 }
2384
2385 if (*hs->name ==
'\0')
2386 {
2387 if (!silent)
2388 {
2389 DialogF(
DF_WARN, HSDialog.shell,
1,
"Highlight Style",
2390 "Please specify a name\nfor the highlight style",
"OK");
2391 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2392 }
2393 NEditFree(hs->name);
2394 NEditFree(hs);
2395 return NULL;
2396 }
2397
2398
2399 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW,
"color", silent);
2400 if (hs->color ==
NULL) {
2401 NEditFree(hs->name);
2402 NEditFree(hs);
2403 return NULL;
2404 }
2405
2406 if (*hs->color ==
'\0')
2407 {
2408 if (!silent)
2409 {
2410 DialogF(
DF_WARN, HSDialog.shell,
1,
"Style Color",
2411 "Please specify a color\nfor the highlight style",
2412 "OK");
2413 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2414 }
2415 NEditFree(hs->name);
2416 NEditFree(hs->color);
2417 NEditFree(hs);
2418 return NULL;
2419 }
2420
2421
2422 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2423 &rgb))
2424 {
2425 if (!silent)
2426 {
2427 DialogF(
DF_WARN, HSDialog.shell,
1,
"Invalid Color",
2428 "Invalid X color specification: %s\n",
"OK",
2429 hs->color);
2430 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2431 }
2432 NEditFree(hs->name);
2433 NEditFree(hs->color);
2434 NEditFree(hs);
2435 return NULL;;
2436 }
2437
2438
2439 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2440 "bgColor", silent);
2441 if (hs->bgColor && *hs->bgColor ==
'\0') {
2442 NEditFree(hs->bgColor);
2443 hs->bgColor =
NULL;
2444 }
2445
2446
2447 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2448 hs->bgColor, &rgb))
2449 {
2450 if (!silent)
2451 {
2452 DialogF(
DF_WARN, HSDialog.shell,
1,
"Invalid Color",
2453 "Invalid X background color specification: %s\n",
"OK",
2454 hs->bgColor);
2455 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2456 }
2457 NEditFree(hs->name);
2458 NEditFree(hs->color);
2459 NEditFree(hs->bgColor);
2460 NEditFree(hs);
2461 return NULL;;
2462 }
2463
2464
2465 if (XmToggleButtonGetState(HSDialog.boldW))
2466 hs->font =
BOLD_FONT;
2467 else if (XmToggleButtonGetState(HSDialog.italicW))
2468 hs->font =
ITALIC_FONT;
2469 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2470 hs->font =
BOLD_ITALIC_FONT;
2471 else
2472 hs->font =
PLAIN_FONT;
2473
2474 return hs;
2475 }
2476
2477
2478
2479
2480
2481 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2482 {
2483 highlightStyleRec *newHS;
2484
2485 newHS = (highlightStyleRec *)NEditMalloc(
sizeof(highlightStyleRec));
2486 newHS->name = (
char*)NEditMalloc(strlen(hs->name)+
1);
2487 strcpy(newHS->name, hs->name);
2488 if (hs->color ==
NULL)
2489 newHS->color =
NULL;
2490 else {
2491 newHS->color = (
char*)NEditMalloc(strlen(hs->color)+
1);
2492 strcpy(newHS->color, hs->color);
2493 }
2494 if (hs->bgColor ==
NULL)
2495 newHS->bgColor =
NULL;
2496 else {
2497 newHS->bgColor = (
char*)NEditMalloc(strlen(hs->bgColor)+
1);
2498 strcpy(newHS->bgColor, hs->bgColor);
2499 }
2500 newHS->font = hs->font;
2501 return newHS;
2502 }
2503
2504
2505
2506
2507
2508 static void freeHighlightStyleRec(highlightStyleRec *hs)
2509 {
2510 NEditFree(hs->name);
2511 NEditFree(hs->color);
2512 NEditFree(hs);
2513 }
2514
2515
2516
2517
2518 static void setStyleByName(
const char *style)
2519 {
2520 int i;
2521
2522 for (i=
0; i<HSDialog.nHighlightStyles; i++) {
2523 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2524 SelectManagedListItem(HSDialog.managedListW, i);
2525 break;
2526 }
2527 }
2528 }
2529
2530
2531
2532
2533
2534 static int hsDialogEmpty(
void)
2535 {
2536 return TextWidgetIsBlank(HSDialog.nameW) &&
2537 TextWidgetIsBlank(HSDialog.colorW) &&
2538 XmToggleButtonGetState(HSDialog.plainW);
2539 }
2540
2541
2542
2543
2544
2545 static int updateHSList(
void)
2546 {
2547 WindowInfo *window;
2548 int i;
2549
2550
2551 if (!UpdateManagedList(HSDialog.managedListW, True)) {
2552 return False;
2553 }
2554
2555 ColorProfile *colorProfile =
NULL;
2556 if(HSDialog.colorProfileName) {
2557 colorProfile = GetColorProfile(HSDialog.colorProfileName);
2558 if(!colorProfile) {
2559 DialogF(
DF_ERR, HSDialog.shell,
1,
"Error",
2560 "Color Profile %s not found",
2561 "OK", HSDialog.colorProfileName);
2562 return False;
2563 }
2564 }
2565
2566 size_t nstyles = NHighlightStyles;
2567 highlightStyleRec **styleList = HighlightStyles;
2568 if(colorProfile) {
2569 if(colorProfile->stylesAlloc ==
0) {
2570 colorProfile->styles =
NULL;
2571 nstyles =
0;
2572 }
else {
2573 nstyles = colorProfile->numStyles;
2574 }
2575 if(HSDialog.nHighlightStyles > colorProfile->stylesAlloc) {
2576 colorProfile->stylesAlloc = HSDialog.nHighlightStyles;
2577 colorProfile->styles = NEditRealloc(
2578 colorProfile->styles,
2579 colorProfile->stylesAlloc *
sizeof(highlightStyleRec*));
2580 }
2581 styleList = colorProfile->styles;
2582 }
2583
2584
2585 for (i=
0; i<nstyles; i++) {
2586 freeHighlightStyleRec(styleList[i]);
2587 }
2588 for (i=
0; i<HSDialog.nHighlightStyles; i++) {
2589 styleList[i] =
2590 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2591 }
2592
2593 if(colorProfile) {
2594 colorProfile->numStyles = HSDialog.nHighlightStyles;
2595 }
else {
2596 NHighlightStyles = HSDialog.nHighlightStyles;
2597 }
2598
2599
2600 updateHighlightStyleMenu();
2601
2602
2603 for (window=WindowList; window!=
NULL; window=window->next) {
2604 UpdateHighlightStyles(window, True);
2605 }
2606
2607
2608 MarkPrefsChanged();
2609
2610 return True;
2611 }
2612
2613
2614
2615
2616 void EditHighlightPatterns(WindowInfo *window)
2617 {
2618 #define BORDER 4
2619 #define LIST_RIGHT 41
2620 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2621 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2622 Widget okBtn, applyBtn, checkBtn, deleteBtn, closeBtn, helpBtn;
2623 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2624 patternSet *patSet;
2625 XmString s1;
2626 int i, n, nPatterns;
2627 Arg args[
20];
2628
2629
2630 if (HighlightDialog.shell !=
NULL) {
2631 RaiseDialogWindow(HighlightDialog.shell);
2632 return;
2633 }
2634
2635 if (LanguageModeName(
0) ==
NULL)
2636 {
2637 DialogF(
DF_WARN, window->shell,
1,
"No Language Modes",
2638 "No Language Modes available for syntax highlighting\n"
2639 "Add language modes under Preferenses->Language Modes",
2640 "OK");
2641 return;
2642 }
2643
2644
2645 HighlightDialog.langModeName = NEditStrdup(
2646 LanguageModeName(window->languageMode ==
PLAIN_LANGUAGE_MODE ?
0 :
2647 window->languageMode));
2648
2649
2650 patSet = FindPatternSet(HighlightDialog.langModeName);
2651
2652
2653 HighlightDialog.patterns = (highlightPattern **)NEditMalloc(
2654 sizeof(highlightPattern *) *
MAX_PATTERNS);
2655 nPatterns = patSet ==
NULL ?
0 : patSet->nPatterns;
2656 for (i=
0; i<nPatterns; i++)
2657 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],
NULL);
2658 HighlightDialog.nPatterns = nPatterns;
2659
2660
2661
2662 n =
0;
2663 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2664 XtSetArg(args[n], XmNiconName,
"XNEdit Highlight Patterns"); n++;
2665 XtSetArg(args[n], XmNtitle,
"Syntax Highlighting Patterns"); n++;
2666 HighlightDialog.shell = CreateWidget(TheAppShell,
"syntaxHighlight",
2667 topLevelShellWidgetClass, args, n);
2668 AddSmallIcon(HighlightDialog.shell);
2669 form = XtVaCreateManagedWidget(
"editHighlightPatterns",
2670 xmFormWidgetClass, HighlightDialog.shell,
2671 XmNautoUnmanage, False,
2672 XmNresizePolicy, XmRESIZE_NONE,
2673 NULL);
2674 XtAddCallback(form, XmNdestroyCallback, destroyCB,
NULL);
2675 AddMotifCloseCallback(HighlightDialog.shell, closeCB,
NULL);
2676
2677 lmForm = XtVaCreateManagedWidget(
"lmForm", xmFormWidgetClass,
2678 form,
2679 XmNleftAttachment, XmATTACH_POSITION,
2680 XmNleftPosition,
1,
2681 XmNtopAttachment, XmATTACH_POSITION,
2682 XmNtopPosition,
1,
2683 XmNrightAttachment, XmATTACH_POSITION,
2684 XmNrightPosition,
99,
2685 NULL);
2686
2687 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2688 NULL);
2689 n =
0;
2690 XtSetArg(args[n], XmNspacing,
0); n++;
2691 XtSetArg(args[n], XmNmarginWidth,
0); n++;
2692 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2693 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2694 XtSetArg(args[n], XmNleftPosition,
50); n++;
2695 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2696 lmOptMenu = XmCreateOptionMenu(lmForm,
"langModeOptMenu", args, n);
2697 XtManageChild(lmOptMenu);
2698 HighlightDialog.lmOptMenu = lmOptMenu;
2699
2700 XtVaCreateManagedWidget(
"lmLbl", xmLabelGadgetClass, lmForm,
2701 XmNlabelString, s1=XmStringCreateSimple(
"Language Mode:"),
2702 XmNmnemonic,
'M',
2703 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2704 XmNalignment, XmALIGNMENT_END,
2705 XmNrightAttachment, XmATTACH_POSITION,
2706 XmNrightPosition,
50,
2707 XmNtopAttachment, XmATTACH_FORM,
2708 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2709 XmNbottomWidget, lmOptMenu,
NULL);
2710 XmStringFree(s1);
2711
2712 lmBtn = XtVaCreateManagedWidget(
"lmBtn", xmPushButtonWidgetClass, lmForm,
2713 XmNlabelString, s1=
MKSTRING(
"Add / Modify\nLanguage Mode..."),
2714 XmNmnemonic,
'A',
2715 XmNrightAttachment, XmATTACH_FORM,
2716 XmNtopAttachment, XmATTACH_FORM,
NULL);
2717 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB,
NULL);
2718 XmStringFree(s1);
2719
2720 okBtn = XtVaCreateManagedWidget(
"ok", xmPushButtonWidgetClass, form,
2721 XmNlabelString, s1=XmStringCreateSimple(
"OK"),
2722 XmNmarginWidth,
BUTTON_WIDTH_MARGIN,
2723 XmNleftAttachment, XmATTACH_POSITION,
2724 XmNleftPosition,
1,
2725 XmNrightAttachment, XmATTACH_POSITION,
2726 XmNrightPosition,
13,
2727 XmNbottomAttachment, XmATTACH_FORM,
2728 XmNbottomOffset,
BORDER,
NULL);
2729 XtAddCallback(okBtn, XmNactivateCallback, okCB,
NULL);
2730 XmStringFree(s1);
2731
2732 applyBtn = XtVaCreateManagedWidget(
"apply", xmPushButtonWidgetClass, form,
2733 XmNlabelString, s1=XmStringCreateSimple(
"Apply"),
2734 XmNmnemonic,
'y',
2735 XmNleftAttachment, XmATTACH_POSITION,
2736 XmNleftPosition,
13,
2737 XmNrightAttachment, XmATTACH_POSITION,
2738 XmNrightPosition,
26,
2739 XmNbottomAttachment, XmATTACH_FORM,
2740 XmNbottomOffset,
BORDER,
NULL);
2741 XtAddCallback(applyBtn, XmNactivateCallback, applyCB,
NULL);
2742 XmStringFree(s1);
2743
2744 checkBtn = XtVaCreateManagedWidget(
"check", xmPushButtonWidgetClass, form,
2745 XmNlabelString, s1=XmStringCreateSimple(
"Check"),
2746 XmNmnemonic,
'k',
2747 XmNleftAttachment, XmATTACH_POSITION,
2748 XmNleftPosition,
26,
2749 XmNrightAttachment, XmATTACH_POSITION,
2750 XmNrightPosition,
39,
2751 XmNbottomAttachment, XmATTACH_FORM,
2752 XmNbottomOffset,
BORDER,
NULL);
2753 XtAddCallback(checkBtn, XmNactivateCallback, checkCB,
NULL);
2754 XmStringFree(s1);
2755
2756 deleteBtn = XtVaCreateManagedWidget(
"delete", xmPushButtonWidgetClass, form,
2757 XmNlabelString, s1=XmStringCreateSimple(
"Delete"),
2758 XmNmnemonic,
'D',
2759 XmNleftAttachment, XmATTACH_POSITION,
2760 XmNleftPosition,
39,
2761 XmNrightAttachment, XmATTACH_POSITION,
2762 XmNrightPosition,
52,
2763 XmNbottomAttachment, XmATTACH_FORM,
2764 XmNbottomOffset,
BORDER,
NULL);
2765 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB,
NULL);
2766 XmStringFree(s1);
2767
2768 restoreBtn = XtVaCreateManagedWidget(
"restore", xmPushButtonWidgetClass, form,
2769 XmNlabelString, s1=XmStringCreateSimple(
"Restore Defaults"),
2770 XmNmnemonic,
'f',
2771 XmNleftAttachment, XmATTACH_POSITION,
2772 XmNleftPosition,
52,
2773 XmNrightAttachment, XmATTACH_POSITION,
2774 XmNrightPosition,
73,
2775 XmNbottomAttachment, XmATTACH_FORM,
2776 XmNbottomOffset,
BORDER,
NULL);
2777 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB,
NULL);
2778 XmStringFree(s1);
2779
2780 closeBtn = XtVaCreateManagedWidget(
"close", xmPushButtonWidgetClass,
2781 form,
2782 XmNlabelString, s1=XmStringCreateSimple(
"Close"),
2783 XmNleftAttachment, XmATTACH_POSITION,
2784 XmNleftPosition,
73,
2785 XmNrightAttachment, XmATTACH_POSITION,
2786 XmNrightPosition,
86,
2787 XmNbottomAttachment, XmATTACH_FORM,
2788 XmNbottomOffset,
BORDER,
NULL);
2789 XtAddCallback(closeBtn, XmNactivateCallback, closeCB,
NULL);
2790 XmStringFree(s1);
2791
2792 helpBtn = XtVaCreateManagedWidget(
"help", xmPushButtonWidgetClass,
2793 form,
2794 XmNlabelString, s1=XmStringCreateSimple(
"Help"),
2795 XmNmnemonic,
'H',
2796 XmNleftAttachment, XmATTACH_POSITION,
2797 XmNleftPosition,
86,
2798 XmNrightAttachment, XmATTACH_POSITION,
2799 XmNrightPosition,
99,
2800 XmNbottomAttachment, XmATTACH_FORM,
2801 XmNbottomOffset,
BORDER,
NULL);
2802 XtAddCallback(helpBtn, XmNactivateCallback, helpCB,
NULL);
2803 XmStringFree(s1);
2804
2805 contextFrame = XtVaCreateManagedWidget(
"contextFrame", xmFrameWidgetClass,
2806 form,
2807 XmNleftAttachment, XmATTACH_POSITION,
2808 XmNleftPosition,
1,
2809 XmNrightAttachment, XmATTACH_POSITION,
2810 XmNrightPosition,
99,
2811 XmNbottomAttachment, XmATTACH_WIDGET,
2812 XmNbottomWidget, okBtn,
2813 XmNbottomOffset,
BORDER,
NULL);
2814 contextForm = XtVaCreateManagedWidget(
"contextForm", xmFormWidgetClass,
2815 contextFrame,
NULL);
2816 XtVaCreateManagedWidget(
"contextLbl", xmLabelGadgetClass, contextFrame,
2817 XmNlabelString, s1=XmStringCreateSimple(
2818 "Context requirements for incremental re-parsing after changes"),
2819 XmNchildType, XmFRAME_TITLE_CHILD,
NULL);
2820 XmStringFree(s1);
2821
2822 HighlightDialog.lineContextW = XtVaCreateManagedWidget(
"lineContext",
2823 xmTextWidgetClass, contextForm,
2824 XmNcolumns,
5,
2825 XmNmaxLength,
12,
2826 XmNleftAttachment, XmATTACH_POSITION,
2827 XmNleftPosition,
15,
2828 XmNrightAttachment, XmATTACH_POSITION,
2829 XmNrightPosition,
25,
NULL);
2830 RemapDeleteKey(HighlightDialog.lineContextW);
2831
2832 XtVaCreateManagedWidget(
"lineContLbl",
2833 xmLabelGadgetClass, contextForm,
2834 XmNlabelString, s1=XmStringCreateSimple(
"lines"),
2835 XmNmnemonic,
'l',
2836 XmNuserData, HighlightDialog.lineContextW,
2837 XmNalignment, XmALIGNMENT_BEGINNING,
2838 XmNleftAttachment, XmATTACH_WIDGET,
2839 XmNleftWidget, HighlightDialog.lineContextW,
2840 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2841 XmNtopWidget, HighlightDialog.lineContextW,
2842 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2843 XmNbottomWidget, HighlightDialog.lineContextW,
NULL);
2844 XmStringFree(s1);
2845
2846 HighlightDialog.charContextW = XtVaCreateManagedWidget(
"charContext",
2847 xmTextWidgetClass, contextForm,
2848 XmNcolumns,
5,
2849 XmNmaxLength,
12,
2850 XmNleftAttachment, XmATTACH_POSITION,
2851 XmNleftPosition,
58,
2852 XmNrightAttachment, XmATTACH_POSITION,
2853 XmNrightPosition,
68,
NULL);
2854 RemapDeleteKey(HighlightDialog.lineContextW);
2855
2856 XtVaCreateManagedWidget(
"charContLbl",
2857 xmLabelGadgetClass, contextForm,
2858 XmNlabelString, s1=XmStringCreateSimple(
"characters"),
2859 XmNmnemonic,
'c',
2860 XmNuserData, HighlightDialog.charContextW,
2861 XmNalignment, XmALIGNMENT_BEGINNING,
2862 XmNleftAttachment, XmATTACH_WIDGET,
2863 XmNleftWidget, HighlightDialog.charContextW,
2864 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2865 XmNtopWidget, HighlightDialog.charContextW,
2866 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2867 XmNbottomWidget, HighlightDialog.charContextW,
NULL);
2868 XmStringFree(s1);
2869
2870 patternsFrame = XtVaCreateManagedWidget(
"patternsFrame", xmFrameWidgetClass,
2871 form,
2872 XmNleftAttachment, XmATTACH_POSITION,
2873 XmNleftPosition,
1,
2874 XmNtopAttachment, XmATTACH_WIDGET,
2875 XmNtopWidget, lmForm,
2876 XmNrightAttachment, XmATTACH_POSITION,
2877 XmNrightPosition,
99,
2878 XmNbottomAttachment, XmATTACH_WIDGET,
2879 XmNbottomWidget, contextFrame,
2880 XmNbottomOffset,
BORDER,
NULL);
2881 patternsForm = XtVaCreateManagedWidget(
"patternsForm", xmFormWidgetClass,
2882 patternsFrame,
NULL);
2883 patternsLbl = XtVaCreateManagedWidget(
"patternsLbl", xmLabelGadgetClass,
2884 patternsFrame,
2885 XmNlabelString, s1=XmStringCreateSimple(
"Patterns"),
2886 XmNmnemonic,
'P',
2887 XmNmarginHeight,
0,
2888 XmNchildType, XmFRAME_TITLE_CHILD,
NULL);
2889 XmStringFree(s1);
2890
2891 typeLbl = XtVaCreateManagedWidget(
"typeLbl", xmLabelGadgetClass,
2892 patternsForm,
2893 XmNlabelString, s1=XmStringCreateSimple(
"Pattern Type:"),
2894 XmNmarginHeight,
0,
2895 XmNalignment, XmALIGNMENT_BEGINNING,
2896 XmNleftAttachment, XmATTACH_POSITION,
2897 XmNleftPosition,
LIST_RIGHT,
2898 XmNtopAttachment, XmATTACH_FORM,
NULL);
2899 XmStringFree(s1);
2900
2901 typeBox = XtVaCreateManagedWidget(
"typeBox", xmRowColumnWidgetClass,
2902 patternsForm,
2903 XmNpacking, XmPACK_COLUMN,
2904 XmNradioBehavior, True,
2905 XmNleftAttachment, XmATTACH_POSITION,
2906 XmNleftPosition,
LIST_RIGHT,
2907 XmNtopAttachment, XmATTACH_WIDGET,
2908 XmNtopWidget, typeLbl,
NULL);
2909 HighlightDialog.topLevelW = XtVaCreateManagedWidget(
"top",
2910 xmToggleButtonWidgetClass, typeBox,
2911 XmNset, True,
2912 XmNmarginHeight,
0,
2913 XmNlabelString, s1=XmStringCreateSimple(
2914 "Pass-1 (applied to all text when loaded or modified)"),
2915 XmNmnemonic,
'1',
NULL);
2916 XmStringFree(s1);
2917 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2918 patTypeCB,
NULL);
2919 HighlightDialog.deferredW = XtVaCreateManagedWidget(
"deferred",
2920 xmToggleButtonWidgetClass, typeBox,
2921 XmNmarginHeight,
0,
2922 XmNlabelString, s1=XmStringCreateSimple(
2923 "Pass-2 (parsing is deferred until text is exposed)"),
2924 XmNmnemonic,
'2',
NULL);
2925 XmStringFree(s1);
2926 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2927 patTypeCB,
NULL);
2928 HighlightDialog.subPatW = XtVaCreateManagedWidget(
"subPat",
2929 xmToggleButtonWidgetClass, typeBox,
2930 XmNmarginHeight,
0,
2931 XmNlabelString, s1=XmStringCreateSimple(
2932 "Sub-pattern (processed within start & end of parent)"),
2933 XmNmnemonic,
'u',
NULL);
2934 XmStringFree(s1);
2935 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2936 patTypeCB,
NULL);
2937 HighlightDialog.colorPatW = XtVaCreateManagedWidget(
"color",
2938 xmToggleButtonWidgetClass, typeBox,
2939 XmNmarginHeight,
0,
2940 XmNlabelString, s1=XmStringCreateSimple(
2941 "Coloring for sub-expressions of parent pattern"),
2942 XmNmnemonic,
'g',
NULL);
2943 XmStringFree(s1);
2944 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2945 patTypeCB,
NULL);
2946
2947 HighlightDialog.matchLbl = XtVaCreateManagedWidget(
"matchLbl",
2948 xmLabelGadgetClass, patternsForm,
2949 XmNlabelString, s1=XmStringCreateSimple(
"Matching:"),
2950 XmNmarginHeight,
0,
2951 XmNalignment, XmALIGNMENT_BEGINNING,
2952 XmNleftAttachment, XmATTACH_POSITION,
2953 XmNleftPosition,
LIST_RIGHT,
2954 XmNtopAttachment, XmATTACH_WIDGET,
2955 XmNtopOffset,
BORDER,
2956 XmNtopWidget, typeBox,
NULL);
2957 XmStringFree(s1);
2958
2959 matchBox = XtVaCreateManagedWidget(
"matchBox", xmRowColumnWidgetClass,
2960 patternsForm,
2961 XmNpacking, XmPACK_COLUMN,
2962 XmNradioBehavior, True,
2963 XmNleftAttachment, XmATTACH_POSITION,
2964 XmNleftPosition,
LIST_RIGHT,
2965 XmNtopAttachment, XmATTACH_WIDGET,
2966 XmNtopWidget, HighlightDialog.matchLbl,
NULL);
2967 HighlightDialog.simpleW = XtVaCreateManagedWidget(
"simple",
2968 xmToggleButtonWidgetClass, matchBox,
2969 XmNset, True,
2970 XmNmarginHeight,
0,
2971 XmNlabelString, s1=XmStringCreateSimple(
2972 "Highlight text matching regular expression"),
2973 XmNmnemonic,
'x',
NULL);
2974 XmStringFree(s1);
2975 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2976 matchTypeCB,
NULL);
2977 HighlightDialog.rangeW = XtVaCreateManagedWidget(
"range",
2978 xmToggleButtonWidgetClass, matchBox,
2979 XmNmarginHeight,
0,
2980 XmNlabelString, s1=XmStringCreateSimple(
2981 "Highlight text between starting and ending REs"),
2982 XmNmnemonic,
'b',
NULL);
2983 XmStringFree(s1);
2984 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2985 matchTypeCB,
NULL);
2986
2987 nameLbl = XtVaCreateManagedWidget(
"nameLbl", xmLabelGadgetClass,
2988 patternsForm,
2989 XmNlabelString, s1=XmStringCreateSimple(
"Pattern Name"),
2990 XmNmnemonic,
'N',
2991 XmNrows,
20,
2992 XmNalignment, XmALIGNMENT_BEGINNING,
2993 XmNleftAttachment, XmATTACH_POSITION,
2994 XmNleftPosition,
LIST_RIGHT,
2995 XmNtopAttachment, XmATTACH_WIDGET,
2996 XmNtopWidget, matchBox,
2997 XmNtopOffset,
BORDER,
NULL);
2998 XmStringFree(s1);
2999
3000 HighlightDialog.nameW = XtVaCreateManagedWidget(
"name", xmTextWidgetClass,
3001 patternsForm,
3002 XmNleftAttachment, XmATTACH_POSITION,
3003 XmNleftPosition,
LIST_RIGHT,
3004 XmNtopAttachment, XmATTACH_WIDGET,
3005 XmNtopWidget, nameLbl,
3006 XmNrightAttachment, XmATTACH_POSITION,
3007 XmNrightPosition, (
99 +
LIST_RIGHT)/
2,
NULL);
3008 RemapDeleteKey(HighlightDialog.nameW);
3009 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW,
NULL);
3010
3011 HighlightDialog.parentLbl = XtVaCreateManagedWidget(
"parentLbl",
3012 xmLabelGadgetClass, patternsForm,
3013 XmNlabelString, s1=XmStringCreateSimple(
"Parent Pattern"),
3014 XmNmnemonic,
't',
3015 XmNrows,
20,
3016 XmNalignment, XmALIGNMENT_BEGINNING,
3017 XmNleftAttachment, XmATTACH_POSITION,
3018 XmNleftPosition, (
99 +
LIST_RIGHT)/
2 +
1,
3019 XmNtopAttachment, XmATTACH_WIDGET,
3020 XmNtopWidget, matchBox,
3021 XmNtopOffset,
BORDER,
NULL);
3022 XmStringFree(s1);
3023
3024 HighlightDialog.parentW = XtVaCreateManagedWidget(
"parent",
3025 xmTextWidgetClass, patternsForm,
3026 XmNleftAttachment, XmATTACH_POSITION,
3027 XmNleftPosition, (
99 +
LIST_RIGHT)/
2 +
1,
3028 XmNtopAttachment, XmATTACH_WIDGET,
3029 XmNtopWidget, HighlightDialog.parentLbl,
3030 XmNrightAttachment, XmATTACH_POSITION,
3031 XmNrightPosition,
99,
NULL);
3032 RemapDeleteKey(HighlightDialog.parentW);
3033 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
3034 HighlightDialog.parentW,
NULL);
3035
3036 HighlightDialog.startLbl = XtVaCreateManagedWidget(
"startLbl",
3037 xmLabelGadgetClass, patternsForm,
3038 XmNalignment, XmALIGNMENT_BEGINNING,
3039 XmNmnemonic,
'R',
3040 XmNtopAttachment, XmATTACH_WIDGET,
3041 XmNtopWidget, HighlightDialog.parentW,
3042 XmNtopOffset,
BORDER,
3043 XmNleftAttachment, XmATTACH_POSITION,
3044 XmNleftPosition,
1,
NULL);
3045
3046 HighlightDialog.errorW = XtVaCreateManagedWidget(
"error",
3047 xmTextWidgetClass, patternsForm,
3048 XmNleftAttachment, XmATTACH_POSITION,
3049 XmNleftPosition,
1,
3050 XmNrightAttachment, XmATTACH_POSITION,
3051 XmNrightPosition,
99,
3052 XmNbottomAttachment, XmATTACH_POSITION,
3053 XmNbottomPosition,
99,
NULL);
3054 RemapDeleteKey(HighlightDialog.errorW);
3055
3056 HighlightDialog.errorLbl = XtVaCreateManagedWidget(
"errorLbl",
3057 xmLabelGadgetClass, patternsForm,
3058 XmNlabelString, s1=XmStringCreateSimple(
3059 "Regular Expression Indicating Error in Match (Optional)"),
3060 XmNmnemonic,
'o',
3061 XmNuserData, HighlightDialog.errorW,
3062 XmNalignment, XmALIGNMENT_BEGINNING,
3063 XmNleftAttachment, XmATTACH_POSITION,
3064 XmNleftPosition,
1,
3065 XmNbottomAttachment, XmATTACH_WIDGET,
3066 XmNbottomWidget, HighlightDialog.errorW,
NULL);
3067 XmStringFree(s1);
3068
3069 HighlightDialog.endW = XtVaCreateManagedWidget(
"end",
3070 xmTextWidgetClass, patternsForm,
3071 XmNleftAttachment, XmATTACH_POSITION,
3072 XmNleftPosition,
1,
3073 XmNbottomAttachment, XmATTACH_WIDGET,
3074 XmNbottomWidget, HighlightDialog.errorLbl,
3075 XmNbottomOffset,
BORDER,
3076 XmNrightAttachment, XmATTACH_POSITION,
3077 XmNrightPosition,
99,
NULL);
3078 RemapDeleteKey(HighlightDialog.endW);
3079
3080 HighlightDialog.endLbl = XtVaCreateManagedWidget(
"endLbl",
3081 xmLabelGadgetClass, patternsForm,
3082 XmNmnemonic,
'E',
3083 XmNuserData, HighlightDialog.endW,
3084 XmNalignment, XmALIGNMENT_BEGINNING,
3085 XmNleftAttachment, XmATTACH_POSITION,
3086 XmNleftPosition,
1,
3087 XmNbottomAttachment, XmATTACH_WIDGET,
3088 XmNbottomWidget, HighlightDialog.endW,
NULL);
3089
3090 n =
0;
3091 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
3092 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
3093 XtSetArg(args[n], XmNwordWrap, True); n++;
3094 XtSetArg(args[n], XmNrows,
3); n++;
3095 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
3096 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
3097 XtSetArg(args[n], XmNbottomOffset,
BORDER); n++;
3098 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
3099 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
3100 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
3101 XtSetArg(args[n], XmNleftPosition,
1); n++;
3102 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
3103 XtSetArg(args[n], XmNrightPosition,
99); n++;
3104 HighlightDialog.startW = XmCreateScrolledText(patternsForm,
"start",args,n);
3105 AddMouseWheelSupport(HighlightDialog.startW);
3106 XtManageChild(HighlightDialog.startW);
3107 MakeSingleLineTextW(HighlightDialog.startW);
3108 RemapDeleteKey(HighlightDialog.startW);
3109 XtVaSetValues(HighlightDialog.startLbl,
3110 XmNuserData,HighlightDialog.startW,
NULL);
3111
3112 styleBtn = XtVaCreateManagedWidget(
"styleLbl", xmPushButtonWidgetClass,
3113 patternsForm,
3114 XmNlabelString, s1=
MKSTRING(
"Add / Modify\nStyle..."),
3115 XmNmnemonic,
'i',
3116 XmNrightAttachment, XmATTACH_POSITION,
3117 XmNrightPosition,
LIST_RIGHT-
1,
3118 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
3119 XmNbottomWidget, HighlightDialog.parentW,
NULL);
3120 XmStringFree(s1);
3121 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB,
NULL);
3122
3123 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
3124 n =
0;
3125 XtSetArg(args[n], XmNspacing,
0); n++;
3126 XtSetArg(args[n], XmNmarginWidth,
0); n++;
3127 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
3128 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
3129 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
3130 XtSetArg(args[n], XmNleftPosition,
1); n++;
3131 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
3132 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
3133 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
3134 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
3135 "styleOptMenu", args, n);
3136 XtManageChild(HighlightDialog.styleOptMenu);
3137
3138 styleLbl = XtVaCreateManagedWidget(
"styleLbl", xmLabelGadgetClass,
3139 patternsForm,
3140 XmNlabelString, s1=XmStringCreateSimple(
"Highlight Style"),
3141 XmNmnemonic,
'S',
3142 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
3143 XmNalignment, XmALIGNMENT_BEGINNING,
3144 XmNleftAttachment, XmATTACH_POSITION,
3145 XmNleftPosition,
1,
3146 XmNbottomAttachment, XmATTACH_WIDGET,
3147 XmNbottomWidget, HighlightDialog.styleOptMenu,
NULL);
3148 XmStringFree(s1);
3149
3150 n =
0;
3151 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
3152 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
3153 XtSetArg(args[n], XmNleftPosition,
1); n++;
3154 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
3155 XtSetArg(args[n], XmNrightPosition,
LIST_RIGHT-
1); n++;
3156 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
3157 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
3158 XtSetArg(args[n], XmNbottomOffset,
BORDER); n++;
3159 HighlightDialog.managedListW = CreateManagedList(patternsForm,
"list", args,
3160 n, (
void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
3161 MAX_PATTERNS,
18, getDisplayedCB,
NULL, setDisplayedCB,
3162 NULL, freeItemCB);
3163 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW,
NULL);
3164
3165
3166 XtVaSetValues(form, XmNdefaultButton, okBtn,
NULL);
3167 XtVaSetValues(form, XmNcancelButton, closeBtn,
NULL);
3168
3169
3170 AddDialogMnemonicHandler(form,
FALSE);
3171
3172
3173 SetIntText(HighlightDialog.lineContextW, patSet==
NULL ?
1 :
3174 patSet->lineContext);
3175 SetIntText(HighlightDialog.charContextW, patSet==
NULL ?
0 :
3176 patSet->charContext);
3177 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
3178 updateLabels();
3179
3180
3181 RealizeWithoutForcingPosition(HighlightDialog.shell);
3182 }
3183
3184
3185
3186
3187
3188 static void updateHighlightStyleMenu(
void)
3189 {
3190 Widget oldMenu;
3191 int patIndex;
3192
3193 if (HighlightDialog.shell ==
NULL)
3194 return;
3195
3196 oldMenu = HighlightDialog.stylePulldown;
3197 HighlightDialog.stylePulldown = createHighlightStylesMenu(
3198 XtParent(XtParent(oldMenu)));
3199 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
3200 XmNsubMenuId, HighlightDialog.stylePulldown,
NULL);
3201 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
3202 if (patIndex == -
1)
3203 setStyleMenu(
"Plain");
3204 else
3205 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
3206
3207 XtDestroyWidget(oldMenu);
3208 }
3209
3210
3211
3212
3213
3214 void UpdateLanguageModeMenu(
void)
3215 {
3216 Widget oldMenu;
3217
3218 if (HighlightDialog.shell ==
NULL)
3219 return;
3220
3221 oldMenu = HighlightDialog.lmPulldown;
3222 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
3223 XtParent(XtParent(oldMenu)), langModeCB,
NULL);
3224 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
3225 XmNsubMenuId, HighlightDialog.lmPulldown,
NULL);
3226 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
3227
3228 XtDestroyWidget(oldMenu);
3229 }
3230
3231 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
3232 {
3233 int i;
3234
3235 NEditFree(HighlightDialog.langModeName);
3236 for (i=
0; i<HighlightDialog.nPatterns; i++)
3237 freePatternSrc(HighlightDialog.patterns[i], True);
3238 HighlightDialog.shell =
NULL;
3239 }
3240
3241 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
3242 {
3243 char *modeName;
3244 patternSet *oldPatSet, *newPatSet;
3245 patternSet emptyPatSet = {
NULL,
1,
0,
0,
NULL};
3246 int i, resp;
3247
3248
3249 XtVaGetValues(w, XmNuserData, &modeName,
NULL);
3250 if (!strcmp(modeName, HighlightDialog.langModeName))
3251 return;
3252
3253
3254 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
3255 if (oldPatSet ==
NULL)
3256 oldPatSet = &emptyPatSet;
3257
3258
3259
3260
3261 newPatSet = getDialogPatternSet();
3262
3263 if (newPatSet ==
NULL)
3264 {
3265 if (DialogF(
DF_WARN, HighlightDialog.shell,
2,
3266 "Incomplete Language Mode",
"Discard incomplete entry\n"
3267 "for current language mode?",
"Keep",
"Discard") ==
1)
3268 {
3269 SetLangModeMenu(HighlightDialog.lmOptMenu,
3270 HighlightDialog.langModeName);
3271 return;
3272 }
3273 }
else if (patternSetsDiffer(oldPatSet, newPatSet))
3274 {
3275 resp = DialogF(
DF_WARN, HighlightDialog.shell,
3,
"Language Mode",
3276 "Apply changes for language mode %s?",
"Apply Changes",
3277 "Discard Changes",
"Cancel", HighlightDialog.langModeName);
3278 if (resp ==
3)
3279 {
3280 SetLangModeMenu(HighlightDialog.lmOptMenu,
3281 HighlightDialog.langModeName);
3282 return;
3283 }
3284 if (resp ==
1)
3285 {
3286 updatePatternSet();
3287 }
3288 }
3289
3290 if (newPatSet !=
NULL)
3291 freePatternSet(newPatSet);
3292
3293
3294 NEditFree(HighlightDialog.langModeName);
3295 for (i=
0; i<HighlightDialog.nPatterns; i++)
3296 freePatternSrc(HighlightDialog.patterns[i], True);
3297
3298
3299 HighlightDialog.langModeName = NEditStrdup(modeName);
3300 newPatSet = FindPatternSet(modeName);
3301 if (newPatSet ==
NULL) {
3302 HighlightDialog.nPatterns =
0;
3303 SetIntText(HighlightDialog.lineContextW,
1);
3304 SetIntText(HighlightDialog.charContextW,
0);
3305 }
else {
3306 for (i=
0; i<newPatSet->nPatterns; i++)
3307 HighlightDialog.patterns[i] =
3308 copyPatternSrc(&newPatSet->patterns[i],
NULL);
3309 HighlightDialog.nPatterns = newPatSet->nPatterns;
3310 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
3311 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
3312 }
3313 ChangeManagedListData(HighlightDialog.managedListW);
3314 }
3315
3316 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
3317 {
3318 EditLanguageModes();
3319 }
3320
3321 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
3322 {
3323 Widget selectedItem;
3324 char *style;
3325
3326 XtVaGetValues(HighlightDialog.styleOptMenu,
3327 XmNmenuHistory, &selectedItem,
3328 NULL);
3329 XtVaGetValues(selectedItem,
3330 XmNuserData, &style,
3331 NULL);
3332 EditHighlightStyles(style);
3333 }
3334
3335 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
3336 {
3337
3338 if (!updatePatternSet())
3339 return;
3340
3341
3342 CloseAllPopupsFor(HighlightDialog.shell);
3343 XtDestroyWidget(HighlightDialog.shell);
3344 }
3345
3346 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
3347 {
3348
3349 updatePatternSet();
3350 }
3351
3352 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
3353 {
3354 if (checkHighlightDialogData())
3355 {
3356 DialogF(
DF_INF, HighlightDialog.shell,
1,
"Pattern compiled",
3357 "Patterns compiled without error",
"OK");
3358 }
3359 }
3360
3361 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
3362 {
3363 patternSet *defaultPatSet;
3364 int i, psn;
3365
3366 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
3367 if (defaultPatSet ==
NULL)
3368 {
3369 DialogF(
DF_WARN, HighlightDialog.shell,
1,
"No Default Pattern",
3370 "There is no default pattern set\nfor language mode %s",
3371 "OK", HighlightDialog.langModeName);
3372 return;
3373 }
3374
3375 if (DialogF(
DF_WARN, HighlightDialog.shell,
2,
"Discard Changes",
3376 "Are you sure you want to discard\n"
3377 "all changes to syntax highlighting\n"
3378 "patterns for language mode %s?",
"Discard",
"Cancel",
3379 HighlightDialog.langModeName) ==
2)
3380 {
3381 return;
3382 }
3383
3384
3385
3386 for (psn=
0; psn<NPatternSets; psn++)
3387 if (!strcmp(HighlightDialog.langModeName,
3388 PatternSets[psn]->languageMode))
3389 break;
3390 if (psn < NPatternSets) {
3391 freePatternSet(PatternSets[psn]);
3392 PatternSets[psn] = defaultPatSet;
3393 }
else
3394 PatternSets[NPatternSets++] = defaultPatSet;
3395
3396
3397 for (i=
0; i<HighlightDialog.nPatterns; i++)
3398 freePatternSrc(HighlightDialog.patterns[i], True);
3399
3400
3401 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3402 for (i=
0; i<defaultPatSet->nPatterns; i++) {
3403 HighlightDialog.patterns[i] = copyPatternSrc(&defaultPatSet->patterns[i],
NULL);
3404 }
3405 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3406 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3407 ChangeManagedListData(HighlightDialog.managedListW);
3408 }
3409
3410 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3411 {
3412 int i, psn;
3413
3414 if (DialogF(
DF_WARN, HighlightDialog.shell,
2,
"Delete Pattern",
3415 "Are you sure you want to delete\n"
3416 "syntax highlighting patterns for\n"
3417 "language mode %s?",
"Yes, Delete",
"Cancel",
3418 HighlightDialog.langModeName) ==
2)
3419 {
3420 return;
3421 }
3422
3423
3424 for (psn=
0; psn<NPatternSets; psn++)
3425 if (!strcmp(HighlightDialog.langModeName,
3426 PatternSets[psn]->languageMode))
3427 break;
3428 if (psn < NPatternSets) {
3429 freePatternSet(PatternSets[psn]);
3430 memmove(&PatternSets[psn], &PatternSets[psn+
1],
3431 (NPatternSets-
1 - psn) *
sizeof(patternSet *));
3432 NPatternSets--;
3433 }
3434
3435
3436 for (i=
0; i<HighlightDialog.nPatterns; i++)
3437 freePatternSrc(HighlightDialog.patterns[i], True);
3438
3439
3440 HighlightDialog.nPatterns =
0;
3441 SetIntText(HighlightDialog.lineContextW,
1);
3442 SetIntText(HighlightDialog.charContextW,
0);
3443 ChangeManagedListData(HighlightDialog.managedListW);
3444 }
3445
3446 static void closeCB(Widget w, XtPointer clientData, XtPointer callData)
3447 {
3448
3449 CloseAllPopupsFor(HighlightDialog.shell);
3450 XtDestroyWidget(HighlightDialog.shell);
3451 }
3452
3453 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3454 {
3455 Help(
HELP_PATTERNS);
3456 }
3457
3458 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3459 {
3460 updateLabels();
3461 }
3462
3463 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3464 {
3465 updateLabels();
3466 }
3467
3468 static void *getDisplayedCB(
void *oldItem,
int explicitRequest,
int *abort,
3469 void *cbArg)
3470 {
3471 highlightPattern *pat;
3472
3473
3474
3475 if (oldItem ==
NULL && dialogEmpty())
3476 return NULL;
3477
3478
3479 pat = readDialogFields(True);
3480 if (pat !=
NULL)
3481 return (
void *)pat;
3482
3483
3484
3485 if (!explicitRequest)
3486 {
3487 if (DialogF(
DF_WARN, HighlightDialog.shell,
2,
"Discard Entry",
3488 "Discard incomplete entry\nfor current pattern?",
"Keep",
3489 "Discard") ==
2)
3490 {
3491 return oldItem ==
NULL
3492 ?
NULL
3493 : (
void *)copyPatternSrc((highlightPattern *)oldItem,
NULL);
3494 }
3495 }
3496
3497
3498 (
void)readDialogFields(False);
3499 *abort = True;
3500 return NULL;
3501 }
3502
3503 static void setDisplayedCB(
void *item,
void *cbArg)
3504 {
3505 highlightPattern *pat = (highlightPattern *)item;
3506 int isSubpat, isDeferred, isColorOnly, isRange;
3507
3508 if (item ==
NULL) {
3509 XmTextSetString(HighlightDialog.nameW,
"");
3510 XmTextSetString(HighlightDialog.parentW,
"");
3511 XmTextSetString(HighlightDialog.startW,
"");
3512 XmTextSetString(HighlightDialog.endW,
"");
3513 XmTextSetString(HighlightDialog.errorW,
"");
3514 RadioButtonChangeState(HighlightDialog.topLevelW, True, False);
3515 RadioButtonChangeState(HighlightDialog.deferredW, False, False);
3516 RadioButtonChangeState(HighlightDialog.subPatW, False, False);
3517 RadioButtonChangeState(HighlightDialog.colorPatW, False, False);
3518 RadioButtonChangeState(HighlightDialog.simpleW, True, False);
3519 RadioButtonChangeState(HighlightDialog.rangeW, False, False);
3520 setStyleMenu(
"Plain");
3521 }
else {
3522 isSubpat = pat->subPatternOf !=
NULL;
3523 isDeferred = pat->flags &
DEFER_PARSING;
3524 isColorOnly = pat->flags &
COLOR_ONLY;
3525 isRange = pat->endRE !=
NULL;
3526 XmTextSetString(HighlightDialog.nameW, pat->name);
3527 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3528 XmTextSetString(HighlightDialog.startW, pat->startRE);
3529 XmTextSetString(HighlightDialog.endW, pat->endRE);
3530 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3531 RadioButtonChangeState(HighlightDialog.topLevelW,
3532 !isSubpat && !isDeferred, False);
3533 RadioButtonChangeState(HighlightDialog.deferredW,
3534 !isSubpat && isDeferred, False);
3535 RadioButtonChangeState(HighlightDialog.subPatW,
3536 isSubpat && !isColorOnly, False);
3537 RadioButtonChangeState(HighlightDialog.colorPatW,
3538 isSubpat && isColorOnly, False);
3539 RadioButtonChangeState(HighlightDialog.simpleW, !isRange, False);
3540 RadioButtonChangeState(HighlightDialog.rangeW, isRange, False);
3541 setStyleMenu(pat->style);
3542 }
3543 updateLabels();
3544 }
3545
3546 static void freeItemCB(
void *item)
3547 {
3548 freePatternSrc((highlightPattern *)item, True);
3549 }
3550
3551
3552
3553
3554
3555 static int checkHighlightDialogData(
void)
3556 {
3557 patternSet *patSet;
3558 int result;
3559
3560
3561 patSet = getDialogPatternSet();
3562 if (patSet ==
NULL)
3563 return False;
3564
3565
3566 result = patSet->nPatterns ==
0 ? True : TestHighlightPatterns(patSet);
3567 freePatternSet(patSet);
3568 return result;
3569 }
3570
3571
3572
3573
3574
3575
3576 static void updateLabels(
void)
3577 {
3578 char *startLbl, *endLbl;
3579 int endSense, errSense, matchSense, parentSense;
3580 XmString s1;
3581
3582 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3583 startLbl =
"Sub-expressions to Highlight in Parent''s Starting \
3584 Regular Expression (\\1, &, etc.)";
3585 endLbl =
"Sub-expressions to Highlight in Parent Pattern''s Ending \
3586 Regular Expression";
3587 endSense = True;
3588 errSense = False;
3589 matchSense = False;
3590 parentSense = True;
3591 }
else {
3592 endLbl =
"Ending Regular Expression";
3593 matchSense = True;
3594 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3595 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3596 startLbl =
"Regular Expression to Match";
3597 endSense = False;
3598 errSense = False;
3599 }
else {
3600 startLbl =
"Starting Regular Expression";
3601 endSense = True;
3602 errSense = True;
3603 }
3604 }
3605
3606 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3607 XtSetSensitive(HighlightDialog.parentW, parentSense);
3608 XtSetSensitive(HighlightDialog.endW, endSense);
3609 XtSetSensitive(HighlightDialog.endLbl, endSense);
3610 XtSetSensitive(HighlightDialog.errorW, errSense);
3611 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3612 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3613 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3614 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3615 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3616 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3617 s1=XmStringCreateSimple(startLbl),
NULL);
3618 XmStringFree(s1);
3619 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3620 s1=XmStringCreateSimple(endLbl),
NULL);
3621 XmStringFree(s1);
3622 }
3623
3624
3625
3626
3627
3628 static void setStyleMenu(
const char *styleName)
3629 {
3630 int i;
3631 Cardinal nItems;
3632 WidgetList items;
3633 Widget selectedItem;
3634 char *itemStyle;
3635
3636 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3637 XmNnumChildren, &nItems,
NULL);
3638 if (nItems ==
0)
3639 return;
3640 selectedItem = items[
0];
3641 for (i=
0; i<(
int)nItems; i++) {
3642 XtVaGetValues(items[i], XmNuserData, &itemStyle,
NULL);
3643 if (!strcmp(itemStyle, styleName)) {
3644 selectedItem = items[i];
3645 break;
3646 }
3647 }
3648 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem,
NULL);
3649 }
3650
3651
3652
3653
3654
3655
3656
3657 static highlightPattern *readDialogFields(
int silent)
3658 {
3659 highlightPattern *pat;
3660 char *inPtr, *outPtr, *style;
3661 Widget selectedItem;
3662 int colorOnly;
3663
3664
3665
3666 pat = (highlightPattern *)NEditMalloc(
sizeof(highlightPattern));
3667 pat->endRE =
NULL;
3668 pat->errorRE =
NULL;
3669 pat->style =
NULL;
3670 pat->subPatternOf =
NULL;
3671
3672
3673 pat->flags =
0;
3674 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3675 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3676 pat->flags |=
DEFER_PARSING;
3677 else if (colorOnly)
3678 pat->flags =
COLOR_ONLY;
3679
3680
3681 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3682 "highlight pattern name", silent);
3683 if (pat->name ==
NULL) {
3684 NEditFree(pat);
3685 return NULL;
3686 }
3687
3688 if (*pat->name ==
'\0')
3689 {
3690 if (!silent)
3691 {
3692 DialogF(
DF_WARN, HighlightDialog.shell,
1,
"Pattern Name",
3693 "Please specify a name\nfor the pattern",
"OK");
3694 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3695 }
3696 NEditFree(pat->name);
3697 NEditFree(pat);
3698 return NULL;
3699 }
3700
3701
3702 pat->startRE = XmTextGetString(HighlightDialog.startW);
3703 if (*pat->startRE ==
'\0')
3704 {
3705 if (!silent)
3706 {
3707 DialogF(
DF_WARN, HighlightDialog.shell,
1,
"Matching Regex",
3708 "Please specify a regular\nexpression to match",
"OK");
3709 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3710 }
3711 freePatternSrc(pat, True);
3712 return NULL;
3713 }
3714
3715
3716
3717 if (colorOnly)
3718 {
3719 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!=
'\0'; inPtr++)
3720 {
3721 if (*inPtr!=
' ' && *inPtr!=
'\t')
3722 {
3723 *outPtr++ = *inPtr;
3724 }
3725 }
3726
3727 *outPtr =
'\0';
3728 if (strspn(pat->startRE,
"&\\123456789 \t") != strlen(pat->startRE)
3729 || (*pat->startRE !=
'\\' && *pat->startRE !=
'&')
3730 || strstr(pat->startRE,
"\\\\") !=
NULL)
3731 {
3732 if (!silent)
3733 {
3734 DialogF(
DF_WARN, HighlightDialog.shell,
1,
"Pattern Error",
3735 "The expression field in patterns which specify highlighting for\n"
3736 "a parent, must contain only sub-expression references in regular\n"
3737 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3738 "Expressions and Help -> Syntax Highlighting for more information",
3739 "OK");
3740 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3741 }
3742 freePatternSrc(pat, True);
3743 return NULL;
3744 }
3745 }
3746
3747
3748 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3749 {
3750 if (TextWidgetIsBlank(HighlightDialog.parentW))
3751 {
3752 if (!silent)
3753 {
3754 DialogF(
DF_WARN, HighlightDialog.shell,
1,
3755 "Specify Parent Pattern",
3756 "Please specify a parent pattern",
"OK");
3757 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3758 }
3759 freePatternSrc(pat, True);
3760 return NULL;
3761 }
3762 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3763 }
3764
3765
3766 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem,
NULL);
3767 XtVaGetValues(selectedItem, XmNuserData, &style,
NULL);
3768 pat->style = (
char*)NEditMalloc(strlen(style) +
1);
3769 strcpy(pat->style, style);
3770
3771
3772
3773 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3774 {
3775 pat->endRE = XmTextGetString(HighlightDialog.endW);
3776 if (!colorOnly && *pat->endRE ==
'\0')
3777 {
3778 if (!silent)
3779 {
3780 DialogF(
DF_WARN, HighlightDialog.shell,
1,
"Specify Regex",
3781 "Please specify an ending\nregular expression",
3782 "OK");
3783 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3784 }
3785 freePatternSrc(pat, True);
3786 return NULL;
3787 }
3788 }
3789
3790
3791 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3792 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3793 if (*pat->errorRE ==
'\0') {
3794 NEditFree(pat->errorRE);
3795 pat->errorRE =
NULL;
3796 }
3797 }
3798 return pat;
3799 }
3800
3801
3802
3803
3804
3805 static int dialogEmpty(
void)
3806 {
3807 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3808 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3809 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3810 TextWidgetIsBlank(HighlightDialog.parentW) &&
3811 TextWidgetIsBlank(HighlightDialog.startW) &&
3812 TextWidgetIsBlank(HighlightDialog.endW) &&
3813 TextWidgetIsBlank(HighlightDialog.errorW);
3814 }
3815
3816
3817
3818
3819
3820
3821 static int updatePatternSet(
void)
3822 {
3823 patternSet *patSet;
3824 WindowInfo *window;
3825 int psn, oldNum = -
1;
3826
3827
3828
3829 if (!checkHighlightDialogData())
3830 return False;
3831
3832
3833 patSet = getDialogPatternSet();
3834 if (patSet ==
NULL)
3835 return False;
3836
3837
3838 for (psn=
0; psn<NPatternSets; psn++)
3839 if (!strcmp(HighlightDialog.langModeName,
3840 PatternSets[psn]->languageMode))
3841 break;
3842
3843
3844
3845 if (psn == NPatternSets) {
3846 PatternSets[NPatternSets++] = patSet;
3847 oldNum =
0;
3848 }
else {
3849 oldNum = PatternSets[psn]->nPatterns;
3850 freePatternSet(PatternSets[psn]);
3851 PatternSets[psn] = patSet;
3852 }
3853
3854
3855
3856 for (window = WindowList; window !=
NULL; window = window->next) {
3857 if (patSet->nPatterns >
0) {
3858 if (window->languageMode !=
PLAIN_LANGUAGE_MODE
3859 &&
0 == strcmp(LanguageModeName(window->languageMode),
3860 patSet->languageMode)) {
3861
3862
3863
3864 if (oldNum ==
0) {
3865
3866
3867
3868 if (IsTopDocument(window)) {
3869 XtSetSensitive(window->highlightItem, True);
3870 }
3871
3872
3873 window->highlightSyntax = GetPrefHighlightSyntax();
3874 }
3875
3876 if (window->highlightSyntax) {
3877 StopHighlighting(window);
3878 if (IsTopDocument(window)) {
3879 XtSetSensitive(window->highlightItem, True);
3880 SetToggleButtonState(window, window->highlightItem,
3881 True, False);
3882 }
3883 StartHighlighting(window, True);
3884 }
3885 }
3886 }
else {
3887
3888
3889 StopHighlighting(window);
3890 window->highlightSyntax = False;
3891
3892 if (IsTopDocument(window)) {
3893 XtSetSensitive(window->highlightItem, False);
3894 SetToggleButtonState(window, window->highlightItem, False, False);
3895 }
3896 }
3897 }
3898
3899
3900 MarkPrefsChanged();
3901
3902 return True;
3903 }
3904
3905
3906
3907
3908
3909 static patternSet *getDialogPatternSet(
void)
3910 {
3911 int i, lineContext, charContext;
3912 patternSet *patSet;
3913
3914
3915 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3916 return NULL;
3917
3918
3919 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3920 "context lines", True) !=
TEXT_READ_OK)
3921 return NULL;
3922 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3923 "context lines", True) !=
TEXT_READ_OK)
3924 return NULL;
3925
3926
3927
3928 patSet = (patternSet *)NEditMalloc(
sizeof(patternSet));
3929 patSet->languageMode = NEditStrdup(HighlightDialog.langModeName);
3930 patSet->lineContext = lineContext;
3931 patSet->charContext = charContext;
3932 patSet->nPatterns = HighlightDialog.nPatterns;
3933 patSet->patterns = (highlightPattern *)NEditMalloc(
sizeof(highlightPattern) *
3934 HighlightDialog.nPatterns);
3935 for (i=
0; i<HighlightDialog.nPatterns; i++)
3936 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3937 return patSet;
3938 }
3939
3940
3941
3942
3943 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3944 {
3945 int i;
3946 highlightPattern *pat1, *pat2;
3947
3948 if (patSet1->lineContext != patSet2->lineContext)
3949 return True;
3950 if (patSet1->charContext != patSet2->charContext)
3951 return True;
3952 if (patSet1->nPatterns != patSet2->nPatterns)
3953 return True;
3954 for (i=
0; i<patSet2->nPatterns; i++) {
3955 pat1 = &patSet1->patterns[i];
3956 pat2 = &patSet2->patterns[i];
3957 if (pat1->flags != pat2->flags)
3958 return True;
3959 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3960 return True;
3961 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3962 return True;
3963 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3964 return True;
3965 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3966 return True;
3967 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3968 return True;
3969 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3970 return True;
3971 }
3972 return False;
3973 }
3974
3975
3976
3977
3978
3979
3980
3981 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3982 highlightPattern *copyTo)
3983 {
3984 highlightPattern *newPat;
3985
3986 if (copyTo ==
NULL)
3987 newPat = (highlightPattern *)NEditMalloc(
sizeof(highlightPattern));
3988 else
3989 newPat = copyTo;
3990 newPat->name = NEditStrdup(pat->name);
3991 newPat->startRE = NEditStrdup(pat->startRE);
3992 newPat->endRE = NEditStrdup(pat->endRE);
3993 newPat->errorRE = NEditStrdup(pat->errorRE);
3994 newPat->style = NEditStrdup(pat->style);
3995 newPat->subPatternOf = NEditStrdup(pat->subPatternOf);
3996 newPat->flags = pat->flags;
3997 return newPat;
3998 }
3999
4000
4001
4002
4003
4004 static void freePatternSrc(highlightPattern *pat,
int freeStruct)
4005 {
4006 NEditFree(pat->name);
4007 NEditFree(pat->startRE);
4008 NEditFree(pat->endRE);
4009 NEditFree(pat->errorRE);
4010 NEditFree(pat->style);
4011 NEditFree(pat->subPatternOf);
4012 if (freeStruct)
4013 NEditFree(pat);
4014 }
4015
4016
4017
4018
4019
4020 static void freePatternSet(patternSet *p)
4021 {
4022 int i;
4023
4024 for (i=
0; i<p->nPatterns; i++)
4025 freePatternSrc(&p->patterns[i], False);
4026 NEditFree(p->languageMode);
4027 NEditFree(p->patterns);
4028 NEditFree(p);
4029 }
4030
4031 #if 0
4032
4033
4034
4035
4036 static int lookupNamedPattern(patternSet *p,
char *patternName)
4037 {
4038 int i;
4039
4040 for (i=
0; i<p->nPatterns; i++)
4041 if (strcmp(p->patterns[i].name, patternName))
4042 return i;
4043 return -
1;
4044 }
4045 #endif
4046
4047
4048
4049
4050
4051 static int lookupNamedStyle(ColorProfile *colorProfile,
const char *styleName)
4052 {
4053 int i;
4054
4055 for (i =
0; i < colorProfile->numStyles; i++)
4056 {
4057 if (!strcmp(styleName, colorProfile->styles[i]->name))
4058 {
4059 return i;
4060 }
4061 }
4062
4063 return -
1;
4064 }
4065
4066
4067
4068
4069 int IndexOfNamedStyle(ColorProfile *colorProfile,
const char *styleName)
4070 {
4071 return lookupNamedStyle(colorProfile, styleName);
4072 }
4073
4074
4075
4076
4077
4078 static char *intToStr(
int i)
4079 {
4080 static char outBuf[
12];
4081
4082 sprintf(outBuf,
"%d", i);
4083 return outBuf;
4084 }
4085