Applied the "OpenMotif sticky radio button" workaround to all radio buttons.
[nedit.git] / source / highlightData.c
blobf1ceaaeafd6c8c1ecb09a44dea8844aacf9fa944
1 static const char CVSID[] = "$Id: highlightData.c,v 1.60 2004/01/16 09:18:27 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+|#\\d|[^{\\\\])\":::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:\"(?<!#\\d)(?:\\$|\\\\\\()\":\"\\$|\\\\\\)\":\"\\\\\\(|(?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:\"\\{\":\"}\":\"(?<=^%)|\\\\]|\\$\\$|\\\\end\\{equation\\}\":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:2:0{\n\
544 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
545 Comment:\"#\":\"$\"::Comment::\n\
546 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line)>\":::Identifier::\n\
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_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>\":::Subroutine::\n\
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:\"(?<=define)\\s+\\w+\":::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 README:\"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
800 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
801 single quoted string:\"'\":\"'\"::String1::\n\
802 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
803 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
804 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
805 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
806 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
807 dqncs single quoted string:\"'\":\"'\"::String1:dq new command sub:\n\
808 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
809 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
810 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
811 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
812 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
813 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
814 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
815 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
816 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
817 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
818 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
819 command substitution:\"`\":\"`\"::Subroutine::\n\
820 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
821 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
822 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
823 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
824 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
825 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
826 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
827 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
828 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
829 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
830 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
831 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
832 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
833 comments in line:\"#\":\"$\"::Comment::\n\
834 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
835 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
836 command options:\"(?<=\\s)-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
837 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
838 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}",
839 "Tcl:1:0{\n\
840 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
841 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
842 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
843 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
844 Comment:\"#\":\"$\"::Comment::\n\
845 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\
846 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\
847 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
848 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
849 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
850 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
851 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
852 Namespace:\"\\w+::\":::Keyword::}",
853 "VHDL:1:0{\n\
854 Comments:\"--\":\"$\"::Comment::\n\
855 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
856 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
857 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
858 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
859 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
860 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
861 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\
862 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
863 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
864 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
865 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
866 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
867 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
868 "Verilog:1:0{\n\
869 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
870 cplus comment:\"//\":\"$\"::Comment::\n\
871 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
872 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
873 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\
874 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\
875 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
876 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\
877 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
878 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
879 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
880 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
881 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
882 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
883 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
884 "XML:1:0{\n\
885 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
886 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
887 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
888 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
889 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
890 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
891 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
892 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
893 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
894 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
895 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
896 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
897 doctype root element:\"\\2\":::Identifier:doctype:C\n\
898 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
899 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
900 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
901 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
902 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
903 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
904 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
905 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
906 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
907 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
908 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
909 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
910 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
911 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
912 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
913 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
914 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
915 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
916 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
917 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
918 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
919 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
920 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
921 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
922 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
923 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
924 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
925 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
926 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
927 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
928 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
929 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
930 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
931 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
932 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
933 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
934 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
935 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
936 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
937 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
938 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
939 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
940 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
941 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
942 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
943 element name:\"\\2\":::Identifier:element:C\n\
944 element assign:\"=\":::Keyword:element:\n\
945 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
946 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
947 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
948 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
949 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
950 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
951 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
952 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
953 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
954 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
955 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
956 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
957 "X Resources:2:0{\n\
958 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
959 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
960 Comment:\"^\\s*!\":\"$\"::Comment::\n\
961 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
962 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
963 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
964 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
965 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
966 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
967 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
968 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
969 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
970 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
971 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
972 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
973 Free Text:\"^.*$\":::Flag::}",
974 "Yacc:1:0{\n\
975 comment:\"/\\*\":\"\\*/\"::Comment::\n\
976 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
977 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
978 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
979 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
980 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
981 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
982 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\
983 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\
984 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
985 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
986 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\
987 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
988 braces:\"[{}]\":::Keyword::D\n\
989 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
990 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
995 ** Read a string (from the value of the styles resource) containing highlight
996 ** styles information, parse it, and load it into the stored highlight style
997 ** list (HighlightStyles) for this NEdit session.
999 int LoadStylesString(char *inString)
1001 char *errMsg, *fontStr;
1002 char *inPtr = inString;
1003 highlightStyleRec *hs;
1004 int i;
1006 for (;;) {
1008 /* skip over blank space */
1009 inPtr += strspn(inPtr, " \t");
1011 /* Allocate a language mode structure in which to store the info. */
1012 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1014 /* read style name */
1015 hs->name = ReadSymbolicField(&inPtr);
1016 if (hs->name == NULL)
1017 return styleError(inString,inPtr, "style name required");
1018 if (!SkipDelimiter(&inPtr, &errMsg)) {
1019 XtFree(hs->name);
1020 XtFree((char *)hs);
1021 return styleError(inString,inPtr, errMsg);
1024 /* read color */
1025 hs->color = ReadSymbolicField(&inPtr);
1026 if (hs->color == NULL) {
1027 XtFree(hs->name);
1028 XtFree((char *)hs);
1029 return styleError(inString,inPtr, "color name required");
1031 hs->bgColor = NULL;
1032 if (SkipOptSeparator('/', &inPtr)) {
1033 /* read bgColor */
1034 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1036 if (!SkipDelimiter(&inPtr, &errMsg)) {
1037 freeHighlightStyleRec(hs);
1038 return styleError(inString,inPtr, errMsg);
1041 /* read the font type */
1042 fontStr = ReadSymbolicField(&inPtr);
1043 for (i=0; i<N_FONT_TYPES; i++) {
1044 if (!strcmp(FontTypeNames[i], fontStr)) {
1045 hs->font = i;
1046 break;
1049 if (i == N_FONT_TYPES) {
1050 XtFree(fontStr);
1051 freeHighlightStyleRec(hs);
1052 return styleError(inString, inPtr, "unrecognized font type");
1054 XtFree(fontStr);
1056 /* pattern set was read correctly, add/change it in the list */
1057 for (i=0; i<NHighlightStyles; i++) {
1058 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1059 freeHighlightStyleRec(HighlightStyles[i]);
1060 HighlightStyles[i] = hs;
1061 break;
1064 if (i == NHighlightStyles) {
1065 HighlightStyles[NHighlightStyles++] = hs;
1066 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1067 return styleError(inString, inPtr,
1068 "maximum allowable number of styles exceeded");
1071 /* if the string ends here, we're done */
1072 inPtr += strspn(inPtr, " \t\n");
1073 if (*inPtr == '\0')
1074 return True;
1079 ** Create a string in the correct format for the styles resource, containing
1080 ** all of the highlight styles information from the stored highlight style
1081 ** list (HighlightStyles) for this NEdit session.
1083 char *WriteStylesString(void)
1085 int i;
1086 char *outStr;
1087 textBuffer *outBuf;
1088 highlightStyleRec *style;
1090 outBuf = BufCreate();
1091 for (i=0; i<NHighlightStyles; i++) {
1092 style = HighlightStyles[i];
1093 BufInsert(outBuf, outBuf->length, "\t");
1094 BufInsert(outBuf, outBuf->length, style->name);
1095 BufInsert(outBuf, outBuf->length, ":");
1096 BufInsert(outBuf, outBuf->length, style->color);
1097 if (style->bgColor) {
1098 BufInsert(outBuf, outBuf->length, "/");
1099 BufInsert(outBuf, outBuf->length, style->bgColor);
1101 BufInsert(outBuf, outBuf->length, ":");
1102 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1103 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1106 /* Get the output, and lop off the trailing newlines */
1107 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1108 BufFree(outBuf);
1109 return outStr;
1113 ** Read a string representing highlight pattern sets and add them
1114 ** to the PatternSets list of loaded highlight patterns. Note that the
1115 ** patterns themselves are not parsed until they are actually used.
1117 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1118 ** that they may contain regular expressions are of the older syntax where
1119 ** braces were not quoted, and \0 was a legal substitution character).
1121 int LoadHighlightString(char *inString, int convertOld)
1123 char *inPtr = inString;
1124 patternSet *patSet;
1125 int i;
1127 for (;;) {
1129 /* Read each pattern set, abort on error */
1130 patSet = readPatternSet(&inPtr, convertOld);
1131 if (patSet == NULL)
1132 return False;
1134 /* Add/change the pattern set in the list */
1135 for (i=0; i<NPatternSets; i++) {
1136 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1137 freePatternSet(PatternSets[i]);
1138 PatternSets[i] = patSet;
1139 break;
1142 if (i == NPatternSets) {
1143 PatternSets[NPatternSets++] = patSet;
1144 if (NPatternSets > MAX_LANGUAGE_MODES)
1145 return False;
1148 /* if the string ends here, we're done */
1149 inPtr += strspn(inPtr, " \t\n");
1150 if (*inPtr == '\0')
1151 return True;
1156 ** Create a string in the correct format for the highlightPatterns resource,
1157 ** containing all of the highlight pattern information from the stored
1158 ** highlight pattern list (PatternSets) for this NEdit session.
1160 char *WriteHighlightString(void)
1162 char *outStr, *str, *escapedStr;
1163 textBuffer *outBuf;
1164 int psn, written = False;
1165 patternSet *patSet;
1167 outBuf = BufCreate();
1168 for (psn=0; psn<NPatternSets; psn++) {
1169 patSet = PatternSets[psn];
1170 if (patSet->nPatterns == 0)
1171 continue;
1172 written = True;
1173 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1174 BufInsert(outBuf, outBuf->length, ":");
1175 if (isDefaultPatternSet(patSet))
1176 BufInsert(outBuf, outBuf->length, "Default\n\t");
1177 else {
1178 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1179 BufInsert(outBuf, outBuf->length, ":");
1180 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1181 BufInsert(outBuf, outBuf->length, "{\n");
1182 BufInsert(outBuf, outBuf->length,
1183 str = createPatternsString(patSet, "\t\t"));
1184 XtFree(str);
1185 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1189 /* Get the output string, and lop off the trailing newline and tab */
1190 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1191 BufFree(outBuf);
1193 /* Protect newlines and backslashes from translation by the resource
1194 reader */
1195 escapedStr = EscapeSensitiveChars(outStr);
1196 XtFree(outStr);
1197 return escapedStr;
1201 ** Update regular expressions in stored pattern sets to version 5.1 regular
1202 ** expression syntax, in which braces and \0 have different meanings
1204 static void convertOldPatternSet(patternSet *patSet)
1206 int p;
1207 highlightPattern *pattern;
1209 for (p=0; p<patSet->nPatterns; p++) {
1210 pattern = &patSet->patterns[p];
1211 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1212 pattern->name, pattern->flags & COLOR_ONLY);
1213 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1214 pattern->name, pattern->flags & COLOR_ONLY);
1215 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1216 pattern->name, pattern->flags & COLOR_ONLY);
1221 ** Convert a single regular expression, patternRE, to version 5.1 regular
1222 ** expression syntax. It will convert either a match expression or a
1223 ** substitution expression, which must be specified by the setting of
1224 ** isSubsExpr. Error messages are directed to stderr, and include the
1225 ** pattern set name and pattern name as passed in patSetName and patName.
1227 static void convertPatternExpr(char **patternRE, char *patSetName,
1228 char *patName, int isSubsExpr)
1230 char *newRE, *errorText;
1232 if (*patternRE == NULL)
1233 return;
1234 if (isSubsExpr) {
1235 newRE = XtMalloc(strlen(*patternRE) + 5000);
1236 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1237 XtFree(*patternRE);
1238 *patternRE = XtNewString(newRE);
1239 XtFree(newRE);
1240 } else{
1241 newRE = ConvertRE(*patternRE, &errorText);
1242 if (newRE == NULL) {
1243 fprintf(stderr, "NEdit error converting old format regular "
1244 "expression in pattern set %s, pattern %s: %s\n",
1245 patSetName, patName, errorText);
1247 XtFree(*patternRE);
1248 *patternRE = newRE;
1253 ** Find the font (font struct) associated with a named style.
1254 ** This routine must only be called with a valid styleName (call
1255 ** NamedStyleExists to find out whether styleName is valid).
1257 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1259 int styleNo=lookupNamedStyle(styleName),fontNum;
1260 XFontStruct *font;
1262 if (styleNo<0)
1263 return GetDefaultFontStruct(window->fontList);
1264 fontNum = HighlightStyles[styleNo]->font;
1265 if (fontNum == BOLD_FONT)
1266 font = window->boldFontStruct;
1267 else if (fontNum == ITALIC_FONT)
1268 font = window->italicFontStruct;
1269 else if (fontNum == BOLD_ITALIC_FONT)
1270 font = window->boldItalicFontStruct;
1271 else /* fontNum == PLAIN_FONT */
1272 font = GetDefaultFontStruct(window->fontList);
1274 /* If font isn't loaded, silently substitute primary font */
1275 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1278 int FontOfNamedStyleIsBold(char *styleName)
1280 int styleNo=lookupNamedStyle(styleName),fontNum;
1282 if (styleNo<0)
1283 return 0;
1284 fontNum = HighlightStyles[styleNo]->font;
1285 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1288 int FontOfNamedStyleIsItalic(char *styleName)
1290 int styleNo=lookupNamedStyle(styleName),fontNum;
1292 if (styleNo<0)
1293 return 0;
1294 fontNum = HighlightStyles[styleNo]->font;
1295 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1299 ** Find the color associated with a named style. This routine must only be
1300 ** called with a valid styleName (call NamedStyleExists to find out whether
1301 ** styleName is valid).
1303 char *ColorOfNamedStyle(const char *styleName)
1305 int styleNo=lookupNamedStyle(styleName);
1307 if (styleNo<0)
1308 return "black";
1309 return HighlightStyles[styleNo]->color;
1313 ** Find the background color associated with a named style.
1315 char *BgColorOfNamedStyle(const char *styleName)
1317 int styleNo=lookupNamedStyle(styleName);
1319 if (styleNo<0)
1320 return "";
1321 return HighlightStyles[styleNo]->bgColor;
1325 ** Determine whether a named style exists
1327 int NamedStyleExists(const char *styleName)
1329 return lookupNamedStyle(styleName) != -1;
1333 ** Look through the list of pattern sets, and find the one for a particular
1334 ** language. Returns NULL if not found.
1336 patternSet *FindPatternSet(const char *langModeName)
1338 int i;
1340 if (langModeName == NULL)
1341 return NULL;
1343 for (i=0; i<NPatternSets; i++)
1344 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1345 return PatternSets[i];
1346 return NULL;
1351 ** Returns True if there are highlight patterns, or potential patterns
1352 ** not yet committed in the syntax highlighting dialog for a language mode,
1354 int LMHasHighlightPatterns(const char *languageMode)
1356 if (FindPatternSet(languageMode) != NULL)
1357 return True;
1358 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1359 languageMode) && HighlightDialog.nPatterns != 0;
1363 ** Change the language mode name of pattern sets for language "oldName" to
1364 ** "newName" in both the stored patterns, and the pattern set currently being
1365 ** edited in the dialog.
1367 void RenameHighlightPattern(const char *oldName, const char *newName)
1369 int i;
1371 for (i=0; i<NPatternSets; i++) {
1372 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1373 XtFree(PatternSets[i]->languageMode);
1374 PatternSets[i]->languageMode = XtNewString(newName);
1377 if (HighlightDialog.shell != NULL) {
1378 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1379 XtFree(HighlightDialog.langModeName);
1380 HighlightDialog.langModeName = XtNewString(newName);
1386 ** Create a pulldown menu pane with the names of the current highlight styles.
1387 ** XmNuserData for each item contains a pointer to the name.
1389 static Widget createHighlightStylesMenu(Widget parent)
1391 Widget menu;
1392 int i;
1393 XmString s1;
1395 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1396 for (i=0; i<NHighlightStyles; i++) {
1397 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1398 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1399 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1400 XmStringFree(s1);
1402 return menu;
1405 static char *createPatternsString(patternSet *patSet, char *indentStr)
1407 char *outStr, *str;
1408 textBuffer *outBuf;
1409 int pn;
1410 highlightPattern *pat;
1412 outBuf = BufCreate();
1413 for (pn=0; pn<patSet->nPatterns; pn++) {
1414 pat = &patSet->patterns[pn];
1415 BufInsert(outBuf, outBuf->length, indentStr);
1416 BufInsert(outBuf, outBuf->length, pat->name);
1417 BufInsert(outBuf, outBuf->length, ":");
1418 if (pat->startRE != NULL) {
1419 BufInsert(outBuf, outBuf->length,
1420 str=MakeQuotedString(pat->startRE));
1421 XtFree(str);
1423 BufInsert(outBuf, outBuf->length, ":");
1424 if (pat->endRE != NULL) {
1425 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1426 XtFree(str);
1428 BufInsert(outBuf, outBuf->length, ":");
1429 if (pat->errorRE != NULL) {
1430 BufInsert(outBuf, outBuf->length,
1431 str=MakeQuotedString(pat->errorRE));
1432 XtFree(str);
1434 BufInsert(outBuf, outBuf->length, ":");
1435 BufInsert(outBuf, outBuf->length, pat->style);
1436 BufInsert(outBuf, outBuf->length, ":");
1437 if (pat->subPatternOf != NULL)
1438 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1439 BufInsert(outBuf, outBuf->length, ":");
1440 if (pat->flags & DEFER_PARSING)
1441 BufInsert(outBuf, outBuf->length, "D");
1442 if (pat->flags & PARSE_SUBPATS_FROM_START)
1443 BufInsert(outBuf, outBuf->length, "R");
1444 if (pat->flags & COLOR_ONLY)
1445 BufInsert(outBuf, outBuf->length, "C");
1446 BufInsert(outBuf, outBuf->length, "\n");
1448 outStr = BufGetAll(outBuf);
1449 BufFree(outBuf);
1450 return outStr;
1454 ** Read in a pattern set character string, and advance *inPtr beyond it.
1455 ** Returns NULL and outputs an error to stderr on failure.
1457 static patternSet *readPatternSet(char **inPtr, int convertOld)
1459 char *errMsg, *stringStart = *inPtr;
1460 patternSet patSet, *retPatSet;
1462 /* remove leading whitespace */
1463 *inPtr += strspn(*inPtr, " \t\n");
1465 /* read language mode field */
1466 patSet.languageMode = ReadSymbolicField(inPtr);
1467 if (patSet.languageMode == NULL)
1468 return highlightError(stringStart, *inPtr,
1469 "language mode must be specified");
1470 if (!SkipDelimiter(inPtr, &errMsg))
1471 return highlightError(stringStart, *inPtr, errMsg);
1473 /* look for "Default" keyword, and if it's there, return the default
1474 pattern set */
1475 if (!strncmp(*inPtr, "Default", 7)) {
1476 *inPtr += 7;
1477 retPatSet = readDefaultPatternSet(patSet.languageMode);
1478 XtFree(patSet.languageMode);
1479 if (retPatSet == NULL)
1480 return highlightError(stringStart, *inPtr,
1481 "No default pattern set");
1482 return retPatSet;
1485 /* read line context field */
1486 if (!ReadNumericField(inPtr, &patSet.lineContext))
1487 return highlightError(stringStart, *inPtr,
1488 "unreadable line context field");
1489 if (!SkipDelimiter(inPtr, &errMsg))
1490 return highlightError(stringStart, *inPtr, errMsg);
1492 /* read character context field */
1493 if (!ReadNumericField(inPtr, &patSet.charContext))
1494 return highlightError(stringStart, *inPtr,
1495 "unreadable character context field");
1497 /* read pattern list */
1498 patSet.patterns = readHighlightPatterns(inPtr,
1499 True, &errMsg, &patSet.nPatterns);
1500 if (patSet.patterns == NULL)
1501 return highlightError(stringStart, *inPtr, errMsg);
1503 /* pattern set was read correctly, make an allocated copy to return */
1504 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1505 memcpy(retPatSet, &patSet, sizeof(patternSet));
1507 /* Convert pre-5.1 pattern sets which use old regular expression
1508 syntax to quote braces and use & rather than \0 */
1509 if (convertOld)
1510 convertOldPatternSet(retPatSet);
1512 return retPatSet;
1516 ** Parse a set of highlight patterns into an array of highlightPattern
1517 ** structures, and a language mode name. If unsuccessful, returns NULL with
1518 ** (statically allocated) message in "errMsg".
1520 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1521 char **errMsg, int *nPatterns)
1523 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1525 /* skip over blank space */
1526 *inPtr += strspn(*inPtr, " \t\n");
1528 /* look for initial brace */
1529 if (withBraces) {
1530 if (**inPtr != '{') {
1531 *errMsg = "pattern list must begin with \"{\"";
1532 return False;
1534 (*inPtr)++;
1538 ** parse each pattern in the list
1540 pat = patternList;
1541 while (True) {
1542 *inPtr += strspn(*inPtr, " \t\n");
1543 if (**inPtr == '\0') {
1544 if (withBraces) {
1545 *errMsg = "end of pattern list not found";
1546 return NULL;
1547 } else
1548 break;
1549 } else if (**inPtr == '}') {
1550 (*inPtr)++;
1551 break;
1553 if (!readHighlightPattern(inPtr, errMsg, pat++))
1554 return NULL;
1555 if (pat - patternList > MAX_PATTERNS) {
1556 *errMsg = "max number of patterns exceeded\n";
1557 return NULL;
1561 /* allocate a more appropriately sized list to return patterns */
1562 *nPatterns = pat - patternList;
1563 returnedList = (highlightPattern *)XtMalloc(
1564 sizeof(highlightPattern) * *nPatterns);
1565 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1566 return returnedList;
1569 static int readHighlightPattern(char **inPtr, char **errMsg,
1570 highlightPattern *pattern)
1572 /* read the name field */
1573 pattern->name = ReadSymbolicField(inPtr);
1574 if (pattern->name == NULL) {
1575 *errMsg = "pattern name is required";
1576 return False;
1578 if (!SkipDelimiter(inPtr, errMsg))
1579 return False;
1581 /* read the start pattern */
1582 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1583 return False;
1584 if (!SkipDelimiter(inPtr, errMsg))
1585 return False;
1587 /* read the end pattern */
1588 if (**inPtr == ':')
1589 pattern->endRE = NULL;
1590 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1591 return False;
1592 if (!SkipDelimiter(inPtr, errMsg))
1593 return False;
1595 /* read the error pattern */
1596 if (**inPtr == ':')
1597 pattern->errorRE = NULL;
1598 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1599 return False;
1600 if (!SkipDelimiter(inPtr, errMsg))
1601 return False;
1603 /* read the style field */
1604 pattern->style = ReadSymbolicField(inPtr);
1605 if (pattern->style == NULL) {
1606 *errMsg = "style field required in pattern";
1607 return False;
1609 if (!SkipDelimiter(inPtr, errMsg))
1610 return False;
1612 /* read the sub-pattern-of field */
1613 pattern->subPatternOf = ReadSymbolicField(inPtr);
1614 if (!SkipDelimiter(inPtr, errMsg))
1615 return False;
1617 /* read flags field */
1618 pattern->flags = 0;
1619 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1620 if (**inPtr == 'D')
1621 pattern->flags |= DEFER_PARSING;
1622 else if (**inPtr == 'R')
1623 pattern->flags |= PARSE_SUBPATS_FROM_START;
1624 else if (**inPtr == 'C')
1625 pattern->flags |= COLOR_ONLY;
1626 else if (**inPtr != ' ' && **inPtr != '\t') {
1627 *errMsg = "unreadable flag field";
1628 return False;
1631 return True;
1635 ** Given a language mode name, determine if there is a default (built-in)
1636 ** pattern set available for that language mode, and if so, read it and
1637 ** return a new allocated copy of it. The returned pattern set should be
1638 ** freed by the caller with freePatternSet()
1640 static patternSet *readDefaultPatternSet(const char *langModeName)
1642 int i, modeNameLen;
1643 char *strPtr;
1645 modeNameLen = strlen(langModeName);
1646 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1647 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1648 DefaultPatternSets[i][modeNameLen] == ':') {
1649 strPtr = DefaultPatternSets[i];
1650 return readPatternSet(&strPtr, False);
1653 return NULL;
1657 ** Return True if patSet exactly matches one of the default pattern sets
1659 static int isDefaultPatternSet(patternSet *patSet)
1661 patternSet *defaultPatSet;
1662 int retVal;
1664 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1665 if (defaultPatSet == NULL)
1666 return False;
1667 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1668 freePatternSet(defaultPatSet);
1669 return retVal;
1673 ** Short-hand functions for formating and outputing errors for
1675 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1676 const char *message)
1678 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1679 return NULL;
1683 static int styleError(const char *stringStart, const char *stoppedAt,
1684 const char *message)
1686 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1687 return False;
1691 ** Present a dialog for editing highlight style information
1693 void EditHighlightStyles(const char *initialStyle)
1695 #define HS_LIST_RIGHT 60
1696 #define HS_LEFT_MARGIN_POS 1
1697 #define HS_RIGHT_MARGIN_POS 99
1698 #define HS_H_MARGIN 10
1699 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1700 Widget fontBox, sep1, okBtn, applyBtn, dismissBtn;
1701 XmString s1;
1702 int i, ac;
1703 Arg args[20];
1705 /* if the dialog is already displayed, just pop it to the top and return */
1706 if (HSDialog.shell != NULL) {
1707 if (initialStyle != NULL)
1708 setStyleByName(initialStyle);
1709 RaiseShellWindow(HSDialog.shell);
1710 return;
1713 /* Copy the list of highlight style information to one that the user
1714 can freely edit (via the dialog and managed-list code) */
1715 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1716 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1717 for (i=0; i<NHighlightStyles; i++)
1718 HSDialog.highlightStyleList[i] =
1719 copyHighlightStyleRec(HighlightStyles[i]);
1720 HSDialog.nHighlightStyles = NHighlightStyles;
1722 /* Create a form widget in an application shell */
1723 ac = 0;
1724 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1725 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1726 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1727 HSDialog.shell = CreateWidget(TheAppShell, "textStyles",
1728 topLevelShellWidgetClass, args, ac);
1729 AddSmallIcon(HSDialog.shell);
1730 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1731 HSDialog.shell, XmNautoUnmanage, False,
1732 XmNresizePolicy, XmRESIZE_NONE, NULL);
1733 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1734 AddMotifCloseCallback(HSDialog.shell, hsDismissCB, NULL);
1736 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1737 XmNlabelString, s1=MKSTRING(
1738 "To modify the properties of an existing highlight style, select the name\n\
1739 from the list on the left. Select \"New\" to add a new style to the list."),
1740 XmNmnemonic, 'N',
1741 XmNtopAttachment, XmATTACH_POSITION,
1742 XmNtopPosition, 2,
1743 XmNleftAttachment, XmATTACH_POSITION,
1744 XmNleftPosition, HS_LEFT_MARGIN_POS,
1745 XmNrightAttachment, XmATTACH_POSITION,
1746 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1747 XmStringFree(s1);
1749 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1750 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1751 XmNmnemonic, 'm',
1752 XmNalignment, XmALIGNMENT_BEGINNING,
1753 XmNleftAttachment, XmATTACH_POSITION,
1754 XmNleftPosition, HS_LIST_RIGHT,
1755 XmNtopAttachment, XmATTACH_WIDGET,
1756 XmNtopOffset, HS_H_MARGIN,
1757 XmNtopWidget, topLbl, NULL);
1758 XmStringFree(s1);
1760 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1761 XmNleftAttachment, XmATTACH_POSITION,
1762 XmNleftPosition, HS_LIST_RIGHT,
1763 XmNtopAttachment, XmATTACH_WIDGET,
1764 XmNtopWidget, nameLbl,
1765 XmNrightAttachment, XmATTACH_POSITION,
1766 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1767 RemapDeleteKey(HSDialog.nameW);
1768 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1770 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1771 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1772 XmNmnemonic, 'C',
1773 XmNalignment, XmALIGNMENT_BEGINNING,
1774 XmNleftAttachment, XmATTACH_POSITION,
1775 XmNleftPosition, HS_LIST_RIGHT,
1776 XmNtopAttachment, XmATTACH_WIDGET,
1777 XmNtopOffset, HS_H_MARGIN,
1778 XmNtopWidget, HSDialog.nameW, NULL);
1779 XmStringFree(s1);
1781 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1782 XmNleftAttachment, XmATTACH_POSITION,
1783 XmNleftPosition, HS_LIST_RIGHT,
1784 XmNtopAttachment, XmATTACH_WIDGET,
1785 XmNtopWidget, colorLbl,
1786 XmNrightAttachment, XmATTACH_POSITION,
1787 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1788 RemapDeleteKey(HSDialog.colorW);
1789 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1791 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1792 XmNlabelString,
1793 s1=XmStringCreateSimple("Background Color (optional)"),
1794 XmNmnemonic, 'g',
1795 XmNalignment, XmALIGNMENT_BEGINNING,
1796 XmNleftAttachment, XmATTACH_POSITION,
1797 XmNleftPosition, HS_LIST_RIGHT,
1798 XmNtopAttachment, XmATTACH_WIDGET,
1799 XmNtopOffset, HS_H_MARGIN,
1800 XmNtopWidget, HSDialog.colorW, NULL);
1801 XmStringFree(s1);
1803 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1804 xmTextWidgetClass, form,
1805 XmNleftAttachment, XmATTACH_POSITION,
1806 XmNleftPosition, HS_LIST_RIGHT,
1807 XmNtopAttachment, XmATTACH_WIDGET,
1808 XmNtopWidget, bgColorLbl,
1809 XmNrightAttachment, XmATTACH_POSITION,
1810 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1811 RemapDeleteKey(HSDialog.bgColorW);
1812 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1814 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1815 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1816 XmNalignment, XmALIGNMENT_BEGINNING,
1817 XmNleftAttachment, XmATTACH_POSITION,
1818 XmNleftPosition, HS_LIST_RIGHT,
1819 XmNtopAttachment, XmATTACH_WIDGET,
1820 XmNtopOffset, HS_H_MARGIN,
1821 XmNtopWidget, HSDialog.bgColorW, NULL);
1822 XmStringFree(s1);
1824 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1825 XmNpacking, XmPACK_COLUMN,
1826 XmNnumColumns, 2,
1827 XmNradioBehavior, True,
1828 XmNleftAttachment, XmATTACH_POSITION,
1829 XmNleftPosition, HS_LIST_RIGHT,
1830 XmNtopAttachment, XmATTACH_WIDGET,
1831 XmNtopWidget, fontLbl, NULL);
1832 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1833 xmToggleButtonWidgetClass, fontBox,
1834 XmNset, True,
1835 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1836 XmNmnemonic, 'P', NULL);
1837 XmStringFree(s1);
1838 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1839 xmToggleButtonWidgetClass, fontBox,
1840 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1841 XmNmnemonic, 'B', NULL);
1842 XmStringFree(s1);
1843 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1844 xmToggleButtonWidgetClass, fontBox,
1845 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1846 XmNmnemonic, 'I', NULL);
1847 XmStringFree(s1);
1848 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1849 xmToggleButtonWidgetClass, fontBox,
1850 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1851 XmNmnemonic, 'o', NULL);
1852 XmStringFree(s1);
1854 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1855 XmNlabelString, s1=XmStringCreateSimple("OK"),
1856 XmNleftAttachment, XmATTACH_POSITION,
1857 XmNleftPosition, 10,
1858 XmNrightAttachment, XmATTACH_POSITION,
1859 XmNrightPosition, 30,
1860 XmNbottomAttachment, XmATTACH_POSITION,
1861 XmNbottomPosition, 99, NULL);
1862 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1863 XmStringFree(s1);
1865 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1866 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1867 XmNmnemonic, 'A',
1868 XmNleftAttachment, XmATTACH_POSITION,
1869 XmNleftPosition, 40,
1870 XmNrightAttachment, XmATTACH_POSITION,
1871 XmNrightPosition, 60,
1872 XmNbottomAttachment, XmATTACH_POSITION,
1873 XmNbottomPosition, 99, NULL);
1874 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1875 XmStringFree(s1);
1877 dismissBtn = XtVaCreateManagedWidget("dismiss",xmPushButtonWidgetClass,form,
1878 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
1879 XmNleftAttachment, XmATTACH_POSITION,
1880 XmNleftPosition, 70,
1881 XmNrightAttachment, XmATTACH_POSITION,
1882 XmNrightPosition, 90,
1883 XmNbottomAttachment, XmATTACH_POSITION,
1884 XmNbottomPosition, 99, NULL);
1885 XtAddCallback(dismissBtn, XmNactivateCallback, hsDismissCB, NULL);
1886 XmStringFree(s1);
1888 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1889 XmNleftAttachment, XmATTACH_FORM,
1890 XmNtopAttachment, XmATTACH_WIDGET,
1891 XmNtopWidget, fontBox,
1892 XmNtopOffset, HS_H_MARGIN,
1893 XmNrightAttachment, XmATTACH_FORM,
1894 XmNbottomAttachment, XmATTACH_WIDGET,
1895 XmNbottomWidget, dismissBtn, 0,
1896 XmNbottomOffset, HS_H_MARGIN, NULL);
1898 ac = 0;
1899 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1900 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1901 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1902 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1903 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1904 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1905 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1906 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1907 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1908 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1909 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1910 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1911 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1912 NULL, hsFreeItemCB);
1913 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1915 /* Set initial default button */
1916 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1917 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
1919 /* If there's a suggestion for an initial selection, make it */
1920 if (initialStyle != NULL)
1921 setStyleByName(initialStyle);
1923 /* Handle mnemonic selection of buttons and focus to dialog */
1924 AddDialogMnemonicHandler(form, FALSE);
1926 /* Realize all of the widgets in the new dialog */
1927 RealizeWithoutForcingPosition(HSDialog.shell);
1930 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1932 int i;
1934 for (i=0; i<HSDialog.nHighlightStyles; i++)
1935 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1936 XtFree((char *)HSDialog.highlightStyleList);
1939 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1941 if (!updateHSList())
1942 return;
1944 /* pop down and destroy the dialog */
1945 XtDestroyWidget(HSDialog.shell);
1946 HSDialog.shell = NULL;
1949 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1951 updateHSList();
1954 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData)
1956 /* pop down and destroy the dialog */
1957 XtDestroyWidget(HSDialog.shell);
1958 HSDialog.shell = NULL;
1961 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1962 void *cbArg)
1964 highlightStyleRec *hs;
1966 /* If the dialog is currently displaying the "new" entry and the
1967 fields are empty, that's just fine */
1968 if (oldItem == NULL && hsDialogEmpty())
1969 return NULL;
1971 /* If there are no problems reading the data, just return it */
1972 hs = readHSDialogFields(True);
1973 if (hs != NULL)
1974 return (void *)hs;
1976 /* If there are problems, and the user didn't ask for the fields to be
1977 read, give more warning */
1978 if (!explicitRequest)
1980 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1981 "Discard incomplete entry\nfor current highlight style?",
1982 "Keep", "Discard") == 2)
1984 return oldItem == NULL
1985 ? NULL
1986 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
1990 /* Do readHSDialogFields again without "silent" mode to display warning */
1991 hs = readHSDialogFields(False);
1992 *abort = True;
1993 return NULL;
1996 static void hsSetDisplayedCB(void *item, void *cbArg)
1998 highlightStyleRec *hs = (highlightStyleRec *)item;
2000 if (item == NULL) {
2001 XmTextSetString(HSDialog.nameW, "");
2002 XmTextSetString(HSDialog.colorW, "");
2003 XmTextSetString(HSDialog.bgColorW, "");
2004 RadioButtonChangeState(HSDialog.plainW, True, False);
2005 RadioButtonChangeState(HSDialog.boldW, False, False);
2006 RadioButtonChangeState(HSDialog.italicW, False, False);
2007 RadioButtonChangeState(HSDialog.boldItalicW, False, False);
2008 } else {
2009 XmTextSetString(HSDialog.nameW, hs->name);
2010 XmTextSetString(HSDialog.colorW, hs->color);
2011 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2012 RadioButtonChangeState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2013 RadioButtonChangeState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2014 RadioButtonChangeState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2015 RadioButtonChangeState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2016 False);
2020 static void hsFreeItemCB(void *item)
2022 freeHighlightStyleRec((highlightStyleRec *)item);
2025 static highlightStyleRec *readHSDialogFields(int silent)
2027 highlightStyleRec *hs;
2028 Display *display = XtDisplay(HSDialog.shell);
2029 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2030 XColor rgb;
2032 /* Allocate a language mode structure to return */
2033 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2035 /* read the name field */
2036 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2037 "highlight style name", silent);
2038 if (hs->name == NULL) {
2039 XtFree((char *)hs);
2040 return NULL;
2043 if (*hs->name == '\0')
2045 if (!silent)
2047 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2048 "Please specify a name\nfor the highlight style", "Dismiss");
2049 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2051 XtFree(hs->name);
2052 XtFree((char *)hs);
2053 return NULL;
2056 /* read the color field */
2057 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2058 if (hs->color == NULL) {
2059 XtFree(hs->name);
2060 XtFree((char *)hs);
2061 return NULL;
2064 if (*hs->color == '\0')
2066 if (!silent)
2068 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2069 "Please specify a color\nfor the highlight style",
2070 "Dismiss");
2071 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2073 XtFree(hs->name);
2074 XtFree(hs->color);
2075 XtFree((char *)hs);
2076 return NULL;
2079 /* Verify that the color is a valid X color spec */
2080 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2081 &rgb))
2083 if (!silent)
2085 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2086 "Invalid X color specification: %s\n", "Dismiss",
2087 hs->color);
2088 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2090 XtFree(hs->name);
2091 XtFree(hs->color);
2092 XtFree((char *)hs);
2093 return NULL;;
2096 /* read the background color field - this may be empty */
2097 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2098 "bgColor", silent);
2099 if (hs->bgColor && *hs->bgColor == '\0') {
2100 XtFree(hs->bgColor);
2101 hs->bgColor = NULL;
2104 /* Verify that the background color (if present) is a valid X color spec */
2105 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2106 hs->bgColor, &rgb))
2108 if (!silent)
2110 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2111 "Invalid X background color specification: %s\n", "Dismiss",
2112 hs->bgColor);
2113 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2115 XtFree(hs->name);
2116 XtFree(hs->color);
2117 XtFree(hs->bgColor);
2118 XtFree((char *)hs);
2119 return NULL;;
2122 /* read the font buttons */
2123 if (XmToggleButtonGetState(HSDialog.boldW))
2124 hs->font = BOLD_FONT;
2125 else if (XmToggleButtonGetState(HSDialog.italicW))
2126 hs->font = ITALIC_FONT;
2127 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2128 hs->font = BOLD_ITALIC_FONT;
2129 else
2130 hs->font = PLAIN_FONT;
2132 return hs;
2136 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2137 ** it contains.
2139 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2141 highlightStyleRec *newHS;
2143 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2144 newHS->name = XtMalloc(strlen(hs->name)+1);
2145 strcpy(newHS->name, hs->name);
2146 if (hs->color == NULL)
2147 newHS->color = NULL;
2148 else {
2149 newHS->color = XtMalloc(strlen(hs->color)+1);
2150 strcpy(newHS->color, hs->color);
2152 if (hs->bgColor == NULL)
2153 newHS->bgColor = NULL;
2154 else {
2155 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2156 strcpy(newHS->bgColor, hs->bgColor);
2158 newHS->font = hs->font;
2159 return newHS;
2163 ** Free all of the allocated data in a highlightStyleRec, including the
2164 ** structure itself.
2166 static void freeHighlightStyleRec(highlightStyleRec *hs)
2168 XtFree(hs->name);
2169 if (hs->color != NULL)
2170 XtFree(hs->color);
2171 XtFree((char *)hs);
2175 ** Select a particular style in the highlight styles dialog
2177 static void setStyleByName(const char *style)
2179 int i;
2181 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2182 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2183 SelectManagedListItem(HSDialog.managedListW, i);
2184 break;
2190 ** Return True if the fields of the highlight styles dialog are consistent
2191 ** with a blank "New" style in the dialog.
2193 static int hsDialogEmpty(void)
2195 return TextWidgetIsBlank(HSDialog.nameW) &&
2196 TextWidgetIsBlank(HSDialog.colorW) &&
2197 XmToggleButtonGetState(HSDialog.plainW);
2201 ** Apply the changes made in the highlight styles dialog to the stored
2202 ** highlight style information in HighlightStyles
2204 static int updateHSList(void)
2206 WindowInfo *window;
2207 int i;
2209 /* Get the current contents of the dialog fields */
2210 if (!UpdateManagedList(HSDialog.managedListW, True))
2211 return False;
2213 /* Replace the old highlight styles list with the new one from the dialog */
2214 for (i=0; i<NHighlightStyles; i++)
2215 freeHighlightStyleRec(HighlightStyles[i]);
2216 for (i=0; i<HSDialog.nHighlightStyles; i++)
2217 HighlightStyles[i] =
2218 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2219 NHighlightStyles = HSDialog.nHighlightStyles;
2221 /* If a syntax highlighting dialog is up, update its menu */
2222 updateHighlightStyleMenu();
2224 /* Redisplay highlighted windows which use changed style(s) */
2225 for (window=WindowList; window!=NULL; window=window->next)
2226 UpdateHighlightStyles(window);
2228 /* Note that preferences have been changed */
2229 MarkPrefsChanged();
2231 return True;
2235 ** Present a dialog for editing highlight pattern information
2237 void EditHighlightPatterns(WindowInfo *window)
2239 #define BORDER 4
2240 #define LIST_RIGHT 41
2241 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2242 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2243 Widget okBtn, applyBtn, checkBtn, deleteBtn, dismissBtn, helpBtn;
2244 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2245 patternSet *patSet;
2246 XmString s1;
2247 int i, n, nPatterns;
2248 Arg args[20];
2250 /* if the dialog is already displayed, just pop it to the top and return */
2251 if (HighlightDialog.shell != NULL) {
2252 RaiseShellWindow(HighlightDialog.shell);
2253 return;
2256 if (LanguageModeName(0) == NULL)
2258 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2259 "No Language Modes available for syntax highlighting\n"
2260 "Add language modes under Preferenses->Language Modes",
2261 "Dismiss");
2262 return;
2265 /* Decide on an initial language mode */
2266 HighlightDialog.langModeName = XtNewString(
2267 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2268 window->languageMode));
2270 /* Find the associated pattern set (patSet) to edit */
2271 patSet = FindPatternSet(HighlightDialog.langModeName);
2273 /* Copy the list of patterns to one that the user can freely edit */
2274 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2275 sizeof(highlightPattern *) * MAX_PATTERNS);
2276 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2277 for (i=0; i<nPatterns; i++)
2278 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2279 HighlightDialog.nPatterns = nPatterns;
2282 /* Create a form widget in an application shell */
2283 n = 0;
2284 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2285 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2286 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2287 HighlightDialog.shell = CreateWidget(TheAppShell, "syntaxHighlight",
2288 topLevelShellWidgetClass, args, n);
2289 AddSmallIcon(HighlightDialog.shell);
2290 form = XtVaCreateManagedWidget("editHighlightPatterns", xmFormWidgetClass,
2291 HighlightDialog.shell, XmNautoUnmanage, False,
2292 XmNresizePolicy, XmRESIZE_NONE, NULL);
2293 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2294 AddMotifCloseCallback(HighlightDialog.shell, dismissCB, NULL);
2296 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2297 form,
2298 XmNleftAttachment, XmATTACH_POSITION,
2299 XmNleftPosition, 1,
2300 XmNtopAttachment, XmATTACH_POSITION,
2301 XmNtopPosition, 1,
2302 XmNrightAttachment, XmATTACH_POSITION,
2303 XmNrightPosition, 99, NULL);
2305 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2306 NULL);
2307 n = 0;
2308 XtSetArg(args[n], XmNspacing, 0); n++;
2309 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2310 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2311 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2312 XtSetArg(args[n], XmNleftPosition, 50); n++;
2313 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2314 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2315 XtManageChild(lmOptMenu);
2316 HighlightDialog.lmOptMenu = lmOptMenu;
2318 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2319 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2320 XmNmnemonic, 'M',
2321 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2322 XmNalignment, XmALIGNMENT_END,
2323 XmNrightAttachment, XmATTACH_POSITION,
2324 XmNrightPosition, 50,
2325 XmNtopAttachment, XmATTACH_FORM,
2326 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2327 XmNbottomWidget, lmOptMenu, NULL);
2328 XmStringFree(s1);
2330 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2331 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2332 XmNmnemonic, 'A',
2333 XmNrightAttachment, XmATTACH_FORM,
2334 XmNtopAttachment, XmATTACH_FORM, NULL);
2335 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2336 XmStringFree(s1);
2338 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2339 XmNlabelString, s1=XmStringCreateSimple("OK"),
2340 XmNleftAttachment, XmATTACH_POSITION,
2341 XmNleftPosition, 1,
2342 XmNrightAttachment, XmATTACH_POSITION,
2343 XmNrightPosition, 13,
2344 XmNbottomAttachment, XmATTACH_FORM,
2345 XmNbottomOffset, BORDER, NULL);
2346 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2347 XmStringFree(s1);
2349 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2350 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2351 XmNmnemonic, 'y',
2352 XmNleftAttachment, XmATTACH_POSITION,
2353 XmNleftPosition, 13,
2354 XmNrightAttachment, XmATTACH_POSITION,
2355 XmNrightPosition, 26,
2356 XmNbottomAttachment, XmATTACH_FORM,
2357 XmNbottomOffset, BORDER, NULL);
2358 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2359 XmStringFree(s1);
2361 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2362 XmNlabelString, s1=XmStringCreateSimple("Check"),
2363 XmNmnemonic, 'k',
2364 XmNleftAttachment, XmATTACH_POSITION,
2365 XmNleftPosition, 26,
2366 XmNrightAttachment, XmATTACH_POSITION,
2367 XmNrightPosition, 39,
2368 XmNbottomAttachment, XmATTACH_FORM,
2369 XmNbottomOffset, BORDER, NULL);
2370 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2371 XmStringFree(s1);
2373 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2374 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2375 XmNmnemonic, 'D',
2376 XmNleftAttachment, XmATTACH_POSITION,
2377 XmNleftPosition, 39,
2378 XmNrightAttachment, XmATTACH_POSITION,
2379 XmNrightPosition, 52,
2380 XmNbottomAttachment, XmATTACH_FORM,
2381 XmNbottomOffset, BORDER, NULL);
2382 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2383 XmStringFree(s1);
2385 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2386 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2387 XmNmnemonic, 'f',
2388 XmNleftAttachment, XmATTACH_POSITION,
2389 XmNleftPosition, 52,
2390 XmNrightAttachment, XmATTACH_POSITION,
2391 XmNrightPosition, 73,
2392 XmNbottomAttachment, XmATTACH_FORM,
2393 XmNbottomOffset, BORDER, NULL);
2394 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2395 XmStringFree(s1);
2397 dismissBtn = XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass,
2398 form,
2399 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
2400 XmNleftAttachment, XmATTACH_POSITION,
2401 XmNleftPosition, 73,
2402 XmNrightAttachment, XmATTACH_POSITION,
2403 XmNrightPosition, 86,
2404 XmNbottomAttachment, XmATTACH_FORM,
2405 XmNbottomOffset, BORDER, NULL);
2406 XtAddCallback(dismissBtn, XmNactivateCallback, dismissCB, NULL);
2407 XmStringFree(s1);
2409 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2410 form,
2411 XmNlabelString, s1=XmStringCreateSimple("Help"),
2412 XmNmnemonic, 'H',
2413 XmNleftAttachment, XmATTACH_POSITION,
2414 XmNleftPosition, 86,
2415 XmNrightAttachment, XmATTACH_POSITION,
2416 XmNrightPosition, 99,
2417 XmNbottomAttachment, XmATTACH_FORM,
2418 XmNbottomOffset, BORDER, NULL);
2419 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2420 XmStringFree(s1);
2422 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2423 form,
2424 XmNleftAttachment, XmATTACH_POSITION,
2425 XmNleftPosition, 1,
2426 XmNrightAttachment, XmATTACH_POSITION,
2427 XmNrightPosition, 99,
2428 XmNbottomAttachment, XmATTACH_WIDGET,
2429 XmNbottomWidget, okBtn,
2430 XmNbottomOffset, BORDER, NULL);
2431 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2432 contextFrame, NULL);
2433 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2434 XmNlabelString, s1=XmStringCreateSimple(
2435 "Context requirements for incremental re-parsing after changes"),
2436 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2437 XmStringFree(s1);
2439 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2440 xmTextWidgetClass, contextForm,
2441 XmNcolumns, 5,
2442 XmNmaxLength, 12,
2443 XmNleftAttachment, XmATTACH_POSITION,
2444 XmNleftPosition, 15,
2445 XmNrightAttachment, XmATTACH_POSITION,
2446 XmNrightPosition, 25, NULL);
2447 RemapDeleteKey(HighlightDialog.lineContextW);
2449 XtVaCreateManagedWidget("lineContLbl",
2450 xmLabelGadgetClass, contextForm,
2451 XmNlabelString, s1=XmStringCreateSimple("lines"),
2452 XmNmnemonic, 'l',
2453 XmNuserData, HighlightDialog.lineContextW,
2454 XmNalignment, XmALIGNMENT_BEGINNING,
2455 XmNleftAttachment, XmATTACH_WIDGET,
2456 XmNleftWidget, HighlightDialog.lineContextW,
2457 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2458 XmNtopWidget, HighlightDialog.lineContextW,
2459 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2460 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2461 XmStringFree(s1);
2463 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2464 xmTextWidgetClass, contextForm,
2465 XmNcolumns, 5,
2466 XmNmaxLength, 12,
2467 XmNleftAttachment, XmATTACH_POSITION,
2468 XmNleftPosition, 58,
2469 XmNrightAttachment, XmATTACH_POSITION,
2470 XmNrightPosition, 68, NULL);
2471 RemapDeleteKey(HighlightDialog.lineContextW);
2473 XtVaCreateManagedWidget("charContLbl",
2474 xmLabelGadgetClass, contextForm,
2475 XmNlabelString, s1=XmStringCreateSimple("characters"),
2476 XmNmnemonic, 'c',
2477 XmNuserData, HighlightDialog.charContextW,
2478 XmNalignment, XmALIGNMENT_BEGINNING,
2479 XmNleftAttachment, XmATTACH_WIDGET,
2480 XmNleftWidget, HighlightDialog.charContextW,
2481 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2482 XmNtopWidget, HighlightDialog.charContextW,
2483 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2484 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2485 XmStringFree(s1);
2487 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2488 form,
2489 XmNleftAttachment, XmATTACH_POSITION,
2490 XmNleftPosition, 1,
2491 XmNtopAttachment, XmATTACH_WIDGET,
2492 XmNtopWidget, lmForm,
2493 XmNrightAttachment, XmATTACH_POSITION,
2494 XmNrightPosition, 99,
2495 XmNbottomAttachment, XmATTACH_WIDGET,
2496 XmNbottomWidget, contextFrame,
2497 XmNbottomOffset, BORDER, NULL);
2498 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2499 patternsFrame, NULL);
2500 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2501 patternsFrame,
2502 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2503 XmNmnemonic, 'P',
2504 XmNmarginHeight, 0,
2505 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2506 XmStringFree(s1);
2508 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2509 patternsForm,
2510 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2511 XmNmarginHeight, 0,
2512 XmNalignment, XmALIGNMENT_BEGINNING,
2513 XmNleftAttachment, XmATTACH_POSITION,
2514 XmNleftPosition, LIST_RIGHT,
2515 XmNtopAttachment, XmATTACH_FORM, NULL);
2516 XmStringFree(s1);
2518 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2519 patternsForm,
2520 XmNpacking, XmPACK_COLUMN,
2521 XmNradioBehavior, True,
2522 XmNleftAttachment, XmATTACH_POSITION,
2523 XmNleftPosition, LIST_RIGHT,
2524 XmNtopAttachment, XmATTACH_WIDGET,
2525 XmNtopWidget, typeLbl, NULL);
2526 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2527 xmToggleButtonWidgetClass, typeBox,
2528 XmNset, True,
2529 XmNmarginHeight, 0,
2530 XmNlabelString, s1=XmStringCreateSimple(
2531 "Pass-1 (applied to all text when loaded or modified)"),
2532 XmNmnemonic, '1', NULL);
2533 XmStringFree(s1);
2534 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2535 patTypeCB, NULL);
2536 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2537 xmToggleButtonWidgetClass, typeBox,
2538 XmNmarginHeight, 0,
2539 XmNlabelString, s1=XmStringCreateSimple(
2540 "Pass-2 (parsing is deferred until text is exposed)"),
2541 XmNmnemonic, '2', NULL);
2542 XmStringFree(s1);
2543 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2544 patTypeCB, NULL);
2545 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2546 xmToggleButtonWidgetClass, typeBox,
2547 XmNmarginHeight, 0,
2548 XmNlabelString, s1=XmStringCreateSimple(
2549 "Sub-pattern (processed within start & end of parent)"),
2550 XmNmnemonic, 'u', NULL);
2551 XmStringFree(s1);
2552 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2553 patTypeCB, NULL);
2554 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2555 xmToggleButtonWidgetClass, typeBox,
2556 XmNmarginHeight, 0,
2557 XmNlabelString, s1=XmStringCreateSimple(
2558 "Coloring for sub-expressions of parent pattern"),
2559 XmNmnemonic, 'g', NULL);
2560 XmStringFree(s1);
2561 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2562 patTypeCB, NULL);
2564 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2565 xmLabelGadgetClass, patternsForm,
2566 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2567 XmNmarginHeight, 0,
2568 XmNalignment, XmALIGNMENT_BEGINNING,
2569 XmNleftAttachment, XmATTACH_POSITION,
2570 XmNleftPosition, LIST_RIGHT,
2571 XmNtopAttachment, XmATTACH_WIDGET,
2572 XmNtopOffset, BORDER,
2573 XmNtopWidget, typeBox, NULL);
2574 XmStringFree(s1);
2576 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2577 patternsForm,
2578 XmNpacking, XmPACK_COLUMN,
2579 XmNradioBehavior, True,
2580 XmNleftAttachment, XmATTACH_POSITION,
2581 XmNleftPosition, LIST_RIGHT,
2582 XmNtopAttachment, XmATTACH_WIDGET,
2583 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2584 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2585 xmToggleButtonWidgetClass, matchBox,
2586 XmNset, True,
2587 XmNmarginHeight, 0,
2588 XmNlabelString, s1=XmStringCreateSimple(
2589 "Highlight text matching regular expression"),
2590 XmNmnemonic, 'x', NULL);
2591 XmStringFree(s1);
2592 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2593 matchTypeCB, NULL);
2594 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2595 xmToggleButtonWidgetClass, matchBox,
2596 XmNmarginHeight, 0,
2597 XmNlabelString, s1=XmStringCreateSimple(
2598 "Highlight text between starting and ending REs"),
2599 XmNmnemonic, 'b', NULL);
2600 XmStringFree(s1);
2601 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2602 matchTypeCB, NULL);
2604 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2605 patternsForm,
2606 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2607 XmNmnemonic, 'N',
2608 XmNrows, 20,
2609 XmNalignment, XmALIGNMENT_BEGINNING,
2610 XmNleftAttachment, XmATTACH_POSITION,
2611 XmNleftPosition, LIST_RIGHT,
2612 XmNtopAttachment, XmATTACH_WIDGET,
2613 XmNtopWidget, matchBox,
2614 XmNtopOffset, BORDER, NULL);
2615 XmStringFree(s1);
2617 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2618 patternsForm,
2619 XmNleftAttachment, XmATTACH_POSITION,
2620 XmNleftPosition, LIST_RIGHT,
2621 XmNtopAttachment, XmATTACH_WIDGET,
2622 XmNtopWidget, nameLbl,
2623 XmNrightAttachment, XmATTACH_POSITION,
2624 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2625 RemapDeleteKey(HighlightDialog.nameW);
2626 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2628 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2629 xmLabelGadgetClass, patternsForm,
2630 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2631 XmNmnemonic, 't',
2632 XmNrows, 20,
2633 XmNalignment, XmALIGNMENT_BEGINNING,
2634 XmNleftAttachment, XmATTACH_POSITION,
2635 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2636 XmNtopAttachment, XmATTACH_WIDGET,
2637 XmNtopWidget, matchBox,
2638 XmNtopOffset, BORDER, NULL);
2639 XmStringFree(s1);
2641 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2642 xmTextWidgetClass, patternsForm,
2643 XmNleftAttachment, XmATTACH_POSITION,
2644 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2645 XmNtopAttachment, XmATTACH_WIDGET,
2646 XmNtopWidget, HighlightDialog.parentLbl,
2647 XmNrightAttachment, XmATTACH_POSITION,
2648 XmNrightPosition, 99, NULL);
2649 RemapDeleteKey(HighlightDialog.parentW);
2650 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2651 HighlightDialog.parentW, NULL);
2653 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2654 xmLabelGadgetClass, patternsForm,
2655 XmNalignment, XmALIGNMENT_BEGINNING,
2656 XmNmnemonic, 'R',
2657 XmNtopAttachment, XmATTACH_WIDGET,
2658 XmNtopWidget, HighlightDialog.parentW,
2659 XmNtopOffset, BORDER,
2660 XmNleftAttachment, XmATTACH_POSITION,
2661 XmNleftPosition, 1, NULL);
2663 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2664 xmTextWidgetClass, patternsForm,
2665 XmNleftAttachment, XmATTACH_POSITION,
2666 XmNleftPosition, 1,
2667 XmNrightAttachment, XmATTACH_POSITION,
2668 XmNrightPosition, 99,
2669 XmNbottomAttachment, XmATTACH_POSITION,
2670 XmNbottomPosition, 99, NULL);
2671 RemapDeleteKey(HighlightDialog.errorW);
2673 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2674 xmLabelGadgetClass, patternsForm,
2675 XmNlabelString, s1=XmStringCreateSimple(
2676 "Regular Expression Indicating Error in Match (Optional)"),
2677 XmNmnemonic, 'o',
2678 XmNuserData, HighlightDialog.errorW,
2679 XmNalignment, XmALIGNMENT_BEGINNING,
2680 XmNleftAttachment, XmATTACH_POSITION,
2681 XmNleftPosition, 1,
2682 XmNbottomAttachment, XmATTACH_WIDGET,
2683 XmNbottomWidget, HighlightDialog.errorW, NULL);
2684 XmStringFree(s1);
2686 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2687 xmTextWidgetClass, patternsForm,
2688 XmNleftAttachment, XmATTACH_POSITION,
2689 XmNleftPosition, 1,
2690 XmNbottomAttachment, XmATTACH_WIDGET,
2691 XmNbottomWidget, HighlightDialog.errorLbl,
2692 XmNbottomOffset, BORDER,
2693 XmNrightAttachment, XmATTACH_POSITION,
2694 XmNrightPosition, 99, NULL);
2695 RemapDeleteKey(HighlightDialog.endW);
2697 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2698 xmLabelGadgetClass, patternsForm,
2699 XmNmnemonic, 'E',
2700 XmNuserData, HighlightDialog.endW,
2701 XmNalignment, XmALIGNMENT_BEGINNING,
2702 XmNleftAttachment, XmATTACH_POSITION,
2703 XmNleftPosition, 1,
2704 XmNbottomAttachment, XmATTACH_WIDGET,
2705 XmNbottomWidget, HighlightDialog.endW, NULL);
2707 n = 0;
2708 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2709 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2710 XtSetArg(args[n], XmNwordWrap, True); n++;
2711 XtSetArg(args[n], XmNrows, 3); n++;
2712 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2713 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2714 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2715 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2716 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2717 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2718 XtSetArg(args[n], XmNleftPosition, 1); n++;
2719 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2720 XtSetArg(args[n], XmNrightPosition, 99); n++;
2721 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2722 AddMouseWheelSupport(HighlightDialog.startW);
2723 XtManageChild(HighlightDialog.startW);
2724 MakeSingleLineTextW(HighlightDialog.startW);
2725 RemapDeleteKey(HighlightDialog.startW);
2726 XtVaSetValues(HighlightDialog.startLbl,
2727 XmNuserData,HighlightDialog.startW, NULL);
2729 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2730 patternsForm,
2731 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2732 XmNmnemonic, 'i',
2733 XmNrightAttachment, XmATTACH_POSITION,
2734 XmNrightPosition, LIST_RIGHT-1,
2735 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2736 XmNbottomWidget, HighlightDialog.parentW, NULL);
2737 XmStringFree(s1);
2738 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2740 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2741 n = 0;
2742 XtSetArg(args[n], XmNspacing, 0); n++;
2743 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2744 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2745 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2746 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2747 XtSetArg(args[n], XmNleftPosition, 1); n++;
2748 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2749 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2750 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2751 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2752 "styleOptMenu", args, n);
2753 XtManageChild(HighlightDialog.styleOptMenu);
2755 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2756 patternsForm,
2757 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2758 XmNmnemonic, 'S',
2759 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2760 XmNalignment, XmALIGNMENT_BEGINNING,
2761 XmNleftAttachment, XmATTACH_POSITION,
2762 XmNleftPosition, 1,
2763 XmNbottomAttachment, XmATTACH_WIDGET,
2764 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2765 XmStringFree(s1);
2767 n = 0;
2768 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2769 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2770 XtSetArg(args[n], XmNleftPosition, 1); n++;
2771 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2772 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2773 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2774 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2775 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2776 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2777 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2778 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2779 NULL, freeItemCB);
2780 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2782 /* Set initial default button */
2783 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2784 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
2786 /* Handle mnemonic selection of buttons and focus to dialog */
2787 AddDialogMnemonicHandler(form, FALSE);
2789 /* Fill in the dialog information for the selected language mode */
2790 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2791 patSet->lineContext);
2792 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2793 patSet->charContext);
2794 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2795 updateLabels();
2797 /* Realize all of the widgets in the new dialog */
2798 RealizeWithoutForcingPosition(HighlightDialog.shell);
2802 ** If a syntax highlighting dialog is up, ask to have the option menu for
2803 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2805 static void updateHighlightStyleMenu(void)
2807 Widget oldMenu;
2808 int patIndex;
2810 if (HighlightDialog.shell == NULL)
2811 return;
2813 oldMenu = HighlightDialog.stylePulldown;
2814 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2815 XtParent(XtParent(oldMenu)));
2816 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2817 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2818 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2819 if (patIndex == -1)
2820 setStyleMenu("Plain");
2821 else
2822 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2824 XtDestroyWidget(oldMenu);
2828 ** If a syntax highlighting dialog is up, ask to have the option menu for
2829 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2831 void UpdateLanguageModeMenu(void)
2833 Widget oldMenu;
2835 if (HighlightDialog.shell == NULL)
2836 return;
2838 oldMenu = HighlightDialog.lmPulldown;
2839 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2840 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2841 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2842 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2843 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2845 XtDestroyWidget(oldMenu);
2848 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2850 int i;
2852 freeNonNull(HighlightDialog.langModeName);
2853 for (i=0; i<HighlightDialog.nPatterns; i++)
2854 freePatternSrc(HighlightDialog.patterns[i], True);
2855 HighlightDialog.shell = NULL;
2858 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2860 char *modeName;
2861 patternSet *oldPatSet, *newPatSet;
2862 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2863 int i, resp;
2865 /* Get the newly selected mode name. If it's the same, do nothing */
2866 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2867 if (!strcmp(modeName, HighlightDialog.langModeName))
2868 return;
2870 /* Look up the original version of the patterns being edited */
2871 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2872 if (oldPatSet == NULL)
2873 oldPatSet = &emptyPatSet;
2875 /* Get the current information displayed by the dialog. If it's bad,
2876 give the user the chance to throw it out or go back and fix it. If
2877 it has changed, give the user the chance to apply discard or cancel. */
2878 newPatSet = getDialogPatternSet();
2880 if (newPatSet == NULL)
2882 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2883 "Incomplete Language Mode", "Discard incomplete entry\n"
2884 "for current language mode?", "Keep", "Discard") == 1)
2886 SetLangModeMenu(HighlightDialog.lmOptMenu,
2887 HighlightDialog.langModeName);
2888 return;
2890 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2892 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2893 "Apply changes for language mode %s?", "Apply Changes",
2894 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2895 if (resp == 3)
2897 SetLangModeMenu(HighlightDialog.lmOptMenu,
2898 HighlightDialog.langModeName);
2899 return;
2901 if (resp == 1)
2903 updatePatternSet();
2907 if (newPatSet != NULL)
2908 freePatternSet(newPatSet);
2910 /* Free the old dialog information */
2911 freeNonNull(HighlightDialog.langModeName);
2912 for (i=0; i<HighlightDialog.nPatterns; i++)
2913 freePatternSrc(HighlightDialog.patterns[i], True);
2915 /* Fill the dialog with the new language mode information */
2916 HighlightDialog.langModeName = XtNewString(modeName);
2917 newPatSet = FindPatternSet(modeName);
2918 if (newPatSet == NULL) {
2919 HighlightDialog.nPatterns = 0;
2920 SetIntText(HighlightDialog.lineContextW, 1);
2921 SetIntText(HighlightDialog.charContextW, 0);
2922 } else {
2923 for (i=0; i<newPatSet->nPatterns; i++)
2924 HighlightDialog.patterns[i] =
2925 copyPatternSrc(&newPatSet->patterns[i], NULL);
2926 HighlightDialog.nPatterns = newPatSet->nPatterns;
2927 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2928 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2930 ChangeManagedListData(HighlightDialog.managedListW);
2933 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2935 EditLanguageModes();
2938 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2940 Widget selectedItem;
2941 char *style;
2943 XtVaGetValues(HighlightDialog.styleOptMenu,
2944 XmNmenuHistory, &selectedItem,
2945 NULL);
2946 XtVaGetValues(selectedItem,
2947 XmNuserData, &style,
2948 NULL);
2949 EditHighlightStyles(style);
2952 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2954 /* change the patterns */
2955 if (!updatePatternSet())
2956 return;
2958 /* pop down and destroy the dialog */
2959 XtDestroyWidget(HighlightDialog.shell);
2962 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
2964 /* change the patterns */
2965 updatePatternSet();
2968 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
2970 if (checkHighlightDialogData())
2972 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
2973 "Patterns compiled without error", "Dismiss");
2977 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
2979 patternSet *defaultPatSet;
2980 int i, psn;
2982 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
2983 if (defaultPatSet == NULL)
2985 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
2986 "There is no default pattern set\nfor language mode %s",
2987 "Dismiss", HighlightDialog.langModeName);
2988 return;
2991 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
2992 "Are you sure you want to discard\n"
2993 "all changes to syntax highlighting\n"
2994 "patterns for language mode %s?", "Discard", "Cancel",
2995 HighlightDialog.langModeName) == 2)
2997 return;
3000 /* if a stored version of the pattern set exists, replace it, if it
3001 doesn't, add a new one */
3002 for (psn=0; psn<NPatternSets; psn++)
3003 if (!strcmp(HighlightDialog.langModeName,
3004 PatternSets[psn]->languageMode))
3005 break;
3006 if (psn < NPatternSets) {
3007 freePatternSet(PatternSets[psn]);
3008 PatternSets[psn] = defaultPatSet;
3009 } else
3010 PatternSets[NPatternSets++] = defaultPatSet;
3012 /* Free the old dialog information */
3013 for (i=0; i<HighlightDialog.nPatterns; i++)
3014 freePatternSrc(HighlightDialog.patterns[i], True);
3016 /* Update the dialog */
3017 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3018 for (i=0; i<defaultPatSet->nPatterns; i++)
3019 HighlightDialog.patterns[i] =
3020 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3021 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3022 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3023 ChangeManagedListData(HighlightDialog.managedListW);
3026 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3028 int i, psn;
3030 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3031 "Are you sure you want to delete\n"
3032 "syntax highlighting patterns for\n"
3033 "language mode %s?", "Yes, Delete", "Cancel",
3034 HighlightDialog.langModeName) == 2)
3036 return;
3039 /* if a stored version of the pattern set exists, delete it from the list */
3040 for (psn=0; psn<NPatternSets; psn++)
3041 if (!strcmp(HighlightDialog.langModeName,
3042 PatternSets[psn]->languageMode))
3043 break;
3044 if (psn < NPatternSets) {
3045 freePatternSet(PatternSets[psn]);
3046 memmove(&PatternSets[psn], &PatternSets[psn+1],
3047 (NPatternSets-1 - psn) * sizeof(patternSet *));
3048 NPatternSets--;
3051 /* Free the old dialog information */
3052 for (i=0; i<HighlightDialog.nPatterns; i++)
3053 freePatternSrc(HighlightDialog.patterns[i], True);
3055 /* Clear out the dialog */
3056 HighlightDialog.nPatterns = 0;
3057 SetIntText(HighlightDialog.lineContextW, 1);
3058 SetIntText(HighlightDialog.charContextW, 0);
3059 ChangeManagedListData(HighlightDialog.managedListW);
3062 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData)
3064 /* pop down and destroy the dialog */
3065 XtDestroyWidget(HighlightDialog.shell);
3068 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3070 Help(HELP_PATTERNS);
3073 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3075 updateLabels();
3078 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3080 updateLabels();
3083 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3084 void *cbArg)
3086 highlightPattern *pat;
3088 /* If the dialog is currently displaying the "new" entry and the
3089 fields are empty, that's just fine */
3090 if (oldItem == NULL && dialogEmpty())
3091 return NULL;
3093 /* If there are no problems reading the data, just return it */
3094 pat = readDialogFields(True);
3095 if (pat != NULL)
3096 return (void *)pat;
3098 /* If there are problems, and the user didn't ask for the fields to be
3099 read, give more warning */
3100 if (!explicitRequest)
3102 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3103 "Discard incomplete entry\nfor current pattern?", "Keep",
3104 "Discard") == 2)
3106 return oldItem == NULL
3107 ? NULL
3108 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3112 /* Do readDialogFields again without "silent" mode to display warning */
3113 pat = readDialogFields(False);
3114 *abort = True;
3115 return NULL;
3118 static void setDisplayedCB(void *item, void *cbArg)
3120 highlightPattern *pat = (highlightPattern *)item;
3121 int isSubpat, isDeferred, isColorOnly, isRange;
3123 if (item == NULL) {
3124 XmTextSetString(HighlightDialog.nameW, "");
3125 XmTextSetString(HighlightDialog.parentW, "");
3126 XmTextSetString(HighlightDialog.startW, "");
3127 XmTextSetString(HighlightDialog.endW, "");
3128 XmTextSetString(HighlightDialog.errorW, "");
3129 RadioButtonChangeState(HighlightDialog.topLevelW, True, False);
3130 RadioButtonChangeState(HighlightDialog.deferredW, False, False);
3131 RadioButtonChangeState(HighlightDialog.subPatW, False, False);
3132 RadioButtonChangeState(HighlightDialog.colorPatW, False, False);
3133 RadioButtonChangeState(HighlightDialog.simpleW, True, False);
3134 RadioButtonChangeState(HighlightDialog.rangeW, False, False);
3135 setStyleMenu("Plain");
3136 } else {
3137 isSubpat = pat->subPatternOf != NULL;
3138 isDeferred = pat->flags & DEFER_PARSING;
3139 isColorOnly = pat->flags & COLOR_ONLY;
3140 isRange = pat->endRE != NULL;
3141 XmTextSetString(HighlightDialog.nameW, pat->name);
3142 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3143 XmTextSetString(HighlightDialog.startW, pat->startRE);
3144 XmTextSetString(HighlightDialog.endW, pat->endRE);
3145 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3146 RadioButtonChangeState(HighlightDialog.topLevelW,
3147 !isSubpat && !isDeferred, False);
3148 RadioButtonChangeState(HighlightDialog.deferredW,
3149 !isSubpat && isDeferred, False);
3150 RadioButtonChangeState(HighlightDialog.subPatW,
3151 isSubpat && !isColorOnly, False);
3152 RadioButtonChangeState(HighlightDialog.colorPatW,
3153 isSubpat && isColorOnly, False);
3154 RadioButtonChangeState(HighlightDialog.simpleW, !isRange, False);
3155 RadioButtonChangeState(HighlightDialog.rangeW, isRange, False);
3156 setStyleMenu(pat->style);
3158 updateLabels();
3161 static void freeItemCB(void *item)
3163 freePatternSrc((highlightPattern *)item, True);
3167 ** Do a test compile of the patterns currently displayed in the highlight
3168 ** patterns dialog, and display warning dialogs if there are problems
3170 static int checkHighlightDialogData(void)
3172 patternSet *patSet;
3173 int result;
3175 /* Get the pattern information from the dialog */
3176 patSet = getDialogPatternSet();
3177 if (patSet == NULL)
3178 return False;
3180 /* Compile the patterns */
3181 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3182 freePatternSet(patSet);
3183 return result;
3187 ** Update the text field labels and sensitivity of various fields, based on
3188 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3189 ** patterns dialog.
3191 static void updateLabels(void)
3193 char *startLbl, *endLbl;
3194 int endSense, errSense, matchSense, parentSense;
3195 XmString s1;
3197 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3198 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3199 Regular Expression (\\1, &, etc.)";
3200 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3201 Regular Expression";
3202 endSense = True;
3203 errSense = False;
3204 matchSense = False;
3205 parentSense = True;
3206 } else {
3207 endLbl = "Ending Regular Expression";
3208 matchSense = True;
3209 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3210 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3211 startLbl = "Regular Expression to Match";
3212 endSense = False;
3213 errSense = False;
3214 } else {
3215 startLbl = "Starting Regular Expression";
3216 endSense = True;
3217 errSense = True;
3221 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3222 XtSetSensitive(HighlightDialog.parentW, parentSense);
3223 XtSetSensitive(HighlightDialog.endW, endSense);
3224 XtSetSensitive(HighlightDialog.endLbl, endSense);
3225 XtSetSensitive(HighlightDialog.errorW, errSense);
3226 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3227 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3228 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3229 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3230 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3231 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3232 s1=XmStringCreateSimple(startLbl), NULL);
3233 XmStringFree(s1);
3234 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3235 s1=XmStringCreateSimple(endLbl), NULL);
3236 XmStringFree(s1);
3240 ** Set the styles menu in the currently displayed highlight dialog to show
3241 ** a particular style
3243 static void setStyleMenu(const char *styleName)
3245 int i;
3246 Cardinal nItems;
3247 WidgetList items;
3248 Widget selectedItem;
3249 char *itemStyle;
3251 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3252 XmNnumChildren, &nItems, NULL);
3253 if (nItems == 0)
3254 return;
3255 selectedItem = items[0];
3256 for (i=0; i<(int)nItems; i++) {
3257 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3258 if (!strcmp(itemStyle, styleName)) {
3259 selectedItem = items[i];
3260 break;
3263 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3267 ** Read the pattern fields of the highlight dialog, and produce an allocated
3268 ** highlightPattern structure reflecting the contents, or pop up dialogs
3269 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3270 ** dialogs). Returns NULL on error.
3272 static highlightPattern *readDialogFields(int silent)
3274 highlightPattern *pat;
3275 char *inPtr, *outPtr, *style;
3276 Widget selectedItem;
3277 int colorOnly;
3279 /* Allocate a pattern source structure to return, zero out fields
3280 so that the whole pattern can be freed on error with freePatternSrc */
3281 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3282 pat->endRE = NULL;
3283 pat->errorRE = NULL;
3284 pat->style = NULL;
3285 pat->subPatternOf = NULL;
3287 /* read the type buttons */
3288 pat->flags = 0;
3289 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3290 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3291 pat->flags |= DEFER_PARSING;
3292 else if (colorOnly)
3293 pat->flags = COLOR_ONLY;
3295 /* read the name field */
3296 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3297 "highlight pattern name", silent);
3298 if (pat->name == NULL) {
3299 XtFree((char *)pat);
3300 return NULL;
3303 if (*pat->name == '\0')
3305 if (!silent)
3307 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3308 "Please specify a name\nfor the pattern", "Dismiss");
3309 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3311 XtFree(pat->name);
3312 XtFree((char *)pat);
3313 return NULL;
3316 /* read the startRE field */
3317 pat->startRE = XmTextGetString(HighlightDialog.startW);
3318 if (*pat->startRE == '\0')
3320 if (!silent)
3322 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3323 "Please specify a regular\nexpression to match", "Dismiss");
3324 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3326 freePatternSrc(pat, True);
3327 return NULL;
3330 /* Make sure coloring patterns contain only sub-expression references
3331 and put it in replacement regular-expression form */
3332 if (colorOnly)
3334 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3336 if (*inPtr!=' ' && *inPtr!='\t')
3338 *outPtr++ = *inPtr;
3342 *outPtr = '\0';
3343 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3344 || (*pat->startRE != '\\' && *pat->startRE != '&')
3345 || strstr(pat->startRE, "\\\\") != NULL)
3347 if (!silent)
3349 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3350 "The expression field in patterns which specify highlighting for\n"
3351 "a parent, must contain only sub-expression references in regular\n"
3352 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3353 "Expressions and Help -> Syntax Highlighting for more information",
3354 "Dismiss");
3355 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3357 freePatternSrc(pat, True);
3358 return NULL;
3362 /* read the parent field */
3363 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3365 if (TextWidgetIsBlank(HighlightDialog.parentW))
3367 if (!silent)
3369 DialogF(DF_WARN, HighlightDialog.shell, 1,
3370 "Specify Parent Pattern",
3371 "Please specify a parent pattern", "Dismiss");
3372 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3374 freePatternSrc(pat, True);
3375 return NULL;
3377 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3380 /* read the styles option menu */
3381 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3382 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3383 pat->style = XtMalloc(strlen(style) + 1);
3384 strcpy(pat->style, style);
3387 /* read the endRE field */
3388 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3390 pat->endRE = XmTextGetString(HighlightDialog.endW);
3391 if (!colorOnly && *pat->endRE == '\0')
3393 if (!silent)
3395 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3396 "Please specify an ending\nregular expression",
3397 "Dismiss");
3398 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3400 freePatternSrc(pat, True);
3401 return NULL;
3405 /* read the errorRE field */
3406 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3407 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3408 if (*pat->errorRE == '\0') {
3409 XtFree(pat->errorRE);
3410 pat->errorRE = NULL;
3413 return pat;
3417 ** Returns true if the pattern fields of the highlight dialog are set to
3418 ** the default ("New" pattern) state.
3420 static int dialogEmpty(void)
3422 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3423 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3424 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3425 TextWidgetIsBlank(HighlightDialog.parentW) &&
3426 TextWidgetIsBlank(HighlightDialog.startW) &&
3427 TextWidgetIsBlank(HighlightDialog.endW) &&
3428 TextWidgetIsBlank(HighlightDialog.errorW);
3432 ** Update the pattern set being edited in the Syntax Highlighting dialog
3433 ** with the information that the dialog is currently displaying, and
3434 ** apply changes to any window which is currently using the patterns.
3436 static int updatePatternSet(void)
3438 patternSet *patSet;
3439 WindowInfo *window;
3440 int psn;
3442 /* Make sure the patterns are valid and compile */
3443 if (!checkHighlightDialogData())
3444 return False;
3446 /* Get the current data */
3447 patSet = getDialogPatternSet();
3448 if (patSet == NULL)
3449 return False;
3451 /* Find the pattern being modified */
3452 for (psn=0; psn<NPatternSets; psn++)
3453 if (!strcmp(HighlightDialog.langModeName,
3454 PatternSets[psn]->languageMode))
3455 break;
3457 /* If it's a new pattern, add it at the end, otherwise free the
3458 existing pattern set and replace it */
3459 if (psn == NPatternSets) {
3460 PatternSets[NPatternSets++] = patSet;
3461 } else {
3462 freePatternSet(PatternSets[psn]);
3463 PatternSets[psn] = patSet;
3466 /* Find windows that are currently using this pattern set and
3467 re-do the highlighting */
3468 for (window=WindowList; window!=NULL; window=window->next) {
3469 if (window->highlightSyntax &&
3470 window->languageMode != PLAIN_LANGUAGE_MODE) {
3471 if (!strcmp(LanguageModeName(window->languageMode),
3472 patSet->languageMode)) {
3473 StopHighlighting(window);
3474 StartHighlighting(window, True);
3479 /* Note that preferences have been changed */
3480 MarkPrefsChanged();
3482 return True;
3486 ** Get the current information that the user has entered in the syntax
3487 ** highlighting dialog. Return NULL if the data is currently invalid
3489 static patternSet *getDialogPatternSet(void)
3491 int i, lineContext, charContext;
3492 patternSet *patSet;
3494 /* Get the current contents of the "patterns" dialog fields */
3495 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3496 return NULL;
3498 /* Get the line and character context values */
3499 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3500 "context lines", True) != TEXT_READ_OK)
3501 return NULL;
3502 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3503 "context lines", True) != TEXT_READ_OK)
3504 return NULL;
3506 /* Allocate a new pattern set structure and copy the fields read from the
3507 dialog, including the modified pattern list into it */
3508 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3509 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3510 patSet->lineContext = lineContext;
3511 patSet->charContext = charContext;
3512 patSet->nPatterns = HighlightDialog.nPatterns;
3513 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3514 HighlightDialog.nPatterns);
3515 for (i=0; i<HighlightDialog.nPatterns; i++)
3516 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3517 return patSet;
3521 ** Return True if "patSet1" and "patSet2" differ
3523 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3525 int i;
3526 highlightPattern *pat1, *pat2;
3528 if (patSet1->lineContext != patSet2->lineContext)
3529 return True;
3530 if (patSet1->charContext != patSet2->charContext)
3531 return True;
3532 if (patSet1->nPatterns != patSet2->nPatterns)
3533 return True;
3534 for (i=0; i<patSet2->nPatterns; i++) {
3535 pat1 = &patSet1->patterns[i];
3536 pat2 = &patSet2->patterns[i];
3537 if (pat1->flags != pat2->flags)
3538 return True;
3539 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3540 return True;
3541 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3542 return True;
3543 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3544 return True;
3545 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3546 return True;
3547 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3548 return True;
3549 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3550 return True;
3552 return False;
3556 ** Copy a highlight pattern data structure and all of the allocated data
3557 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3558 ** otherwise allocate a new highlightPattern structure and return it as the
3559 ** function value.
3561 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3562 highlightPattern *copyTo)
3564 highlightPattern *newPat;
3566 if (copyTo == NULL)
3567 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3568 else
3569 newPat = copyTo;
3570 newPat->name = XtNewString(pat->name);
3571 newPat->startRE = XtNewString(pat->startRE);
3572 newPat->endRE = XtNewString(pat->endRE);
3573 newPat->errorRE = XtNewString(pat->errorRE);
3574 newPat->style = XtNewString(pat->style);
3575 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3576 newPat->flags = pat->flags;
3577 return newPat;
3580 static void freeNonNull(void *ptr)
3582 if (ptr != NULL)
3583 XtFree((char *)ptr);
3587 ** Free the allocated memory contained in a highlightPattern data structure
3588 ** If "freeStruct" is true, free the structure itself as well.
3590 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3592 XtFree(pat->name);
3593 freeNonNull(pat->startRE);
3594 freeNonNull(pat->endRE);
3595 freeNonNull(pat->errorRE);
3596 freeNonNull(pat->style);
3597 freeNonNull(pat->subPatternOf);
3598 if (freeStruct)
3599 XtFree((char *)pat);
3603 ** Free the allocated memory contained in a patternSet data structure
3604 ** If "freeStruct" is true, free the structure itself as well.
3606 static void freePatternSet(patternSet *p)
3608 int i;
3610 for (i=0; i<p->nPatterns; i++)
3611 freePatternSrc(&p->patterns[i], False);
3612 XtFree(p->languageMode);
3613 XtFree((char *)p->patterns);
3614 XtFree((char *)p);
3617 #if 0
3619 ** Free the allocated memory contained in a patternSet data structure
3620 ** If "freeStruct" is true, free the structure itself as well.
3622 static int lookupNamedPattern(patternSet *p, char *patternName)
3624 int i;
3626 for (i=0; i<p->nPatterns; i++)
3627 if (strcmp(p->patterns[i].name, patternName))
3628 return i;
3629 return -1;
3631 #endif
3634 ** Find the index into the HighlightStyles array corresponding to "styleName".
3635 ** If styleName is not found, return -1.
3637 static int lookupNamedStyle(const char *styleName)
3639 int i;
3641 for (i = 0; i < NHighlightStyles; i++)
3643 if (!strcmp(styleName, HighlightStyles[i]->name))
3645 return i;
3649 return -1;
3653 ** Returns a unique number of a given style name
3655 int IndexOfNamedStyle(const char *styleName)
3657 return lookupNamedStyle(styleName);
3661 ** Write the string representation of int "i" to a static area, and
3662 ** return a pointer to it.
3664 static char *intToStr(int i)
3666 static char outBuf[12];
3668 sprintf(outBuf, "%d", i);
3669 return outBuf;