Propogate colors to new windows on opening (744294)
[nedit.git] / source / highlightData.c
blobc82f7011989f488407d4ebe2fcabe49bc0fa3492
1 static const char CVSID[] = "$Id: highlightData.c,v 1.52 2003/05/25 15:55:36 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 README:\"NEdit Macro syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit@thorstenhau.de\":::Flag::D\n\
545 Comment:\"#\":\"$\"::Comment::\n\
546 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line)>\":::Identifier::\n\
547 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
548 Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
549 Built-in Subrs:\"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern|get_range|get_selection|get_style|kill_calltip|length|list_dialog|max|min|rangeset_(?:create|destroy|add|substract|invert|info|range|includes|set_color|set_mode)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|write_file)>\":::Subroutine::\n\
550 Menu Actions:\"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
551 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\
552 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
553 Braces:\"[{}]\":::Keyword::\n\
554 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
555 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
556 String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
557 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
558 Macro Definition:\"\\w+(?=\\s*\\n?\\s*\\{)\":::Subroutine1::\n\
559 Custom Macro:\"\\w+(?=\\s*\\n?\\s*[\\(])\":::Subroutine1::\n\
560 Variables:\"\\w+\":::Identifier1::D}",
561 "Pascal:1:0{\n\
562 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
563 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
564 String:\"'\":\"'\":\"\\n\":String::D\n\
565 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
566 Parentheses:\"\\(|\\)\":::Keyword::D\n\
567 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
568 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
569 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
570 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
571 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
572 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
573 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
574 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
575 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
576 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
577 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
578 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
579 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
580 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
581 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
582 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
583 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
584 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
585 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\
586 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
587 Assignment:\":=\":::Plain::D\n\
588 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
589 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
590 "Perl:2:0{\n\
591 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
592 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
593 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
594 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\
595 dq here doc content:\".\":::String:dq here doc:\n\
596 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
597 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
598 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
599 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\
600 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
601 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
602 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
603 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\
604 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
605 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
606 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
607 sq here doc content:\".\":::String1:sq here doc:\n\
608 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
609 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
610 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
611 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
612 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
613 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
614 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
615 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
616 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
617 word list content:\".\":::String1:word list:\n\
618 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
619 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
620 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
621 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\
622 bq here doc content:\".\":::String1:bq here doc:\n\
623 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
624 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
625 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\
626 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
627 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
628 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\
629 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
630 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
631 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
632 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
633 comment:\"#\":\"$\"::Comment::\n\
634 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
635 label identifier:\"\\2\\5\":::Label:label:C\n\
636 label keyword:\"\\3\\6\":::Keyword:label:C\n\
637 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\
638 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
639 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
640 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
641 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
642 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
643 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
644 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
645 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
646 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
647 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
648 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
649 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
650 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
651 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\
652 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
653 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\
654 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
655 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
656 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
657 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
658 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
659 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
660 end token delim:\"&\":::Preprocessor:end token:C\n\
661 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
662 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
663 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
664 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
665 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
666 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
667 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
668 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\
669 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
670 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
671 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
672 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
673 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
674 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
675 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
676 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
677 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
678 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
679 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\
680 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
681 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
682 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
683 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
684 "PostScript:1:0{\n\
685 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
686 Comment:\"%\":\"$\"::Comment::\n\
687 string:\"\\(\":\"\\)\"::String::\n\
688 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
689 string2:\"\\(\":\"\\)\"::String:string:\n\
690 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
691 string3:\"\\(\":\"\\)\"::String:string2:\n\
692 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
693 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
694 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
695 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
696 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
697 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\
698 Array:\"[\\[\\]]\":::Storage Type::D\n\
699 Procedure:\"[{}]\":::Subroutine::D\n\
700 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\
701 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\
702 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\
703 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
704 "Python:2:0{\n\
705 Comment:\"#\":\"$\"::Comment::\n\
706 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
707 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
708 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
709 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
710 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\
711 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\
712 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\
713 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\
714 Representation:\"`\":\"`\":\"$\":String2::\n\
715 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
716 Number:\"(?<!\\Y)(?:(?:(?:[1-9]\\d*|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[eE][\\-+]?\\d+|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[jJ]?|(?:[1-9]\\d*|0)[jJ]|(?:0|[1-9]\\d*|0[0-7]+|0[xX][\\da-fA-F]+)[lL]?)(?!\\Y)\":::Numeric Const::\n\
717 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
718 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
719 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\
720 Member def color:\"\\1\":::Keyword:Member definition:C\n\
721 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
722 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
723 Member def error:\"\\7\":::Flag:Member definition:C\n\
724 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
725 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
726 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
727 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\
728 Function def color:\"\\1\":::Keyword:Function definition:C\n\
729 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
730 Function def error:\"\\3\":::Flag:Function definition:C\n\
731 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\
732 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
733 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
734 Class def error:\"\\3\":::Flag:Class definition:C\n\
735 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\
736 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
737 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
738 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
739 Member ref error:\"\\8\":::Flag:Member reference:C\n\
740 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
741 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\
742 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\
743 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
744 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\
745 Built-in warnings:\"<(?:DeprecationWarning|OverflowWarning|RuntimeWarning|SyntaxWarning|UserWarning|Warning)>\":::Identifier1::\n\
746 Braces and parens:\"[[{()}\\]]\":::Keyword::D}",
747 "Regex:1:0{\n\
748 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
749 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
750 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
751 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
752 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
753 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\
754 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
755 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\
756 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
757 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
758 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
759 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
760 "SGML HTML:6:0{\n\
761 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
762 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
763 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
764 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
765 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\
766 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
767 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
768 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
769 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
770 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
771 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
772 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
773 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
774 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
775 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
776 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
777 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
778 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
779 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
780 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
781 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
782 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
783 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
784 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
785 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
786 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
787 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
788 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
789 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
790 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
791 "SQL:1:0{\n\
792 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
793 comment:\"--\":\"$\"::Comment::\n\
794 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
795 string:\"'\":\"'\"::String::\n\
796 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\
797 comment2:\"/\\*\":\"\\*/\"::Comment::}",
798 "Sh Ksh Bash:1:0{\n\
799 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
800 single quoted string:\"'\":\"'\"::String1::\n\
801 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
802 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
803 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
804 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
805 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
806 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
807 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
808 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
809 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
810 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
811 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
812 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
813 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
814 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
815 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
816 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
817 command substitution:\"`\":\"`\"::Subroutine::\n\
818 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
819 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
820 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
821 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
822 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
823 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
824 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
825 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
826 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
827 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
828 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
829 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
830 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
831 comments in line:\"#\":\"$\"::Comment::\n\
832 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
833 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
834 command options:\"[ \\t]-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
835 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
836 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}",
837 "Tcl:1:0{\n\
838 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
839 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
840 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
841 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
842 Comment:\"#\":\"$\"::Comment::\n\
843 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\
844 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\
845 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
846 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
847 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
848 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
849 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
850 Namespace:\"\\w+::\":::Keyword::}",
851 "VHDL:1:0{\n\
852 Comments:\"--\":\"$\"::Comment::\n\
853 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
854 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
855 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
856 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
857 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
858 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
859 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\
860 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
861 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
862 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
863 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
864 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
865 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
866 "Verilog:1:0{\n\
867 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
868 cplus comment:\"//\":\"$\"::Comment::\n\
869 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
870 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
871 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\
872 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\
873 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
874 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\
875 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
876 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
877 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
878 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
879 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
880 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
881 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
882 "XML:1:0{\n\
883 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
884 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
885 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
886 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
887 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
888 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
889 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
890 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
891 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
892 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
893 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
894 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
895 doctype root element:\"\\2\":::Identifier:doctype:C\n\
896 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
897 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
898 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
899 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
900 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
901 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
902 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
903 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
904 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
905 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
906 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
907 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
908 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
909 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
910 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
911 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
912 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
913 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
914 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
915 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
916 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
917 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
918 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
919 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
920 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
921 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
922 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
923 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
924 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
925 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
926 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
927 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
928 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
929 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
930 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
931 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
932 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
933 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
934 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
935 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
936 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
937 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
938 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
939 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
940 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
941 element name:\"\\2\":::Identifier:element:C\n\
942 element assign:\"=\":::Keyword:element:\n\
943 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
944 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
945 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
946 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
947 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
948 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
949 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
950 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
951 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
952 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
953 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
954 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
955 "X Resources:2:0{\n\
956 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
957 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
958 Comment:\"^\\s*!\":\"$\"::Comment::\n\
959 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
960 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
961 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
962 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
963 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
964 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
965 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
966 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
967 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
968 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
969 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
970 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
971 Free Text:\"^.*$\":::Flag::}",
972 "Yacc:1:0{\n\
973 comment:\"/\\*\":\"\\*/\"::Comment::\n\
974 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
975 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
976 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
977 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
978 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
979 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
980 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\
981 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\
982 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
983 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
984 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\
985 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
986 braces:\"[{}]\":::Keyword::D\n\
987 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
988 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
993 ** Read a string (from the value of the styles resource) containing highlight
994 ** styles information, parse it, and load it into the stored highlight style
995 ** list (HighlightStyles) for this NEdit session.
997 int LoadStylesString(char *inString)
999 char *errMsg, *fontStr;
1000 char *inPtr = inString;
1001 highlightStyleRec *hs;
1002 int i;
1004 for (;;) {
1006 /* skip over blank space */
1007 inPtr += strspn(inPtr, " \t");
1009 /* Allocate a language mode structure in which to store the info. */
1010 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1012 /* read style name */
1013 hs->name = ReadSymbolicField(&inPtr);
1014 if (hs->name == NULL)
1015 return styleError(inString,inPtr, "style name required");
1016 if (!SkipDelimiter(&inPtr, &errMsg)) {
1017 XtFree(hs->name);
1018 XtFree((char *)hs);
1019 return styleError(inString,inPtr, errMsg);
1022 /* read color */
1023 hs->color = ReadSymbolicField(&inPtr);
1024 if (hs->color == NULL) {
1025 XtFree(hs->name);
1026 XtFree((char *)hs);
1027 return styleError(inString,inPtr, "color name required");
1029 hs->bgColor = NULL;
1030 if (SkipOptSeparator('/', &inPtr, &errMsg)) {
1031 /* read bgColor */
1032 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1034 if (!SkipDelimiter(&inPtr, &errMsg)) {
1035 freeHighlightStyleRec(hs);
1036 return styleError(inString,inPtr, errMsg);
1039 /* read the font type */
1040 fontStr = ReadSymbolicField(&inPtr);
1041 for (i=0; i<N_FONT_TYPES; i++) {
1042 if (!strcmp(FontTypeNames[i], fontStr)) {
1043 hs->font = i;
1044 break;
1047 if (i == N_FONT_TYPES) {
1048 XtFree(fontStr);
1049 freeHighlightStyleRec(hs);
1050 return styleError(inString, inPtr, "unrecognized font type");
1052 XtFree(fontStr);
1054 /* pattern set was read correctly, add/change it in the list */
1055 for (i=0; i<NHighlightStyles; i++) {
1056 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1057 freeHighlightStyleRec(HighlightStyles[i]);
1058 HighlightStyles[i] = hs;
1059 break;
1062 if (i == NHighlightStyles) {
1063 HighlightStyles[NHighlightStyles++] = hs;
1064 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1065 return styleError(inString, inPtr,
1066 "maximum allowable number of styles exceeded");
1069 /* if the string ends here, we're done */
1070 inPtr += strspn(inPtr, " \t\n");
1071 if (*inPtr == '\0')
1072 return True;
1077 ** Create a string in the correct format for the styles resource, containing
1078 ** all of the highlight styles information from the stored highlight style
1079 ** list (HighlightStyles) for this NEdit session.
1081 char *WriteStylesString(void)
1083 int i;
1084 char *outStr;
1085 textBuffer *outBuf;
1086 highlightStyleRec *style;
1088 outBuf = BufCreate();
1089 for (i=0; i<NHighlightStyles; i++) {
1090 style = HighlightStyles[i];
1091 BufInsert(outBuf, outBuf->length, "\t");
1092 BufInsert(outBuf, outBuf->length, style->name);
1093 BufInsert(outBuf, outBuf->length, ":");
1094 BufInsert(outBuf, outBuf->length, style->color);
1095 if (style->bgColor) {
1096 BufInsert(outBuf, outBuf->length, "/");
1097 BufInsert(outBuf, outBuf->length, style->bgColor);
1099 BufInsert(outBuf, outBuf->length, ":");
1100 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1101 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1104 /* Get the output, and lop off the trailing newlines */
1105 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1106 BufFree(outBuf);
1107 return outStr;
1111 ** Read a string representing highlight pattern sets and add them
1112 ** to the PatternSets list of loaded highlight patterns. Note that the
1113 ** patterns themselves are not parsed until they are actually used.
1115 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1116 ** that they may contain regular expressions are of the older syntax where
1117 ** braces were not quoted, and \0 was a legal substitution character).
1119 int LoadHighlightString(char *inString, int convertOld)
1121 char *inPtr = inString;
1122 patternSet *patSet;
1123 int i;
1125 for (;;) {
1127 /* Read each pattern set, abort on error */
1128 patSet = readPatternSet(&inPtr, convertOld);
1129 if (patSet == NULL)
1130 return False;
1132 /* Add/change the pattern set in the list */
1133 for (i=0; i<NPatternSets; i++) {
1134 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1135 freePatternSet(PatternSets[i]);
1136 PatternSets[i] = patSet;
1137 break;
1140 if (i == NPatternSets) {
1141 PatternSets[NPatternSets++] = patSet;
1142 if (NPatternSets > MAX_LANGUAGE_MODES)
1143 return False;
1146 /* if the string ends here, we're done */
1147 inPtr += strspn(inPtr, " \t\n");
1148 if (*inPtr == '\0')
1149 return True;
1154 ** Create a string in the correct format for the highlightPatterns resource,
1155 ** containing all of the highlight pattern information from the stored
1156 ** highlight pattern list (PatternSets) for this NEdit session.
1158 char *WriteHighlightString(void)
1160 char *outStr, *str, *escapedStr;
1161 textBuffer *outBuf;
1162 int psn, written = False;
1163 patternSet *patSet;
1165 outBuf = BufCreate();
1166 for (psn=0; psn<NPatternSets; psn++) {
1167 patSet = PatternSets[psn];
1168 if (patSet->nPatterns == 0)
1169 continue;
1170 written = True;
1171 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1172 BufInsert(outBuf, outBuf->length, ":");
1173 if (isDefaultPatternSet(patSet))
1174 BufInsert(outBuf, outBuf->length, "Default\n\t");
1175 else {
1176 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1177 BufInsert(outBuf, outBuf->length, ":");
1178 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1179 BufInsert(outBuf, outBuf->length, "{\n");
1180 BufInsert(outBuf, outBuf->length,
1181 str = createPatternsString(patSet, "\t\t"));
1182 XtFree(str);
1183 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1187 /* Get the output string, and lop off the trailing newline and tab */
1188 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1189 BufFree(outBuf);
1191 /* Protect newlines and backslashes from translation by the resource
1192 reader */
1193 escapedStr = EscapeSensitiveChars(outStr);
1194 XtFree(outStr);
1195 return escapedStr;
1199 ** Update regular expressions in stored pattern sets to version 5.1 regular
1200 ** expression syntax, in which braces and \0 have different meanings
1202 static void convertOldPatternSet(patternSet *patSet)
1204 int p;
1205 highlightPattern *pattern;
1207 for (p=0; p<patSet->nPatterns; p++) {
1208 pattern = &patSet->patterns[p];
1209 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1210 pattern->name, pattern->flags & COLOR_ONLY);
1211 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1212 pattern->name, pattern->flags & COLOR_ONLY);
1213 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1214 pattern->name, pattern->flags & COLOR_ONLY);
1219 ** Convert a single regular expression, patternRE, to version 5.1 regular
1220 ** expression syntax. It will convert either a match expression or a
1221 ** substitution expression, which must be specified by the setting of
1222 ** isSubsExpr. Error messages are directed to stderr, and include the
1223 ** pattern set name and pattern name as passed in patSetName and patName.
1225 static void convertPatternExpr(char **patternRE, char *patSetName,
1226 char *patName, int isSubsExpr)
1228 char *newRE, *errorText;
1230 if (*patternRE == NULL)
1231 return;
1232 if (isSubsExpr) {
1233 newRE = XtMalloc(strlen(*patternRE) + 5000);
1234 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1235 XtFree(*patternRE);
1236 *patternRE = XtNewString(newRE);
1237 XtFree(newRE);
1238 } else{
1239 newRE = ConvertRE(*patternRE, &errorText);
1240 if (newRE == NULL) {
1241 fprintf(stderr, "NEdit error converting old format regular "
1242 "expression in pattern set %s, pattern %s: %s\n",
1243 patSetName, patName, errorText);
1245 XtFree(*patternRE);
1246 *patternRE = newRE;
1251 ** Find the font (font struct) associated with a named style.
1252 ** This routine must only be called with a valid styleName (call
1253 ** NamedStyleExists to find out whether styleName is valid).
1255 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1257 int styleNo=lookupNamedStyle(styleName),fontNum;
1258 XFontStruct *font;
1260 if (styleNo<0)
1261 return GetDefaultFontStruct(window->fontList);
1262 fontNum = HighlightStyles[styleNo]->font;
1263 if (fontNum == BOLD_FONT)
1264 font = window->boldFontStruct;
1265 else if (fontNum == ITALIC_FONT)
1266 font = window->italicFontStruct;
1267 else if (fontNum == BOLD_ITALIC_FONT)
1268 font = window->boldItalicFontStruct;
1269 else /* fontNum == PLAIN_FONT */
1270 font = GetDefaultFontStruct(window->fontList);
1272 /* If font isn't loaded, silently substitute primary font */
1273 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1276 int FontOfNamedStyleIsBold(char *styleName)
1278 int styleNo=lookupNamedStyle(styleName),fontNum;
1280 if (styleNo<0)
1281 return 0;
1282 fontNum = HighlightStyles[styleNo]->font;
1283 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1286 int FontOfNamedStyleIsItalic(char *styleName)
1288 int styleNo=lookupNamedStyle(styleName),fontNum;
1290 if (styleNo<0)
1291 return 0;
1292 fontNum = HighlightStyles[styleNo]->font;
1293 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1297 ** Find the color associated with a named style. This routine must only be
1298 ** called with a valid styleName (call NamedStyleExists to find out whether
1299 ** styleName is valid).
1301 char *ColorOfNamedStyle(const char *styleName)
1303 int styleNo=lookupNamedStyle(styleName);
1305 if (styleNo<0)
1306 return "black";
1307 return HighlightStyles[styleNo]->color;
1311 ** Find the background color associated with a named style.
1313 char *BgColorOfNamedStyle(const char *styleName)
1315 int styleNo=lookupNamedStyle(styleName);
1317 if (styleNo<0)
1318 return "";
1319 return HighlightStyles[styleNo]->bgColor;
1323 ** Determine whether a named style exists
1325 int NamedStyleExists(const char *styleName)
1327 return lookupNamedStyle(styleName) != -1;
1331 ** Look through the list of pattern sets, and find the one for a particular
1332 ** language. Returns NULL if not found.
1334 patternSet *FindPatternSet(const char *langModeName)
1336 int i;
1338 if (langModeName == NULL)
1339 return NULL;
1341 for (i=0; i<NPatternSets; i++)
1342 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1343 return PatternSets[i];
1344 return NULL;
1349 ** Returns True if there are highlight patterns, or potential patterns
1350 ** not yet committed in the syntax highlighting dialog for a language mode,
1352 int LMHasHighlightPatterns(const char *languageMode)
1354 if (FindPatternSet(languageMode) != NULL)
1355 return True;
1356 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1357 languageMode) && HighlightDialog.nPatterns != 0;
1361 ** Change the language mode name of pattern sets for language "oldName" to
1362 ** "newName" in both the stored patterns, and the pattern set currently being
1363 ** edited in the dialog.
1365 void RenameHighlightPattern(const char *oldName, const char *newName)
1367 int i;
1369 for (i=0; i<NPatternSets; i++) {
1370 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1371 XtFree(PatternSets[i]->languageMode);
1372 PatternSets[i]->languageMode = XtNewString(newName);
1375 if (HighlightDialog.shell != NULL) {
1376 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1377 XtFree(HighlightDialog.langModeName);
1378 HighlightDialog.langModeName = XtNewString(newName);
1384 ** Create a pulldown menu pane with the names of the current highlight styles.
1385 ** XmNuserData for each item contains a pointer to the name.
1387 static Widget createHighlightStylesMenu(Widget parent)
1389 Widget menu;
1390 int i;
1391 XmString s1;
1393 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1394 for (i=0; i<NHighlightStyles; i++) {
1395 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1396 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1397 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1398 XmStringFree(s1);
1400 return menu;
1403 static char *createPatternsString(patternSet *patSet, char *indentStr)
1405 char *outStr, *str;
1406 textBuffer *outBuf;
1407 int pn;
1408 highlightPattern *pat;
1410 outBuf = BufCreate();
1411 for (pn=0; pn<patSet->nPatterns; pn++) {
1412 pat = &patSet->patterns[pn];
1413 BufInsert(outBuf, outBuf->length, indentStr);
1414 BufInsert(outBuf, outBuf->length, pat->name);
1415 BufInsert(outBuf, outBuf->length, ":");
1416 if (pat->startRE != NULL) {
1417 BufInsert(outBuf, outBuf->length,
1418 str=MakeQuotedString(pat->startRE));
1419 XtFree(str);
1421 BufInsert(outBuf, outBuf->length, ":");
1422 if (pat->endRE != NULL) {
1423 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1424 XtFree(str);
1426 BufInsert(outBuf, outBuf->length, ":");
1427 if (pat->errorRE != NULL) {
1428 BufInsert(outBuf, outBuf->length,
1429 str=MakeQuotedString(pat->errorRE));
1430 XtFree(str);
1432 BufInsert(outBuf, outBuf->length, ":");
1433 BufInsert(outBuf, outBuf->length, pat->style);
1434 BufInsert(outBuf, outBuf->length, ":");
1435 if (pat->subPatternOf != NULL)
1436 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1437 BufInsert(outBuf, outBuf->length, ":");
1438 if (pat->flags & DEFER_PARSING)
1439 BufInsert(outBuf, outBuf->length, "D");
1440 if (pat->flags & PARSE_SUBPATS_FROM_START)
1441 BufInsert(outBuf, outBuf->length, "R");
1442 if (pat->flags & COLOR_ONLY)
1443 BufInsert(outBuf, outBuf->length, "C");
1444 BufInsert(outBuf, outBuf->length, "\n");
1446 outStr = BufGetAll(outBuf);
1447 BufFree(outBuf);
1448 return outStr;
1452 ** Read in a pattern set character string, and advance *inPtr beyond it.
1453 ** Returns NULL and outputs an error to stderr on failure.
1455 static patternSet *readPatternSet(char **inPtr, int convertOld)
1457 char *errMsg, *stringStart = *inPtr;
1458 patternSet patSet, *retPatSet;
1460 /* remove leading whitespace */
1461 *inPtr += strspn(*inPtr, " \t\n");
1463 /* read language mode field */
1464 patSet.languageMode = ReadSymbolicField(inPtr);
1465 if (patSet.languageMode == NULL)
1466 return highlightError(stringStart, *inPtr,
1467 "language mode must be specified");
1468 if (!SkipDelimiter(inPtr, &errMsg))
1469 return highlightError(stringStart, *inPtr, errMsg);
1471 /* look for "Default" keyword, and if it's there, return the default
1472 pattern set */
1473 if (!strncmp(*inPtr, "Default", 7)) {
1474 *inPtr += 7;
1475 retPatSet = readDefaultPatternSet(patSet.languageMode);
1476 XtFree(patSet.languageMode);
1477 if (retPatSet == NULL)
1478 return highlightError(stringStart, *inPtr,
1479 "No default pattern set");
1480 return retPatSet;
1483 /* read line context field */
1484 if (!ReadNumericField(inPtr, &patSet.lineContext))
1485 return highlightError(stringStart, *inPtr,
1486 "unreadable line context field");
1487 if (!SkipDelimiter(inPtr, &errMsg))
1488 return highlightError(stringStart, *inPtr, errMsg);
1490 /* read character context field */
1491 if (!ReadNumericField(inPtr, &patSet.charContext))
1492 return highlightError(stringStart, *inPtr,
1493 "unreadable character context field");
1495 /* read pattern list */
1496 patSet.patterns = readHighlightPatterns(inPtr,
1497 True, &errMsg, &patSet.nPatterns);
1498 if (patSet.patterns == NULL)
1499 return highlightError(stringStart, *inPtr, errMsg);
1501 /* pattern set was read correctly, make an allocated copy to return */
1502 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1503 memcpy(retPatSet, &patSet, sizeof(patternSet));
1505 /* Convert pre-5.1 pattern sets which use old regular expression
1506 syntax to quote braces and use & rather than \0 */
1507 if (convertOld)
1508 convertOldPatternSet(retPatSet);
1510 return retPatSet;
1514 ** Parse a set of highlight patterns into an array of highlightPattern
1515 ** structures, and a language mode name. If unsuccessful, returns NULL with
1516 ** (statically allocated) message in "errMsg".
1518 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1519 char **errMsg, int *nPatterns)
1521 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1523 /* skip over blank space */
1524 *inPtr += strspn(*inPtr, " \t\n");
1526 /* look for initial brace */
1527 if (withBraces) {
1528 if (**inPtr != '{') {
1529 *errMsg = "pattern list must begin with \"{\"";
1530 return False;
1532 (*inPtr)++;
1536 ** parse each pattern in the list
1538 pat = patternList;
1539 while (True) {
1540 *inPtr += strspn(*inPtr, " \t\n");
1541 if (**inPtr == '\0') {
1542 if (withBraces) {
1543 *errMsg = "end of pattern list not found";
1544 return NULL;
1545 } else
1546 break;
1547 } else if (**inPtr == '}') {
1548 (*inPtr)++;
1549 break;
1551 if (!readHighlightPattern(inPtr, errMsg, pat++))
1552 return NULL;
1553 if (pat - patternList > MAX_PATTERNS) {
1554 *errMsg = "max number of patterns exceeded\n";
1555 return NULL;
1559 /* allocate a more appropriately sized list to return patterns */
1560 *nPatterns = pat - patternList;
1561 returnedList = (highlightPattern *)XtMalloc(
1562 sizeof(highlightPattern) * *nPatterns);
1563 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1564 return returnedList;
1567 static int readHighlightPattern(char **inPtr, char **errMsg,
1568 highlightPattern *pattern)
1570 /* read the name field */
1571 pattern->name = ReadSymbolicField(inPtr);
1572 if (pattern->name == NULL) {
1573 *errMsg = "pattern name is required";
1574 return False;
1576 if (!SkipDelimiter(inPtr, errMsg))
1577 return False;
1579 /* read the start pattern */
1580 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1581 return False;
1582 if (!SkipDelimiter(inPtr, errMsg))
1583 return False;
1585 /* read the end pattern */
1586 if (**inPtr == ':')
1587 pattern->endRE = NULL;
1588 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1589 return False;
1590 if (!SkipDelimiter(inPtr, errMsg))
1591 return False;
1593 /* read the error pattern */
1594 if (**inPtr == ':')
1595 pattern->errorRE = NULL;
1596 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1597 return False;
1598 if (!SkipDelimiter(inPtr, errMsg))
1599 return False;
1601 /* read the style field */
1602 pattern->style = ReadSymbolicField(inPtr);
1603 if (pattern->style == NULL) {
1604 *errMsg = "style field required in pattern";
1605 return False;
1607 if (!SkipDelimiter(inPtr, errMsg))
1608 return False;
1610 /* read the sub-pattern-of field */
1611 pattern->subPatternOf = ReadSymbolicField(inPtr);
1612 if (!SkipDelimiter(inPtr, errMsg))
1613 return False;
1615 /* read flags field */
1616 pattern->flags = 0;
1617 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1618 if (**inPtr == 'D')
1619 pattern->flags |= DEFER_PARSING;
1620 else if (**inPtr == 'R')
1621 pattern->flags |= PARSE_SUBPATS_FROM_START;
1622 else if (**inPtr == 'C')
1623 pattern->flags |= COLOR_ONLY;
1624 else if (**inPtr != ' ' && **inPtr != '\t') {
1625 *errMsg = "unreadable flag field";
1626 return False;
1629 return True;
1633 ** Given a language mode name, determine if there is a default (built-in)
1634 ** pattern set available for that language mode, and if so, read it and
1635 ** return a new allocated copy of it. The returned pattern set should be
1636 ** freed by the caller with freePatternSet()
1638 static patternSet *readDefaultPatternSet(const char *langModeName)
1640 int i, modeNameLen;
1641 char *strPtr;
1643 modeNameLen = strlen(langModeName);
1644 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1645 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1646 DefaultPatternSets[i][modeNameLen] == ':') {
1647 strPtr = DefaultPatternSets[i];
1648 return readPatternSet(&strPtr, False);
1651 return NULL;
1655 ** Return True if patSet exactly matches one of the default pattern sets
1657 static int isDefaultPatternSet(patternSet *patSet)
1659 patternSet *defaultPatSet;
1660 int retVal;
1662 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1663 if (defaultPatSet == NULL)
1664 return False;
1665 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1666 freePatternSet(defaultPatSet);
1667 return retVal;
1671 ** Short-hand functions for formating and outputing errors for
1673 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1674 const char *message)
1676 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1677 return NULL;
1681 static int styleError(const char *stringStart, const char *stoppedAt,
1682 const char *message)
1684 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1685 return False;
1689 ** Present a dialog for editing highlight style information
1691 void EditHighlightStyles(const char *initialStyle)
1693 #define HS_LIST_RIGHT 60
1694 #define HS_LEFT_MARGIN_POS 1
1695 #define HS_RIGHT_MARGIN_POS 99
1696 #define HS_H_MARGIN 10
1697 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1698 Widget fontBox, sep1, okBtn, applyBtn, dismissBtn;
1699 XmString s1;
1700 int i, ac;
1701 Arg args[20];
1703 /* if the dialog is already displayed, just pop it to the top and return */
1704 if (HSDialog.shell != NULL) {
1705 if (initialStyle != NULL)
1706 setStyleByName(initialStyle);
1707 RaiseShellWindow(HSDialog.shell);
1708 return;
1711 /* Copy the list of highlight style information to one that the user
1712 can freely edit (via the dialog and managed-list code) */
1713 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1714 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1715 for (i=0; i<NHighlightStyles; i++)
1716 HSDialog.highlightStyleList[i] =
1717 copyHighlightStyleRec(HighlightStyles[i]);
1718 HSDialog.nHighlightStyles = NHighlightStyles;
1720 /* Create a form widget in an application shell */
1721 ac = 0;
1722 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1723 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1724 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1725 HSDialog.shell = CreateShellWithBestVis(APP_NAME, APP_CLASS,
1726 applicationShellWidgetClass, TheDisplay, args, ac);
1727 AddSmallIcon(HSDialog.shell);
1728 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1729 HSDialog.shell, XmNautoUnmanage, False,
1730 XmNresizePolicy, XmRESIZE_NONE, NULL);
1731 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1732 AddMotifCloseCallback(HSDialog.shell, hsDismissCB, NULL);
1734 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1735 XmNlabelString, s1=MKSTRING(
1736 "To modify the properties of an existing highlight style, select the name\n\
1737 from the list on the left. Select \"New\" to add a new style to the list."),
1738 XmNmnemonic, 'N',
1739 XmNtopAttachment, XmATTACH_POSITION,
1740 XmNtopPosition, 2,
1741 XmNleftAttachment, XmATTACH_POSITION,
1742 XmNleftPosition, HS_LEFT_MARGIN_POS,
1743 XmNrightAttachment, XmATTACH_POSITION,
1744 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1745 XmStringFree(s1);
1747 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1748 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1749 XmNmnemonic, 'm',
1750 XmNalignment, XmALIGNMENT_BEGINNING,
1751 XmNleftAttachment, XmATTACH_POSITION,
1752 XmNleftPosition, HS_LIST_RIGHT,
1753 XmNtopAttachment, XmATTACH_WIDGET,
1754 XmNtopOffset, HS_H_MARGIN,
1755 XmNtopWidget, topLbl, NULL);
1756 XmStringFree(s1);
1758 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1759 XmNleftAttachment, XmATTACH_POSITION,
1760 XmNleftPosition, HS_LIST_RIGHT,
1761 XmNtopAttachment, XmATTACH_WIDGET,
1762 XmNtopWidget, nameLbl,
1763 XmNrightAttachment, XmATTACH_POSITION,
1764 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1765 RemapDeleteKey(HSDialog.nameW);
1766 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1768 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1769 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1770 XmNmnemonic, 'C',
1771 XmNalignment, XmALIGNMENT_BEGINNING,
1772 XmNleftAttachment, XmATTACH_POSITION,
1773 XmNleftPosition, HS_LIST_RIGHT,
1774 XmNtopAttachment, XmATTACH_WIDGET,
1775 XmNtopOffset, HS_H_MARGIN,
1776 XmNtopWidget, HSDialog.nameW, NULL);
1777 XmStringFree(s1);
1779 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1780 XmNleftAttachment, XmATTACH_POSITION,
1781 XmNleftPosition, HS_LIST_RIGHT,
1782 XmNtopAttachment, XmATTACH_WIDGET,
1783 XmNtopWidget, colorLbl,
1784 XmNrightAttachment, XmATTACH_POSITION,
1785 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1786 RemapDeleteKey(HSDialog.colorW);
1787 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1789 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1790 XmNlabelString,
1791 s1=XmStringCreateSimple("Background Color (optional)"),
1792 XmNmnemonic, 'g',
1793 XmNalignment, XmALIGNMENT_BEGINNING,
1794 XmNleftAttachment, XmATTACH_POSITION,
1795 XmNleftPosition, HS_LIST_RIGHT,
1796 XmNtopAttachment, XmATTACH_WIDGET,
1797 XmNtopOffset, HS_H_MARGIN,
1798 XmNtopWidget, HSDialog.colorW, NULL);
1799 XmStringFree(s1);
1801 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1802 xmTextWidgetClass, form,
1803 XmNleftAttachment, XmATTACH_POSITION,
1804 XmNleftPosition, HS_LIST_RIGHT,
1805 XmNtopAttachment, XmATTACH_WIDGET,
1806 XmNtopWidget, bgColorLbl,
1807 XmNrightAttachment, XmATTACH_POSITION,
1808 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1809 RemapDeleteKey(HSDialog.bgColorW);
1810 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1812 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1813 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1814 XmNalignment, XmALIGNMENT_BEGINNING,
1815 XmNleftAttachment, XmATTACH_POSITION,
1816 XmNleftPosition, HS_LIST_RIGHT,
1817 XmNtopAttachment, XmATTACH_WIDGET,
1818 XmNtopOffset, HS_H_MARGIN,
1819 XmNtopWidget, HSDialog.bgColorW, NULL);
1820 XmStringFree(s1);
1822 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1823 XmNpacking, XmPACK_COLUMN,
1824 XmNnumColumns, 2,
1825 XmNradioBehavior, True,
1826 XmNleftAttachment, XmATTACH_POSITION,
1827 XmNleftPosition, HS_LIST_RIGHT,
1828 XmNtopAttachment, XmATTACH_WIDGET,
1829 XmNtopWidget, fontLbl, NULL);
1830 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1831 xmToggleButtonWidgetClass, fontBox,
1832 XmNset, True,
1833 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1834 XmNmnemonic, 'P', NULL);
1835 XmStringFree(s1);
1836 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1837 xmToggleButtonWidgetClass, fontBox,
1838 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1839 XmNmnemonic, 'B', NULL);
1840 XmStringFree(s1);
1841 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1842 xmToggleButtonWidgetClass, fontBox,
1843 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1844 XmNmnemonic, 'I', NULL);
1845 XmStringFree(s1);
1846 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1847 xmToggleButtonWidgetClass, fontBox,
1848 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1849 XmNmnemonic, 'o', NULL);
1850 XmStringFree(s1);
1852 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1853 XmNlabelString, s1=XmStringCreateSimple("OK"),
1854 XmNleftAttachment, XmATTACH_POSITION,
1855 XmNleftPosition, 10,
1856 XmNrightAttachment, XmATTACH_POSITION,
1857 XmNrightPosition, 30,
1858 XmNbottomAttachment, XmATTACH_POSITION,
1859 XmNbottomPosition, 99, NULL);
1860 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1861 XmStringFree(s1);
1863 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1864 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1865 XmNmnemonic, 'A',
1866 XmNleftAttachment, XmATTACH_POSITION,
1867 XmNleftPosition, 40,
1868 XmNrightAttachment, XmATTACH_POSITION,
1869 XmNrightPosition, 60,
1870 XmNbottomAttachment, XmATTACH_POSITION,
1871 XmNbottomPosition, 99, NULL);
1872 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1873 XmStringFree(s1);
1875 dismissBtn = XtVaCreateManagedWidget("dismiss",xmPushButtonWidgetClass,form,
1876 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
1877 XmNleftAttachment, XmATTACH_POSITION,
1878 XmNleftPosition, 70,
1879 XmNrightAttachment, XmATTACH_POSITION,
1880 XmNrightPosition, 90,
1881 XmNbottomAttachment, XmATTACH_POSITION,
1882 XmNbottomPosition, 99, NULL);
1883 XtAddCallback(dismissBtn, XmNactivateCallback, hsDismissCB, NULL);
1884 XmStringFree(s1);
1886 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1887 XmNleftAttachment, XmATTACH_FORM,
1888 XmNtopAttachment, XmATTACH_WIDGET,
1889 XmNtopWidget, fontBox,
1890 XmNtopOffset, HS_H_MARGIN,
1891 XmNrightAttachment, XmATTACH_FORM,
1892 XmNbottomAttachment, XmATTACH_WIDGET,
1893 XmNbottomWidget, dismissBtn, 0,
1894 XmNbottomOffset, HS_H_MARGIN, NULL);
1896 ac = 0;
1897 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1898 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1899 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1900 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1901 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1902 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1903 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1904 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1905 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1906 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1907 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1908 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1909 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1910 NULL, hsFreeItemCB);
1911 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1913 /* Set initial default button */
1914 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1915 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
1917 /* If there's a suggestion for an initial selection, make it */
1918 if (initialStyle != NULL)
1919 setStyleByName(initialStyle);
1921 /* Handle mnemonic selection of buttons and focus to dialog */
1922 AddDialogMnemonicHandler(form, FALSE);
1924 /* Realize all of the widgets in the new dialog */
1925 RealizeWithoutForcingPosition(HSDialog.shell);
1928 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1930 int i;
1932 for (i=0; i<HSDialog.nHighlightStyles; i++)
1933 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1934 XtFree((char *)HSDialog.highlightStyleList);
1937 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1939 if (!updateHSList())
1940 return;
1942 /* pop down and destroy the dialog */
1943 XtDestroyWidget(HSDialog.shell);
1944 HSDialog.shell = NULL;
1947 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1949 updateHSList();
1952 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData)
1954 /* pop down and destroy the dialog */
1955 XtDestroyWidget(HSDialog.shell);
1956 HSDialog.shell = NULL;
1959 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1960 void *cbArg)
1962 highlightStyleRec *hs;
1964 /* If the dialog is currently displaying the "new" entry and the
1965 fields are empty, that's just fine */
1966 if (oldItem == NULL && hsDialogEmpty())
1967 return NULL;
1969 /* If there are no problems reading the data, just return it */
1970 hs = readHSDialogFields(True);
1971 if (hs != NULL)
1972 return (void *)hs;
1974 /* If there are problems, and the user didn't ask for the fields to be
1975 read, give more warning */
1976 if (!explicitRequest)
1978 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1979 "Discard incomplete entry\nfor current highlight style?",
1980 "Keep", "Discard") == 2)
1982 return oldItem == NULL
1983 ? NULL
1984 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
1988 /* Do readHSDialogFields again without "silent" mode to display warning */
1989 hs = readHSDialogFields(False);
1990 *abort = True;
1991 return NULL;
1994 static void hsSetDisplayedCB(void *item, void *cbArg)
1996 highlightStyleRec *hs = (highlightStyleRec *)item;
1998 if (item == NULL) {
1999 XmTextSetString(HSDialog.nameW, "");
2000 XmTextSetString(HSDialog.colorW, "");
2001 XmTextSetString(HSDialog.bgColorW, "");
2002 XmToggleButtonSetState(HSDialog.plainW, True, False);
2003 XmToggleButtonSetState(HSDialog.boldW, False, False);
2004 XmToggleButtonSetState(HSDialog.italicW, False, False);
2005 XmToggleButtonSetState(HSDialog.boldItalicW, False, False);
2006 } else {
2007 XmTextSetString(HSDialog.nameW, hs->name);
2008 XmTextSetString(HSDialog.colorW, hs->color);
2009 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2010 XmToggleButtonSetState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2011 XmToggleButtonSetState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2012 XmToggleButtonSetState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2013 XmToggleButtonSetState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2014 False);
2018 static void hsFreeItemCB(void *item)
2020 freeHighlightStyleRec((highlightStyleRec *)item);
2023 static highlightStyleRec *readHSDialogFields(int silent)
2025 highlightStyleRec *hs;
2026 Display *display = XtDisplay(HSDialog.shell);
2027 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2028 XColor rgb;
2030 /* Allocate a language mode structure to return */
2031 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2033 /* read the name field */
2034 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2035 "highlight style name", silent);
2036 if (hs->name == NULL) {
2037 XtFree((char *)hs);
2038 return NULL;
2041 if (*hs->name == '\0')
2043 if (!silent)
2045 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2046 "Please specify a name\nfor the highlight style", "Dismiss");
2047 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2049 XtFree(hs->name);
2050 XtFree((char *)hs);
2051 return NULL;
2054 /* read the color field */
2055 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2056 if (hs->color == NULL) {
2057 XtFree(hs->name);
2058 XtFree((char *)hs);
2059 return NULL;
2062 if (*hs->color == '\0')
2064 if (!silent)
2066 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2067 "Please specify a color\nfor the highlight style",
2068 "Dismiss");
2069 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2071 XtFree(hs->name);
2072 XtFree(hs->color);
2073 XtFree((char *)hs);
2074 return NULL;
2077 /* Verify that the color is a valid X color spec */
2078 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2079 &rgb))
2081 if (!silent)
2083 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2084 "Invalid X color specification: %s\n", "Dismiss",
2085 hs->color);
2086 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2088 XtFree(hs->name);
2089 XtFree(hs->color);
2090 XtFree((char *)hs);
2091 return NULL;;
2094 /* read the background color field - this may be empty */
2095 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2096 "bgColor", silent);
2097 if (hs->bgColor && *hs->bgColor == '\0') {
2098 XtFree(hs->bgColor);
2099 hs->bgColor = NULL;
2102 /* Verify that the background color (if present) is a valid X color spec */
2103 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2104 hs->bgColor, &rgb))
2106 if (!silent)
2108 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2109 "Invalid X background color specification: %s\n", "Dismiss",
2110 hs->bgColor);
2111 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2113 XtFree(hs->name);
2114 XtFree(hs->color);
2115 XtFree(hs->bgColor);
2116 XtFree((char *)hs);
2117 return NULL;;
2120 /* read the font buttons */
2121 if (XmToggleButtonGetState(HSDialog.boldW))
2122 hs->font = BOLD_FONT;
2123 else if (XmToggleButtonGetState(HSDialog.italicW))
2124 hs->font = ITALIC_FONT;
2125 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2126 hs->font = BOLD_ITALIC_FONT;
2127 else
2128 hs->font = PLAIN_FONT;
2130 return hs;
2134 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2135 ** it contains.
2137 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2139 highlightStyleRec *newHS;
2141 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2142 newHS->name = XtMalloc(strlen(hs->name)+1);
2143 strcpy(newHS->name, hs->name);
2144 if (hs->color == NULL)
2145 newHS->color = NULL;
2146 else {
2147 newHS->color = XtMalloc(strlen(hs->color)+1);
2148 strcpy(newHS->color, hs->color);
2150 if (hs->bgColor == NULL)
2151 newHS->bgColor = NULL;
2152 else {
2153 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2154 strcpy(newHS->bgColor, hs->bgColor);
2156 newHS->font = hs->font;
2157 return newHS;
2161 ** Free all of the allocated data in a highlightStyleRec, including the
2162 ** structure itself.
2164 static void freeHighlightStyleRec(highlightStyleRec *hs)
2166 XtFree(hs->name);
2167 if (hs->color != NULL)
2168 XtFree(hs->color);
2169 XtFree((char *)hs);
2173 ** Select a particular style in the highlight styles dialog
2175 static void setStyleByName(const char *style)
2177 int i;
2179 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2180 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2181 SelectManagedListItem(HSDialog.managedListW, i);
2182 break;
2188 ** Return True if the fields of the highlight styles dialog are consistent
2189 ** with a blank "New" style in the dialog.
2191 static int hsDialogEmpty(void)
2193 return TextWidgetIsBlank(HSDialog.nameW) &&
2194 TextWidgetIsBlank(HSDialog.colorW) &&
2195 XmToggleButtonGetState(HSDialog.plainW);
2199 ** Apply the changes made in the highlight styles dialog to the stored
2200 ** highlight style information in HighlightStyles
2202 static int updateHSList(void)
2204 WindowInfo *window;
2205 int i;
2207 /* Get the current contents of the dialog fields */
2208 if (!UpdateManagedList(HSDialog.managedListW, True))
2209 return False;
2211 /* Replace the old highlight styles list with the new one from the dialog */
2212 for (i=0; i<NHighlightStyles; i++)
2213 freeHighlightStyleRec(HighlightStyles[i]);
2214 for (i=0; i<HSDialog.nHighlightStyles; i++)
2215 HighlightStyles[i] =
2216 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2217 NHighlightStyles = HSDialog.nHighlightStyles;
2219 /* If a syntax highlighting dialog is up, update its menu */
2220 updateHighlightStyleMenu();
2222 /* Redisplay highlighted windows which use changed style(s) */
2223 for (window=WindowList; window!=NULL; window=window->next)
2224 UpdateHighlightStyles(window);
2226 /* Note that preferences have been changed */
2227 MarkPrefsChanged();
2229 return True;
2233 ** Present a dialog for editing highlight pattern information
2235 void EditHighlightPatterns(WindowInfo *window)
2237 #define BORDER 4
2238 #define LIST_RIGHT 41
2239 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2240 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2241 Widget okBtn, applyBtn, checkBtn, deleteBtn, dismissBtn, helpBtn;
2242 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2243 patternSet *patSet;
2244 XmString s1;
2245 int i, n, nPatterns;
2246 Arg args[20];
2248 /* if the dialog is already displayed, just pop it to the top and return */
2249 if (HighlightDialog.shell != NULL) {
2250 RaiseShellWindow(HighlightDialog.shell);
2251 return;
2254 if (LanguageModeName(0) == NULL)
2256 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2257 "No Language Modes available for syntax highlighting\n"
2258 "Add language modes under Preferenses->Language Modes",
2259 "Dismiss");
2260 return;
2263 /* Decide on an initial language mode */
2264 HighlightDialog.langModeName = XtNewString(
2265 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2266 window->languageMode));
2268 /* Find the associated pattern set (patSet) to edit */
2269 patSet = FindPatternSet(HighlightDialog.langModeName);
2271 /* Copy the list of patterns to one that the user can freely edit */
2272 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2273 sizeof(highlightPattern *) * MAX_PATTERNS);
2274 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2275 for (i=0; i<nPatterns; i++)
2276 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2277 HighlightDialog.nPatterns = nPatterns;
2280 /* Create a form widget in an application shell */
2281 n = 0;
2282 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2283 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2284 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2285 HighlightDialog.shell = CreateShellWithBestVis(APP_NAME, APP_CLASS,
2286 applicationShellWidgetClass, TheDisplay, args, n);
2287 AddSmallIcon(HighlightDialog.shell);
2288 form = XtVaCreateManagedWidget("editHighlightPatterns", xmFormWidgetClass,
2289 HighlightDialog.shell, XmNautoUnmanage, False,
2290 XmNresizePolicy, XmRESIZE_NONE, NULL);
2291 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2292 AddMotifCloseCallback(HighlightDialog.shell, dismissCB, NULL);
2294 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2295 form,
2296 XmNleftAttachment, XmATTACH_POSITION,
2297 XmNleftPosition, 1,
2298 XmNtopAttachment, XmATTACH_POSITION,
2299 XmNtopPosition, 1,
2300 XmNrightAttachment, XmATTACH_POSITION,
2301 XmNrightPosition, 99, NULL);
2303 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2304 NULL);
2305 n = 0;
2306 XtSetArg(args[n], XmNspacing, 0); n++;
2307 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2308 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2309 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2310 XtSetArg(args[n], XmNleftPosition, 50); n++;
2311 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2312 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2313 XtManageChild(lmOptMenu);
2314 HighlightDialog.lmOptMenu = lmOptMenu;
2316 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2317 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2318 XmNmnemonic, 'M',
2319 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2320 XmNalignment, XmALIGNMENT_END,
2321 XmNrightAttachment, XmATTACH_POSITION,
2322 XmNrightPosition, 50,
2323 XmNtopAttachment, XmATTACH_FORM,
2324 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2325 XmNbottomWidget, lmOptMenu, NULL);
2326 XmStringFree(s1);
2328 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2329 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2330 XmNmnemonic, 'A',
2331 XmNrightAttachment, XmATTACH_FORM,
2332 XmNtopAttachment, XmATTACH_FORM, NULL);
2333 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2334 XmStringFree(s1);
2336 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2337 XmNlabelString, s1=XmStringCreateSimple("OK"),
2338 XmNleftAttachment, XmATTACH_POSITION,
2339 XmNleftPosition, 1,
2340 XmNrightAttachment, XmATTACH_POSITION,
2341 XmNrightPosition, 13,
2342 XmNbottomAttachment, XmATTACH_FORM,
2343 XmNbottomOffset, BORDER, NULL);
2344 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2345 XmStringFree(s1);
2347 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2348 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2349 XmNmnemonic, 'y',
2350 XmNleftAttachment, XmATTACH_POSITION,
2351 XmNleftPosition, 13,
2352 XmNrightAttachment, XmATTACH_POSITION,
2353 XmNrightPosition, 26,
2354 XmNbottomAttachment, XmATTACH_FORM,
2355 XmNbottomOffset, BORDER, NULL);
2356 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2357 XmStringFree(s1);
2359 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2360 XmNlabelString, s1=XmStringCreateSimple("Check"),
2361 XmNmnemonic, 'k',
2362 XmNleftAttachment, XmATTACH_POSITION,
2363 XmNleftPosition, 26,
2364 XmNrightAttachment, XmATTACH_POSITION,
2365 XmNrightPosition, 39,
2366 XmNbottomAttachment, XmATTACH_FORM,
2367 XmNbottomOffset, BORDER, NULL);
2368 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2369 XmStringFree(s1);
2371 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2372 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2373 XmNmnemonic, 'D',
2374 XmNleftAttachment, XmATTACH_POSITION,
2375 XmNleftPosition, 39,
2376 XmNrightAttachment, XmATTACH_POSITION,
2377 XmNrightPosition, 52,
2378 XmNbottomAttachment, XmATTACH_FORM,
2379 XmNbottomOffset, BORDER, NULL);
2380 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2381 XmStringFree(s1);
2383 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2384 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2385 XmNmnemonic, 'f',
2386 XmNleftAttachment, XmATTACH_POSITION,
2387 XmNleftPosition, 52,
2388 XmNrightAttachment, XmATTACH_POSITION,
2389 XmNrightPosition, 73,
2390 XmNbottomAttachment, XmATTACH_FORM,
2391 XmNbottomOffset, BORDER, NULL);
2392 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2393 XmStringFree(s1);
2395 dismissBtn = XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass,
2396 form,
2397 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
2398 XmNleftAttachment, XmATTACH_POSITION,
2399 XmNleftPosition, 73,
2400 XmNrightAttachment, XmATTACH_POSITION,
2401 XmNrightPosition, 86,
2402 XmNbottomAttachment, XmATTACH_FORM,
2403 XmNbottomOffset, BORDER, NULL);
2404 XtAddCallback(dismissBtn, XmNactivateCallback, dismissCB, NULL);
2405 XmStringFree(s1);
2407 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2408 form,
2409 XmNlabelString, s1=XmStringCreateSimple("Help"),
2410 XmNmnemonic, 'H',
2411 XmNleftAttachment, XmATTACH_POSITION,
2412 XmNleftPosition, 86,
2413 XmNrightAttachment, XmATTACH_POSITION,
2414 XmNrightPosition, 99,
2415 XmNbottomAttachment, XmATTACH_FORM,
2416 XmNbottomOffset, BORDER, NULL);
2417 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2418 XmStringFree(s1);
2420 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2421 form,
2422 XmNleftAttachment, XmATTACH_POSITION,
2423 XmNleftPosition, 1,
2424 XmNrightAttachment, XmATTACH_POSITION,
2425 XmNrightPosition, 99,
2426 XmNbottomAttachment, XmATTACH_WIDGET,
2427 XmNbottomWidget, okBtn,
2428 XmNbottomOffset, BORDER, NULL);
2429 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2430 contextFrame, NULL);
2431 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2432 XmNlabelString, s1=XmStringCreateSimple(
2433 "Context requirements for incremental re-parsing after changes"),
2434 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2435 XmStringFree(s1);
2437 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2438 xmTextWidgetClass, contextForm,
2439 XmNcolumns, 5,
2440 XmNmaxLength, 12,
2441 XmNleftAttachment, XmATTACH_POSITION,
2442 XmNleftPosition, 15,
2443 XmNrightAttachment, XmATTACH_POSITION,
2444 XmNrightPosition, 25, NULL);
2445 RemapDeleteKey(HighlightDialog.lineContextW);
2447 XtVaCreateManagedWidget("lineContLbl",
2448 xmLabelGadgetClass, contextForm,
2449 XmNlabelString, s1=XmStringCreateSimple("lines"),
2450 XmNmnemonic, 'l',
2451 XmNuserData, HighlightDialog.lineContextW,
2452 XmNalignment, XmALIGNMENT_BEGINNING,
2453 XmNleftAttachment, XmATTACH_WIDGET,
2454 XmNleftWidget, HighlightDialog.lineContextW,
2455 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2456 XmNtopWidget, HighlightDialog.lineContextW,
2457 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2458 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2459 XmStringFree(s1);
2461 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2462 xmTextWidgetClass, contextForm,
2463 XmNcolumns, 5,
2464 XmNmaxLength, 12,
2465 XmNleftAttachment, XmATTACH_POSITION,
2466 XmNleftPosition, 58,
2467 XmNrightAttachment, XmATTACH_POSITION,
2468 XmNrightPosition, 68, NULL);
2469 RemapDeleteKey(HighlightDialog.lineContextW);
2471 XtVaCreateManagedWidget("charContLbl",
2472 xmLabelGadgetClass, contextForm,
2473 XmNlabelString, s1=XmStringCreateSimple("characters"),
2474 XmNmnemonic, 'c',
2475 XmNuserData, HighlightDialog.charContextW,
2476 XmNalignment, XmALIGNMENT_BEGINNING,
2477 XmNleftAttachment, XmATTACH_WIDGET,
2478 XmNleftWidget, HighlightDialog.charContextW,
2479 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2480 XmNtopWidget, HighlightDialog.charContextW,
2481 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2482 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2483 XmStringFree(s1);
2485 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2486 form,
2487 XmNleftAttachment, XmATTACH_POSITION,
2488 XmNleftPosition, 1,
2489 XmNtopAttachment, XmATTACH_WIDGET,
2490 XmNtopWidget, lmForm,
2491 XmNrightAttachment, XmATTACH_POSITION,
2492 XmNrightPosition, 99,
2493 XmNbottomAttachment, XmATTACH_WIDGET,
2494 XmNbottomWidget, contextFrame,
2495 XmNbottomOffset, BORDER, NULL);
2496 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2497 patternsFrame, NULL);
2498 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2499 patternsFrame,
2500 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2501 XmNmnemonic, 'P',
2502 XmNmarginHeight, 0,
2503 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2504 XmStringFree(s1);
2506 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2507 patternsForm,
2508 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2509 XmNmarginHeight, 0,
2510 XmNalignment, XmALIGNMENT_BEGINNING,
2511 XmNleftAttachment, XmATTACH_POSITION,
2512 XmNleftPosition, LIST_RIGHT,
2513 XmNtopAttachment, XmATTACH_FORM, NULL);
2514 XmStringFree(s1);
2516 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2517 patternsForm,
2518 XmNpacking, XmPACK_COLUMN,
2519 XmNradioBehavior, True,
2520 XmNleftAttachment, XmATTACH_POSITION,
2521 XmNleftPosition, LIST_RIGHT,
2522 XmNtopAttachment, XmATTACH_WIDGET,
2523 XmNtopWidget, typeLbl, NULL);
2524 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2525 xmToggleButtonWidgetClass, typeBox,
2526 XmNset, True,
2527 XmNmarginHeight, 0,
2528 XmNlabelString, s1=XmStringCreateSimple(
2529 "Pass-1 (applied to all text when loaded or modified)"),
2530 XmNmnemonic, '1', NULL);
2531 XmStringFree(s1);
2532 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2533 patTypeCB, NULL);
2534 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2535 xmToggleButtonWidgetClass, typeBox,
2536 XmNmarginHeight, 0,
2537 XmNlabelString, s1=XmStringCreateSimple(
2538 "Pass-2 (parsing is deferred until text is exposed)"),
2539 XmNmnemonic, '2', NULL);
2540 XmStringFree(s1);
2541 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2542 patTypeCB, NULL);
2543 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2544 xmToggleButtonWidgetClass, typeBox,
2545 XmNmarginHeight, 0,
2546 XmNlabelString, s1=XmStringCreateSimple(
2547 "Sub-pattern (processed within start & end of parent)"),
2548 XmNmnemonic, 'u', NULL);
2549 XmStringFree(s1);
2550 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2551 patTypeCB, NULL);
2552 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2553 xmToggleButtonWidgetClass, typeBox,
2554 XmNmarginHeight, 0,
2555 XmNlabelString, s1=XmStringCreateSimple(
2556 "Coloring for sub-expressions of parent pattern"),
2557 XmNmnemonic, 'g', NULL);
2558 XmStringFree(s1);
2559 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2560 patTypeCB, NULL);
2562 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2563 xmLabelGadgetClass, patternsForm,
2564 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2565 XmNmarginHeight, 0,
2566 XmNalignment, XmALIGNMENT_BEGINNING,
2567 XmNleftAttachment, XmATTACH_POSITION,
2568 XmNleftPosition, LIST_RIGHT,
2569 XmNtopAttachment, XmATTACH_WIDGET,
2570 XmNtopOffset, BORDER,
2571 XmNtopWidget, typeBox, NULL);
2572 XmStringFree(s1);
2574 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2575 patternsForm,
2576 XmNpacking, XmPACK_COLUMN,
2577 XmNradioBehavior, True,
2578 XmNleftAttachment, XmATTACH_POSITION,
2579 XmNleftPosition, LIST_RIGHT,
2580 XmNtopAttachment, XmATTACH_WIDGET,
2581 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2582 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2583 xmToggleButtonWidgetClass, matchBox,
2584 XmNset, True,
2585 XmNmarginHeight, 0,
2586 XmNlabelString, s1=XmStringCreateSimple(
2587 "Highlight text matching regular expression"),
2588 XmNmnemonic, 'x', NULL);
2589 XmStringFree(s1);
2590 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2591 matchTypeCB, NULL);
2592 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2593 xmToggleButtonWidgetClass, matchBox,
2594 XmNmarginHeight, 0,
2595 XmNlabelString, s1=XmStringCreateSimple(
2596 "Highlight text between starting and ending REs"),
2597 XmNmnemonic, 'b', NULL);
2598 XmStringFree(s1);
2599 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2600 matchTypeCB, NULL);
2602 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2603 patternsForm,
2604 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2605 XmNmnemonic, 'N',
2606 XmNrows, 20,
2607 XmNalignment, XmALIGNMENT_BEGINNING,
2608 XmNleftAttachment, XmATTACH_POSITION,
2609 XmNleftPosition, LIST_RIGHT,
2610 XmNtopAttachment, XmATTACH_WIDGET,
2611 XmNtopWidget, matchBox,
2612 XmNtopOffset, BORDER, NULL);
2613 XmStringFree(s1);
2615 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2616 patternsForm,
2617 XmNleftAttachment, XmATTACH_POSITION,
2618 XmNleftPosition, LIST_RIGHT,
2619 XmNtopAttachment, XmATTACH_WIDGET,
2620 XmNtopWidget, nameLbl,
2621 XmNrightAttachment, XmATTACH_POSITION,
2622 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2623 RemapDeleteKey(HighlightDialog.nameW);
2624 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2626 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2627 xmLabelGadgetClass, patternsForm,
2628 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2629 XmNmnemonic, 't',
2630 XmNrows, 20,
2631 XmNalignment, XmALIGNMENT_BEGINNING,
2632 XmNleftAttachment, XmATTACH_POSITION,
2633 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2634 XmNtopAttachment, XmATTACH_WIDGET,
2635 XmNtopWidget, matchBox,
2636 XmNtopOffset, BORDER, NULL);
2637 XmStringFree(s1);
2639 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2640 xmTextWidgetClass, patternsForm,
2641 XmNleftAttachment, XmATTACH_POSITION,
2642 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2643 XmNtopAttachment, XmATTACH_WIDGET,
2644 XmNtopWidget, HighlightDialog.parentLbl,
2645 XmNrightAttachment, XmATTACH_POSITION,
2646 XmNrightPosition, 99, NULL);
2647 RemapDeleteKey(HighlightDialog.parentW);
2648 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2649 HighlightDialog.parentW, NULL);
2651 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2652 xmLabelGadgetClass, patternsForm,
2653 XmNalignment, XmALIGNMENT_BEGINNING,
2654 XmNmnemonic, 'R',
2655 XmNtopAttachment, XmATTACH_WIDGET,
2656 XmNtopWidget, HighlightDialog.parentW,
2657 XmNtopOffset, BORDER,
2658 XmNleftAttachment, XmATTACH_POSITION,
2659 XmNleftPosition, 1, NULL);
2661 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2662 xmTextWidgetClass, patternsForm,
2663 XmNleftAttachment, XmATTACH_POSITION,
2664 XmNleftPosition, 1,
2665 XmNrightAttachment, XmATTACH_POSITION,
2666 XmNrightPosition, 99,
2667 XmNbottomAttachment, XmATTACH_POSITION,
2668 XmNbottomPosition, 99, NULL);
2669 RemapDeleteKey(HighlightDialog.errorW);
2671 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2672 xmLabelGadgetClass, patternsForm,
2673 XmNlabelString, s1=XmStringCreateSimple(
2674 "Regular Expression Indicating Error in Match (Optional)"),
2675 XmNmnemonic, 'o',
2676 XmNuserData, HighlightDialog.errorW,
2677 XmNalignment, XmALIGNMENT_BEGINNING,
2678 XmNleftAttachment, XmATTACH_POSITION,
2679 XmNleftPosition, 1,
2680 XmNbottomAttachment, XmATTACH_WIDGET,
2681 XmNbottomWidget, HighlightDialog.errorW, NULL);
2682 XmStringFree(s1);
2684 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2685 xmTextWidgetClass, patternsForm,
2686 XmNleftAttachment, XmATTACH_POSITION,
2687 XmNleftPosition, 1,
2688 XmNbottomAttachment, XmATTACH_WIDGET,
2689 XmNbottomWidget, HighlightDialog.errorLbl,
2690 XmNbottomOffset, BORDER,
2691 XmNrightAttachment, XmATTACH_POSITION,
2692 XmNrightPosition, 99, NULL);
2693 RemapDeleteKey(HighlightDialog.endW);
2695 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2696 xmLabelGadgetClass, patternsForm,
2697 XmNmnemonic, 'E',
2698 XmNuserData, HighlightDialog.endW,
2699 XmNalignment, XmALIGNMENT_BEGINNING,
2700 XmNleftAttachment, XmATTACH_POSITION,
2701 XmNleftPosition, 1,
2702 XmNbottomAttachment, XmATTACH_WIDGET,
2703 XmNbottomWidget, HighlightDialog.endW, NULL);
2705 n = 0;
2706 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2707 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2708 XtSetArg(args[n], XmNwordWrap, True); n++;
2709 XtSetArg(args[n], XmNrows, 3); n++;
2710 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2711 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2712 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2713 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2714 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2715 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2716 XtSetArg(args[n], XmNleftPosition, 1); n++;
2717 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2718 XtSetArg(args[n], XmNrightPosition, 99); n++;
2719 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2720 AddMouseWheelSupport(HighlightDialog.startW);
2721 XtManageChild(HighlightDialog.startW);
2722 MakeSingleLineTextW(HighlightDialog.startW);
2723 RemapDeleteKey(HighlightDialog.startW);
2724 XtVaSetValues(HighlightDialog.startLbl,
2725 XmNuserData,HighlightDialog.startW, NULL);
2727 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2728 patternsForm,
2729 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2730 XmNmnemonic, 'i',
2731 XmNrightAttachment, XmATTACH_POSITION,
2732 XmNrightPosition, LIST_RIGHT-1,
2733 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2734 XmNbottomWidget, HighlightDialog.parentW, NULL);
2735 XmStringFree(s1);
2736 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2738 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2739 n = 0;
2740 XtSetArg(args[n], XmNspacing, 0); n++;
2741 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2742 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2743 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2744 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2745 XtSetArg(args[n], XmNleftPosition, 1); n++;
2746 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2747 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2748 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2749 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2750 "styleOptMenu", args, n);
2751 XtManageChild(HighlightDialog.styleOptMenu);
2753 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2754 patternsForm,
2755 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2756 XmNmnemonic, 'S',
2757 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2758 XmNalignment, XmALIGNMENT_BEGINNING,
2759 XmNleftAttachment, XmATTACH_POSITION,
2760 XmNleftPosition, 1,
2761 XmNbottomAttachment, XmATTACH_WIDGET,
2762 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2763 XmStringFree(s1);
2765 n = 0;
2766 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2767 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2768 XtSetArg(args[n], XmNleftPosition, 1); n++;
2769 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2770 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2771 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2772 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2773 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2774 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2775 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2776 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2777 NULL, freeItemCB);
2778 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2780 /* Set initial default button */
2781 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2782 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
2784 /* Handle mnemonic selection of buttons and focus to dialog */
2785 AddDialogMnemonicHandler(form, FALSE);
2787 /* Fill in the dialog information for the selected language mode */
2788 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2789 patSet->lineContext);
2790 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2791 patSet->charContext);
2792 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2793 updateLabels();
2795 /* Realize all of the widgets in the new dialog */
2796 RealizeWithoutForcingPosition(HighlightDialog.shell);
2800 ** If a syntax highlighting dialog is up, ask to have the option menu for
2801 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2803 static void updateHighlightStyleMenu(void)
2805 Widget oldMenu;
2806 int patIndex;
2808 if (HighlightDialog.shell == NULL)
2809 return;
2811 oldMenu = HighlightDialog.stylePulldown;
2812 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2813 XtParent(XtParent(oldMenu)));
2814 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2815 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2816 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2817 if (patIndex == -1)
2818 setStyleMenu("Plain");
2819 else
2820 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2822 XtDestroyWidget(oldMenu);
2826 ** If a syntax highlighting dialog is up, ask to have the option menu for
2827 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2829 void UpdateLanguageModeMenu(void)
2831 Widget oldMenu;
2833 if (HighlightDialog.shell == NULL)
2834 return;
2836 oldMenu = HighlightDialog.lmPulldown;
2837 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2838 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2839 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2840 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2841 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2843 XtDestroyWidget(oldMenu);
2846 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2848 int i;
2850 freeNonNull(HighlightDialog.langModeName);
2851 for (i=0; i<HighlightDialog.nPatterns; i++)
2852 freePatternSrc(HighlightDialog.patterns[i], True);
2853 HighlightDialog.shell = NULL;
2856 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2858 char *modeName;
2859 patternSet *oldPatSet, *newPatSet;
2860 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2861 int i, resp;
2863 /* Get the newly selected mode name. If it's the same, do nothing */
2864 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2865 if (!strcmp(modeName, HighlightDialog.langModeName))
2866 return;
2868 /* Look up the original version of the patterns being edited */
2869 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2870 if (oldPatSet == NULL)
2871 oldPatSet = &emptyPatSet;
2873 /* Get the current information displayed by the dialog. If it's bad,
2874 give the user the chance to throw it out or go back and fix it. If
2875 it has changed, give the user the chance to apply discard or cancel. */
2876 newPatSet = getDialogPatternSet();
2878 if (newPatSet == NULL)
2880 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2881 "Incomplete Language Mode", "Discard incomplete entry\n"
2882 "for current language mode?", "Keep", "Discard") == 1)
2884 SetLangModeMenu(HighlightDialog.lmOptMenu,
2885 HighlightDialog.langModeName);
2886 return;
2888 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2890 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2891 "Apply changes for language mode %s?", "Apply Changes",
2892 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2893 if (resp == 3)
2895 SetLangModeMenu(HighlightDialog.lmOptMenu,
2896 HighlightDialog.langModeName);
2897 return;
2899 if (resp == 1)
2901 updatePatternSet();
2905 if (newPatSet != NULL)
2906 freePatternSet(newPatSet);
2908 /* Free the old dialog information */
2909 freeNonNull(HighlightDialog.langModeName);
2910 for (i=0; i<HighlightDialog.nPatterns; i++)
2911 freePatternSrc(HighlightDialog.patterns[i], True);
2913 /* Fill the dialog with the new language mode information */
2914 HighlightDialog.langModeName = XtNewString(modeName);
2915 newPatSet = FindPatternSet(modeName);
2916 if (newPatSet == NULL) {
2917 HighlightDialog.nPatterns = 0;
2918 SetIntText(HighlightDialog.lineContextW, 1);
2919 SetIntText(HighlightDialog.charContextW, 0);
2920 } else {
2921 for (i=0; i<newPatSet->nPatterns; i++)
2922 HighlightDialog.patterns[i] =
2923 copyPatternSrc(&newPatSet->patterns[i], NULL);
2924 HighlightDialog.nPatterns = newPatSet->nPatterns;
2925 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2926 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2928 ChangeManagedListData(HighlightDialog.managedListW);
2931 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2933 EditLanguageModes();
2936 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2938 Widget selectedItem;
2939 char *style;
2941 XtVaGetValues(HighlightDialog.styleOptMenu,
2942 XmNmenuHistory, &selectedItem,
2943 NULL);
2944 XtVaGetValues(selectedItem,
2945 XmNuserData, &style,
2946 NULL);
2947 EditHighlightStyles(style);
2950 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2952 /* change the patterns */
2953 if (!updatePatternSet())
2954 return;
2956 /* pop down and destroy the dialog */
2957 XtDestroyWidget(HighlightDialog.shell);
2960 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
2962 /* change the patterns */
2963 updatePatternSet();
2966 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
2968 if (checkHighlightDialogData())
2970 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
2971 "Patterns compiled without error", "Dismiss");
2975 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
2977 patternSet *defaultPatSet;
2978 int i, psn;
2980 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
2981 if (defaultPatSet == NULL)
2983 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
2984 "There is no default pattern set\nfor language mode %s",
2985 "Dismiss", HighlightDialog.langModeName);
2986 return;
2989 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
2990 "Are you sure you want to discard\n"
2991 "all changes to syntax highlighting\n"
2992 "patterns for language mode %s?", "Discard", "Cancel",
2993 HighlightDialog.langModeName) == 2)
2995 return;
2998 /* if a stored version of the pattern set exists, replace it, if it
2999 doesn't, add a new one */
3000 for (psn=0; psn<NPatternSets; psn++)
3001 if (!strcmp(HighlightDialog.langModeName,
3002 PatternSets[psn]->languageMode))
3003 break;
3004 if (psn < NPatternSets) {
3005 freePatternSet(PatternSets[psn]);
3006 PatternSets[psn] = defaultPatSet;
3007 } else
3008 PatternSets[NPatternSets++] = defaultPatSet;
3010 /* Free the old dialog information */
3011 for (i=0; i<HighlightDialog.nPatterns; i++)
3012 freePatternSrc(HighlightDialog.patterns[i], True);
3014 /* Update the dialog */
3015 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3016 for (i=0; i<defaultPatSet->nPatterns; i++)
3017 HighlightDialog.patterns[i] =
3018 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3019 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3020 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3021 ChangeManagedListData(HighlightDialog.managedListW);
3024 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3026 int i, psn;
3028 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3029 "Are you sure you want to delete\n"
3030 "syntax highlighting patterns for\n"
3031 "language mode %s?", "Yes, Delete", "Cancel",
3032 HighlightDialog.langModeName) == 2)
3034 return;
3037 /* if a stored version of the pattern set exists, delete it from the list */
3038 for (psn=0; psn<NPatternSets; psn++)
3039 if (!strcmp(HighlightDialog.langModeName,
3040 PatternSets[psn]->languageMode))
3041 break;
3042 if (psn < NPatternSets) {
3043 freePatternSet(PatternSets[psn]);
3044 memmove(&PatternSets[psn], &PatternSets[psn+1],
3045 (NPatternSets-1 - psn) * sizeof(patternSet *));
3046 NPatternSets--;
3049 /* Free the old dialog information */
3050 for (i=0; i<HighlightDialog.nPatterns; i++)
3051 freePatternSrc(HighlightDialog.patterns[i], True);
3053 /* Clear out the dialog */
3054 HighlightDialog.nPatterns = 0;
3055 SetIntText(HighlightDialog.lineContextW, 1);
3056 SetIntText(HighlightDialog.charContextW, 0);
3057 ChangeManagedListData(HighlightDialog.managedListW);
3060 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData)
3062 /* pop down and destroy the dialog */
3063 XtDestroyWidget(HighlightDialog.shell);
3066 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3068 Help(HELP_PATTERNS);
3071 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3073 updateLabels();
3076 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3078 updateLabels();
3081 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3082 void *cbArg)
3084 highlightPattern *pat;
3086 /* If the dialog is currently displaying the "new" entry and the
3087 fields are empty, that's just fine */
3088 if (oldItem == NULL && dialogEmpty())
3089 return NULL;
3091 /* If there are no problems reading the data, just return it */
3092 pat = readDialogFields(True);
3093 if (pat != NULL)
3094 return (void *)pat;
3096 /* If there are problems, and the user didn't ask for the fields to be
3097 read, give more warning */
3098 if (!explicitRequest)
3100 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3101 "Discard incomplete entry\nfor current pattern?", "Keep",
3102 "Discard") == 2)
3104 return oldItem == NULL
3105 ? NULL
3106 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3110 /* Do readDialogFields again without "silent" mode to display warning */
3111 pat = readDialogFields(False);
3112 *abort = True;
3113 return NULL;
3116 static void setDisplayedCB(void *item, void *cbArg)
3118 highlightPattern *pat = (highlightPattern *)item;
3119 int isSubpat, isDeferred, isColorOnly, isRange;
3121 if (item == NULL) {
3122 XmTextSetString(HighlightDialog.nameW, "");
3123 XmTextSetString(HighlightDialog.parentW, "");
3124 XmTextSetString(HighlightDialog.startW, "");
3125 XmTextSetString(HighlightDialog.endW, "");
3126 XmTextSetString(HighlightDialog.errorW, "");
3127 XmToggleButtonSetState(HighlightDialog.topLevelW, True, False);
3128 XmToggleButtonSetState(HighlightDialog.deferredW, False, False);
3129 XmToggleButtonSetState(HighlightDialog.subPatW, False, False);
3130 XmToggleButtonSetState(HighlightDialog.colorPatW, False, False);
3131 XmToggleButtonSetState(HighlightDialog.simpleW, True, False);
3132 XmToggleButtonSetState(HighlightDialog.rangeW, False, False);
3133 setStyleMenu("Plain");
3134 } else {
3135 isSubpat = pat->subPatternOf != NULL;
3136 isDeferred = pat->flags & DEFER_PARSING;
3137 isColorOnly = pat->flags & COLOR_ONLY;
3138 isRange = pat->endRE != NULL;
3139 XmTextSetString(HighlightDialog.nameW, pat->name);
3140 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3141 XmTextSetString(HighlightDialog.startW, pat->startRE);
3142 XmTextSetString(HighlightDialog.endW, pat->endRE);
3143 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3144 XmToggleButtonSetState(HighlightDialog.topLevelW,
3145 !isSubpat && !isDeferred, False);
3146 XmToggleButtonSetState(HighlightDialog.deferredW,
3147 !isSubpat && isDeferred, False);
3148 XmToggleButtonSetState(HighlightDialog.subPatW,
3149 isSubpat && !isColorOnly, False);
3150 XmToggleButtonSetState(HighlightDialog.colorPatW,
3151 isSubpat && isColorOnly, False);
3152 XmToggleButtonSetState(HighlightDialog.simpleW, !isRange, False);
3153 XmToggleButtonSetState(HighlightDialog.rangeW, isRange, False);
3154 setStyleMenu(pat->style);
3156 updateLabels();
3159 static void freeItemCB(void *item)
3161 freePatternSrc((highlightPattern *)item, True);
3165 ** Do a test compile of the patterns currently displayed in the highlight
3166 ** patterns dialog, and display warning dialogs if there are problems
3168 static int checkHighlightDialogData(void)
3170 patternSet *patSet;
3171 int result;
3173 /* Get the pattern information from the dialog */
3174 patSet = getDialogPatternSet();
3175 if (patSet == NULL)
3176 return False;
3178 /* Compile the patterns */
3179 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3180 freePatternSet(patSet);
3181 return result;
3185 ** Update the text field labels and sensitivity of various fields, based on
3186 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3187 ** patterns dialog.
3189 static void updateLabels(void)
3191 char *startLbl, *endLbl;
3192 int endSense, errSense, matchSense, parentSense;
3193 XmString s1;
3195 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3196 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3197 Regular Expression (\\1, &, etc.)";
3198 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3199 Regular Expression";
3200 endSense = True;
3201 errSense = False;
3202 matchSense = False;
3203 parentSense = True;
3204 } else {
3205 endLbl = "Ending Regular Expression";
3206 matchSense = True;
3207 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3208 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3209 startLbl = "Regular Expression to Match";
3210 endSense = False;
3211 errSense = False;
3212 } else {
3213 startLbl = "Starting Regular Expression";
3214 endSense = True;
3215 errSense = True;
3219 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3220 XtSetSensitive(HighlightDialog.parentW, parentSense);
3221 XtSetSensitive(HighlightDialog.endW, endSense);
3222 XtSetSensitive(HighlightDialog.endLbl, endSense);
3223 XtSetSensitive(HighlightDialog.errorW, errSense);
3224 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3225 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3226 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3227 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3228 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3229 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3230 s1=XmStringCreateSimple(startLbl), NULL);
3231 XmStringFree(s1);
3232 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3233 s1=XmStringCreateSimple(endLbl), NULL);
3234 XmStringFree(s1);
3238 ** Set the styles menu in the currently displayed highlight dialog to show
3239 ** a particular style
3241 static void setStyleMenu(const char *styleName)
3243 int i;
3244 Cardinal nItems;
3245 WidgetList items;
3246 Widget selectedItem;
3247 char *itemStyle;
3249 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3250 XmNnumChildren, &nItems, NULL);
3251 if (nItems == 0)
3252 return;
3253 selectedItem = items[0];
3254 for (i=0; i<(int)nItems; i++) {
3255 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3256 if (!strcmp(itemStyle, styleName)) {
3257 selectedItem = items[i];
3258 break;
3261 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3265 ** Read the pattern fields of the highlight dialog, and produce an allocated
3266 ** highlightPattern structure reflecting the contents, or pop up dialogs
3267 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3268 ** dialogs). Returns NULL on error.
3270 static highlightPattern *readDialogFields(int silent)
3272 highlightPattern *pat;
3273 char *inPtr, *outPtr, *style;
3274 Widget selectedItem;
3275 int colorOnly;
3277 /* Allocate a pattern source structure to return, zero out fields
3278 so that the whole pattern can be freed on error with freePatternSrc */
3279 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3280 pat->endRE = NULL;
3281 pat->errorRE = NULL;
3282 pat->style = NULL;
3283 pat->subPatternOf = NULL;
3285 /* read the type buttons */
3286 pat->flags = 0;
3287 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3288 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3289 pat->flags |= DEFER_PARSING;
3290 else if (colorOnly)
3291 pat->flags = COLOR_ONLY;
3293 /* read the name field */
3294 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3295 "highlight pattern name", silent);
3296 if (pat->name == NULL) {
3297 XtFree((char *)pat);
3298 return NULL;
3301 if (*pat->name == '\0')
3303 if (!silent)
3305 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3306 "Please specify a name\nfor the pattern", "Dismiss");
3307 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3309 XtFree(pat->name);
3310 XtFree((char *)pat);
3311 return NULL;
3314 /* read the startRE field */
3315 pat->startRE = XmTextGetString(HighlightDialog.startW);
3316 if (*pat->startRE == '\0')
3318 if (!silent)
3320 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3321 "Please specify a regular\nexpression to match", "Dismiss");
3322 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3324 freePatternSrc(pat, True);
3325 return NULL;
3328 /* Make sure coloring patterns contain only sub-expression references
3329 and put it in replacement regular-expression form */
3330 if (colorOnly)
3332 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3334 if (*inPtr!=' ' && *inPtr!='\t')
3336 *outPtr++ = *inPtr;
3340 *outPtr = '\0';
3341 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3342 || (*pat->startRE != '\\' && *pat->startRE != '&')
3343 || strstr(pat->startRE, "\\\\") != NULL)
3345 if (!silent)
3347 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3348 "The expression field in patterns which specify highlighting for\n"
3349 "a parent, must contain only sub-expression references in regular\n"
3350 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3351 "Expressions and Help -> Syntax Highlighting for more information",
3352 "Dismiss");
3353 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3355 freePatternSrc(pat, True);
3356 return NULL;
3360 /* read the parent field */
3361 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3363 if (TextWidgetIsBlank(HighlightDialog.parentW))
3365 if (!silent)
3367 DialogF(DF_WARN, HighlightDialog.shell, 1,
3368 "Specify Parent Pattern",
3369 "Please specify a parent pattern", "Dismiss");
3370 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3372 freePatternSrc(pat, True);
3373 return NULL;
3375 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3378 /* read the styles option menu */
3379 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3380 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3381 pat->style = XtMalloc(strlen(style) + 1);
3382 strcpy(pat->style, style);
3385 /* read the endRE field */
3386 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3388 pat->endRE = XmTextGetString(HighlightDialog.endW);
3389 if (!colorOnly && *pat->endRE == '\0')
3391 if (!silent)
3393 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3394 "Please specify an ending\nregular expression",
3395 "Dismiss");
3396 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3398 freePatternSrc(pat, True);
3399 return NULL;
3403 /* read the errorRE field */
3404 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3405 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3406 if (*pat->errorRE == '\0') {
3407 XtFree(pat->errorRE);
3408 pat->errorRE = NULL;
3411 return pat;
3415 ** Returns true if the pattern fields of the highlight dialog are set to
3416 ** the default ("New" pattern) state.
3418 static int dialogEmpty(void)
3420 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3421 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3422 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3423 TextWidgetIsBlank(HighlightDialog.parentW) &&
3424 TextWidgetIsBlank(HighlightDialog.startW) &&
3425 TextWidgetIsBlank(HighlightDialog.endW) &&
3426 TextWidgetIsBlank(HighlightDialog.errorW);
3430 ** Update the pattern set being edited in the Syntax Highlighting dialog
3431 ** with the information that the dialog is currently displaying, and
3432 ** apply changes to any window which is currently using the patterns.
3434 static int updatePatternSet(void)
3436 patternSet *patSet;
3437 WindowInfo *window;
3438 int psn;
3440 /* Make sure the patterns are valid and compile */
3441 if (!checkHighlightDialogData())
3442 return False;
3444 /* Get the current data */
3445 patSet = getDialogPatternSet();
3446 if (patSet == NULL)
3447 return False;
3449 /* Find the pattern being modified */
3450 for (psn=0; psn<NPatternSets; psn++)
3451 if (!strcmp(HighlightDialog.langModeName,
3452 PatternSets[psn]->languageMode))
3453 break;
3455 /* If it's a new pattern, add it at the end, otherwise free the
3456 existing pattern set and replace it */
3457 if (psn == NPatternSets) {
3458 PatternSets[NPatternSets++] = patSet;
3459 } else {
3460 freePatternSet(PatternSets[psn]);
3461 PatternSets[psn] = patSet;
3464 /* Find windows that are currently using this pattern set and
3465 re-do the highlighting */
3466 for (window=WindowList; window!=NULL; window=window->next) {
3467 if (window->highlightSyntax &&
3468 window->languageMode != PLAIN_LANGUAGE_MODE) {
3469 if (!strcmp(LanguageModeName(window->languageMode),
3470 patSet->languageMode)) {
3471 StopHighlighting(window);
3472 StartHighlighting(window, True);
3477 /* Note that preferences have been changed */
3478 MarkPrefsChanged();
3480 return True;
3484 ** Get the current information that the user has entered in the syntax
3485 ** highlighting dialog. Return NULL if the data is currently invalid
3487 static patternSet *getDialogPatternSet(void)
3489 int i, lineContext, charContext;
3490 patternSet *patSet;
3492 /* Get the current contents of the "patterns" dialog fields */
3493 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3494 return NULL;
3496 /* Get the line and character context values */
3497 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3498 "context lines", True) != TEXT_READ_OK)
3499 return NULL;
3500 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3501 "context lines", True) != TEXT_READ_OK)
3502 return NULL;
3504 /* Allocate a new pattern set structure and copy the fields read from the
3505 dialog, including the modified pattern list into it */
3506 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3507 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3508 patSet->lineContext = lineContext;
3509 patSet->charContext = charContext;
3510 patSet->nPatterns = HighlightDialog.nPatterns;
3511 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3512 HighlightDialog.nPatterns);
3513 for (i=0; i<HighlightDialog.nPatterns; i++)
3514 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3515 return patSet;
3519 ** Return True if "patSet1" and "patSet2" differ
3521 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3523 int i;
3524 highlightPattern *pat1, *pat2;
3526 if (patSet1->lineContext != patSet2->lineContext)
3527 return True;
3528 if (patSet1->charContext != patSet2->charContext)
3529 return True;
3530 if (patSet1->nPatterns != patSet2->nPatterns)
3531 return True;
3532 for (i=0; i<patSet2->nPatterns; i++) {
3533 pat1 = &patSet1->patterns[i];
3534 pat2 = &patSet2->patterns[i];
3535 if (pat1->flags != pat2->flags)
3536 return True;
3537 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3538 return True;
3539 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3540 return True;
3541 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3542 return True;
3543 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3544 return True;
3545 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3546 return True;
3547 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3548 return True;
3550 return False;
3554 ** Copy a highlight pattern data structure and all of the allocated data
3555 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3556 ** otherwise allocate a new highlightPattern structure and return it as the
3557 ** function value.
3559 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3560 highlightPattern *copyTo)
3562 highlightPattern *newPat;
3564 if (copyTo == NULL)
3565 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3566 else
3567 newPat = copyTo;
3568 newPat->name = XtNewString(pat->name);
3569 newPat->startRE = XtNewString(pat->startRE);
3570 newPat->endRE = XtNewString(pat->endRE);
3571 newPat->errorRE = XtNewString(pat->errorRE);
3572 newPat->style = XtNewString(pat->style);
3573 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3574 newPat->flags = pat->flags;
3575 return newPat;
3578 static void freeNonNull(void *ptr)
3580 if (ptr != NULL)
3581 XtFree((char *)ptr);
3585 ** Free the allocated memory contained in a highlightPattern data structure
3586 ** If "freeStruct" is true, free the structure itself as well.
3588 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3590 XtFree(pat->name);
3591 freeNonNull(pat->startRE);
3592 freeNonNull(pat->endRE);
3593 freeNonNull(pat->errorRE);
3594 freeNonNull(pat->style);
3595 freeNonNull(pat->subPatternOf);
3596 if (freeStruct)
3597 XtFree((char *)pat);
3601 ** Free the allocated memory contained in a patternSet data structure
3602 ** If "freeStruct" is true, free the structure itself as well.
3604 static void freePatternSet(patternSet *p)
3606 int i;
3608 for (i=0; i<p->nPatterns; i++)
3609 freePatternSrc(&p->patterns[i], False);
3610 XtFree(p->languageMode);
3611 XtFree((char *)p->patterns);
3612 XtFree((char *)p);
3615 #if 0
3617 ** Free the allocated memory contained in a patternSet data structure
3618 ** If "freeStruct" is true, free the structure itself as well.
3620 static int lookupNamedPattern(patternSet *p, char *patternName)
3622 int i;
3624 for (i=0; i<p->nPatterns; i++)
3625 if (strcmp(p->patterns[i].name, patternName))
3626 return i;
3627 return -1;
3629 #endif
3632 ** Find the index into the HighlightStyles array corresponding to "styleName".
3633 ** If styleName is not found, return -1.
3635 static int lookupNamedStyle(const char *styleName)
3637 int i;
3639 for (i = 0; i < NHighlightStyles; i++)
3641 if (!strcmp(styleName, HighlightStyles[i]->name))
3643 return i;
3647 return -1;
3651 ** Returns a unique number of a given style name
3653 int IndexOfNamedStyle(const char *styleName)
3655 return lookupNamedStyle(styleName);
3659 ** Write the string representation of int "i" to a static area, and
3660 ** return a pointer to it.
3662 static char *intToStr(int i)
3664 static char outBuf[12];
3666 sprintf(outBuf, "%d", i);
3667 return outBuf;