Updated Python patterns (no updated delimiters yet).
[nedit.git] / source / highlightData.c
blob6debb38d830995f3bd7c966f16de34faa60fc5dc
1 static const char CVSID[] = "$Id: highlightData.c,v 1.47 2003/05/16 16:58:13 edg Exp $";
2 /*******************************************************************************
3 * *
4 * highlightData.c -- Maintain, and allow user to edit, highlight pattern list *
5 * used for syntax highlighting *
6 * *
7 * Copyright (C) 1999 Mark Edel *
8 * *
9 * This is free software; you can redistribute it and/or modify it under the *
10 * terms of the GNU General Public License as published by the Free Software *
11 * Foundation; either version 2 of the License, or (at your option) any later *
12 * version. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
17 * for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * April, 1997 *
25 * *
26 * Written by Mark Edel *
27 * *
28 *******************************************************************************/
30 #ifdef HAVE_CONFIG_H
31 #include "../config.h"
32 #endif
34 #include "highlightData.h"
35 #include "textBuf.h"
36 #include "nedit.h"
37 #include "highlight.h"
38 #include "regularExp.h"
39 #include "preferences.h"
40 #include "help.h"
41 #include "window.h"
42 #include "regexConvert.h"
43 #include "../util/misc.h"
44 #include "../util/DialogF.h"
45 #include "../util/managedList.h"
47 #include <stdio.h>
48 #include <string.h>
49 #include <limits.h>
50 #ifdef VMS
51 #include "../util/VMSparam.h"
52 #else
53 #ifndef __MVS__
54 #include <sys/param.h>
55 #endif
56 #endif /*VMS*/
58 #include <Xm/Xm.h>
59 #include <Xm/Form.h>
60 #include <Xm/Frame.h>
61 #include <Xm/Text.h>
62 #include <Xm/LabelG.h>
63 #include <Xm/PushB.h>
64 #include <Xm/ToggleB.h>
65 #include <Xm/RowColumn.h>
66 #include <Xm/SeparatoG.h>
68 #ifdef HAVE_DEBUG_H
69 #include "../debug.h"
70 #endif
72 /* Maximum allowed number of styles (also limited by representation of
73 styles as a byte - 'b') */
74 #define MAX_HIGHLIGHT_STYLES 128
76 /* Maximum number of patterns allowed in a pattern set (regular expression
77 limitations are probably much more restrictive). */
78 #define MAX_PATTERNS 127
80 /* Names for the fonts that can be used for syntax highlighting */
81 #define N_FONT_TYPES 4
82 enum fontTypes {PLAIN_FONT, ITALIC_FONT, BOLD_FONT, BOLD_ITALIC_FONT};
83 static const char *FontTypeNames[N_FONT_TYPES] =
84 {"Plain", "Italic", "Bold", "Bold Italic"};
86 typedef struct {
87 char *name;
88 char *color;
89 char *bgColor;
90 int font;
91 } highlightStyleRec;
93 static int styleError(const char *stringStart, const char *stoppedAt,
94 const char *message);
95 #if 0
96 static int lookupNamedPattern(patternSet *p, char *patternName);
97 #endif
98 static int lookupNamedStyle(const char *styleName);
99 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
100 char **errMsg, int *nPatterns);
101 static int readHighlightPattern(char **inPtr, char **errMsg,
102 highlightPattern *pattern);
103 static patternSet *readDefaultPatternSet(const char *langModeName);
104 static int isDefaultPatternSet(patternSet *patSet);
105 static patternSet *readPatternSet(char **inPtr, int convertOld);
106 static patternSet *highlightError(char *stringStart, char *stoppedAt,
107 const char *message);
108 static char *intToStr(int i);
109 static char *createPatternsString(patternSet *patSet, char *indentStr);
110 static void setStyleByName(const char *style);
111 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData);
112 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData);
113 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData);
114 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData);
115 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs);
116 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
117 void *cbArg);
118 static void hsSetDisplayedCB(void *item, void *cbArg);
119 static highlightStyleRec *readHSDialogFields(int silent);
120 static void hsFreeItemCB(void *item);
121 static void freeHighlightStyleRec(highlightStyleRec *hs);
122 static int hsDialogEmpty(void);
123 static int updateHSList(void);
124 static void updateHighlightStyleMenu(void);
125 static void convertOldPatternSet(patternSet *patSet);
126 static void convertPatternExpr(char **patternRE, char *patSetName,
127 char *patName, int isSubsExpr);
128 static Widget createHighlightStylesMenu(Widget parent);
129 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData);
130 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData);
131 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData);
132 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData);
133 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData);
134 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData);
135 static int checkHighlightDialogData(void);
136 static void updateLabels(void);
137 static void okCB(Widget w, XtPointer clientData, XtPointer callData);
138 static void applyCB(Widget w, XtPointer clientData, XtPointer callData);
139 static void checkCB(Widget w, XtPointer clientData, XtPointer callData);
140 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData);
141 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData);
142 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData);
143 static void helpCB(Widget w, XtPointer clientData, XtPointer callData);
144 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
145 void *cbArg);
146 static void setDisplayedCB(void *item, void *cbArg);
147 static void setStyleMenu(const char *styleName);
148 static highlightPattern *readDialogFields(int silent);
149 static int dialogEmpty(void);
150 static int updatePatternSet(void);
151 static patternSet *getDialogPatternSet(void);
152 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2);
153 static highlightPattern *copyPatternSrc(highlightPattern *pat,
154 highlightPattern *copyTo);
155 static void freeNonNull(void *ptr);
156 static void freeItemCB(void *item);
157 static void freePatternSrc(highlightPattern *pat, int freeStruct);
158 static void freePatternSet(patternSet *p);
160 /* list of available highlight styles */
161 static int NHighlightStyles = 0;
162 static highlightStyleRec *HighlightStyles[MAX_HIGHLIGHT_STYLES];
164 /* Highlight styles dialog information */
165 static struct {
166 Widget shell;
167 Widget nameW;
168 Widget colorW;
169 Widget bgColorW;
170 Widget recogW;
171 Widget plainW, boldW, italicW, boldItalicW;
172 Widget managedListW;
173 highlightStyleRec **highlightStyleList;
174 int nHighlightStyles;
175 } HSDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0};
177 /* Highlight dialog information */
178 static struct {
179 Widget shell;
180 Widget lmOptMenu;
181 Widget lmPulldown;
182 Widget styleOptMenu;
183 Widget stylePulldown;
184 Widget nameW;
185 Widget topLevelW;
186 Widget deferredW;
187 Widget subPatW;
188 Widget colorPatW;
189 Widget simpleW;
190 Widget rangeW;
191 Widget parentW;
192 Widget startW;
193 Widget endW;
194 Widget errorW;
195 Widget lineContextW;
196 Widget charContextW;
197 Widget managedListW;
198 Widget parentLbl;
199 Widget startLbl;
200 Widget endLbl;
201 Widget errorLbl;
202 Widget matchLbl;
203 char *langModeName;
204 int nPatterns;
205 highlightPattern **patterns;
206 } HighlightDialog = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
207 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
208 NULL, NULL, NULL, NULL, NULL, 0, NULL };
210 /* Pattern sources loaded from the .nedit file or set by the user */
211 static int NPatternSets = 0;
212 static patternSet *PatternSets[MAX_LANGUAGE_MODES];
214 static char *DefaultPatternSets[] = {
215 "Ada:1:0{\n\
216 Comments:\"--\":\"$\"::Comment::\n\
217 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
218 Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\
219 Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
220 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
221 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
222 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
223 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
224 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\
225 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
226 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
227 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\
228 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
229 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
230 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
231 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
232 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
233 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
234 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
235 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
236 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
237 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
238 "Awk:2:0{\n\
239 Comment:\"#\":\"$\"::Comment::\n\
240 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
241 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
242 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
243 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
244 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
245 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
246 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
247 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
248 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
249 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
250 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\
251 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
252 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
253 newline escape:\"\\\\$\":::Preprocessor1::\n\
254 Function:\"function\":::Preprocessor1::D}",
255 "C++:1:0{\n\
256 comment:\"/\\*\":\"\\*/\"::Comment::\n\
257 cplus comment:\"//\":\"$\"::Comment::\n\
258 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
259 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
260 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
261 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
262 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
263 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
264 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
265 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
266 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\
267 storage keyword:\"<(?:class|typename|typeid|template|friend|virtual|inline|explicit|operator|public|private|protected|const|extern|auto|register|static|mutable|unsigned|signed|volatile|char|double|float|int|long|short|bool|wchar_t|void|typedef|struct|union|enum|asm|export)>\":::Storage Type::D\n\
268 keyword:\"<(?:new|delete|this|return|goto|if|else|case|default|switch|break|continue|while|do|for|try|catch|throw|sizeof|true|false|namespace|using|dynamic_cast|static_cast|reinterpret_cast|const_cast)>\":::Keyword::D\n\
269 braces:\"[{}]\":::Keyword::D}",
270 "C:1:0 {\n\
271 comment:\"/\\*\":\"\\*/\"::Comment::\n\
272 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
273 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
274 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
275 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
276 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
277 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
278 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
279 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\
280 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\
281 keyword:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
282 braces:\"[{}]\":::Keyword::D}",
283 "CSS:1:0{\n\
284 comment:\"/\\*\":\"\\*/\"::Comment::\n\
285 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
286 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
287 import url:\"\\1\":::Subroutine1:import rule:C\n\
288 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
289 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
290 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
291 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
292 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
293 charset name:\"\\1\":::String:charset rule:C\n\
294 font-face rule:\"@font-face\":::Preprocessor::\n\
295 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
296 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
297 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
298 declaration:\"\\{\":\"\\}\"::Warning::\n\
299 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
300 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
301 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\
302 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
303 value delims:\"&\":\"&\"::Keyword:value:C\n\
304 value modifier:\"!important|inherit\":::Keyword:value:\n\
305 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
306 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\
307 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\
308 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\
309 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
310 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
311 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\
312 integer value:\"<\\d+>\":::Numeric Const:value:\n\
313 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
314 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
315 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
316 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
317 sq string value:\"'\":\"'\":\"\\n\":String:value:\n\
318 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
319 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
320 operators:\"[,/]\":::Keyword:value:\n\
321 selector id:\"#[-\\w]+>\":::Pointer::\n\
322 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
323 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
324 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
325 selector operators:\"[,>*+]\":::Keyword::\n\
326 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
327 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
328 free text:\".\":::Warning::\n\
329 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
330 "Csh:1:0{\n\
331 Comment:\"#\":\"$\"::Comment::\n\
332 Single Quote String:\"'\":\"([^\\\\]'|^')\":\"\\n\":String::\n\
333 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
334 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
335 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
336 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
337 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\
338 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\
339 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
340 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
341 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\
342 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\
343 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
344 "Fortran:2:0{\n\
345 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
346 Bang Comment:\"!\":\"$\"::Comment::\n\
347 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
348 String:\"'\":\"'\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
349 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\
350 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
351 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
352 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
353 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
354 "Java:3:0{\n\
355 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
356 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
357 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
358 comment:\"/\\*\":\"\\*/\"::Comment::\n\
359 cplus comment:\"//\":\"$\"::Comment::\n\
360 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
361 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])\":::String1:string:\n\
362 single quoted:\"'\":\"'\":\"\\n\":String::\n\
363 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])(?=')\":::String1:single quoted:\n\
364 single quoted char:\".(?=')\":::String:single quoted:\n\
365 single quoted error:\".\":::Flag:single quoted:\n\
366 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
367 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
368 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
369 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
370 classdef:\"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
371 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
372 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
373 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
374 extends comma:\",\":::Keyword:extends:\n\
375 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
376 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
377 extends error:\".\":::Flag:extends:\n\
378 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
379 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
380 impl_throw comma:\",\":::Keyword:impl_throw:\n\
381 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
382 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
383 impl_throw error:\".\":::Flag:impl_throw:\n\
384 case:\"<case>\":\":\"::Label::\n\
385 case single quoted:\"'\\\\?[^']'\":::Character Const:case:\n\
386 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
387 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
388 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
389 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
390 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
391 case error:\".\":::Flag:case:\n\
392 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
393 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
394 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
395 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
396 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
397 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
398 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
399 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
400 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
401 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
402 keyword - modifiers:\"<(?:abstract|final|native|private|protected|public|static|transient|synchronized|volatile)>\":::Keyword::\n\
403 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
404 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
405 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
406 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
407 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
408 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
409 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
410 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
411 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
412 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
413 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
414 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
415 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
416 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
417 error:\".\":::Flag::D}",
418 #ifndef VMS
419 /* The VAX C compiler cannot compile this definition */
420 "JavaScript:1:0{\n\
421 DSComment:\"//\":\"$\"::Comment::\n\
422 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
423 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\
424 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\
425 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\
426 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
427 Braces:\"[{}]\":::Keyword::\n\
428 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
429 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
430 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
431 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
432 Parentheses:\"[\\(\\)]\":::Plain::\n\
433 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\
434 SQStrings:\"'\":\"'\":\"\\n\":String::\n\
435 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
436 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
437 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\
438 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\
439 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
440 #endif /*VMS*/
441 "LaTeX:1:0{\n\
442 Comment:\"%\":\"$\"::Text Comment::\n\
443 Parameter:\"#[0-9]*\":::Text Arg::\n\
444 Special Chars:\"[{}&]\":::Keyword::\n\
445 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
446 Super Sub 1 Char:\"(?:\\^|_)(?:\\\\\\l+|[^{\\\\])\":::Text Arg2::\n\
447 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
448 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
449 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
450 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
451 Inline Math:\"\\$|\\\\\\(\":\"\\$|\\\\\\)\":\"\\\\\\(|(?n[^\\\\]%)\":LaTeX Math::\n\
452 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
453 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
454 No Arg Command:\"\\\\(?:left|right)[\\[\\]{}()]\":::Text Key::\n\
455 Command:\"[_^]|[\\\\@](?:a'|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_='`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
456 Cmd Brace Args:\"\\{\":\"}\":\"(?n[^\\\\]%)\":Text Arg2:Command:\n\
457 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
458 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
459 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
460 Cmd Bracket Args:\"\\[\":\"\\]\":\"$|\\\\\\]\":Text Arg2:Command:\n\
461 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
462 Sub Cmd Bracket Args Esc:\"\\\\\\}\":::Plain:Sub Cmd Bracket Args:\n\
463 Sub Cmd Bracket Args:\"\\{\":\"\\}\":\"$|\\\\\\]\":Preprocessor1:Cmd Bracket Args:\n\
464 Sub Command:\"(?:[_^]|(?:[\\\\@](?:[A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
465 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
466 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
467 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
468 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
469 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
470 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
471 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
472 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
473 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
474 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
475 "Lex:1:0{\n\
476 comment:\"/\\*\":\"\\*/\"::Comment::\n\
477 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
478 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
479 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
480 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
481 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
482 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
483 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
484 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\
485 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\
486 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
487 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\
488 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\
489 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
490 braces:\"[{}]\":::Keyword::D\n\
491 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
492 "Makefile:8:0{\n\
493 Comment:\"#\":\"$\"::Comment::\n\
494 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
495 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
496 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
497 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
498 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\
499 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
500 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
501 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
502 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
503 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
504 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
505 Continuation:\"\\\\$\":::Keyword::\n\
506 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
507 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
508 Escaped Dollar:\"\\$\\$\":::Comment::\n\
509 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
510 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
511 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
512 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
513 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
514 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
515 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
516 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
517 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
518 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
519 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
520 "Matlab:1:0{\n\
521 Comment:\"%\":\"$\"::Comment::\n\
522 Comment in Octave:\"#\":\"$\"::Plain::\n\
523 Keyword:\"<(break|clear|else|elseif|end|for|function|global|if|return|then|while)>\":::Keyword::\n\
524 Transpose:\"[\\w.]('+)\":::Plain::\n\
525 Paren transposed:\"\\)('+)\":::Keyword::\n\
526 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
527 Parentheses:\"[\\(\\)]\":::Keyword::\n\
528 Brackets transposed:\"\\]('+)\":::Text Key1::\n\
529 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
530 Brackets:\"[\\[\\]]\":::Text Key1::\n\
531 Braces transposed:\"\\}('+)\":::Text Arg::\n\
532 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
533 Braces:\"[\\{\\}]\":::Text Arg::\n\
534 String:\"'\":\"'\"::String::\n\
535 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
536 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
537 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
538 Shell command:\"!\":\"$\"::String1::\n\
539 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
540 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
541 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
542 Logical operators:\"~|&|\\|\":::Text Arg2::}",
543 "NEdit Macro:1:0{\n\
544 Comment:\"#\":\"$\"::Comment::\n\
545 Built-in Vars:\"(?<!\\Y)\\$([1-9]|column|n_args|cursor|file_name|file_path|text_length|selection_start|selection_end|selection_left|selection_right|wrap_margin|tab_dist|em_tab_dist|use_tabs|language_mode|modified|statistics_line|incremental_search_line|show_line_numbers|auto_indent|wrap_text|highlight_syntax|make_backup_copy|incremental_backup|show_matching|overtype_mode|read_only|locked|file_format|font_name|font_name_italic|font_name_bold|font_name_bold_italic|sub_sep|string_dialog_button|search_end|read_status|shell_cmd_status|list_dialog_button|min_font_width|max_font_width|top_line|n_display_lines|display_width|active_pane|n_panes|line|empty_array|backlight_string|rangeset_list)>\":::Identifier::\n\
546 Built-in Subrs:\"<(focus_window|shell_command|length|get_range|t_print|dialog|string_dialog|replace_range|replace_selection|set_cursor_pos|get_character|min|max|search|search_string|substring|replace_substring|read_file|write_file|append_file|beep|get_selection|replace_in_string|select|select_rectangle|toupper|tolower|string_to_clipboard|clipboard_to_string|list_dialog|getenv|set_language_mode|string_compare|split|valid_number|set_backlight_string|rangeset_(create|destroy|add|subtract|invert|info|range|includes|set_color|set_mode)|highlight_(pattern_of_pos|style_of_pos|color_of_pos|color_value_of_pos|style_of_pos_is_bold|style_of_pos_is_italic|pattern_extends_from|pattern_style|style_color|style_color_value|style_is_bold|style_is_italic))>\":::Subroutine::\n\
547 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|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|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_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|find-definition|find_definition|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)>\":::Subroutine::\n\
548 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\
549 Keyword:\"<(while|if|else|for|break|continue|return|define|in)>\":::Keyword::\n\
550 Braces:\"[{}]\":::Keyword::\n\
551 Global Variable:\"\\$[A-Za-z0-9_]*\":::Identifier1::\n\
552 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
553 String Escape Char:\"\\\\(.|\\n)\":::Text Escape:String:\n\
554 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
555 Custom macro:\"\\w+(?=\\s*[\\({])\":::Subroutine1::\n\
556 Variables:\"\\w+\":::Identifier1::D}",
557 "Pascal:1:0{\n\
558 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
559 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
560 String:\"'\":\"'\":\"\\n\":String::D\n\
561 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
562 Parentheses:\"\\(|\\)\":::Keyword::D\n\
563 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
564 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
565 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
566 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
567 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
568 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
569 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
570 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
571 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
572 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
573 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
574 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
575 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
576 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
577 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
578 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
579 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
580 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
581 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\
582 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
583 Assignment:\":=\":::Plain::D\n\
584 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
585 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
586 "Perl:2:0{\n\
587 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
588 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
589 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
590 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\
591 dq here doc content:\".\":::String:dq here doc:\n\
592 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
593 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
594 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
595 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\
596 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
597 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
598 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
599 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\
600 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
601 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
602 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
603 sq here doc content:\".\":::String1:sq here doc:\n\
604 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
605 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
606 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
607 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
608 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
609 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
610 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
611 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
612 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
613 word list content:\".\":::String1:word list:\n\
614 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
615 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
616 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
617 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\
618 bq here doc content:\".\":::String1:bq here doc:\n\
619 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
620 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
621 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\
622 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
623 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
624 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\
625 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
626 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
627 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
628 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
629 comment:\"#\":\"$\"::Comment::\n\
630 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
631 label identifier:\"\\2\\5\":::Label:label:C\n\
632 label keyword:\"\\3\\6\":::Keyword:label:C\n\
633 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\
634 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
635 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
636 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
637 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
638 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
639 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
640 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
641 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
642 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
643 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
644 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
645 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
646 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
647 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\
648 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
649 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\
650 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
651 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
652 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
653 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
654 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
655 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
656 end token delim:\"&\":::Preprocessor:end token:C\n\
657 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
658 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
659 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
660 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
661 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
662 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
663 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
664 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\
665 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
666 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
667 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
668 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
669 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
670 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
671 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
672 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
673 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
674 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
675 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\
676 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
677 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
678 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
679 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
680 "PostScript:1:0{\n\
681 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
682 Comment:\"%\":\"$\"::Comment::\n\
683 string:\"\\(\":\"\\)\"::String::\n\
684 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
685 string2:\"\\(\":\"\\)\"::String:string:\n\
686 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
687 string3:\"\\(\":\"\\)\"::String:string2:\n\
688 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
689 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
690 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
691 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
692 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
693 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\
694 Array:\"[\\[\\]]\":::Storage Type::D\n\
695 Procedure:\"[{}]\":::Subroutine::D\n\
696 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\
697 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\
698 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\
699 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
700 "Python:2:0{\n\
701 Comment:\"#\":\"$\"::Comment::\n\
702 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
703 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
704 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
705 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
706 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\
707 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\
708 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\
709 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\
710 Representation:\"`\":\"`\":\"$\":String2::\n\
711 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
712 Number:\"(?<!\\w)(?:(?:(?:[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[0-7]+|0[xX][\\da-fA-F]+)[lL]?)(?!\\w)\":::Numeric Const::\n\
713 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
714 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
715 Member definition:\"<(def)\\s+(?:(__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|eq|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|irshift|isub|iter|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|truediv|xor)__)|((__(?:bases|class|dict)__)|(__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))(?=(?:\\s*(?:\\\\\\n\\s*)?\\(\\s*|\\s*\\(\\s*(?:\\\\?\\n\\s*)?)self>)\":::Plain::\n\
716 Member def color:\"\\1\":::Keyword:Member definition:C\n\
717 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
718 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
719 Member def error:\"\\7\":::Flag:Member definition:C\n\
720 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
721 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
722 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
723 Function definition:\"<(def)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|eval|execfile|file|filter|float|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|range|raw_input|reduce|reload|repr|round|self|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
724 Function def color:\"\\1\":::Keyword:Function definition:C\n\
725 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
726 Function def error:\"\\3\":::Flag:Function definition:C\n\
727 Class definition:\"<(class)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|eval|execfile|file|filter|float|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|range|raw_input|reduce|reload|repr|round|self|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
728 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
729 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
730 Class def error:\"\\3\":::Flag:Class definition:C\n\
731 Member reference:\"\\.\\s*(?:\\\\?\\n\\s*)?(?:((__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|eq|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|irshift|isub|iter|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|truediv|xor)__)|(__(?:new)__))|((__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(__(?:bases|class|dict)__)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
732 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
733 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
734 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
735 Member ref error:\"\\8\":::Flag:Member reference:C\n\
736 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
737 Keyword:\"<(?:and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield)>\":::Keyword::\n\
738 Built-in function:\"<(?:__import__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
739 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
740 Built-in exceptions:\"<(?:ArithmeticError|AssertionError|AttributeError|EOFError|EnvironmentError|Exception|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StandardError|StopIteration|SyntaxError|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
741 Built-in warnings:\"<(?:DeprecationWarning|OverflowWarning|RuntimeWarning|SyntaxWarning|UserWarning|Warning)>\":::Identifier1::\n\
742 Braces and parens:\"[[{()}\\]]\":::Keyword::D}",
743 "Regex:1:0{\n\
744 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
745 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
746 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
747 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
748 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
749 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\
750 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
751 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\
752 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
753 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
754 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
755 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
756 "SGML HTML:6:0{\n\
757 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
758 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
759 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
760 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
761 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\
762 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
763 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
764 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
765 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
766 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
767 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
768 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
769 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
770 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
771 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
772 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
773 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
774 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
775 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
776 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
777 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
778 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
779 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
780 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
781 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
782 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
783 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
784 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
785 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
786 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
787 "SQL:1:0{\n\
788 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
789 comment:\"--\":\"$\"::Comment::\n\
790 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
791 string:\"'\":\"'\"::String::\n\
792 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\
793 comment2:\"/\\*\":\"\\*/\"::Comment::}",
794 "Sh Ksh Bash:1:0{\n\
795 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
796 single quoted string:\"'\":\"'\"::String1::\n\
797 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
798 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
799 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
800 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
801 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
802 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
803 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
804 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
805 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
806 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
807 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
808 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
809 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
810 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
811 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
812 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
813 command substitution:\"`\":\"`\"::Subroutine::\n\
814 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
815 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
816 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
817 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
818 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
819 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
820 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
821 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
822 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
823 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
824 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
825 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
826 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
827 comments in line:\"#\":\"$\"::Comment::\n\
828 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
829 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
830 command options:\"[ \\t]-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
831 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
832 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}",
833 "Tcl:1:0{\n\
834 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
835 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
836 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
837 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
838 Comment:\"#\":\"$\"::Comment::\n\
839 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\
840 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\
841 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
842 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
843 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
844 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
845 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
846 Namespace:\"\\w+::\":::Keyword::}",
847 "VHDL:1:0{\n\
848 Comments:\"--\":\"$\"::Comment::\n\
849 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
850 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
851 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
852 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
853 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
854 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
855 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\
856 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
857 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
858 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
859 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
860 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
861 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
862 "Verilog:1:0{\n\
863 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
864 cplus comment:\"//\":\"$\"::Comment::\n\
865 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
866 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
867 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\
868 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\
869 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
870 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\
871 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
872 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
873 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
874 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
875 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
876 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
877 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
878 "XML:1:0{\n\
879 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
880 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
881 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
882 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
883 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
884 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
885 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
886 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
887 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
888 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
889 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
890 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
891 doctype root element:\"\\2\":::Identifier:doctype:C\n\
892 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
893 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
894 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
895 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
896 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
897 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
898 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
899 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
900 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
901 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
902 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
903 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
904 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
905 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
906 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
907 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
908 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
909 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
910 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
911 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
912 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
913 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
914 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
915 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
916 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
917 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
918 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
919 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
920 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
921 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
922 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
923 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
924 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
925 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
926 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
927 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
928 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
929 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
930 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
931 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
932 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
933 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
934 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
935 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
936 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
937 element name:\"\\2\":::Identifier:element:C\n\
938 element assign:\"=\":::Keyword:element:\n\
939 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
940 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
941 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
942 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
943 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
944 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
945 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
946 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
947 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
948 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
949 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
950 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
951 "X Resources:2:0{\n\
952 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
953 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
954 Comment:\"^\\s*!\":\"$\"::Comment::\n\
955 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
956 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
957 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
958 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
959 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
960 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
961 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
962 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
963 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
964 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
965 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
966 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
967 Free Text:\"^.*$\":::Flag::}",
968 "Yacc:1:0{\n\
969 comment:\"/\\*\":\"\\*/\"::Comment::\n\
970 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
971 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
972 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
973 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
974 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
975 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
976 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\
977 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\
978 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
979 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
980 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\
981 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
982 braces:\"[{}]\":::Keyword::D\n\
983 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
984 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
989 ** Read a string (from the value of the styles resource) containing highlight
990 ** styles information, parse it, and load it into the stored highlight style
991 ** list (HighlightStyles) for this NEdit session.
993 int LoadStylesString(char *inString)
995 char *errMsg, *fontStr;
996 char *inPtr = inString;
997 highlightStyleRec *hs;
998 int i;
1000 for (;;) {
1002 /* skip over blank space */
1003 inPtr += strspn(inPtr, " \t");
1005 /* Allocate a language mode structure in which to store the info. */
1006 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1008 /* read style name */
1009 hs->name = ReadSymbolicField(&inPtr);
1010 if (hs->name == NULL)
1011 return styleError(inString,inPtr, "style name required");
1012 if (!SkipDelimiter(&inPtr, &errMsg)) {
1013 XtFree(hs->name);
1014 XtFree((char *)hs);
1015 return styleError(inString,inPtr, errMsg);
1018 /* read color */
1019 hs->color = ReadSymbolicField(&inPtr);
1020 if (hs->color == NULL) {
1021 XtFree(hs->name);
1022 XtFree((char *)hs);
1023 return styleError(inString,inPtr, "color name required");
1025 hs->bgColor = NULL;
1026 if (SkipOptSeparator('/', &inPtr, &errMsg)) {
1027 /* read bgColor */
1028 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1030 if (!SkipDelimiter(&inPtr, &errMsg)) {
1031 freeHighlightStyleRec(hs);
1032 return styleError(inString,inPtr, errMsg);
1035 /* read the font type */
1036 fontStr = ReadSymbolicField(&inPtr);
1037 for (i=0; i<N_FONT_TYPES; i++) {
1038 if (!strcmp(FontTypeNames[i], fontStr)) {
1039 hs->font = i;
1040 break;
1043 if (i == N_FONT_TYPES) {
1044 XtFree(fontStr);
1045 freeHighlightStyleRec(hs);
1046 return styleError(inString, inPtr, "unrecognized font type");
1048 XtFree(fontStr);
1050 /* pattern set was read correctly, add/change it in the list */
1051 for (i=0; i<NHighlightStyles; i++) {
1052 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1053 freeHighlightStyleRec(HighlightStyles[i]);
1054 HighlightStyles[i] = hs;
1055 break;
1058 if (i == NHighlightStyles) {
1059 HighlightStyles[NHighlightStyles++] = hs;
1060 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1061 return styleError(inString, inPtr,
1062 "maximum allowable number of styles exceeded");
1065 /* if the string ends here, we're done */
1066 inPtr += strspn(inPtr, " \t\n");
1067 if (*inPtr == '\0')
1068 return True;
1073 ** Create a string in the correct format for the styles resource, containing
1074 ** all of the highlight styles information from the stored highlight style
1075 ** list (HighlightStyles) for this NEdit session.
1077 char *WriteStylesString(void)
1079 int i;
1080 char *outStr;
1081 textBuffer *outBuf;
1082 highlightStyleRec *style;
1084 outBuf = BufCreate();
1085 for (i=0; i<NHighlightStyles; i++) {
1086 style = HighlightStyles[i];
1087 BufInsert(outBuf, outBuf->length, "\t");
1088 BufInsert(outBuf, outBuf->length, style->name);
1089 BufInsert(outBuf, outBuf->length, ":");
1090 BufInsert(outBuf, outBuf->length, style->color);
1091 if (style->bgColor) {
1092 BufInsert(outBuf, outBuf->length, "/");
1093 BufInsert(outBuf, outBuf->length, style->bgColor);
1095 BufInsert(outBuf, outBuf->length, ":");
1096 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1097 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1100 /* Get the output, and lop off the trailing newlines */
1101 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1102 BufFree(outBuf);
1103 return outStr;
1107 ** Read a string representing highlight pattern sets and add them
1108 ** to the PatternSets list of loaded highlight patterns. Note that the
1109 ** patterns themselves are not parsed until they are actually used.
1111 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1112 ** that they may contain regular expressions are of the older syntax where
1113 ** braces were not quoted, and \0 was a legal substitution character).
1115 int LoadHighlightString(char *inString, int convertOld)
1117 char *inPtr = inString;
1118 patternSet *patSet;
1119 int i;
1121 for (;;) {
1123 /* Read each pattern set, abort on error */
1124 patSet = readPatternSet(&inPtr, convertOld);
1125 if (patSet == NULL)
1126 return False;
1128 /* Add/change the pattern set in the list */
1129 for (i=0; i<NPatternSets; i++) {
1130 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1131 freePatternSet(PatternSets[i]);
1132 PatternSets[i] = patSet;
1133 break;
1136 if (i == NPatternSets) {
1137 PatternSets[NPatternSets++] = patSet;
1138 if (NPatternSets > MAX_LANGUAGE_MODES)
1139 return False;
1142 /* if the string ends here, we're done */
1143 inPtr += strspn(inPtr, " \t\n");
1144 if (*inPtr == '\0')
1145 return True;
1150 ** Create a string in the correct format for the highlightPatterns resource,
1151 ** containing all of the highlight pattern information from the stored
1152 ** highlight pattern list (PatternSets) for this NEdit session.
1154 char *WriteHighlightString(void)
1156 char *outStr, *str, *escapedStr;
1157 textBuffer *outBuf;
1158 int psn, written = False;
1159 patternSet *patSet;
1161 outBuf = BufCreate();
1162 for (psn=0; psn<NPatternSets; psn++) {
1163 patSet = PatternSets[psn];
1164 if (patSet->nPatterns == 0)
1165 continue;
1166 written = True;
1167 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1168 BufInsert(outBuf, outBuf->length, ":");
1169 if (isDefaultPatternSet(patSet))
1170 BufInsert(outBuf, outBuf->length, "Default\n\t");
1171 else {
1172 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1173 BufInsert(outBuf, outBuf->length, ":");
1174 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1175 BufInsert(outBuf, outBuf->length, "{\n");
1176 BufInsert(outBuf, outBuf->length,
1177 str = createPatternsString(patSet, "\t\t"));
1178 XtFree(str);
1179 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1183 /* Get the output string, and lop off the trailing newline and tab */
1184 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1185 BufFree(outBuf);
1187 /* Protect newlines and backslashes from translation by the resource
1188 reader */
1189 escapedStr = EscapeSensitiveChars(outStr);
1190 XtFree(outStr);
1191 return escapedStr;
1195 ** Update regular expressions in stored pattern sets to version 5.1 regular
1196 ** expression syntax, in which braces and \0 have different meanings
1198 static void convertOldPatternSet(patternSet *patSet)
1200 int p;
1201 highlightPattern *pattern;
1203 for (p=0; p<patSet->nPatterns; p++) {
1204 pattern = &patSet->patterns[p];
1205 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1206 pattern->name, pattern->flags & COLOR_ONLY);
1207 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1208 pattern->name, pattern->flags & COLOR_ONLY);
1209 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1210 pattern->name, pattern->flags & COLOR_ONLY);
1215 ** Convert a single regular expression, patternRE, to version 5.1 regular
1216 ** expression syntax. It will convert either a match expression or a
1217 ** substitution expression, which must be specified by the setting of
1218 ** isSubsExpr. Error messages are directed to stderr, and include the
1219 ** pattern set name and pattern name as passed in patSetName and patName.
1221 static void convertPatternExpr(char **patternRE, char *patSetName,
1222 char *patName, int isSubsExpr)
1224 char *newRE, *errorText;
1226 if (*patternRE == NULL)
1227 return;
1228 if (isSubsExpr) {
1229 newRE = XtMalloc(strlen(*patternRE) + 5000);
1230 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1231 XtFree(*patternRE);
1232 *patternRE = XtNewString(newRE);
1233 XtFree(newRE);
1234 } else{
1235 newRE = ConvertRE(*patternRE, &errorText);
1236 if (newRE == NULL) {
1237 fprintf(stderr, "NEdit error converting old format regular "
1238 "expression in pattern set %s, pattern %s: %s\n",
1239 patSetName, patName, errorText);
1241 XtFree(*patternRE);
1242 *patternRE = newRE;
1247 ** Find the font (font struct) associated with a named style.
1248 ** This routine must only be called with a valid styleName (call
1249 ** NamedStyleExists to find out whether styleName is valid).
1251 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1253 int styleNo=lookupNamedStyle(styleName),fontNum;
1254 XFontStruct *font;
1256 if (styleNo<0)
1257 return GetDefaultFontStruct(window->fontList);
1258 fontNum = HighlightStyles[styleNo]->font;
1259 if (fontNum == BOLD_FONT)
1260 font = window->boldFontStruct;
1261 else if (fontNum == ITALIC_FONT)
1262 font = window->italicFontStruct;
1263 else if (fontNum == BOLD_ITALIC_FONT)
1264 font = window->boldItalicFontStruct;
1265 else /* fontNum == PLAIN_FONT */
1266 font = GetDefaultFontStruct(window->fontList);
1268 /* If font isn't loaded, silently substitute primary font */
1269 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1272 int FontOfNamedStyleIsBold(char *styleName)
1274 int styleNo=lookupNamedStyle(styleName),fontNum;
1276 if (styleNo<0)
1277 return 0;
1278 fontNum = HighlightStyles[styleNo]->font;
1279 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1282 int FontOfNamedStyleIsItalic(char *styleName)
1284 int styleNo=lookupNamedStyle(styleName),fontNum;
1286 if (styleNo<0)
1287 return 0;
1288 fontNum = HighlightStyles[styleNo]->font;
1289 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1293 ** Find the color associated with a named style. This routine must only be
1294 ** called with a valid styleName (call NamedStyleExists to find out whether
1295 ** styleName is valid).
1297 char *ColorOfNamedStyle(const char *styleName)
1299 int styleNo=lookupNamedStyle(styleName);
1301 if (styleNo<0)
1302 return "black";
1303 return HighlightStyles[styleNo]->color;
1307 ** Find the background color associated with a named style.
1309 char *BgColorOfNamedStyle(const char *styleName)
1311 int styleNo=lookupNamedStyle(styleName);
1313 if (styleNo<0)
1314 return "";
1315 return HighlightStyles[styleNo]->bgColor;
1319 ** Determine whether a named style exists
1321 int NamedStyleExists(const char *styleName)
1323 return lookupNamedStyle(styleName) != -1;
1327 ** Look through the list of pattern sets, and find the one for a particular
1328 ** language. Returns NULL if not found.
1330 patternSet *FindPatternSet(const char *langModeName)
1332 int i;
1334 if (langModeName == NULL)
1335 return NULL;
1337 for (i=0; i<NPatternSets; i++)
1338 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1339 return PatternSets[i];
1340 return NULL;
1345 ** Returns True if there are highlight patterns, or potential patterns
1346 ** not yet committed in the syntax highlighting dialog for a language mode,
1348 int LMHasHighlightPatterns(const char *languageMode)
1350 if (FindPatternSet(languageMode) != NULL)
1351 return True;
1352 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1353 languageMode) && HighlightDialog.nPatterns != 0;
1357 ** Change the language mode name of pattern sets for language "oldName" to
1358 ** "newName" in both the stored patterns, and the pattern set currently being
1359 ** edited in the dialog.
1361 void RenameHighlightPattern(const char *oldName, const char *newName)
1363 int i;
1365 for (i=0; i<NPatternSets; i++) {
1366 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1367 XtFree(PatternSets[i]->languageMode);
1368 PatternSets[i]->languageMode = XtNewString(newName);
1371 if (HighlightDialog.shell != NULL) {
1372 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1373 XtFree(HighlightDialog.langModeName);
1374 HighlightDialog.langModeName = XtNewString(newName);
1380 ** Create a pulldown menu pane with the names of the current highlight styles.
1381 ** XmNuserData for each item contains a pointer to the name.
1383 static Widget createHighlightStylesMenu(Widget parent)
1385 Widget menu;
1386 int i;
1387 XmString s1;
1389 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1390 for (i=0; i<NHighlightStyles; i++) {
1391 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1392 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1393 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1394 XmStringFree(s1);
1396 return menu;
1399 static char *createPatternsString(patternSet *patSet, char *indentStr)
1401 char *outStr, *str;
1402 textBuffer *outBuf;
1403 int pn;
1404 highlightPattern *pat;
1406 outBuf = BufCreate();
1407 for (pn=0; pn<patSet->nPatterns; pn++) {
1408 pat = &patSet->patterns[pn];
1409 BufInsert(outBuf, outBuf->length, indentStr);
1410 BufInsert(outBuf, outBuf->length, pat->name);
1411 BufInsert(outBuf, outBuf->length, ":");
1412 if (pat->startRE != NULL) {
1413 BufInsert(outBuf, outBuf->length,
1414 str=MakeQuotedString(pat->startRE));
1415 XtFree(str);
1417 BufInsert(outBuf, outBuf->length, ":");
1418 if (pat->endRE != NULL) {
1419 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1420 XtFree(str);
1422 BufInsert(outBuf, outBuf->length, ":");
1423 if (pat->errorRE != NULL) {
1424 BufInsert(outBuf, outBuf->length,
1425 str=MakeQuotedString(pat->errorRE));
1426 XtFree(str);
1428 BufInsert(outBuf, outBuf->length, ":");
1429 BufInsert(outBuf, outBuf->length, pat->style);
1430 BufInsert(outBuf, outBuf->length, ":");
1431 if (pat->subPatternOf != NULL)
1432 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1433 BufInsert(outBuf, outBuf->length, ":");
1434 if (pat->flags & DEFER_PARSING)
1435 BufInsert(outBuf, outBuf->length, "D");
1436 if (pat->flags & PARSE_SUBPATS_FROM_START)
1437 BufInsert(outBuf, outBuf->length, "R");
1438 if (pat->flags & COLOR_ONLY)
1439 BufInsert(outBuf, outBuf->length, "C");
1440 BufInsert(outBuf, outBuf->length, "\n");
1442 outStr = BufGetAll(outBuf);
1443 BufFree(outBuf);
1444 return outStr;
1448 ** Read in a pattern set character string, and advance *inPtr beyond it.
1449 ** Returns NULL and outputs an error to stderr on failure.
1451 static patternSet *readPatternSet(char **inPtr, int convertOld)
1453 char *errMsg, *stringStart = *inPtr;
1454 patternSet patSet, *retPatSet;
1456 /* remove leading whitespace */
1457 *inPtr += strspn(*inPtr, " \t\n");
1459 /* read language mode field */
1460 patSet.languageMode = ReadSymbolicField(inPtr);
1461 if (patSet.languageMode == NULL)
1462 return highlightError(stringStart, *inPtr,
1463 "language mode must be specified");
1464 if (!SkipDelimiter(inPtr, &errMsg))
1465 return highlightError(stringStart, *inPtr, errMsg);
1467 /* look for "Default" keyword, and if it's there, return the default
1468 pattern set */
1469 if (!strncmp(*inPtr, "Default", 7)) {
1470 *inPtr += 7;
1471 retPatSet = readDefaultPatternSet(patSet.languageMode);
1472 XtFree(patSet.languageMode);
1473 if (retPatSet == NULL)
1474 return highlightError(stringStart, *inPtr,
1475 "No default pattern set");
1476 return retPatSet;
1479 /* read line context field */
1480 if (!ReadNumericField(inPtr, &patSet.lineContext))
1481 return highlightError(stringStart, *inPtr,
1482 "unreadable line context field");
1483 if (!SkipDelimiter(inPtr, &errMsg))
1484 return highlightError(stringStart, *inPtr, errMsg);
1486 /* read character context field */
1487 if (!ReadNumericField(inPtr, &patSet.charContext))
1488 return highlightError(stringStart, *inPtr,
1489 "unreadable character context field");
1491 /* read pattern list */
1492 patSet.patterns = readHighlightPatterns(inPtr,
1493 True, &errMsg, &patSet.nPatterns);
1494 if (patSet.patterns == NULL)
1495 return highlightError(stringStart, *inPtr, errMsg);
1497 /* pattern set was read correctly, make an allocated copy to return */
1498 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1499 memcpy(retPatSet, &patSet, sizeof(patternSet));
1501 /* Convert pre-5.1 pattern sets which use old regular expression
1502 syntax to quote braces and use & rather than \0 */
1503 if (convertOld)
1504 convertOldPatternSet(retPatSet);
1506 return retPatSet;
1510 ** Parse a set of highlight patterns into an array of highlightPattern
1511 ** structures, and a language mode name. If unsuccessful, returns NULL with
1512 ** (statically allocated) message in "errMsg".
1514 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1515 char **errMsg, int *nPatterns)
1517 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1519 /* skip over blank space */
1520 *inPtr += strspn(*inPtr, " \t\n");
1522 /* look for initial brace */
1523 if (withBraces) {
1524 if (**inPtr != '{') {
1525 *errMsg = "pattern list must begin with \"{\"";
1526 return False;
1528 (*inPtr)++;
1532 ** parse each pattern in the list
1534 pat = patternList;
1535 while (True) {
1536 *inPtr += strspn(*inPtr, " \t\n");
1537 if (**inPtr == '\0') {
1538 if (withBraces) {
1539 *errMsg = "end of pattern list not found";
1540 return NULL;
1541 } else
1542 break;
1543 } else if (**inPtr == '}') {
1544 (*inPtr)++;
1545 break;
1547 if (!readHighlightPattern(inPtr, errMsg, pat++))
1548 return NULL;
1549 if (pat - patternList > MAX_PATTERNS) {
1550 *errMsg = "max number of patterns exceeded\n";
1551 return NULL;
1555 /* allocate a more appropriately sized list to return patterns */
1556 *nPatterns = pat - patternList;
1557 returnedList = (highlightPattern *)XtMalloc(
1558 sizeof(highlightPattern) * *nPatterns);
1559 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1560 return returnedList;
1563 static int readHighlightPattern(char **inPtr, char **errMsg,
1564 highlightPattern *pattern)
1566 /* read the name field */
1567 pattern->name = ReadSymbolicField(inPtr);
1568 if (pattern->name == NULL) {
1569 *errMsg = "pattern name is required";
1570 return False;
1572 if (!SkipDelimiter(inPtr, errMsg))
1573 return False;
1575 /* read the start pattern */
1576 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1577 return False;
1578 if (!SkipDelimiter(inPtr, errMsg))
1579 return False;
1581 /* read the end pattern */
1582 if (**inPtr == ':')
1583 pattern->endRE = NULL;
1584 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1585 return False;
1586 if (!SkipDelimiter(inPtr, errMsg))
1587 return False;
1589 /* read the error pattern */
1590 if (**inPtr == ':')
1591 pattern->errorRE = NULL;
1592 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1593 return False;
1594 if (!SkipDelimiter(inPtr, errMsg))
1595 return False;
1597 /* read the style field */
1598 pattern->style = ReadSymbolicField(inPtr);
1599 if (pattern->style == NULL) {
1600 *errMsg = "style field required in pattern";
1601 return False;
1603 if (!SkipDelimiter(inPtr, errMsg))
1604 return False;
1606 /* read the sub-pattern-of field */
1607 pattern->subPatternOf = ReadSymbolicField(inPtr);
1608 if (!SkipDelimiter(inPtr, errMsg))
1609 return False;
1611 /* read flags field */
1612 pattern->flags = 0;
1613 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1614 if (**inPtr == 'D')
1615 pattern->flags |= DEFER_PARSING;
1616 else if (**inPtr == 'R')
1617 pattern->flags |= PARSE_SUBPATS_FROM_START;
1618 else if (**inPtr == 'C')
1619 pattern->flags |= COLOR_ONLY;
1620 else if (**inPtr != ' ' && **inPtr != '\t') {
1621 *errMsg = "unreadable flag field";
1622 return False;
1625 return True;
1629 ** Given a language mode name, determine if there is a default (built-in)
1630 ** pattern set available for that language mode, and if so, read it and
1631 ** return a new allocated copy of it. The returned pattern set should be
1632 ** freed by the caller with freePatternSet()
1634 static patternSet *readDefaultPatternSet(const char *langModeName)
1636 int i, modeNameLen;
1637 char *strPtr;
1639 modeNameLen = strlen(langModeName);
1640 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1641 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1642 DefaultPatternSets[i][modeNameLen] == ':') {
1643 strPtr = DefaultPatternSets[i];
1644 return readPatternSet(&strPtr, False);
1647 return NULL;
1651 ** Return True if patSet exactly matches one of the default pattern sets
1653 static int isDefaultPatternSet(patternSet *patSet)
1655 patternSet *defaultPatSet;
1656 int retVal;
1658 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1659 if (defaultPatSet == NULL)
1660 return False;
1661 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1662 freePatternSet(defaultPatSet);
1663 return retVal;
1667 ** Short-hand functions for formating and outputing errors for
1669 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1670 const char *message)
1672 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1673 return NULL;
1677 static int styleError(const char *stringStart, const char *stoppedAt,
1678 const char *message)
1680 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1681 return False;
1685 ** Present a dialog for editing highlight style information
1687 void EditHighlightStyles(const char *initialStyle)
1689 #define HS_LIST_RIGHT 60
1690 #define HS_LEFT_MARGIN_POS 1
1691 #define HS_RIGHT_MARGIN_POS 99
1692 #define HS_H_MARGIN 10
1693 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1694 Widget fontBox, sep1, okBtn, applyBtn, dismissBtn;
1695 XmString s1;
1696 int i, ac;
1697 Arg args[20];
1699 /* if the dialog is already displayed, just pop it to the top and return */
1700 if (HSDialog.shell != NULL) {
1701 if (initialStyle != NULL)
1702 setStyleByName(initialStyle);
1703 RaiseShellWindow(HSDialog.shell);
1704 return;
1707 /* Copy the list of highlight style information to one that the user
1708 can freely edit (via the dialog and managed-list code) */
1709 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1710 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1711 for (i=0; i<NHighlightStyles; i++)
1712 HSDialog.highlightStyleList[i] =
1713 copyHighlightStyleRec(HighlightStyles[i]);
1714 HSDialog.nHighlightStyles = NHighlightStyles;
1716 /* Create a form widget in an application shell */
1717 ac = 0;
1718 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1719 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1720 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1721 HSDialog.shell = CreateShellWithBestVis(APP_NAME, APP_CLASS,
1722 applicationShellWidgetClass, TheDisplay, args, ac);
1723 AddSmallIcon(HSDialog.shell);
1724 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1725 HSDialog.shell, XmNautoUnmanage, False,
1726 XmNresizePolicy, XmRESIZE_NONE, NULL);
1727 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1728 AddMotifCloseCallback(HSDialog.shell, hsDismissCB, NULL);
1730 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1731 XmNlabelString, s1=MKSTRING(
1732 "To modify the properties of an existing highlight style, select the name\n\
1733 from the list on the left. Select \"New\" to add a new style to the list."),
1734 XmNmnemonic, 'N',
1735 XmNtopAttachment, XmATTACH_POSITION,
1736 XmNtopPosition, 2,
1737 XmNleftAttachment, XmATTACH_POSITION,
1738 XmNleftPosition, HS_LEFT_MARGIN_POS,
1739 XmNrightAttachment, XmATTACH_POSITION,
1740 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1741 XmStringFree(s1);
1743 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1744 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1745 XmNmnemonic, 'm',
1746 XmNalignment, XmALIGNMENT_BEGINNING,
1747 XmNleftAttachment, XmATTACH_POSITION,
1748 XmNleftPosition, HS_LIST_RIGHT,
1749 XmNtopAttachment, XmATTACH_WIDGET,
1750 XmNtopOffset, HS_H_MARGIN,
1751 XmNtopWidget, topLbl, NULL);
1752 XmStringFree(s1);
1754 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1755 XmNleftAttachment, XmATTACH_POSITION,
1756 XmNleftPosition, HS_LIST_RIGHT,
1757 XmNtopAttachment, XmATTACH_WIDGET,
1758 XmNtopWidget, nameLbl,
1759 XmNrightAttachment, XmATTACH_POSITION,
1760 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1761 RemapDeleteKey(HSDialog.nameW);
1762 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1764 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1765 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1766 XmNmnemonic, 'C',
1767 XmNalignment, XmALIGNMENT_BEGINNING,
1768 XmNleftAttachment, XmATTACH_POSITION,
1769 XmNleftPosition, HS_LIST_RIGHT,
1770 XmNtopAttachment, XmATTACH_WIDGET,
1771 XmNtopOffset, HS_H_MARGIN,
1772 XmNtopWidget, HSDialog.nameW, NULL);
1773 XmStringFree(s1);
1775 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1776 XmNleftAttachment, XmATTACH_POSITION,
1777 XmNleftPosition, HS_LIST_RIGHT,
1778 XmNtopAttachment, XmATTACH_WIDGET,
1779 XmNtopWidget, colorLbl,
1780 XmNrightAttachment, XmATTACH_POSITION,
1781 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1782 RemapDeleteKey(HSDialog.colorW);
1783 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1785 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1786 XmNlabelString,
1787 s1=XmStringCreateSimple("Background Color (optional)"),
1788 XmNmnemonic, 'g',
1789 XmNalignment, XmALIGNMENT_BEGINNING,
1790 XmNleftAttachment, XmATTACH_POSITION,
1791 XmNleftPosition, HS_LIST_RIGHT,
1792 XmNtopAttachment, XmATTACH_WIDGET,
1793 XmNtopOffset, HS_H_MARGIN,
1794 XmNtopWidget, HSDialog.colorW, NULL);
1795 XmStringFree(s1);
1797 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1798 xmTextWidgetClass, form,
1799 XmNleftAttachment, XmATTACH_POSITION,
1800 XmNleftPosition, HS_LIST_RIGHT,
1801 XmNtopAttachment, XmATTACH_WIDGET,
1802 XmNtopWidget, bgColorLbl,
1803 XmNrightAttachment, XmATTACH_POSITION,
1804 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1805 RemapDeleteKey(HSDialog.bgColorW);
1806 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1808 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1809 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1810 XmNalignment, XmALIGNMENT_BEGINNING,
1811 XmNleftAttachment, XmATTACH_POSITION,
1812 XmNleftPosition, HS_LIST_RIGHT,
1813 XmNtopAttachment, XmATTACH_WIDGET,
1814 XmNtopOffset, HS_H_MARGIN,
1815 XmNtopWidget, HSDialog.bgColorW, NULL);
1816 XmStringFree(s1);
1818 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1819 XmNpacking, XmPACK_COLUMN,
1820 XmNnumColumns, 2,
1821 XmNradioBehavior, True,
1822 XmNleftAttachment, XmATTACH_POSITION,
1823 XmNleftPosition, HS_LIST_RIGHT,
1824 XmNtopAttachment, XmATTACH_WIDGET,
1825 XmNtopWidget, fontLbl, NULL);
1826 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1827 xmToggleButtonWidgetClass, fontBox,
1828 XmNset, True,
1829 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1830 XmNmnemonic, 'P', NULL);
1831 XmStringFree(s1);
1832 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1833 xmToggleButtonWidgetClass, fontBox,
1834 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1835 XmNmnemonic, 'B', NULL);
1836 XmStringFree(s1);
1837 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1838 xmToggleButtonWidgetClass, fontBox,
1839 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1840 XmNmnemonic, 'I', NULL);
1841 XmStringFree(s1);
1842 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1843 xmToggleButtonWidgetClass, fontBox,
1844 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1845 XmNmnemonic, 'o', NULL);
1846 XmStringFree(s1);
1848 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1849 XmNlabelString, s1=XmStringCreateSimple("OK"),
1850 XmNleftAttachment, XmATTACH_POSITION,
1851 XmNleftPosition, 10,
1852 XmNrightAttachment, XmATTACH_POSITION,
1853 XmNrightPosition, 30,
1854 XmNbottomAttachment, XmATTACH_POSITION,
1855 XmNbottomPosition, 99, NULL);
1856 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1857 XmStringFree(s1);
1859 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1860 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1861 XmNmnemonic, 'A',
1862 XmNleftAttachment, XmATTACH_POSITION,
1863 XmNleftPosition, 40,
1864 XmNrightAttachment, XmATTACH_POSITION,
1865 XmNrightPosition, 60,
1866 XmNbottomAttachment, XmATTACH_POSITION,
1867 XmNbottomPosition, 99, NULL);
1868 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1869 XmStringFree(s1);
1871 dismissBtn = XtVaCreateManagedWidget("dismiss",xmPushButtonWidgetClass,form,
1872 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
1873 XmNleftAttachment, XmATTACH_POSITION,
1874 XmNleftPosition, 70,
1875 XmNrightAttachment, XmATTACH_POSITION,
1876 XmNrightPosition, 90,
1877 XmNbottomAttachment, XmATTACH_POSITION,
1878 XmNbottomPosition, 99, NULL);
1879 XtAddCallback(dismissBtn, XmNactivateCallback, hsDismissCB, NULL);
1880 XmStringFree(s1);
1882 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1883 XmNleftAttachment, XmATTACH_FORM,
1884 XmNtopAttachment, XmATTACH_WIDGET,
1885 XmNtopWidget, fontBox,
1886 XmNtopOffset, HS_H_MARGIN,
1887 XmNrightAttachment, XmATTACH_FORM,
1888 XmNbottomAttachment, XmATTACH_WIDGET,
1889 XmNbottomWidget, dismissBtn, 0,
1890 XmNbottomOffset, HS_H_MARGIN, NULL);
1892 ac = 0;
1893 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1894 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1895 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1896 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1897 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1898 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1899 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1900 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1901 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1902 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1903 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1904 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1905 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1906 NULL, hsFreeItemCB);
1907 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1909 /* Set initial default button */
1910 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1911 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
1913 /* If there's a suggestion for an initial selection, make it */
1914 if (initialStyle != NULL)
1915 setStyleByName(initialStyle);
1917 /* Handle mnemonic selection of buttons and focus to dialog */
1918 AddDialogMnemonicHandler(form, FALSE);
1920 /* Realize all of the widgets in the new dialog */
1921 RealizeWithoutForcingPosition(HSDialog.shell);
1924 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1926 int i;
1928 for (i=0; i<HSDialog.nHighlightStyles; i++)
1929 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1930 XtFree((char *)HSDialog.highlightStyleList);
1933 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1935 if (!updateHSList())
1936 return;
1938 /* pop down and destroy the dialog */
1939 XtDestroyWidget(HSDialog.shell);
1940 HSDialog.shell = NULL;
1943 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1945 updateHSList();
1948 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData)
1950 /* pop down and destroy the dialog */
1951 XtDestroyWidget(HSDialog.shell);
1952 HSDialog.shell = NULL;
1955 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1956 void *cbArg)
1958 highlightStyleRec *hs;
1960 /* If the dialog is currently displaying the "new" entry and the
1961 fields are empty, that's just fine */
1962 if (oldItem == NULL && hsDialogEmpty())
1963 return NULL;
1965 /* If there are no problems reading the data, just return it */
1966 hs = readHSDialogFields(True);
1967 if (hs != NULL)
1968 return (void *)hs;
1970 /* If there are problems, and the user didn't ask for the fields to be
1971 read, give more warning */
1972 if (!explicitRequest)
1974 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1975 "Discard incomplete entry\nfor current highlight style?",
1976 "Keep", "Discard") == 2)
1978 return oldItem == NULL
1979 ? NULL
1980 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
1984 /* Do readHSDialogFields again without "silent" mode to display warning */
1985 hs = readHSDialogFields(False);
1986 *abort = True;
1987 return NULL;
1990 static void hsSetDisplayedCB(void *item, void *cbArg)
1992 highlightStyleRec *hs = (highlightStyleRec *)item;
1994 if (item == NULL) {
1995 XmTextSetString(HSDialog.nameW, "");
1996 XmTextSetString(HSDialog.colorW, "");
1997 XmTextSetString(HSDialog.bgColorW, "");
1998 XmToggleButtonSetState(HSDialog.plainW, True, False);
1999 XmToggleButtonSetState(HSDialog.boldW, False, False);
2000 XmToggleButtonSetState(HSDialog.italicW, False, False);
2001 XmToggleButtonSetState(HSDialog.boldItalicW, False, False);
2002 } else {
2003 XmTextSetString(HSDialog.nameW, hs->name);
2004 XmTextSetString(HSDialog.colorW, hs->color);
2005 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2006 XmToggleButtonSetState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2007 XmToggleButtonSetState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2008 XmToggleButtonSetState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2009 XmToggleButtonSetState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2010 False);
2014 static void hsFreeItemCB(void *item)
2016 freeHighlightStyleRec((highlightStyleRec *)item);
2019 static highlightStyleRec *readHSDialogFields(int silent)
2021 highlightStyleRec *hs;
2022 Display *display = XtDisplay(HSDialog.shell);
2023 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2024 XColor rgb;
2026 /* Allocate a language mode structure to return */
2027 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2029 /* read the name field */
2030 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2031 "highlight style name", silent);
2032 if (hs->name == NULL) {
2033 XtFree((char *)hs);
2034 return NULL;
2037 if (*hs->name == '\0')
2039 if (!silent)
2041 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2042 "Please specify a name\nfor the highlight style", "Dismiss");
2043 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2045 XtFree(hs->name);
2046 XtFree((char *)hs);
2047 return NULL;
2050 /* read the color field */
2051 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2052 if (hs->color == NULL) {
2053 XtFree(hs->name);
2054 XtFree((char *)hs);
2055 return NULL;
2058 if (*hs->color == '\0')
2060 if (!silent)
2062 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2063 "Please specify a color\nfor the highlight style",
2064 "Dismiss");
2065 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2067 XtFree(hs->name);
2068 XtFree(hs->color);
2069 XtFree((char *)hs);
2070 return NULL;
2073 /* Verify that the color is a valid X color spec */
2074 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2075 &rgb))
2077 if (!silent)
2079 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2080 "Invalid X color specification: %s\n", "Dismiss",
2081 hs->color);
2082 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2084 XtFree(hs->name);
2085 XtFree(hs->color);
2086 XtFree((char *)hs);
2087 return NULL;;
2090 /* read the background color field - this may be empty */
2091 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2092 "bgColor", silent);
2093 if (hs->bgColor && *hs->bgColor == '\0') {
2094 XtFree(hs->bgColor);
2095 hs->bgColor = NULL;
2098 /* Verify that the background color (if present) is a valid X color spec */
2099 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2100 hs->bgColor, &rgb))
2102 if (!silent)
2104 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2105 "Invalid X background color specification: %s\n", "Dismiss",
2106 hs->bgColor);
2107 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2109 XtFree(hs->name);
2110 XtFree(hs->color);
2111 XtFree(hs->bgColor);
2112 XtFree((char *)hs);
2113 return NULL;;
2116 /* read the font buttons */
2117 if (XmToggleButtonGetState(HSDialog.boldW))
2118 hs->font = BOLD_FONT;
2119 else if (XmToggleButtonGetState(HSDialog.italicW))
2120 hs->font = ITALIC_FONT;
2121 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2122 hs->font = BOLD_ITALIC_FONT;
2123 else
2124 hs->font = PLAIN_FONT;
2126 return hs;
2130 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2131 ** it contains.
2133 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2135 highlightStyleRec *newHS;
2137 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2138 newHS->name = XtMalloc(strlen(hs->name)+1);
2139 strcpy(newHS->name, hs->name);
2140 if (hs->color == NULL)
2141 newHS->color = NULL;
2142 else {
2143 newHS->color = XtMalloc(strlen(hs->color)+1);
2144 strcpy(newHS->color, hs->color);
2146 if (hs->bgColor == NULL)
2147 newHS->bgColor = NULL;
2148 else {
2149 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2150 strcpy(newHS->bgColor, hs->bgColor);
2152 newHS->font = hs->font;
2153 return newHS;
2157 ** Free all of the allocated data in a highlightStyleRec, including the
2158 ** structure itself.
2160 static void freeHighlightStyleRec(highlightStyleRec *hs)
2162 XtFree(hs->name);
2163 if (hs->color != NULL)
2164 XtFree(hs->color);
2165 XtFree((char *)hs);
2169 ** Select a particular style in the highlight styles dialog
2171 static void setStyleByName(const char *style)
2173 int i;
2175 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2176 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2177 SelectManagedListItem(HSDialog.managedListW, i);
2178 break;
2184 ** Return True if the fields of the highlight styles dialog are consistent
2185 ** with a blank "New" style in the dialog.
2187 static int hsDialogEmpty(void)
2189 return TextWidgetIsBlank(HSDialog.nameW) &&
2190 TextWidgetIsBlank(HSDialog.colorW) &&
2191 XmToggleButtonGetState(HSDialog.plainW);
2195 ** Apply the changes made in the highlight styles dialog to the stored
2196 ** highlight style information in HighlightStyles
2198 static int updateHSList(void)
2200 WindowInfo *window;
2201 int i;
2203 /* Get the current contents of the dialog fields */
2204 if (!UpdateManagedList(HSDialog.managedListW, True))
2205 return False;
2207 /* Replace the old highlight styles list with the new one from the dialog */
2208 for (i=0; i<NHighlightStyles; i++)
2209 freeHighlightStyleRec(HighlightStyles[i]);
2210 for (i=0; i<HSDialog.nHighlightStyles; i++)
2211 HighlightStyles[i] =
2212 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2213 NHighlightStyles = HSDialog.nHighlightStyles;
2215 /* If a syntax highlighting dialog is up, update its menu */
2216 updateHighlightStyleMenu();
2218 /* Redisplay highlighted windows which use changed style(s) */
2219 for (window=WindowList; window!=NULL; window=window->next)
2220 UpdateHighlightStyles(window);
2222 /* Note that preferences have been changed */
2223 MarkPrefsChanged();
2225 return True;
2229 ** Present a dialog for editing highlight pattern information
2231 void EditHighlightPatterns(WindowInfo *window)
2233 #define BORDER 4
2234 #define LIST_RIGHT 41
2235 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2236 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2237 Widget okBtn, applyBtn, checkBtn, deleteBtn, dismissBtn, helpBtn;
2238 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2239 patternSet *patSet;
2240 XmString s1;
2241 int i, n, nPatterns;
2242 Arg args[20];
2244 /* if the dialog is already displayed, just pop it to the top and return */
2245 if (HighlightDialog.shell != NULL) {
2246 RaiseShellWindow(HighlightDialog.shell);
2247 return;
2250 if (LanguageModeName(0) == NULL)
2252 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2253 "No Language Modes available for syntax highlighting\n"
2254 "Add language modes under Preferenses->Language Modes",
2255 "Dismiss");
2256 return;
2259 /* Decide on an initial language mode */
2260 HighlightDialog.langModeName = XtNewString(
2261 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2262 window->languageMode));
2264 /* Find the associated pattern set (patSet) to edit */
2265 patSet = FindPatternSet(HighlightDialog.langModeName);
2267 /* Copy the list of patterns to one that the user can freely edit */
2268 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2269 sizeof(highlightPattern *) * MAX_PATTERNS);
2270 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2271 for (i=0; i<nPatterns; i++)
2272 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2273 HighlightDialog.nPatterns = nPatterns;
2276 /* Create a form widget in an application shell */
2277 n = 0;
2278 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2279 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2280 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2281 HighlightDialog.shell = CreateShellWithBestVis(APP_NAME, APP_CLASS,
2282 applicationShellWidgetClass, TheDisplay, args, n);
2283 AddSmallIcon(HighlightDialog.shell);
2284 form = XtVaCreateManagedWidget("editHighlightPatterns", xmFormWidgetClass,
2285 HighlightDialog.shell, XmNautoUnmanage, False,
2286 XmNresizePolicy, XmRESIZE_NONE, NULL);
2287 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2288 AddMotifCloseCallback(HighlightDialog.shell, dismissCB, NULL);
2290 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2291 form,
2292 XmNleftAttachment, XmATTACH_POSITION,
2293 XmNleftPosition, 1,
2294 XmNtopAttachment, XmATTACH_POSITION,
2295 XmNtopPosition, 1,
2296 XmNrightAttachment, XmATTACH_POSITION,
2297 XmNrightPosition, 99, NULL);
2299 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2300 NULL);
2301 n = 0;
2302 XtSetArg(args[n], XmNspacing, 0); n++;
2303 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2304 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2305 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2306 XtSetArg(args[n], XmNleftPosition, 50); n++;
2307 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2308 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2309 XtManageChild(lmOptMenu);
2310 HighlightDialog.lmOptMenu = lmOptMenu;
2312 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2313 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2314 XmNmnemonic, 'M',
2315 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2316 XmNalignment, XmALIGNMENT_END,
2317 XmNrightAttachment, XmATTACH_POSITION,
2318 XmNrightPosition, 50,
2319 XmNtopAttachment, XmATTACH_FORM,
2320 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2321 XmNbottomWidget, lmOptMenu, NULL);
2322 XmStringFree(s1);
2324 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2325 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2326 XmNmnemonic, 'A',
2327 XmNrightAttachment, XmATTACH_FORM,
2328 XmNtopAttachment, XmATTACH_FORM, NULL);
2329 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2330 XmStringFree(s1);
2332 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2333 XmNlabelString, s1=XmStringCreateSimple("OK"),
2334 XmNleftAttachment, XmATTACH_POSITION,
2335 XmNleftPosition, 1,
2336 XmNrightAttachment, XmATTACH_POSITION,
2337 XmNrightPosition, 13,
2338 XmNbottomAttachment, XmATTACH_FORM,
2339 XmNbottomOffset, BORDER, NULL);
2340 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2341 XmStringFree(s1);
2343 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2344 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2345 XmNmnemonic, 'y',
2346 XmNleftAttachment, XmATTACH_POSITION,
2347 XmNleftPosition, 13,
2348 XmNrightAttachment, XmATTACH_POSITION,
2349 XmNrightPosition, 26,
2350 XmNbottomAttachment, XmATTACH_FORM,
2351 XmNbottomOffset, BORDER, NULL);
2352 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2353 XmStringFree(s1);
2355 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2356 XmNlabelString, s1=XmStringCreateSimple("Check"),
2357 XmNmnemonic, 'k',
2358 XmNleftAttachment, XmATTACH_POSITION,
2359 XmNleftPosition, 26,
2360 XmNrightAttachment, XmATTACH_POSITION,
2361 XmNrightPosition, 39,
2362 XmNbottomAttachment, XmATTACH_FORM,
2363 XmNbottomOffset, BORDER, NULL);
2364 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2365 XmStringFree(s1);
2367 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2368 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2369 XmNmnemonic, 'D',
2370 XmNleftAttachment, XmATTACH_POSITION,
2371 XmNleftPosition, 39,
2372 XmNrightAttachment, XmATTACH_POSITION,
2373 XmNrightPosition, 52,
2374 XmNbottomAttachment, XmATTACH_FORM,
2375 XmNbottomOffset, BORDER, NULL);
2376 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2377 XmStringFree(s1);
2379 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2380 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2381 XmNmnemonic, 'f',
2382 XmNleftAttachment, XmATTACH_POSITION,
2383 XmNleftPosition, 52,
2384 XmNrightAttachment, XmATTACH_POSITION,
2385 XmNrightPosition, 73,
2386 XmNbottomAttachment, XmATTACH_FORM,
2387 XmNbottomOffset, BORDER, NULL);
2388 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2389 XmStringFree(s1);
2391 dismissBtn = XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass,
2392 form,
2393 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
2394 XmNleftAttachment, XmATTACH_POSITION,
2395 XmNleftPosition, 73,
2396 XmNrightAttachment, XmATTACH_POSITION,
2397 XmNrightPosition, 86,
2398 XmNbottomAttachment, XmATTACH_FORM,
2399 XmNbottomOffset, BORDER, NULL);
2400 XtAddCallback(dismissBtn, XmNactivateCallback, dismissCB, NULL);
2401 XmStringFree(s1);
2403 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2404 form,
2405 XmNlabelString, s1=XmStringCreateSimple("Help"),
2406 XmNmnemonic, 'H',
2407 XmNleftAttachment, XmATTACH_POSITION,
2408 XmNleftPosition, 86,
2409 XmNrightAttachment, XmATTACH_POSITION,
2410 XmNrightPosition, 99,
2411 XmNbottomAttachment, XmATTACH_FORM,
2412 XmNbottomOffset, BORDER, NULL);
2413 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2414 XmStringFree(s1);
2416 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2417 form,
2418 XmNleftAttachment, XmATTACH_POSITION,
2419 XmNleftPosition, 1,
2420 XmNrightAttachment, XmATTACH_POSITION,
2421 XmNrightPosition, 99,
2422 XmNbottomAttachment, XmATTACH_WIDGET,
2423 XmNbottomWidget, okBtn,
2424 XmNbottomOffset, BORDER, NULL);
2425 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2426 contextFrame, NULL);
2427 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2428 XmNlabelString, s1=XmStringCreateSimple(
2429 "Context requirements for incremental re-parsing after changes"),
2430 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2431 XmStringFree(s1);
2433 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2434 xmTextWidgetClass, contextForm,
2435 XmNcolumns, 5,
2436 XmNmaxLength, 12,
2437 XmNleftAttachment, XmATTACH_POSITION,
2438 XmNleftPosition, 15,
2439 XmNrightAttachment, XmATTACH_POSITION,
2440 XmNrightPosition, 25, NULL);
2441 RemapDeleteKey(HighlightDialog.lineContextW);
2443 XtVaCreateManagedWidget("lineContLbl",
2444 xmLabelGadgetClass, contextForm,
2445 XmNlabelString, s1=XmStringCreateSimple("lines"),
2446 XmNmnemonic, 'l',
2447 XmNuserData, HighlightDialog.lineContextW,
2448 XmNalignment, XmALIGNMENT_BEGINNING,
2449 XmNleftAttachment, XmATTACH_WIDGET,
2450 XmNleftWidget, HighlightDialog.lineContextW,
2451 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2452 XmNtopWidget, HighlightDialog.lineContextW,
2453 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2454 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2455 XmStringFree(s1);
2457 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2458 xmTextWidgetClass, contextForm,
2459 XmNcolumns, 5,
2460 XmNmaxLength, 12,
2461 XmNleftAttachment, XmATTACH_POSITION,
2462 XmNleftPosition, 58,
2463 XmNrightAttachment, XmATTACH_POSITION,
2464 XmNrightPosition, 68, NULL);
2465 RemapDeleteKey(HighlightDialog.lineContextW);
2467 XtVaCreateManagedWidget("charContLbl",
2468 xmLabelGadgetClass, contextForm,
2469 XmNlabelString, s1=XmStringCreateSimple("characters"),
2470 XmNmnemonic, 'c',
2471 XmNuserData, HighlightDialog.charContextW,
2472 XmNalignment, XmALIGNMENT_BEGINNING,
2473 XmNleftAttachment, XmATTACH_WIDGET,
2474 XmNleftWidget, HighlightDialog.charContextW,
2475 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2476 XmNtopWidget, HighlightDialog.charContextW,
2477 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2478 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2479 XmStringFree(s1);
2481 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2482 form,
2483 XmNleftAttachment, XmATTACH_POSITION,
2484 XmNleftPosition, 1,
2485 XmNtopAttachment, XmATTACH_WIDGET,
2486 XmNtopWidget, lmForm,
2487 XmNrightAttachment, XmATTACH_POSITION,
2488 XmNrightPosition, 99,
2489 XmNbottomAttachment, XmATTACH_WIDGET,
2490 XmNbottomWidget, contextFrame,
2491 XmNbottomOffset, BORDER, NULL);
2492 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2493 patternsFrame, NULL);
2494 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2495 patternsFrame,
2496 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2497 XmNmnemonic, 'P',
2498 XmNmarginHeight, 0,
2499 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2500 XmStringFree(s1);
2502 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2503 patternsForm,
2504 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2505 XmNmarginHeight, 0,
2506 XmNalignment, XmALIGNMENT_BEGINNING,
2507 XmNleftAttachment, XmATTACH_POSITION,
2508 XmNleftPosition, LIST_RIGHT,
2509 XmNtopAttachment, XmATTACH_FORM, NULL);
2510 XmStringFree(s1);
2512 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2513 patternsForm,
2514 XmNpacking, XmPACK_COLUMN,
2515 XmNradioBehavior, True,
2516 XmNleftAttachment, XmATTACH_POSITION,
2517 XmNleftPosition, LIST_RIGHT,
2518 XmNtopAttachment, XmATTACH_WIDGET,
2519 XmNtopWidget, typeLbl, NULL);
2520 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2521 xmToggleButtonWidgetClass, typeBox,
2522 XmNset, True,
2523 XmNmarginHeight, 0,
2524 XmNlabelString, s1=XmStringCreateSimple(
2525 "Pass-1 (applied to all text when loaded or modified)"),
2526 XmNmnemonic, '1', NULL);
2527 XmStringFree(s1);
2528 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2529 patTypeCB, NULL);
2530 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2531 xmToggleButtonWidgetClass, typeBox,
2532 XmNmarginHeight, 0,
2533 XmNlabelString, s1=XmStringCreateSimple(
2534 "Pass-2 (parsing is deferred until text is exposed)"),
2535 XmNmnemonic, '2', NULL);
2536 XmStringFree(s1);
2537 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2538 patTypeCB, NULL);
2539 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2540 xmToggleButtonWidgetClass, typeBox,
2541 XmNmarginHeight, 0,
2542 XmNlabelString, s1=XmStringCreateSimple(
2543 "Sub-pattern (processed within start & end of parent)"),
2544 XmNmnemonic, 'u', NULL);
2545 XmStringFree(s1);
2546 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2547 patTypeCB, NULL);
2548 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2549 xmToggleButtonWidgetClass, typeBox,
2550 XmNmarginHeight, 0,
2551 XmNlabelString, s1=XmStringCreateSimple(
2552 "Coloring for sub-expressions of parent pattern"),
2553 XmNmnemonic, 'g', NULL);
2554 XmStringFree(s1);
2555 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2556 patTypeCB, NULL);
2558 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2559 xmLabelGadgetClass, patternsForm,
2560 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2561 XmNmarginHeight, 0,
2562 XmNalignment, XmALIGNMENT_BEGINNING,
2563 XmNleftAttachment, XmATTACH_POSITION,
2564 XmNleftPosition, LIST_RIGHT,
2565 XmNtopAttachment, XmATTACH_WIDGET,
2566 XmNtopOffset, BORDER,
2567 XmNtopWidget, typeBox, NULL);
2568 XmStringFree(s1);
2570 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2571 patternsForm,
2572 XmNpacking, XmPACK_COLUMN,
2573 XmNradioBehavior, True,
2574 XmNleftAttachment, XmATTACH_POSITION,
2575 XmNleftPosition, LIST_RIGHT,
2576 XmNtopAttachment, XmATTACH_WIDGET,
2577 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2578 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2579 xmToggleButtonWidgetClass, matchBox,
2580 XmNset, True,
2581 XmNmarginHeight, 0,
2582 XmNlabelString, s1=XmStringCreateSimple(
2583 "Highlight text matching regular expression"),
2584 XmNmnemonic, 'x', NULL);
2585 XmStringFree(s1);
2586 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2587 matchTypeCB, NULL);
2588 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2589 xmToggleButtonWidgetClass, matchBox,
2590 XmNmarginHeight, 0,
2591 XmNlabelString, s1=XmStringCreateSimple(
2592 "Highlight text between starting and ending REs"),
2593 XmNmnemonic, 'b', NULL);
2594 XmStringFree(s1);
2595 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2596 matchTypeCB, NULL);
2598 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2599 patternsForm,
2600 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2601 XmNmnemonic, 'N',
2602 XmNrows, 20,
2603 XmNalignment, XmALIGNMENT_BEGINNING,
2604 XmNleftAttachment, XmATTACH_POSITION,
2605 XmNleftPosition, LIST_RIGHT,
2606 XmNtopAttachment, XmATTACH_WIDGET,
2607 XmNtopWidget, matchBox,
2608 XmNtopOffset, BORDER, NULL);
2609 XmStringFree(s1);
2611 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2612 patternsForm,
2613 XmNleftAttachment, XmATTACH_POSITION,
2614 XmNleftPosition, LIST_RIGHT,
2615 XmNtopAttachment, XmATTACH_WIDGET,
2616 XmNtopWidget, nameLbl,
2617 XmNrightAttachment, XmATTACH_POSITION,
2618 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2619 RemapDeleteKey(HighlightDialog.nameW);
2620 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2622 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2623 xmLabelGadgetClass, patternsForm,
2624 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2625 XmNmnemonic, 't',
2626 XmNrows, 20,
2627 XmNalignment, XmALIGNMENT_BEGINNING,
2628 XmNleftAttachment, XmATTACH_POSITION,
2629 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2630 XmNtopAttachment, XmATTACH_WIDGET,
2631 XmNtopWidget, matchBox,
2632 XmNtopOffset, BORDER, NULL);
2633 XmStringFree(s1);
2635 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2636 xmTextWidgetClass, patternsForm,
2637 XmNleftAttachment, XmATTACH_POSITION,
2638 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2639 XmNtopAttachment, XmATTACH_WIDGET,
2640 XmNtopWidget, HighlightDialog.parentLbl,
2641 XmNrightAttachment, XmATTACH_POSITION,
2642 XmNrightPosition, 99, NULL);
2643 RemapDeleteKey(HighlightDialog.parentW);
2644 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2645 HighlightDialog.parentW, NULL);
2647 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2648 xmLabelGadgetClass, patternsForm,
2649 XmNalignment, XmALIGNMENT_BEGINNING,
2650 XmNmnemonic, 'R',
2651 XmNtopAttachment, XmATTACH_WIDGET,
2652 XmNtopWidget, HighlightDialog.parentW,
2653 XmNtopOffset, BORDER,
2654 XmNleftAttachment, XmATTACH_POSITION,
2655 XmNleftPosition, 1, NULL);
2657 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2658 xmTextWidgetClass, patternsForm,
2659 XmNleftAttachment, XmATTACH_POSITION,
2660 XmNleftPosition, 1,
2661 XmNrightAttachment, XmATTACH_POSITION,
2662 XmNrightPosition, 99,
2663 XmNbottomAttachment, XmATTACH_POSITION,
2664 XmNbottomPosition, 99, NULL);
2665 RemapDeleteKey(HighlightDialog.errorW);
2667 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2668 xmLabelGadgetClass, patternsForm,
2669 XmNlabelString, s1=XmStringCreateSimple(
2670 "Regular Expression Indicating Error in Match (Optional)"),
2671 XmNmnemonic, 'o',
2672 XmNuserData, HighlightDialog.errorW,
2673 XmNalignment, XmALIGNMENT_BEGINNING,
2674 XmNleftAttachment, XmATTACH_POSITION,
2675 XmNleftPosition, 1,
2676 XmNbottomAttachment, XmATTACH_WIDGET,
2677 XmNbottomWidget, HighlightDialog.errorW, NULL);
2678 XmStringFree(s1);
2680 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2681 xmTextWidgetClass, patternsForm,
2682 XmNleftAttachment, XmATTACH_POSITION,
2683 XmNleftPosition, 1,
2684 XmNbottomAttachment, XmATTACH_WIDGET,
2685 XmNbottomWidget, HighlightDialog.errorLbl,
2686 XmNbottomOffset, BORDER,
2687 XmNrightAttachment, XmATTACH_POSITION,
2688 XmNrightPosition, 99, NULL);
2689 RemapDeleteKey(HighlightDialog.endW);
2691 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2692 xmLabelGadgetClass, patternsForm,
2693 XmNmnemonic, 'E',
2694 XmNuserData, HighlightDialog.endW,
2695 XmNalignment, XmALIGNMENT_BEGINNING,
2696 XmNleftAttachment, XmATTACH_POSITION,
2697 XmNleftPosition, 1,
2698 XmNbottomAttachment, XmATTACH_WIDGET,
2699 XmNbottomWidget, HighlightDialog.endW, NULL);
2701 n = 0;
2702 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2703 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2704 XtSetArg(args[n], XmNwordWrap, True); n++;
2705 XtSetArg(args[n], XmNrows, 3); n++;
2706 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2707 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2708 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2709 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2710 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2711 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2712 XtSetArg(args[n], XmNleftPosition, 1); n++;
2713 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2714 XtSetArg(args[n], XmNrightPosition, 99); n++;
2715 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2716 AddMouseWheelSupport(HighlightDialog.startW);
2717 XtManageChild(HighlightDialog.startW);
2718 MakeSingleLineTextW(HighlightDialog.startW);
2719 RemapDeleteKey(HighlightDialog.startW);
2720 XtVaSetValues(HighlightDialog.startLbl,
2721 XmNuserData,HighlightDialog.startW, NULL);
2723 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2724 patternsForm,
2725 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2726 XmNmnemonic, 'i',
2727 XmNrightAttachment, XmATTACH_POSITION,
2728 XmNrightPosition, LIST_RIGHT-1,
2729 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2730 XmNbottomWidget, HighlightDialog.parentW, NULL);
2731 XmStringFree(s1);
2732 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2734 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2735 n = 0;
2736 XtSetArg(args[n], XmNspacing, 0); n++;
2737 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2738 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2739 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2740 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2741 XtSetArg(args[n], XmNleftPosition, 1); n++;
2742 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2743 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2744 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2745 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2746 "styleOptMenu", args, n);
2747 XtManageChild(HighlightDialog.styleOptMenu);
2749 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2750 patternsForm,
2751 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2752 XmNmnemonic, 'S',
2753 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2754 XmNalignment, XmALIGNMENT_BEGINNING,
2755 XmNleftAttachment, XmATTACH_POSITION,
2756 XmNleftPosition, 1,
2757 XmNbottomAttachment, XmATTACH_WIDGET,
2758 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2759 XmStringFree(s1);
2761 n = 0;
2762 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2763 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2764 XtSetArg(args[n], XmNleftPosition, 1); n++;
2765 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2766 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2767 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2768 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2769 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2770 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2771 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2772 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2773 NULL, freeItemCB);
2774 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2776 /* Set initial default button */
2777 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2778 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
2780 /* Handle mnemonic selection of buttons and focus to dialog */
2781 AddDialogMnemonicHandler(form, FALSE);
2783 /* Fill in the dialog information for the selected language mode */
2784 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2785 patSet->lineContext);
2786 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2787 patSet->charContext);
2788 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2789 updateLabels();
2791 /* Realize all of the widgets in the new dialog */
2792 RealizeWithoutForcingPosition(HighlightDialog.shell);
2796 ** If a syntax highlighting dialog is up, ask to have the option menu for
2797 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2799 static void updateHighlightStyleMenu(void)
2801 Widget oldMenu;
2802 int patIndex;
2804 if (HighlightDialog.shell == NULL)
2805 return;
2807 oldMenu = HighlightDialog.stylePulldown;
2808 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2809 XtParent(XtParent(oldMenu)));
2810 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2811 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2812 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2813 if (patIndex == -1)
2814 setStyleMenu("Plain");
2815 else
2816 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2818 XtDestroyWidget(oldMenu);
2822 ** If a syntax highlighting dialog is up, ask to have the option menu for
2823 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2825 void UpdateLanguageModeMenu(void)
2827 Widget oldMenu;
2829 if (HighlightDialog.shell == NULL)
2830 return;
2832 oldMenu = HighlightDialog.lmPulldown;
2833 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2834 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2835 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2836 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2837 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2839 XtDestroyWidget(oldMenu);
2842 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2844 int i;
2846 freeNonNull(HighlightDialog.langModeName);
2847 for (i=0; i<HighlightDialog.nPatterns; i++)
2848 freePatternSrc(HighlightDialog.patterns[i], True);
2849 HighlightDialog.shell = NULL;
2852 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2854 char *modeName;
2855 patternSet *oldPatSet, *newPatSet;
2856 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2857 int i, resp;
2859 /* Get the newly selected mode name. If it's the same, do nothing */
2860 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2861 if (!strcmp(modeName, HighlightDialog.langModeName))
2862 return;
2864 /* Look up the original version of the patterns being edited */
2865 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2866 if (oldPatSet == NULL)
2867 oldPatSet = &emptyPatSet;
2869 /* Get the current information displayed by the dialog. If it's bad,
2870 give the user the chance to throw it out or go back and fix it. If
2871 it has changed, give the user the chance to apply discard or cancel. */
2872 newPatSet = getDialogPatternSet();
2874 if (newPatSet == NULL)
2876 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2877 "Incomplete Language Mode", "Discard incomplete entry\n"
2878 "for current language mode?", "Keep", "Discard") == 1)
2880 SetLangModeMenu(HighlightDialog.lmOptMenu,
2881 HighlightDialog.langModeName);
2882 return;
2884 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2886 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2887 "Apply changes for language mode %s?", "Apply Changes",
2888 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2889 if (resp == 3)
2891 SetLangModeMenu(HighlightDialog.lmOptMenu,
2892 HighlightDialog.langModeName);
2893 return;
2895 if (resp == 1)
2897 updatePatternSet();
2901 if (newPatSet != NULL)
2902 freePatternSet(newPatSet);
2904 /* Free the old dialog information */
2905 freeNonNull(HighlightDialog.langModeName);
2906 for (i=0; i<HighlightDialog.nPatterns; i++)
2907 freePatternSrc(HighlightDialog.patterns[i], True);
2909 /* Fill the dialog with the new language mode information */
2910 HighlightDialog.langModeName = XtNewString(modeName);
2911 newPatSet = FindPatternSet(modeName);
2912 if (newPatSet == NULL) {
2913 HighlightDialog.nPatterns = 0;
2914 SetIntText(HighlightDialog.lineContextW, 1);
2915 SetIntText(HighlightDialog.charContextW, 0);
2916 } else {
2917 for (i=0; i<newPatSet->nPatterns; i++)
2918 HighlightDialog.patterns[i] =
2919 copyPatternSrc(&newPatSet->patterns[i], NULL);
2920 HighlightDialog.nPatterns = newPatSet->nPatterns;
2921 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2922 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2924 ChangeManagedListData(HighlightDialog.managedListW);
2927 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2929 EditLanguageModes();
2932 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2934 Widget selectedItem;
2935 char *style;
2937 XtVaGetValues(HighlightDialog.styleOptMenu,
2938 XmNmenuHistory, &selectedItem,
2939 NULL);
2940 XtVaGetValues(selectedItem,
2941 XmNuserData, &style,
2942 NULL);
2943 EditHighlightStyles(style);
2946 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2948 /* change the patterns */
2949 if (!updatePatternSet())
2950 return;
2952 /* pop down and destroy the dialog */
2953 XtDestroyWidget(HighlightDialog.shell);
2956 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
2958 /* change the patterns */
2959 updatePatternSet();
2962 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
2964 if (checkHighlightDialogData())
2966 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
2967 "Patterns compiled without error", "Dismiss");
2971 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
2973 patternSet *defaultPatSet;
2974 int i, psn;
2976 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
2977 if (defaultPatSet == NULL)
2979 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
2980 "There is no default pattern set\nfor language mode %s",
2981 "Dismiss", HighlightDialog.langModeName);
2982 return;
2985 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
2986 "Are you sure you want to discard\n"
2987 "all changes to syntax highlighting\n"
2988 "patterns for language mode %s?", "Discard", "Cancel",
2989 HighlightDialog.langModeName) == 2)
2991 return;
2994 /* if a stored version of the pattern set exists, replace it, if it
2995 doesn't, add a new one */
2996 for (psn=0; psn<NPatternSets; psn++)
2997 if (!strcmp(HighlightDialog.langModeName,
2998 PatternSets[psn]->languageMode))
2999 break;
3000 if (psn < NPatternSets) {
3001 freePatternSet(PatternSets[psn]);
3002 PatternSets[psn] = defaultPatSet;
3003 } else
3004 PatternSets[NPatternSets++] = defaultPatSet;
3006 /* Free the old dialog information */
3007 for (i=0; i<HighlightDialog.nPatterns; i++)
3008 freePatternSrc(HighlightDialog.patterns[i], True);
3010 /* Update the dialog */
3011 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3012 for (i=0; i<defaultPatSet->nPatterns; i++)
3013 HighlightDialog.patterns[i] =
3014 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3015 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3016 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3017 ChangeManagedListData(HighlightDialog.managedListW);
3020 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3022 int i, psn;
3024 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3025 "Are you sure you want to delete\n"
3026 "syntax highlighting patterns for\n"
3027 "language mode %s?", "Yes, Delete", "Cancel",
3028 HighlightDialog.langModeName) == 2)
3030 return;
3033 /* if a stored version of the pattern set exists, delete it from the list */
3034 for (psn=0; psn<NPatternSets; psn++)
3035 if (!strcmp(HighlightDialog.langModeName,
3036 PatternSets[psn]->languageMode))
3037 break;
3038 if (psn < NPatternSets) {
3039 freePatternSet(PatternSets[psn]);
3040 memmove(&PatternSets[psn], &PatternSets[psn+1],
3041 (NPatternSets-1 - psn) * sizeof(patternSet *));
3042 NPatternSets--;
3045 /* Free the old dialog information */
3046 for (i=0; i<HighlightDialog.nPatterns; i++)
3047 freePatternSrc(HighlightDialog.patterns[i], True);
3049 /* Clear out the dialog */
3050 HighlightDialog.nPatterns = 0;
3051 SetIntText(HighlightDialog.lineContextW, 1);
3052 SetIntText(HighlightDialog.charContextW, 0);
3053 ChangeManagedListData(HighlightDialog.managedListW);
3056 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData)
3058 /* pop down and destroy the dialog */
3059 XtDestroyWidget(HighlightDialog.shell);
3062 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3064 Help(HELP_PATTERNS);
3067 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3069 updateLabels();
3072 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3074 updateLabels();
3077 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3078 void *cbArg)
3080 highlightPattern *pat;
3082 /* If the dialog is currently displaying the "new" entry and the
3083 fields are empty, that's just fine */
3084 if (oldItem == NULL && dialogEmpty())
3085 return NULL;
3087 /* If there are no problems reading the data, just return it */
3088 pat = readDialogFields(True);
3089 if (pat != NULL)
3090 return (void *)pat;
3092 /* If there are problems, and the user didn't ask for the fields to be
3093 read, give more warning */
3094 if (!explicitRequest)
3096 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3097 "Discard incomplete entry\nfor current pattern?", "Keep",
3098 "Discard") == 2)
3100 return oldItem == NULL
3101 ? NULL
3102 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3106 /* Do readDialogFields again without "silent" mode to display warning */
3107 pat = readDialogFields(False);
3108 *abort = True;
3109 return NULL;
3112 static void setDisplayedCB(void *item, void *cbArg)
3114 highlightPattern *pat = (highlightPattern *)item;
3115 int isSubpat, isDeferred, isColorOnly, isRange;
3117 if (item == NULL) {
3118 XmTextSetString(HighlightDialog.nameW, "");
3119 XmTextSetString(HighlightDialog.parentW, "");
3120 XmTextSetString(HighlightDialog.startW, "");
3121 XmTextSetString(HighlightDialog.endW, "");
3122 XmTextSetString(HighlightDialog.errorW, "");
3123 XmToggleButtonSetState(HighlightDialog.topLevelW, True, False);
3124 XmToggleButtonSetState(HighlightDialog.deferredW, False, False);
3125 XmToggleButtonSetState(HighlightDialog.subPatW, False, False);
3126 XmToggleButtonSetState(HighlightDialog.colorPatW, False, False);
3127 XmToggleButtonSetState(HighlightDialog.simpleW, True, False);
3128 XmToggleButtonSetState(HighlightDialog.rangeW, False, False);
3129 setStyleMenu("Plain");
3130 } else {
3131 isSubpat = pat->subPatternOf != NULL;
3132 isDeferred = pat->flags & DEFER_PARSING;
3133 isColorOnly = pat->flags & COLOR_ONLY;
3134 isRange = pat->endRE != NULL;
3135 XmTextSetString(HighlightDialog.nameW, pat->name);
3136 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3137 XmTextSetString(HighlightDialog.startW, pat->startRE);
3138 XmTextSetString(HighlightDialog.endW, pat->endRE);
3139 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3140 XmToggleButtonSetState(HighlightDialog.topLevelW,
3141 !isSubpat && !isDeferred, False);
3142 XmToggleButtonSetState(HighlightDialog.deferredW,
3143 !isSubpat && isDeferred, False);
3144 XmToggleButtonSetState(HighlightDialog.subPatW,
3145 isSubpat && !isColorOnly, False);
3146 XmToggleButtonSetState(HighlightDialog.colorPatW,
3147 isSubpat && isColorOnly, False);
3148 XmToggleButtonSetState(HighlightDialog.simpleW, !isRange, False);
3149 XmToggleButtonSetState(HighlightDialog.rangeW, isRange, False);
3150 setStyleMenu(pat->style);
3152 updateLabels();
3155 static void freeItemCB(void *item)
3157 freePatternSrc((highlightPattern *)item, True);
3161 ** Do a test compile of the patterns currently displayed in the highlight
3162 ** patterns dialog, and display warning dialogs if there are problems
3164 static int checkHighlightDialogData(void)
3166 patternSet *patSet;
3167 int result;
3169 /* Get the pattern information from the dialog */
3170 patSet = getDialogPatternSet();
3171 if (patSet == NULL)
3172 return False;
3174 /* Compile the patterns */
3175 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3176 freePatternSet(patSet);
3177 return result;
3181 ** Update the text field labels and sensitivity of various fields, based on
3182 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3183 ** patterns dialog.
3185 static void updateLabels(void)
3187 char *startLbl, *endLbl;
3188 int endSense, errSense, matchSense, parentSense;
3189 XmString s1;
3191 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3192 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3193 Regular Expression (\\1, &, etc.)";
3194 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3195 Regular Expression";
3196 endSense = True;
3197 errSense = False;
3198 matchSense = False;
3199 parentSense = True;
3200 } else {
3201 endLbl = "Ending Regular Expression";
3202 matchSense = True;
3203 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3204 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3205 startLbl = "Regular Expression to Match";
3206 endSense = False;
3207 errSense = False;
3208 } else {
3209 startLbl = "Starting Regular Expression";
3210 endSense = True;
3211 errSense = True;
3215 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3216 XtSetSensitive(HighlightDialog.parentW, parentSense);
3217 XtSetSensitive(HighlightDialog.endW, endSense);
3218 XtSetSensitive(HighlightDialog.endLbl, endSense);
3219 XtSetSensitive(HighlightDialog.errorW, errSense);
3220 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3221 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3222 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3223 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3224 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3225 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3226 s1=XmStringCreateSimple(startLbl), NULL);
3227 XmStringFree(s1);
3228 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3229 s1=XmStringCreateSimple(endLbl), NULL);
3230 XmStringFree(s1);
3234 ** Set the styles menu in the currently displayed highlight dialog to show
3235 ** a particular style
3237 static void setStyleMenu(const char *styleName)
3239 int i;
3240 Cardinal nItems;
3241 WidgetList items;
3242 Widget selectedItem;
3243 char *itemStyle;
3245 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3246 XmNnumChildren, &nItems, NULL);
3247 if (nItems == 0)
3248 return;
3249 selectedItem = items[0];
3250 for (i=0; i<(int)nItems; i++) {
3251 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3252 if (!strcmp(itemStyle, styleName)) {
3253 selectedItem = items[i];
3254 break;
3257 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3261 ** Read the pattern fields of the highlight dialog, and produce an allocated
3262 ** highlightPattern structure reflecting the contents, or pop up dialogs
3263 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3264 ** dialogs). Returns NULL on error.
3266 static highlightPattern *readDialogFields(int silent)
3268 highlightPattern *pat;
3269 char *inPtr, *outPtr, *style;
3270 Widget selectedItem;
3271 int colorOnly;
3273 /* Allocate a pattern source structure to return, zero out fields
3274 so that the whole pattern can be freed on error with freePatternSrc */
3275 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3276 pat->endRE = NULL;
3277 pat->errorRE = NULL;
3278 pat->style = NULL;
3279 pat->subPatternOf = NULL;
3281 /* read the type buttons */
3282 pat->flags = 0;
3283 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3284 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3285 pat->flags |= DEFER_PARSING;
3286 else if (colorOnly)
3287 pat->flags = COLOR_ONLY;
3289 /* read the name field */
3290 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3291 "highlight pattern name", silent);
3292 if (pat->name == NULL) {
3293 XtFree((char *)pat);
3294 return NULL;
3297 if (*pat->name == '\0')
3299 if (!silent)
3301 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3302 "Please specify a name\nfor the pattern", "Dismiss");
3303 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3305 XtFree(pat->name);
3306 XtFree((char *)pat);
3307 return NULL;
3310 /* read the startRE field */
3311 pat->startRE = XmTextGetString(HighlightDialog.startW);
3312 if (*pat->startRE == '\0')
3314 if (!silent)
3316 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3317 "Please specify a regular\nexpression to match", "Dismiss");
3318 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3320 freePatternSrc(pat, True);
3321 return NULL;
3324 /* Make sure coloring patterns contain only sub-expression references
3325 and put it in replacement regular-expression form */
3326 if (colorOnly)
3328 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3330 if (*inPtr!=' ' && *inPtr!='\t')
3332 *outPtr++ = *inPtr;
3336 *outPtr = '\0';
3337 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3338 || (*pat->startRE != '\\' && *pat->startRE != '&')
3339 || strstr(pat->startRE, "\\\\") != NULL)
3341 if (!silent)
3343 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3344 "The expression field in patterns which specify highlighting for\n"
3345 "a parent, must contain only sub-expression references in regular\n"
3346 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3347 "Expressions and Help -> Syntax Highlighting for more information",
3348 "Dismiss");
3349 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3351 freePatternSrc(pat, True);
3352 return NULL;
3356 /* read the parent field */
3357 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3359 if (TextWidgetIsBlank(HighlightDialog.parentW))
3361 if (!silent)
3363 DialogF(DF_WARN, HighlightDialog.shell, 1,
3364 "Specify Parent Pattern",
3365 "Please specify a parent pattern", "Dismiss");
3366 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3368 freePatternSrc(pat, True);
3369 return NULL;
3371 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3374 /* read the styles option menu */
3375 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3376 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3377 pat->style = XtMalloc(strlen(style) + 1);
3378 strcpy(pat->style, style);
3381 /* read the endRE field */
3382 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3384 pat->endRE = XmTextGetString(HighlightDialog.endW);
3385 if (!colorOnly && *pat->endRE == '\0')
3387 if (!silent)
3389 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3390 "Please specify an ending\nregular expression",
3391 "Dismiss");
3392 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3394 freePatternSrc(pat, True);
3395 return NULL;
3399 /* read the errorRE field */
3400 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3401 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3402 if (*pat->errorRE == '\0') {
3403 XtFree(pat->errorRE);
3404 pat->errorRE = NULL;
3407 return pat;
3411 ** Returns true if the pattern fields of the highlight dialog are set to
3412 ** the default ("New" pattern) state.
3414 static int dialogEmpty(void)
3416 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3417 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3418 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3419 TextWidgetIsBlank(HighlightDialog.parentW) &&
3420 TextWidgetIsBlank(HighlightDialog.startW) &&
3421 TextWidgetIsBlank(HighlightDialog.endW) &&
3422 TextWidgetIsBlank(HighlightDialog.errorW);
3426 ** Update the pattern set being edited in the Syntax Highlighting dialog
3427 ** with the information that the dialog is currently displaying, and
3428 ** apply changes to any window which is currently using the patterns.
3430 static int updatePatternSet(void)
3432 patternSet *patSet;
3433 WindowInfo *window;
3434 int psn;
3436 /* Make sure the patterns are valid and compile */
3437 if (!checkHighlightDialogData())
3438 return False;
3440 /* Get the current data */
3441 patSet = getDialogPatternSet();
3442 if (patSet == NULL)
3443 return False;
3445 /* Find the pattern being modified */
3446 for (psn=0; psn<NPatternSets; psn++)
3447 if (!strcmp(HighlightDialog.langModeName,
3448 PatternSets[psn]->languageMode))
3449 break;
3451 /* If it's a new pattern, add it at the end, otherwise free the
3452 existing pattern set and replace it */
3453 if (psn == NPatternSets) {
3454 PatternSets[NPatternSets++] = patSet;
3455 } else {
3456 freePatternSet(PatternSets[psn]);
3457 PatternSets[psn] = patSet;
3460 /* Find windows that are currently using this pattern set and
3461 re-do the highlighting */
3462 for (window=WindowList; window!=NULL; window=window->next) {
3463 if (window->highlightSyntax &&
3464 window->languageMode != PLAIN_LANGUAGE_MODE) {
3465 if (!strcmp(LanguageModeName(window->languageMode),
3466 patSet->languageMode)) {
3467 StopHighlighting(window);
3468 StartHighlighting(window, True);
3473 /* Note that preferences have been changed */
3474 MarkPrefsChanged();
3476 return True;
3480 ** Get the current information that the user has entered in the syntax
3481 ** highlighting dialog. Return NULL if the data is currently invalid
3483 static patternSet *getDialogPatternSet(void)
3485 int i, lineContext, charContext;
3486 patternSet *patSet;
3488 /* Get the current contents of the "patterns" dialog fields */
3489 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3490 return NULL;
3492 /* Get the line and character context values */
3493 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3494 "context lines", True) != TEXT_READ_OK)
3495 return NULL;
3496 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3497 "context lines", True) != TEXT_READ_OK)
3498 return NULL;
3500 /* Allocate a new pattern set structure and copy the fields read from the
3501 dialog, including the modified pattern list into it */
3502 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3503 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3504 patSet->lineContext = lineContext;
3505 patSet->charContext = charContext;
3506 patSet->nPatterns = HighlightDialog.nPatterns;
3507 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3508 HighlightDialog.nPatterns);
3509 for (i=0; i<HighlightDialog.nPatterns; i++)
3510 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3511 return patSet;
3515 ** Return True if "patSet1" and "patSet2" differ
3517 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3519 int i;
3520 highlightPattern *pat1, *pat2;
3522 if (patSet1->lineContext != patSet2->lineContext)
3523 return True;
3524 if (patSet1->charContext != patSet2->charContext)
3525 return True;
3526 if (patSet1->nPatterns != patSet2->nPatterns)
3527 return True;
3528 for (i=0; i<patSet2->nPatterns; i++) {
3529 pat1 = &patSet1->patterns[i];
3530 pat2 = &patSet2->patterns[i];
3531 if (pat1->flags != pat2->flags)
3532 return True;
3533 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3534 return True;
3535 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3536 return True;
3537 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3538 return True;
3539 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3540 return True;
3541 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3542 return True;
3543 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3544 return True;
3546 return False;
3550 ** Copy a highlight pattern data structure and all of the allocated data
3551 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3552 ** otherwise allocate a new highlightPattern structure and return it as the
3553 ** function value.
3555 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3556 highlightPattern *copyTo)
3558 highlightPattern *newPat;
3560 if (copyTo == NULL)
3561 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3562 else
3563 newPat = copyTo;
3564 newPat->name = XtNewString(pat->name);
3565 newPat->startRE = XtNewString(pat->startRE);
3566 newPat->endRE = XtNewString(pat->endRE);
3567 newPat->errorRE = XtNewString(pat->errorRE);
3568 newPat->style = XtNewString(pat->style);
3569 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3570 newPat->flags = pat->flags;
3571 return newPat;
3574 static void freeNonNull(void *ptr)
3576 if (ptr != NULL)
3577 XtFree((char *)ptr);
3581 ** Free the allocated memory contained in a highlightPattern data structure
3582 ** If "freeStruct" is true, free the structure itself as well.
3584 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3586 XtFree(pat->name);
3587 freeNonNull(pat->startRE);
3588 freeNonNull(pat->endRE);
3589 freeNonNull(pat->errorRE);
3590 freeNonNull(pat->style);
3591 freeNonNull(pat->subPatternOf);
3592 if (freeStruct)
3593 XtFree((char *)pat);
3597 ** Free the allocated memory contained in a patternSet data structure
3598 ** If "freeStruct" is true, free the structure itself as well.
3600 static void freePatternSet(patternSet *p)
3602 int i;
3604 for (i=0; i<p->nPatterns; i++)
3605 freePatternSrc(&p->patterns[i], False);
3606 XtFree(p->languageMode);
3607 XtFree((char *)p->patterns);
3608 XtFree((char *)p);
3611 #if 0
3613 ** Free the allocated memory contained in a patternSet data structure
3614 ** If "freeStruct" is true, free the structure itself as well.
3616 static int lookupNamedPattern(patternSet *p, char *patternName)
3618 int i;
3620 for (i=0; i<p->nPatterns; i++)
3621 if (strcmp(p->patterns[i].name, patternName))
3622 return i;
3623 return -1;
3625 #endif
3628 ** Find the index into the HighlightStyles array corresponding to "styleName".
3629 ** If styleName is not found, return -1.
3631 static int lookupNamedStyle(const char *styleName)
3633 int i;
3635 for (i = 0; i < NHighlightStyles; i++)
3637 if (!strcmp(styleName, HighlightStyles[i]->name))
3639 return i;
3643 return -1;
3647 ** Returns a unique number of a given style name
3649 int IndexOfNamedStyle(const char *styleName)
3651 return lookupNamedStyle(styleName);
3655 ** Write the string representation of int "i" to a static area, and
3656 ** return a pointer to it.
3658 static char *intToStr(int i)
3660 static char outBuf[12];
3662 sprintf(outBuf, "%d", i);
3663 return outBuf;