Minor fix.
[nedit.git] / source / highlightData.c
blob6ceb23e1dabed6b7cdd35ce51f6833ea62006eb1
1 static const char CVSID[] = "$Id: highlightData.c,v 1.71 2005/02/24 18:23: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. In addition, you may distribute version of this program linked to *
13 * Motif or Open Motif. See README for details. *
14 * *
15 * This software is distributed in the hope that it will be useful, but WITHOUT *
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
18 * for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License along with *
21 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
22 * Place, Suite 330, Boston, MA 02111-1307 USA *
23 * *
24 * Nirvana Text Editor *
25 * April, 1997 *
26 * *
27 * Written by Mark Edel *
28 * *
29 *******************************************************************************/
31 #ifdef HAVE_CONFIG_H
32 #include "../config.h"
33 #endif
35 #include "highlightData.h"
36 #include "textBuf.h"
37 #include "nedit.h"
38 #include "highlight.h"
39 #include "regularExp.h"
40 #include "preferences.h"
41 #include "help.h"
42 #include "window.h"
43 #include "regexConvert.h"
44 #include "../util/misc.h"
45 #include "../util/DialogF.h"
46 #include "../util/managedList.h"
48 #include <stdio.h>
49 #include <string.h>
50 #include <limits.h>
51 #ifdef VMS
52 #include "../util/VMSparam.h"
53 #else
54 #ifndef __MVS__
55 #include <sys/param.h>
56 #endif
57 #endif /*VMS*/
59 #include <Xm/Xm.h>
60 #include <Xm/Form.h>
61 #include <Xm/Frame.h>
62 #include <Xm/Text.h>
63 #include <Xm/LabelG.h>
64 #include <Xm/PushB.h>
65 #include <Xm/ToggleB.h>
66 #include <Xm/RowColumn.h>
67 #include <Xm/SeparatoG.h>
69 #ifdef HAVE_DEBUG_H
70 #include "../debug.h"
71 #endif
73 /* Maximum allowed number of styles (also limited by representation of
74 styles as a byte - 'b') */
75 #define MAX_HIGHLIGHT_STYLES 128
77 /* Maximum number of patterns allowed in a pattern set (regular expression
78 limitations are probably much more restrictive). */
79 #define MAX_PATTERNS 127
81 /* Names for the fonts that can be used for syntax highlighting */
82 #define N_FONT_TYPES 4
83 enum fontTypes {PLAIN_FONT, ITALIC_FONT, BOLD_FONT, BOLD_ITALIC_FONT};
84 static const char *FontTypeNames[N_FONT_TYPES] =
85 {"Plain", "Italic", "Bold", "Bold Italic"};
87 typedef struct {
88 char *name;
89 char *color;
90 char *bgColor;
91 int font;
92 } highlightStyleRec;
94 static int styleError(const char *stringStart, const char *stoppedAt,
95 const char *message);
96 #if 0
97 static int lookupNamedPattern(patternSet *p, char *patternName);
98 #endif
99 static int lookupNamedStyle(const char *styleName);
100 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
101 char **errMsg, int *nPatterns);
102 static int readHighlightPattern(char **inPtr, char **errMsg,
103 highlightPattern *pattern);
104 static patternSet *readDefaultPatternSet(const char *langModeName);
105 static int isDefaultPatternSet(patternSet *patSet);
106 static patternSet *readPatternSet(char **inPtr, int convertOld);
107 static patternSet *highlightError(char *stringStart, char *stoppedAt,
108 const char *message);
109 static char *intToStr(int i);
110 static char *createPatternsString(patternSet *patSet, char *indentStr);
111 static void setStyleByName(const char *style);
112 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData);
113 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData);
114 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData);
115 static void hsCloseCB(Widget w, XtPointer clientData, XtPointer callData);
116 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs);
117 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
118 void *cbArg);
119 static void hsSetDisplayedCB(void *item, void *cbArg);
120 static highlightStyleRec *readHSDialogFields(int silent);
121 static void hsFreeItemCB(void *item);
122 static void freeHighlightStyleRec(highlightStyleRec *hs);
123 static int hsDialogEmpty(void);
124 static int updateHSList(void);
125 static void updateHighlightStyleMenu(void);
126 static void convertOldPatternSet(patternSet *patSet);
127 static void convertPatternExpr(char **patternRE, char *patSetName,
128 char *patName, int isSubsExpr);
129 static Widget createHighlightStylesMenu(Widget parent);
130 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData);
131 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData);
132 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData);
133 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData);
134 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData);
135 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData);
136 static int checkHighlightDialogData(void);
137 static void updateLabels(void);
138 static void okCB(Widget w, XtPointer clientData, XtPointer callData);
139 static void applyCB(Widget w, XtPointer clientData, XtPointer callData);
140 static void checkCB(Widget w, XtPointer clientData, XtPointer callData);
141 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData);
142 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData);
143 static void closeCB(Widget w, XtPointer clientData, XtPointer callData);
144 static void helpCB(Widget w, XtPointer clientData, XtPointer callData);
145 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
146 void *cbArg);
147 static void setDisplayedCB(void *item, void *cbArg);
148 static void setStyleMenu(const char *styleName);
149 static highlightPattern *readDialogFields(int silent);
150 static int dialogEmpty(void);
151 static int updatePatternSet(void);
152 static patternSet *getDialogPatternSet(void);
153 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2);
154 static highlightPattern *copyPatternSrc(highlightPattern *pat,
155 highlightPattern *copyTo);
156 static void freeNonNull(void *ptr);
157 static void freeItemCB(void *item);
158 static void freePatternSrc(highlightPattern *pat, int freeStruct);
159 static void freePatternSet(patternSet *p);
161 /* list of available highlight styles */
162 static int NHighlightStyles = 0;
163 static highlightStyleRec *HighlightStyles[MAX_HIGHLIGHT_STYLES];
165 /* Highlight styles dialog information */
166 static struct {
167 Widget shell;
168 Widget nameW;
169 Widget colorW;
170 Widget bgColorW;
171 Widget recogW;
172 Widget plainW, boldW, italicW, boldItalicW;
173 Widget managedListW;
174 highlightStyleRec **highlightStyleList;
175 int nHighlightStyles;
176 } HSDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0};
178 /* Highlight dialog information */
179 static struct {
180 Widget shell;
181 Widget lmOptMenu;
182 Widget lmPulldown;
183 Widget styleOptMenu;
184 Widget stylePulldown;
185 Widget nameW;
186 Widget topLevelW;
187 Widget deferredW;
188 Widget subPatW;
189 Widget colorPatW;
190 Widget simpleW;
191 Widget rangeW;
192 Widget parentW;
193 Widget startW;
194 Widget endW;
195 Widget errorW;
196 Widget lineContextW;
197 Widget charContextW;
198 Widget managedListW;
199 Widget parentLbl;
200 Widget startLbl;
201 Widget endLbl;
202 Widget errorLbl;
203 Widget matchLbl;
204 char *langModeName;
205 int nPatterns;
206 highlightPattern **patterns;
207 } HighlightDialog = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
208 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
209 NULL, NULL, NULL, NULL, NULL, 0, NULL };
211 /* Pattern sources loaded from the .nedit file or set by the user */
212 static int NPatternSets = 0;
213 static patternSet *PatternSets[MAX_LANGUAGE_MODES];
215 static char *DefaultPatternSets[] = {
216 "Ada:1:0{\n\
217 Comments:\"--\":\"$\"::Comment::\n\
218 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
219 Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\
220 Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
221 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
222 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
223 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
224 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
225 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\
226 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
227 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
228 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\
229 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
230 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
231 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
232 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
233 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
234 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
235 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
236 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
237 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
238 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
239 "Awk:2:0{\n\
240 Comment:\"#\":\"$\"::Comment::\n\
241 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
242 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
243 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
244 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
245 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
246 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
247 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
248 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
249 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
250 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
251 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\
252 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
253 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
254 newline escape:\"\\\\$\":::Preprocessor1::\n\
255 Function:\"function\":::Preprocessor1::D}",
256 "C++:1:0{\n\
257 comment:\"/\\*\":\"\\*/\"::Comment::\n\
258 cplus comment:\"//\":\"(?<!\\\\)$\"::Comment::\n\
259 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
260 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
261 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
262 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
263 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
264 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
265 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
266 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
267 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
268 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
269 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\
270 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\
271 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\
272 braces:\"[{}]\":::Keyword::D}",
273 "C:1:0 {\n\
274 comment:\"/\\*\":\"\\*/\"::Comment::\n\
275 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
276 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
277 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
278 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
279 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
280 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
281 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
282 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
283 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
284 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\
285 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\
286 keyword:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
287 braces:\"[{}]\":::Keyword::D}",
288 "CSS:1:0{\n\
289 comment:\"/\\*\":\"\\*/\"::Comment::\n\
290 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
291 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
292 import url:\"\\1\":::Subroutine1:import rule:C\n\
293 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
294 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
295 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
296 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
297 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
298 charset name:\"\\1\":::String:charset rule:C\n\
299 font-face rule:\"@font-face\":::Preprocessor::\n\
300 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
301 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
302 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
303 declaration:\"\\{\":\"\\}\"::Warning::\n\
304 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
305 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
306 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\
307 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
308 value delims:\"&\":\"&\"::Keyword:value:C\n\
309 value modifier:\"!important|inherit\":::Keyword:value:\n\
310 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
311 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\
312 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\
313 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\
314 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
315 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
316 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\
317 integer value:\"<\\d+>\":::Numeric Const:value:\n\
318 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
319 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
320 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
321 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
322 sq string value:\"'\":\"'\":\"\\n\":String:value:\n\
323 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
324 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
325 operators:\"[,/]\":::Keyword:value:\n\
326 selector id:\"#[-\\w]+>\":::Pointer::\n\
327 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
328 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
329 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
330 selector operators:\"[,>*+]\":::Keyword::\n\
331 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
332 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
333 free text:\".\":::Warning::\n\
334 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
335 "Csh:1:0{\n\
336 Comment:\"#\":\"$\"::Comment::\n\
337 Single Quote String:\"'\":\"([^\\\\]'|^')\":\"\\n\":String::\n\
338 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
339 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
340 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
341 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
342 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\
343 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\
344 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
345 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
346 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\
347 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\
348 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
349 "Fortran:2:0{\n\
350 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
351 Bang Comment:\"!\":\"$\"::Comment::\n\
352 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
353 String:\"'\":\"'\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
354 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\
355 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
356 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
357 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
358 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
359 "Java:3:0{\n\
360 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
361 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
362 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
363 comment:\"/\\*\":\"\\*/\"::Comment::\n\
364 cplus comment:\"//\":\"$\"::Comment::\n\
365 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
366 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])\":::String1:string:\n\
367 single quoted:\"'\":\"'\":\"\\n\":String::\n\
368 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])(?=')\":::String1:single quoted:\n\
369 single quoted char:\".(?=')\":::String:single quoted:\n\
370 single quoted error:\".\":::Flag:single quoted:\n\
371 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
372 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
373 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
374 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
375 classdef:\"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
376 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
377 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
378 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
379 extends comma:\",\":::Keyword:extends:\n\
380 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
381 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
382 extends error:\".\":::Flag:extends:\n\
383 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
384 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
385 impl_throw comma:\",\":::Keyword:impl_throw:\n\
386 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
387 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
388 impl_throw error:\".\":::Flag:impl_throw:\n\
389 case:\"<case>\":\":\"::Label::\n\
390 case single quoted:\"'\\\\?[^']'\":::Character Const:case:\n\
391 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
392 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
393 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
394 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
395 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
396 case error:\".\":::Flag:case:\n\
397 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
398 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
399 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
400 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
401 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
402 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
403 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
404 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
405 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
406 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
407 keyword - modifiers:\"<(?:abstract|final|native|private|protected|public|static|transient|synchronized|volatile)>\":::Keyword::\n\
408 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
409 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
410 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
411 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
412 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
413 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
414 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
415 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
416 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
417 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
418 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
419 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
420 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
421 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
422 error:\".\":::Flag::D}",
423 #ifndef VMS
424 /* The VAX C compiler cannot compile this definition */
425 "JavaScript:1:0{\n\
426 DSComment:\"//\":\"$\"::Comment::\n\
427 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
428 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\
429 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\
430 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\
431 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
432 Braces:\"[{}]\":::Keyword::\n\
433 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
434 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
435 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
436 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
437 Parentheses:\"[\\(\\)]\":::Plain::\n\
438 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\
439 SQStrings:\"'\":\"'\":\"\\n\":String::\n\
440 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
441 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
442 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\
443 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\
444 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
445 #endif /*VMS*/
446 "LaTeX:1:0{\n\
447 Comment:\"%\":\"$\"::Text Comment::\n\
448 Parameter:\"#[0-9]*\":::Text Arg::\n\
449 Special Chars:\"[{}&]\":::Keyword::\n\
450 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
451 Super Sub 1 Char:\"(?:\\^|_)(?:\\\\\\l+|#\\d|[^{\\\\])\":::Text Arg2::\n\
452 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
453 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
454 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
455 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
456 Inline Math:\"(?<!#\\d)(?:\\$|\\\\\\()\":\"\\$|\\\\\\)\":\"\\\\\\(|(?n[^\\\\]%)\":LaTeX Math::\n\
457 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
458 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
459 No Arg Command:\"\\\\(?:left|right)[\\[\\]{}()]\":::Text Key::\n\
460 Command:\"[_^]|[\\\\@](?:a'|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_='`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
461 Cmd Brace Args:\"\\{\":\"}\":\"(?<=^%)|\\\\]|\\$\\$|\\\\end\\{equation\\}\":Text Arg2:Command:\n\
462 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
463 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
464 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
465 Cmd Bracket Args:\"\\[\":\"\\]\":\"$|\\\\\\]\":Text Arg2:Command:\n\
466 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
467 Sub Cmd Bracket Args Esc:\"\\\\\\}\":::Plain:Sub Cmd Bracket Args:\n\
468 Sub Cmd Bracket Args:\"\\{\":\"\\}\":\"$|\\\\\\]\":Preprocessor1:Cmd Bracket Args:\n\
469 Sub Command:\"(?:[_^]|(?:[\\\\@](?:[A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
470 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
471 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
472 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
473 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
474 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
475 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
476 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
477 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
478 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
479 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
480 "Lex:1:0{\n\
481 comment:\"/\\*\":\"\\*/\"::Comment::\n\
482 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
483 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
484 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
485 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
486 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
487 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
488 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
489 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
490 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
491 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\
492 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\
493 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
494 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\
495 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\
496 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
497 braces:\"[{}]\":::Keyword::D\n\
498 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
499 "Makefile:8:0{\n\
500 Comment:\"#\":\"$\"::Comment::\n\
501 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
502 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
503 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
504 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
505 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\
506 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
507 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
508 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
509 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
510 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
511 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
512 Continuation:\"\\\\$\":::Keyword::\n\
513 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
514 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
515 Escaped Dollar:\"\\$\\$\":::Comment::\n\
516 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
517 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
518 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
519 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
520 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
521 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
522 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
523 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
524 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
525 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
526 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
527 "Matlab:1:0{\n\
528 Comment:\"%\":\"$\"::Comment::\n\
529 Comment in Octave:\"#\":\"$\"::Plain::\n\
530 Keyword:\"<(break|clear|else|elseif|end|for|function|global|if|return|then|while)>\":::Keyword::\n\
531 Transpose:\"[\\w.]('+)\":::Plain::\n\
532 Paren transposed:\"\\)('+)\":::Keyword::\n\
533 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
534 Parentheses:\"[\\(\\)]\":::Keyword::\n\
535 Brackets transposed:\"\\]('+)\":::Text Key1::\n\
536 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
537 Brackets:\"[\\[\\]]\":::Text Key1::\n\
538 Braces transposed:\"\\}('+)\":::Text Arg::\n\
539 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
540 Braces:\"[\\{\\}]\":::Text Arg::\n\
541 String:\"'\":\"'\"::String::\n\
542 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
543 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
544 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
545 Shell command:\"!\":\"$\"::String1::\n\
546 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
547 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
548 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
549 Logical operators:\"~|&|\\|\":::Text Arg2::}",
550 "NEdit Macro:2:0{\n\
551 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
552 Comment:\"#\":\"$\"::Comment::\n\
553 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\
554 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\
555 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\
556 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\
557 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\
558 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\
559 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
560 Braces:\"[{}\\[\\]]\":::Keyword::\n\
561 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
562 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
563 String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
564 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
565 Macro Definition:\"(?<=define)\\s+\\w+\":::Subroutine1::\n\
566 Custom Macro:\"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])\":::Subroutine1::\n\
567 Variables:\"\\w+\":::Identifier1::D}",
568 "Pascal:1:0{\n\
569 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
570 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
571 String:\"'\":\"'\":\"\\n\":String::D\n\
572 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
573 Parentheses:\"\\(|\\)\":::Keyword::D\n\
574 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
575 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
576 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
577 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
578 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
579 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
580 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
581 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
582 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
583 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
584 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
585 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
586 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
587 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
588 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
589 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
590 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
591 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
592 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\
593 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
594 Assignment:\":=\":::Plain::D\n\
595 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
596 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
597 "Perl:2:0{\n\
598 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
599 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
600 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
601 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\
602 dq here doc content:\".\":::String:dq here doc:\n\
603 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
604 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
605 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
606 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\
607 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
608 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
609 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
610 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\
611 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
612 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
613 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
614 sq here doc content:\".\":::String1:sq here doc:\n\
615 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
616 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
617 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
618 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
619 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
620 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
621 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
622 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
623 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
624 word list content:\".\":::String1:word list:\n\
625 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
626 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
627 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
628 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\
629 bq here doc content:\".\":::String1:bq here doc:\n\
630 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
631 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
632 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\
633 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
634 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
635 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\
636 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
637 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
638 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
639 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
640 comment:\"#\":\"$\"::Comment::\n\
641 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
642 label identifier:\"\\2\\5\":::Label:label:C\n\
643 label keyword:\"\\3\\6\":::Keyword:label:C\n\
644 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\
645 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
646 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
647 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
648 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
649 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
650 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
651 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
652 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
653 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
654 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
655 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
656 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
657 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
658 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\
659 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
660 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\
661 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
662 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
663 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
664 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
665 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
666 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
667 end token delim:\"&\":::Preprocessor:end token:C\n\
668 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
669 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
670 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
671 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
672 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
673 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
674 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
675 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\
676 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
677 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
678 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
679 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
680 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
681 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
682 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
683 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
684 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
685 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
686 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\
687 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
688 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
689 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
690 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
691 "PostScript:1:0{\n\
692 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
693 Comment:\"%\":\"$\"::Comment::\n\
694 string:\"\\(\":\"\\)\"::String::\n\
695 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
696 string2:\"\\(\":\"\\)\"::String:string:\n\
697 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
698 string3:\"\\(\":\"\\)\"::String:string2:\n\
699 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
700 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
701 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
702 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
703 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
704 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\
705 Array:\"[\\[\\]]\":::Storage Type::D\n\
706 Procedure:\"[{}]\":::Subroutine::D\n\
707 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\
708 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\
709 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\
710 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
711 "Python:2:0{\n\
712 Comment:\"#\":\"$\"::Comment::\n\
713 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
714 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
715 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
716 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
717 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\
718 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\
719 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\
720 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\
721 Representation:\"`\":\"`\":\"$\":String2::\n\
722 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
723 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\
724 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
725 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
726 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\
727 Member def color:\"\\1\":::Keyword:Member definition:C\n\
728 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
729 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
730 Member def error:\"\\7\":::Flag:Member definition:C\n\
731 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
732 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
733 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
734 Function definition:\"<(def)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|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|sum|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\
735 Function def color:\"\\1\":::Keyword:Function definition:C\n\
736 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
737 Function def error:\"\\3\":::Flag:Function definition:C\n\
738 Class definition:\"<(class)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|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|sum|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\
739 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
740 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
741 Class def error:\"\\3\":::Flag:Class definition:C\n\
742 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\
743 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
744 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
745 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
746 Member ref error:\"\\8\":::Flag:Member reference:C\n\
747 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
748 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\
749 Built-in function:\"<(?:__import__|abs|basestring|bool|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
750 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
751 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|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
752 Built-in warnings:\"<(?:DeprecationWarning|FutureWarning|OverflowWarning|PendingDeprecationWarning|RuntimeWarning|SyntaxWarning|UserWarning|Warning)>\":::Identifier1::\n\
753 Deprecated function:\"<(?:apply|buffer|coerce|intern)>\":::Warning::\n\
754 Braces and parens:\"[[{()}\\]]\":::Keyword::D}",
755 "Regex:1:0{\n\
756 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
757 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
758 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
759 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
760 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
761 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\
762 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
763 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\
764 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
765 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
766 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
767 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
768 "SGML HTML:6:0{\n\
769 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
770 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
771 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
772 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
773 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\
774 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
775 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
776 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
777 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
778 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
779 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
780 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
781 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
782 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
783 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
784 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
785 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
786 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
787 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
788 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
789 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
790 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
791 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
792 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
793 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
794 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
795 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
796 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
797 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
798 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
799 "SQL:1:0{\n\
800 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
801 comment:\"--\":\"$\"::Comment::\n\
802 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
803 string:\"'\":\"'\"::String::\n\
804 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\
805 comment2:\"/\\*\":\"\\*/\"::Comment::}",
806 "Sh Ksh Bash:1:0{\n\
807 README:\"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
808 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
809 single quoted string:\"'\":\"'\"::String1::\n\
810 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
811 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
812 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
813 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
814 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
815 dqncs single quoted string:\"'\":\"'\"::String1:dq new command sub:\n\
816 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
817 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
818 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
819 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
820 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
821 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
822 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
823 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
824 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
825 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
826 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
827 command substitution:\"`\":\"`\"::Subroutine::\n\
828 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
829 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
830 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
831 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
832 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
833 ncs new command substitution:\"\\$\\(\":\"\\)\"::Subroutine:new command substitution:\n\
834 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
835 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
836 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
837 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
838 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
839 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
840 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
841 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
842 comments in line:\"#\":\"$\"::Comment::\n\
843 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
844 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
845 command options:\"(?<=\\s)-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
846 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
847 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}",
848 "Tcl:1:0{\n\
849 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
850 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
851 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
852 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
853 Comment:\"#\":\"$\"::Comment::\n\
854 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\
855 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\
856 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
857 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
858 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
859 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
860 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
861 Namespace:\"\\w+::\":::Keyword::}",
862 "VHDL:1:0{\n\
863 Comments:\"--\":\"$\"::Comment::\n\
864 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
865 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
866 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
867 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
868 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
869 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
870 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\
871 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
872 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
873 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
874 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
875 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
876 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
877 "Verilog:1:0{\n\
878 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
879 cplus comment:\"//\":\"$\"::Comment::\n\
880 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
881 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
882 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\
883 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\
884 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
885 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\
886 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
887 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
888 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
889 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
890 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
891 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
892 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
893 "XML:1:0{\n\
894 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
895 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
896 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
897 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
898 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
899 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
900 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
901 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
902 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
903 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
904 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
905 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
906 doctype root element:\"\\2\":::Identifier:doctype:C\n\
907 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
908 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
909 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
910 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
911 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
912 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
913 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
914 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
915 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
916 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
917 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
918 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
919 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
920 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
921 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
922 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
923 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
924 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
925 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
926 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
927 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
928 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
929 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
930 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
931 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
932 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
933 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
934 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
935 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
936 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
937 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
938 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
939 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
940 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
941 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
942 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
943 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
944 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
945 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
946 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
947 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
948 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
949 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
950 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
951 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
952 element name:\"\\2\":::Identifier:element:C\n\
953 element assign:\"=\":::Keyword:element:\n\
954 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
955 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
956 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
957 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
958 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
959 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
960 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
961 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
962 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
963 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
964 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
965 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
966 "X Resources:2:0{\n\
967 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
968 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
969 Comment:\"^\\s*!\":\"$\"::Comment::\n\
970 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
971 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
972 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
973 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
974 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
975 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
976 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
977 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
978 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
979 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
980 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
981 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
982 Free Text:\"^.*$\":::Flag::}",
983 "Yacc:1:0{\n\
984 comment:\"/\\*\":\"\\*/\"::Comment::\n\
985 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
986 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
987 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
988 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
989 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
990 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
991 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
992 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
993 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\
994 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\
995 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
996 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
997 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\
998 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
999 braces:\"[{}]\":::Keyword::D\n\
1000 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
1001 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
1006 ** Read a string (from the value of the styles resource) containing highlight
1007 ** styles information, parse it, and load it into the stored highlight style
1008 ** list (HighlightStyles) for this NEdit session.
1010 int LoadStylesString(char *inString)
1012 char *errMsg, *fontStr;
1013 char *inPtr = inString;
1014 highlightStyleRec *hs;
1015 int i;
1017 for (;;) {
1019 /* skip over blank space */
1020 inPtr += strspn(inPtr, " \t");
1022 /* Allocate a language mode structure in which to store the info. */
1023 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1025 /* read style name */
1026 hs->name = ReadSymbolicField(&inPtr);
1027 if (hs->name == NULL)
1028 return styleError(inString,inPtr, "style name required");
1029 if (!SkipDelimiter(&inPtr, &errMsg)) {
1030 XtFree(hs->name);
1031 XtFree((char *)hs);
1032 return styleError(inString,inPtr, errMsg);
1035 /* read color */
1036 hs->color = ReadSymbolicField(&inPtr);
1037 if (hs->color == NULL) {
1038 XtFree(hs->name);
1039 XtFree((char *)hs);
1040 return styleError(inString,inPtr, "color name required");
1042 hs->bgColor = NULL;
1043 if (SkipOptSeparator('/', &inPtr)) {
1044 /* read bgColor */
1045 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1047 if (!SkipDelimiter(&inPtr, &errMsg)) {
1048 freeHighlightStyleRec(hs);
1049 return styleError(inString,inPtr, errMsg);
1052 /* read the font type */
1053 fontStr = ReadSymbolicField(&inPtr);
1054 for (i=0; i<N_FONT_TYPES; i++) {
1055 if (!strcmp(FontTypeNames[i], fontStr)) {
1056 hs->font = i;
1057 break;
1060 if (i == N_FONT_TYPES) {
1061 XtFree(fontStr);
1062 freeHighlightStyleRec(hs);
1063 return styleError(inString, inPtr, "unrecognized font type");
1065 XtFree(fontStr);
1067 /* pattern set was read correctly, add/change it in the list */
1068 for (i=0; i<NHighlightStyles; i++) {
1069 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1070 freeHighlightStyleRec(HighlightStyles[i]);
1071 HighlightStyles[i] = hs;
1072 break;
1075 if (i == NHighlightStyles) {
1076 HighlightStyles[NHighlightStyles++] = hs;
1077 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1078 return styleError(inString, inPtr,
1079 "maximum allowable number of styles exceeded");
1082 /* if the string ends here, we're done */
1083 inPtr += strspn(inPtr, " \t\n");
1084 if (*inPtr == '\0')
1085 return True;
1090 ** Create a string in the correct format for the styles resource, containing
1091 ** all of the highlight styles information from the stored highlight style
1092 ** list (HighlightStyles) for this NEdit session.
1094 char *WriteStylesString(void)
1096 int i;
1097 char *outStr;
1098 textBuffer *outBuf;
1099 highlightStyleRec *style;
1101 outBuf = BufCreate();
1102 for (i=0; i<NHighlightStyles; i++) {
1103 style = HighlightStyles[i];
1104 BufInsert(outBuf, outBuf->length, "\t");
1105 BufInsert(outBuf, outBuf->length, style->name);
1106 BufInsert(outBuf, outBuf->length, ":");
1107 BufInsert(outBuf, outBuf->length, style->color);
1108 if (style->bgColor) {
1109 BufInsert(outBuf, outBuf->length, "/");
1110 BufInsert(outBuf, outBuf->length, style->bgColor);
1112 BufInsert(outBuf, outBuf->length, ":");
1113 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1114 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1117 /* Get the output, and lop off the trailing newlines */
1118 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1119 BufFree(outBuf);
1120 return outStr;
1124 ** Read a string representing highlight pattern sets and add them
1125 ** to the PatternSets list of loaded highlight patterns. Note that the
1126 ** patterns themselves are not parsed until they are actually used.
1128 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1129 ** that they may contain regular expressions are of the older syntax where
1130 ** braces were not quoted, and \0 was a legal substitution character).
1132 int LoadHighlightString(char *inString, int convertOld)
1134 char *inPtr = inString;
1135 patternSet *patSet;
1136 int i;
1138 for (;;) {
1140 /* Read each pattern set, abort on error */
1141 patSet = readPatternSet(&inPtr, convertOld);
1142 if (patSet == NULL)
1143 return False;
1145 /* Add/change the pattern set in the list */
1146 for (i=0; i<NPatternSets; i++) {
1147 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1148 freePatternSet(PatternSets[i]);
1149 PatternSets[i] = patSet;
1150 break;
1153 if (i == NPatternSets) {
1154 PatternSets[NPatternSets++] = patSet;
1155 if (NPatternSets > MAX_LANGUAGE_MODES)
1156 return False;
1159 /* if the string ends here, we're done */
1160 inPtr += strspn(inPtr, " \t\n");
1161 if (*inPtr == '\0')
1162 return True;
1167 ** Create a string in the correct format for the highlightPatterns resource,
1168 ** containing all of the highlight pattern information from the stored
1169 ** highlight pattern list (PatternSets) for this NEdit session.
1171 char *WriteHighlightString(void)
1173 char *outStr, *str, *escapedStr;
1174 textBuffer *outBuf;
1175 int psn, written = False;
1176 patternSet *patSet;
1178 outBuf = BufCreate();
1179 for (psn=0; psn<NPatternSets; psn++) {
1180 patSet = PatternSets[psn];
1181 if (patSet->nPatterns == 0)
1182 continue;
1183 written = True;
1184 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1185 BufInsert(outBuf, outBuf->length, ":");
1186 if (isDefaultPatternSet(patSet))
1187 BufInsert(outBuf, outBuf->length, "Default\n\t");
1188 else {
1189 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1190 BufInsert(outBuf, outBuf->length, ":");
1191 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1192 BufInsert(outBuf, outBuf->length, "{\n");
1193 BufInsert(outBuf, outBuf->length,
1194 str = createPatternsString(patSet, "\t\t"));
1195 XtFree(str);
1196 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1200 /* Get the output string, and lop off the trailing newline and tab */
1201 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1202 BufFree(outBuf);
1204 /* Protect newlines and backslashes from translation by the resource
1205 reader */
1206 escapedStr = EscapeSensitiveChars(outStr);
1207 XtFree(outStr);
1208 return escapedStr;
1212 ** Update regular expressions in stored pattern sets to version 5.1 regular
1213 ** expression syntax, in which braces and \0 have different meanings
1215 static void convertOldPatternSet(patternSet *patSet)
1217 int p;
1218 highlightPattern *pattern;
1220 for (p=0; p<patSet->nPatterns; p++) {
1221 pattern = &patSet->patterns[p];
1222 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1223 pattern->name, pattern->flags & COLOR_ONLY);
1224 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1225 pattern->name, pattern->flags & COLOR_ONLY);
1226 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1227 pattern->name, pattern->flags & COLOR_ONLY);
1232 ** Convert a single regular expression, patternRE, to version 5.1 regular
1233 ** expression syntax. It will convert either a match expression or a
1234 ** substitution expression, which must be specified by the setting of
1235 ** isSubsExpr. Error messages are directed to stderr, and include the
1236 ** pattern set name and pattern name as passed in patSetName and patName.
1238 static void convertPatternExpr(char **patternRE, char *patSetName,
1239 char *patName, int isSubsExpr)
1241 char *newRE, *errorText;
1243 if (*patternRE == NULL)
1244 return;
1245 if (isSubsExpr) {
1246 newRE = XtMalloc(strlen(*patternRE) + 5000);
1247 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1248 XtFree(*patternRE);
1249 *patternRE = XtNewString(newRE);
1250 XtFree(newRE);
1251 } else{
1252 newRE = ConvertRE(*patternRE, &errorText);
1253 if (newRE == NULL) {
1254 fprintf(stderr, "NEdit error converting old format regular "
1255 "expression in pattern set %s, pattern %s: %s\n",
1256 patSetName, patName, errorText);
1258 XtFree(*patternRE);
1259 *patternRE = newRE;
1264 ** Find the font (font struct) associated with a named style.
1265 ** This routine must only be called with a valid styleName (call
1266 ** NamedStyleExists to find out whether styleName is valid).
1268 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1270 int styleNo=lookupNamedStyle(styleName),fontNum;
1271 XFontStruct *font;
1273 if (styleNo<0)
1274 return GetDefaultFontStruct(window->fontList);
1275 fontNum = HighlightStyles[styleNo]->font;
1276 if (fontNum == BOLD_FONT)
1277 font = window->boldFontStruct;
1278 else if (fontNum == ITALIC_FONT)
1279 font = window->italicFontStruct;
1280 else if (fontNum == BOLD_ITALIC_FONT)
1281 font = window->boldItalicFontStruct;
1282 else /* fontNum == PLAIN_FONT */
1283 font = GetDefaultFontStruct(window->fontList);
1285 /* If font isn't loaded, silently substitute primary font */
1286 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1289 int FontOfNamedStyleIsBold(char *styleName)
1291 int styleNo=lookupNamedStyle(styleName),fontNum;
1293 if (styleNo<0)
1294 return 0;
1295 fontNum = HighlightStyles[styleNo]->font;
1296 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1299 int FontOfNamedStyleIsItalic(char *styleName)
1301 int styleNo=lookupNamedStyle(styleName),fontNum;
1303 if (styleNo<0)
1304 return 0;
1305 fontNum = HighlightStyles[styleNo]->font;
1306 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1310 ** Find the color associated with a named style. This routine must only be
1311 ** called with a valid styleName (call NamedStyleExists to find out whether
1312 ** styleName is valid).
1314 char *ColorOfNamedStyle(const char *styleName)
1316 int styleNo=lookupNamedStyle(styleName);
1318 if (styleNo<0)
1319 return "black";
1320 return HighlightStyles[styleNo]->color;
1324 ** Find the background color associated with a named style.
1326 char *BgColorOfNamedStyle(const char *styleName)
1328 int styleNo=lookupNamedStyle(styleName);
1330 if (styleNo<0)
1331 return "";
1332 return HighlightStyles[styleNo]->bgColor;
1336 ** Determine whether a named style exists
1338 int NamedStyleExists(const char *styleName)
1340 return lookupNamedStyle(styleName) != -1;
1344 ** Look through the list of pattern sets, and find the one for a particular
1345 ** language. Returns NULL if not found.
1347 patternSet *FindPatternSet(const char *langModeName)
1349 int i;
1351 if (langModeName == NULL)
1352 return NULL;
1354 for (i=0; i<NPatternSets; i++)
1355 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1356 return PatternSets[i];
1357 return NULL;
1362 ** Returns True if there are highlight patterns, or potential patterns
1363 ** not yet committed in the syntax highlighting dialog for a language mode,
1365 int LMHasHighlightPatterns(const char *languageMode)
1367 if (FindPatternSet(languageMode) != NULL)
1368 return True;
1369 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1370 languageMode) && HighlightDialog.nPatterns != 0;
1374 ** Change the language mode name of pattern sets for language "oldName" to
1375 ** "newName" in both the stored patterns, and the pattern set currently being
1376 ** edited in the dialog.
1378 void RenameHighlightPattern(const char *oldName, const char *newName)
1380 int i;
1382 for (i=0; i<NPatternSets; i++) {
1383 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1384 XtFree(PatternSets[i]->languageMode);
1385 PatternSets[i]->languageMode = XtNewString(newName);
1388 if (HighlightDialog.shell != NULL) {
1389 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1390 XtFree(HighlightDialog.langModeName);
1391 HighlightDialog.langModeName = XtNewString(newName);
1397 ** Create a pulldown menu pane with the names of the current highlight styles.
1398 ** XmNuserData for each item contains a pointer to the name.
1400 static Widget createHighlightStylesMenu(Widget parent)
1402 Widget menu;
1403 int i;
1404 XmString s1;
1406 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1407 for (i=0; i<NHighlightStyles; i++) {
1408 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1409 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1410 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1411 XmStringFree(s1);
1413 return menu;
1416 static char *createPatternsString(patternSet *patSet, char *indentStr)
1418 char *outStr, *str;
1419 textBuffer *outBuf;
1420 int pn;
1421 highlightPattern *pat;
1423 outBuf = BufCreate();
1424 for (pn=0; pn<patSet->nPatterns; pn++) {
1425 pat = &patSet->patterns[pn];
1426 BufInsert(outBuf, outBuf->length, indentStr);
1427 BufInsert(outBuf, outBuf->length, pat->name);
1428 BufInsert(outBuf, outBuf->length, ":");
1429 if (pat->startRE != NULL) {
1430 BufInsert(outBuf, outBuf->length,
1431 str=MakeQuotedString(pat->startRE));
1432 XtFree(str);
1434 BufInsert(outBuf, outBuf->length, ":");
1435 if (pat->endRE != NULL) {
1436 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1437 XtFree(str);
1439 BufInsert(outBuf, outBuf->length, ":");
1440 if (pat->errorRE != NULL) {
1441 BufInsert(outBuf, outBuf->length,
1442 str=MakeQuotedString(pat->errorRE));
1443 XtFree(str);
1445 BufInsert(outBuf, outBuf->length, ":");
1446 BufInsert(outBuf, outBuf->length, pat->style);
1447 BufInsert(outBuf, outBuf->length, ":");
1448 if (pat->subPatternOf != NULL)
1449 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1450 BufInsert(outBuf, outBuf->length, ":");
1451 if (pat->flags & DEFER_PARSING)
1452 BufInsert(outBuf, outBuf->length, "D");
1453 if (pat->flags & PARSE_SUBPATS_FROM_START)
1454 BufInsert(outBuf, outBuf->length, "R");
1455 if (pat->flags & COLOR_ONLY)
1456 BufInsert(outBuf, outBuf->length, "C");
1457 BufInsert(outBuf, outBuf->length, "\n");
1459 outStr = BufGetAll(outBuf);
1460 BufFree(outBuf);
1461 return outStr;
1465 ** Read in a pattern set character string, and advance *inPtr beyond it.
1466 ** Returns NULL and outputs an error to stderr on failure.
1468 static patternSet *readPatternSet(char **inPtr, int convertOld)
1470 char *errMsg, *stringStart = *inPtr;
1471 patternSet patSet, *retPatSet;
1473 /* remove leading whitespace */
1474 *inPtr += strspn(*inPtr, " \t\n");
1476 /* read language mode field */
1477 patSet.languageMode = ReadSymbolicField(inPtr);
1478 if (patSet.languageMode == NULL)
1479 return highlightError(stringStart, *inPtr,
1480 "language mode must be specified");
1481 if (!SkipDelimiter(inPtr, &errMsg))
1482 return highlightError(stringStart, *inPtr, errMsg);
1484 /* look for "Default" keyword, and if it's there, return the default
1485 pattern set */
1486 if (!strncmp(*inPtr, "Default", 7)) {
1487 *inPtr += 7;
1488 retPatSet = readDefaultPatternSet(patSet.languageMode);
1489 XtFree(patSet.languageMode);
1490 if (retPatSet == NULL)
1491 return highlightError(stringStart, *inPtr,
1492 "No default pattern set");
1493 return retPatSet;
1496 /* read line context field */
1497 if (!ReadNumericField(inPtr, &patSet.lineContext))
1498 return highlightError(stringStart, *inPtr,
1499 "unreadable line context field");
1500 if (!SkipDelimiter(inPtr, &errMsg))
1501 return highlightError(stringStart, *inPtr, errMsg);
1503 /* read character context field */
1504 if (!ReadNumericField(inPtr, &patSet.charContext))
1505 return highlightError(stringStart, *inPtr,
1506 "unreadable character context field");
1508 /* read pattern list */
1509 patSet.patterns = readHighlightPatterns(inPtr,
1510 True, &errMsg, &patSet.nPatterns);
1511 if (patSet.patterns == NULL)
1512 return highlightError(stringStart, *inPtr, errMsg);
1514 /* pattern set was read correctly, make an allocated copy to return */
1515 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1516 memcpy(retPatSet, &patSet, sizeof(patternSet));
1518 /* Convert pre-5.1 pattern sets which use old regular expression
1519 syntax to quote braces and use & rather than \0 */
1520 if (convertOld)
1521 convertOldPatternSet(retPatSet);
1523 return retPatSet;
1527 ** Parse a set of highlight patterns into an array of highlightPattern
1528 ** structures, and a language mode name. If unsuccessful, returns NULL with
1529 ** (statically allocated) message in "errMsg".
1531 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1532 char **errMsg, int *nPatterns)
1534 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1536 /* skip over blank space */
1537 *inPtr += strspn(*inPtr, " \t\n");
1539 /* look for initial brace */
1540 if (withBraces) {
1541 if (**inPtr != '{') {
1542 *errMsg = "pattern list must begin with \"{\"";
1543 return False;
1545 (*inPtr)++;
1549 ** parse each pattern in the list
1551 pat = patternList;
1552 while (True) {
1553 *inPtr += strspn(*inPtr, " \t\n");
1554 if (**inPtr == '\0') {
1555 if (withBraces) {
1556 *errMsg = "end of pattern list not found";
1557 return NULL;
1558 } else
1559 break;
1560 } else if (**inPtr == '}') {
1561 (*inPtr)++;
1562 break;
1564 if (!readHighlightPattern(inPtr, errMsg, pat++))
1565 return NULL;
1566 if (pat - patternList > MAX_PATTERNS) {
1567 *errMsg = "max number of patterns exceeded\n";
1568 return NULL;
1572 /* allocate a more appropriately sized list to return patterns */
1573 *nPatterns = pat - patternList;
1574 returnedList = (highlightPattern *)XtMalloc(
1575 sizeof(highlightPattern) * *nPatterns);
1576 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1577 return returnedList;
1580 static int readHighlightPattern(char **inPtr, char **errMsg,
1581 highlightPattern *pattern)
1583 /* read the name field */
1584 pattern->name = ReadSymbolicField(inPtr);
1585 if (pattern->name == NULL) {
1586 *errMsg = "pattern name is required";
1587 return False;
1589 if (!SkipDelimiter(inPtr, errMsg))
1590 return False;
1592 /* read the start pattern */
1593 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1594 return False;
1595 if (!SkipDelimiter(inPtr, errMsg))
1596 return False;
1598 /* read the end pattern */
1599 if (**inPtr == ':')
1600 pattern->endRE = NULL;
1601 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1602 return False;
1603 if (!SkipDelimiter(inPtr, errMsg))
1604 return False;
1606 /* read the error pattern */
1607 if (**inPtr == ':')
1608 pattern->errorRE = NULL;
1609 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1610 return False;
1611 if (!SkipDelimiter(inPtr, errMsg))
1612 return False;
1614 /* read the style field */
1615 pattern->style = ReadSymbolicField(inPtr);
1616 if (pattern->style == NULL) {
1617 *errMsg = "style field required in pattern";
1618 return False;
1620 if (!SkipDelimiter(inPtr, errMsg))
1621 return False;
1623 /* read the sub-pattern-of field */
1624 pattern->subPatternOf = ReadSymbolicField(inPtr);
1625 if (!SkipDelimiter(inPtr, errMsg))
1626 return False;
1628 /* read flags field */
1629 pattern->flags = 0;
1630 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1631 if (**inPtr == 'D')
1632 pattern->flags |= DEFER_PARSING;
1633 else if (**inPtr == 'R')
1634 pattern->flags |= PARSE_SUBPATS_FROM_START;
1635 else if (**inPtr == 'C')
1636 pattern->flags |= COLOR_ONLY;
1637 else if (**inPtr != ' ' && **inPtr != '\t') {
1638 *errMsg = "unreadable flag field";
1639 return False;
1642 return True;
1646 ** Given a language mode name, determine if there is a default (built-in)
1647 ** pattern set available for that language mode, and if so, read it and
1648 ** return a new allocated copy of it. The returned pattern set should be
1649 ** freed by the caller with freePatternSet()
1651 static patternSet *readDefaultPatternSet(const char *langModeName)
1653 int i, modeNameLen;
1654 char *strPtr;
1656 modeNameLen = strlen(langModeName);
1657 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1658 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1659 DefaultPatternSets[i][modeNameLen] == ':') {
1660 strPtr = DefaultPatternSets[i];
1661 return readPatternSet(&strPtr, False);
1664 return NULL;
1668 ** Return True if patSet exactly matches one of the default pattern sets
1670 static int isDefaultPatternSet(patternSet *patSet)
1672 patternSet *defaultPatSet;
1673 int retVal;
1675 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1676 if (defaultPatSet == NULL)
1677 return False;
1678 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1679 freePatternSet(defaultPatSet);
1680 return retVal;
1684 ** Short-hand functions for formating and outputing errors for
1686 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1687 const char *message)
1689 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1690 return NULL;
1694 static int styleError(const char *stringStart, const char *stoppedAt,
1695 const char *message)
1697 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1698 return False;
1702 ** Present a dialog for editing highlight style information
1704 void EditHighlightStyles(const char *initialStyle)
1706 #define HS_LIST_RIGHT 60
1707 #define HS_LEFT_MARGIN_POS 1
1708 #define HS_RIGHT_MARGIN_POS 99
1709 #define HS_H_MARGIN 10
1710 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1711 Widget fontBox, sep1, okBtn, applyBtn, closeBtn;
1712 XmString s1;
1713 int i, ac;
1714 Arg args[20];
1716 /* if the dialog is already displayed, just pop it to the top and return */
1717 if (HSDialog.shell != NULL) {
1718 if (initialStyle != NULL)
1719 setStyleByName(initialStyle);
1720 RaiseDialogWindow(HSDialog.shell);
1721 return;
1724 /* Copy the list of highlight style information to one that the user
1725 can freely edit (via the dialog and managed-list code) */
1726 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1727 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1728 for (i=0; i<NHighlightStyles; i++)
1729 HSDialog.highlightStyleList[i] =
1730 copyHighlightStyleRec(HighlightStyles[i]);
1731 HSDialog.nHighlightStyles = NHighlightStyles;
1733 /* Create a form widget in an application shell */
1734 ac = 0;
1735 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1736 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1737 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1738 HSDialog.shell = CreateWidget(TheAppShell, "textStyles",
1739 topLevelShellWidgetClass, args, ac);
1740 AddSmallIcon(HSDialog.shell);
1741 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1742 HSDialog.shell, XmNautoUnmanage, False,
1743 XmNresizePolicy, XmRESIZE_NONE, NULL);
1744 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1745 AddMotifCloseCallback(HSDialog.shell, hsCloseCB, NULL);
1747 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1748 XmNlabelString, s1=MKSTRING(
1749 "To modify the properties of an existing highlight style, select the name\n\
1750 from the list on the left. Select \"New\" to add a new style to the list."),
1751 XmNmnemonic, 'N',
1752 XmNtopAttachment, XmATTACH_POSITION,
1753 XmNtopPosition, 2,
1754 XmNleftAttachment, XmATTACH_POSITION,
1755 XmNleftPosition, HS_LEFT_MARGIN_POS,
1756 XmNrightAttachment, XmATTACH_POSITION,
1757 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1758 XmStringFree(s1);
1760 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1761 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1762 XmNmnemonic, 'm',
1763 XmNalignment, XmALIGNMENT_BEGINNING,
1764 XmNleftAttachment, XmATTACH_POSITION,
1765 XmNleftPosition, HS_LIST_RIGHT,
1766 XmNtopAttachment, XmATTACH_WIDGET,
1767 XmNtopOffset, HS_H_MARGIN,
1768 XmNtopWidget, topLbl, NULL);
1769 XmStringFree(s1);
1771 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1772 XmNleftAttachment, XmATTACH_POSITION,
1773 XmNleftPosition, HS_LIST_RIGHT,
1774 XmNtopAttachment, XmATTACH_WIDGET,
1775 XmNtopWidget, nameLbl,
1776 XmNrightAttachment, XmATTACH_POSITION,
1777 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1778 RemapDeleteKey(HSDialog.nameW);
1779 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1781 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1782 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1783 XmNmnemonic, 'C',
1784 XmNalignment, XmALIGNMENT_BEGINNING,
1785 XmNleftAttachment, XmATTACH_POSITION,
1786 XmNleftPosition, HS_LIST_RIGHT,
1787 XmNtopAttachment, XmATTACH_WIDGET,
1788 XmNtopOffset, HS_H_MARGIN,
1789 XmNtopWidget, HSDialog.nameW, NULL);
1790 XmStringFree(s1);
1792 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1793 XmNleftAttachment, XmATTACH_POSITION,
1794 XmNleftPosition, HS_LIST_RIGHT,
1795 XmNtopAttachment, XmATTACH_WIDGET,
1796 XmNtopWidget, colorLbl,
1797 XmNrightAttachment, XmATTACH_POSITION,
1798 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1799 RemapDeleteKey(HSDialog.colorW);
1800 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1802 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1803 XmNlabelString,
1804 s1=XmStringCreateSimple("Background Color (optional)"),
1805 XmNmnemonic, 'g',
1806 XmNalignment, XmALIGNMENT_BEGINNING,
1807 XmNleftAttachment, XmATTACH_POSITION,
1808 XmNleftPosition, HS_LIST_RIGHT,
1809 XmNtopAttachment, XmATTACH_WIDGET,
1810 XmNtopOffset, HS_H_MARGIN,
1811 XmNtopWidget, HSDialog.colorW, NULL);
1812 XmStringFree(s1);
1814 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1815 xmTextWidgetClass, form,
1816 XmNleftAttachment, XmATTACH_POSITION,
1817 XmNleftPosition, HS_LIST_RIGHT,
1818 XmNtopAttachment, XmATTACH_WIDGET,
1819 XmNtopWidget, bgColorLbl,
1820 XmNrightAttachment, XmATTACH_POSITION,
1821 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1822 RemapDeleteKey(HSDialog.bgColorW);
1823 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1825 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1826 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1827 XmNalignment, XmALIGNMENT_BEGINNING,
1828 XmNleftAttachment, XmATTACH_POSITION,
1829 XmNleftPosition, HS_LIST_RIGHT,
1830 XmNtopAttachment, XmATTACH_WIDGET,
1831 XmNtopOffset, HS_H_MARGIN,
1832 XmNtopWidget, HSDialog.bgColorW, NULL);
1833 XmStringFree(s1);
1835 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1836 XmNpacking, XmPACK_COLUMN,
1837 XmNnumColumns, 2,
1838 XmNradioBehavior, True,
1839 XmNleftAttachment, XmATTACH_POSITION,
1840 XmNleftPosition, HS_LIST_RIGHT,
1841 XmNtopAttachment, XmATTACH_WIDGET,
1842 XmNtopWidget, fontLbl, NULL);
1843 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1844 xmToggleButtonWidgetClass, fontBox,
1845 XmNset, True,
1846 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1847 XmNmnemonic, 'P', NULL);
1848 XmStringFree(s1);
1849 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1850 xmToggleButtonWidgetClass, fontBox,
1851 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1852 XmNmnemonic, 'B', NULL);
1853 XmStringFree(s1);
1854 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1855 xmToggleButtonWidgetClass, fontBox,
1856 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1857 XmNmnemonic, 'I', NULL);
1858 XmStringFree(s1);
1859 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1860 xmToggleButtonWidgetClass, fontBox,
1861 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1862 XmNmnemonic, 'o', NULL);
1863 XmStringFree(s1);
1865 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1866 XmNlabelString, s1=XmStringCreateSimple("OK"),
1867 XmNmarginWidth, BUTTON_WIDTH_MARGIN,
1868 XmNleftAttachment, XmATTACH_POSITION,
1869 XmNleftPosition, 10,
1870 XmNrightAttachment, XmATTACH_POSITION,
1871 XmNrightPosition, 30,
1872 XmNbottomAttachment, XmATTACH_POSITION,
1873 XmNbottomPosition, 99, NULL);
1874 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1875 XmStringFree(s1);
1877 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1878 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1879 XmNmnemonic, 'A',
1880 XmNleftAttachment, XmATTACH_POSITION,
1881 XmNleftPosition, 40,
1882 XmNrightAttachment, XmATTACH_POSITION,
1883 XmNrightPosition, 60,
1884 XmNbottomAttachment, XmATTACH_POSITION,
1885 XmNbottomPosition, 99, NULL);
1886 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1887 XmStringFree(s1);
1889 closeBtn = XtVaCreateManagedWidget("close",
1890 xmPushButtonWidgetClass, form,
1891 XmNlabelString, s1=XmStringCreateSimple("Close"),
1892 XmNleftAttachment, XmATTACH_POSITION,
1893 XmNleftPosition, 70,
1894 XmNrightAttachment, XmATTACH_POSITION,
1895 XmNrightPosition, 90,
1896 XmNbottomAttachment, XmATTACH_POSITION,
1897 XmNbottomPosition, 99,
1898 NULL);
1899 XtAddCallback(closeBtn, XmNactivateCallback, hsCloseCB, NULL);
1900 XmStringFree(s1);
1902 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1903 XmNleftAttachment, XmATTACH_FORM,
1904 XmNtopAttachment, XmATTACH_WIDGET,
1905 XmNtopWidget, fontBox,
1906 XmNtopOffset, HS_H_MARGIN,
1907 XmNrightAttachment, XmATTACH_FORM,
1908 XmNbottomAttachment, XmATTACH_WIDGET,
1909 XmNbottomWidget, closeBtn, 0,
1910 XmNbottomOffset, HS_H_MARGIN, NULL);
1912 ac = 0;
1913 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1914 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1915 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1916 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1917 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1918 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1919 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1920 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1921 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1922 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1923 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1924 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1925 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1926 form, hsFreeItemCB);
1927 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1929 /* Set initial default button */
1930 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1931 XtVaSetValues(form, XmNcancelButton, closeBtn, NULL);
1933 /* If there's a suggestion for an initial selection, make it */
1934 if (initialStyle != NULL)
1935 setStyleByName(initialStyle);
1937 /* Handle mnemonic selection of buttons and focus to dialog */
1938 AddDialogMnemonicHandler(form, FALSE);
1940 /* Realize all of the widgets in the new dialog */
1941 RealizeWithoutForcingPosition(HSDialog.shell);
1944 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1946 int i;
1948 for (i=0; i<HSDialog.nHighlightStyles; i++)
1949 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1950 XtFree((char *)HSDialog.highlightStyleList);
1953 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1955 if (!updateHSList())
1956 return;
1958 /* pop down and destroy the dialog */
1959 XtDestroyWidget(HSDialog.shell);
1960 HSDialog.shell = NULL;
1963 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1965 updateHSList();
1968 static void hsCloseCB(Widget w, XtPointer clientData, XtPointer callData)
1970 /* pop down and destroy the dialog */
1971 XtDestroyWidget(HSDialog.shell);
1972 HSDialog.shell = NULL;
1975 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1976 void *cbArg)
1978 highlightStyleRec *hs;
1980 /* If the dialog is currently displaying the "new" entry and the
1981 fields are empty, that's just fine */
1982 if (oldItem == NULL && hsDialogEmpty())
1983 return NULL;
1985 /* If there are no problems reading the data, just return it */
1986 hs = readHSDialogFields(True);
1987 if (hs != NULL)
1988 return (void *)hs;
1990 /* If there are problems, and the user didn't ask for the fields to be
1991 read, give more warning */
1992 if (!explicitRequest)
1994 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1995 "Discard incomplete entry\nfor current highlight style?",
1996 "Keep", "Discard") == 2)
1998 return oldItem == NULL
1999 ? NULL
2000 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
2004 /* Do readHSDialogFields again without "silent" mode to display warning */
2005 hs = readHSDialogFields(False);
2006 *abort = True;
2007 return NULL;
2010 static void hsSetDisplayedCB(void *item, void *cbArg)
2012 highlightStyleRec *hs = (highlightStyleRec *)item;
2014 if (item == NULL) {
2015 XmTextSetString(HSDialog.nameW, "");
2016 XmTextSetString(HSDialog.colorW, "");
2017 XmTextSetString(HSDialog.bgColorW, "");
2018 RadioButtonChangeState(HSDialog.plainW, True, False);
2019 RadioButtonChangeState(HSDialog.boldW, False, False);
2020 RadioButtonChangeState(HSDialog.italicW, False, False);
2021 RadioButtonChangeState(HSDialog.boldItalicW, False, False);
2022 } else {
2023 if (strcmp(hs->name, "Plain") == 0) {
2024 /* you should not be able to delete the reserved style "Plain" */
2025 int i, others = 0;
2026 int nList = HSDialog.nHighlightStyles;
2027 highlightStyleRec **list = HSDialog.highlightStyleList;
2028 /* do we have other styles called Plain? */
2029 for (i = 0; i < nList; i++) {
2030 if (list[i] != hs && strcmp(list[i]->name, "Plain") == 0) {
2031 others++;
2034 if (others == 0) {
2035 /* this is the last style entry named "Plain" */
2036 Widget form = (Widget)cbArg;
2037 Widget deleteBtn = XtNameToWidget(form, "*delete");
2038 /* disable delete button */
2039 if (deleteBtn) {
2040 XtSetSensitive(deleteBtn, False);
2044 XmTextSetString(HSDialog.nameW, hs->name);
2045 XmTextSetString(HSDialog.colorW, hs->color);
2046 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2047 RadioButtonChangeState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2048 RadioButtonChangeState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2049 RadioButtonChangeState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2050 RadioButtonChangeState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2051 False);
2055 static void hsFreeItemCB(void *item)
2057 freeHighlightStyleRec((highlightStyleRec *)item);
2060 static highlightStyleRec *readHSDialogFields(int silent)
2062 highlightStyleRec *hs;
2063 Display *display = XtDisplay(HSDialog.shell);
2064 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2065 XColor rgb;
2067 /* Allocate a language mode structure to return */
2068 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2070 /* read the name field */
2071 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2072 "highlight style name", silent);
2073 if (hs->name == NULL) {
2074 XtFree((char *)hs);
2075 return NULL;
2078 if (*hs->name == '\0')
2080 if (!silent)
2082 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2083 "Please specify a name\nfor the highlight style", "OK");
2084 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2086 XtFree(hs->name);
2087 XtFree((char *)hs);
2088 return NULL;
2091 /* read the color field */
2092 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2093 if (hs->color == NULL) {
2094 XtFree(hs->name);
2095 XtFree((char *)hs);
2096 return NULL;
2099 if (*hs->color == '\0')
2101 if (!silent)
2103 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2104 "Please specify a color\nfor the highlight style",
2105 "OK");
2106 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2108 XtFree(hs->name);
2109 XtFree(hs->color);
2110 XtFree((char *)hs);
2111 return NULL;
2114 /* Verify that the color is a valid X color spec */
2115 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2116 &rgb))
2118 if (!silent)
2120 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2121 "Invalid X color specification: %s\n", "OK",
2122 hs->color);
2123 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2125 XtFree(hs->name);
2126 XtFree(hs->color);
2127 XtFree((char *)hs);
2128 return NULL;;
2131 /* read the background color field - this may be empty */
2132 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2133 "bgColor", silent);
2134 if (hs->bgColor && *hs->bgColor == '\0') {
2135 XtFree(hs->bgColor);
2136 hs->bgColor = NULL;
2139 /* Verify that the background color (if present) is a valid X color spec */
2140 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2141 hs->bgColor, &rgb))
2143 if (!silent)
2145 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2146 "Invalid X background color specification: %s\n", "OK",
2147 hs->bgColor);
2148 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2150 XtFree(hs->name);
2151 XtFree(hs->color);
2152 XtFree(hs->bgColor);
2153 XtFree((char *)hs);
2154 return NULL;;
2157 /* read the font buttons */
2158 if (XmToggleButtonGetState(HSDialog.boldW))
2159 hs->font = BOLD_FONT;
2160 else if (XmToggleButtonGetState(HSDialog.italicW))
2161 hs->font = ITALIC_FONT;
2162 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2163 hs->font = BOLD_ITALIC_FONT;
2164 else
2165 hs->font = PLAIN_FONT;
2167 return hs;
2171 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2172 ** it contains.
2174 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2176 highlightStyleRec *newHS;
2178 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2179 newHS->name = XtMalloc(strlen(hs->name)+1);
2180 strcpy(newHS->name, hs->name);
2181 if (hs->color == NULL)
2182 newHS->color = NULL;
2183 else {
2184 newHS->color = XtMalloc(strlen(hs->color)+1);
2185 strcpy(newHS->color, hs->color);
2187 if (hs->bgColor == NULL)
2188 newHS->bgColor = NULL;
2189 else {
2190 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2191 strcpy(newHS->bgColor, hs->bgColor);
2193 newHS->font = hs->font;
2194 return newHS;
2198 ** Free all of the allocated data in a highlightStyleRec, including the
2199 ** structure itself.
2201 static void freeHighlightStyleRec(highlightStyleRec *hs)
2203 XtFree(hs->name);
2204 if (hs->color != NULL)
2205 XtFree(hs->color);
2206 XtFree((char *)hs);
2210 ** Select a particular style in the highlight styles dialog
2212 static void setStyleByName(const char *style)
2214 int i;
2216 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2217 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2218 SelectManagedListItem(HSDialog.managedListW, i);
2219 break;
2225 ** Return True if the fields of the highlight styles dialog are consistent
2226 ** with a blank "New" style in the dialog.
2228 static int hsDialogEmpty(void)
2230 return TextWidgetIsBlank(HSDialog.nameW) &&
2231 TextWidgetIsBlank(HSDialog.colorW) &&
2232 XmToggleButtonGetState(HSDialog.plainW);
2236 ** Apply the changes made in the highlight styles dialog to the stored
2237 ** highlight style information in HighlightStyles
2239 static int updateHSList(void)
2241 WindowInfo *window;
2242 int i;
2244 /* Get the current contents of the dialog fields */
2245 if (!UpdateManagedList(HSDialog.managedListW, True))
2246 return False;
2248 /* Replace the old highlight styles list with the new one from the dialog */
2249 for (i=0; i<NHighlightStyles; i++)
2250 freeHighlightStyleRec(HighlightStyles[i]);
2251 for (i=0; i<HSDialog.nHighlightStyles; i++)
2252 HighlightStyles[i] =
2253 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2254 NHighlightStyles = HSDialog.nHighlightStyles;
2256 /* If a syntax highlighting dialog is up, update its menu */
2257 updateHighlightStyleMenu();
2259 /* Redisplay highlighted windows which use changed style(s) */
2260 for (window=WindowList; window!=NULL; window=window->next)
2261 UpdateHighlightStyles(window);
2263 /* Note that preferences have been changed */
2264 MarkPrefsChanged();
2266 return True;
2270 ** Present a dialog for editing highlight pattern information
2272 void EditHighlightPatterns(WindowInfo *window)
2274 #define BORDER 4
2275 #define LIST_RIGHT 41
2276 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2277 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2278 Widget okBtn, applyBtn, checkBtn, deleteBtn, closeBtn, helpBtn;
2279 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2280 patternSet *patSet;
2281 XmString s1;
2282 int i, n, nPatterns;
2283 Arg args[20];
2285 /* if the dialog is already displayed, just pop it to the top and return */
2286 if (HighlightDialog.shell != NULL) {
2287 RaiseDialogWindow(HighlightDialog.shell);
2288 return;
2291 if (LanguageModeName(0) == NULL)
2293 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2294 "No Language Modes available for syntax highlighting\n"
2295 "Add language modes under Preferenses->Language Modes",
2296 "OK");
2297 return;
2300 /* Decide on an initial language mode */
2301 HighlightDialog.langModeName = XtNewString(
2302 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2303 window->languageMode));
2305 /* Find the associated pattern set (patSet) to edit */
2306 patSet = FindPatternSet(HighlightDialog.langModeName);
2308 /* Copy the list of patterns to one that the user can freely edit */
2309 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2310 sizeof(highlightPattern *) * MAX_PATTERNS);
2311 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2312 for (i=0; i<nPatterns; i++)
2313 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2314 HighlightDialog.nPatterns = nPatterns;
2317 /* Create a form widget in an application shell */
2318 n = 0;
2319 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2320 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2321 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2322 HighlightDialog.shell = CreateWidget(TheAppShell, "syntaxHighlight",
2323 topLevelShellWidgetClass, args, n);
2324 AddSmallIcon(HighlightDialog.shell);
2325 form = XtVaCreateManagedWidget("editHighlightPatterns",
2326 xmFormWidgetClass, HighlightDialog.shell,
2327 XmNautoUnmanage, False,
2328 XmNresizePolicy, XmRESIZE_NONE,
2329 NULL);
2330 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2331 AddMotifCloseCallback(HighlightDialog.shell, closeCB, NULL);
2333 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2334 form,
2335 XmNleftAttachment, XmATTACH_POSITION,
2336 XmNleftPosition, 1,
2337 XmNtopAttachment, XmATTACH_POSITION,
2338 XmNtopPosition, 1,
2339 XmNrightAttachment, XmATTACH_POSITION,
2340 XmNrightPosition, 99,
2341 NULL);
2343 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2344 NULL);
2345 n = 0;
2346 XtSetArg(args[n], XmNspacing, 0); n++;
2347 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2348 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2349 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2350 XtSetArg(args[n], XmNleftPosition, 50); n++;
2351 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2352 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2353 XtManageChild(lmOptMenu);
2354 HighlightDialog.lmOptMenu = lmOptMenu;
2356 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2357 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2358 XmNmnemonic, 'M',
2359 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2360 XmNalignment, XmALIGNMENT_END,
2361 XmNrightAttachment, XmATTACH_POSITION,
2362 XmNrightPosition, 50,
2363 XmNtopAttachment, XmATTACH_FORM,
2364 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2365 XmNbottomWidget, lmOptMenu, NULL);
2366 XmStringFree(s1);
2368 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2369 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2370 XmNmnemonic, 'A',
2371 XmNrightAttachment, XmATTACH_FORM,
2372 XmNtopAttachment, XmATTACH_FORM, NULL);
2373 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2374 XmStringFree(s1);
2376 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2377 XmNlabelString, s1=XmStringCreateSimple("OK"),
2378 XmNmarginWidth, BUTTON_WIDTH_MARGIN,
2379 XmNleftAttachment, XmATTACH_POSITION,
2380 XmNleftPosition, 1,
2381 XmNrightAttachment, XmATTACH_POSITION,
2382 XmNrightPosition, 13,
2383 XmNbottomAttachment, XmATTACH_FORM,
2384 XmNbottomOffset, BORDER, NULL);
2385 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2386 XmStringFree(s1);
2388 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2389 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2390 XmNmnemonic, 'y',
2391 XmNleftAttachment, XmATTACH_POSITION,
2392 XmNleftPosition, 13,
2393 XmNrightAttachment, XmATTACH_POSITION,
2394 XmNrightPosition, 26,
2395 XmNbottomAttachment, XmATTACH_FORM,
2396 XmNbottomOffset, BORDER, NULL);
2397 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2398 XmStringFree(s1);
2400 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2401 XmNlabelString, s1=XmStringCreateSimple("Check"),
2402 XmNmnemonic, 'k',
2403 XmNleftAttachment, XmATTACH_POSITION,
2404 XmNleftPosition, 26,
2405 XmNrightAttachment, XmATTACH_POSITION,
2406 XmNrightPosition, 39,
2407 XmNbottomAttachment, XmATTACH_FORM,
2408 XmNbottomOffset, BORDER, NULL);
2409 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2410 XmStringFree(s1);
2412 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2413 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2414 XmNmnemonic, 'D',
2415 XmNleftAttachment, XmATTACH_POSITION,
2416 XmNleftPosition, 39,
2417 XmNrightAttachment, XmATTACH_POSITION,
2418 XmNrightPosition, 52,
2419 XmNbottomAttachment, XmATTACH_FORM,
2420 XmNbottomOffset, BORDER, NULL);
2421 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2422 XmStringFree(s1);
2424 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2425 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2426 XmNmnemonic, 'f',
2427 XmNleftAttachment, XmATTACH_POSITION,
2428 XmNleftPosition, 52,
2429 XmNrightAttachment, XmATTACH_POSITION,
2430 XmNrightPosition, 73,
2431 XmNbottomAttachment, XmATTACH_FORM,
2432 XmNbottomOffset, BORDER, NULL);
2433 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2434 XmStringFree(s1);
2436 closeBtn = XtVaCreateManagedWidget("close", xmPushButtonWidgetClass,
2437 form,
2438 XmNlabelString, s1=XmStringCreateSimple("Close"),
2439 XmNleftAttachment, XmATTACH_POSITION,
2440 XmNleftPosition, 73,
2441 XmNrightAttachment, XmATTACH_POSITION,
2442 XmNrightPosition, 86,
2443 XmNbottomAttachment, XmATTACH_FORM,
2444 XmNbottomOffset, BORDER, NULL);
2445 XtAddCallback(closeBtn, XmNactivateCallback, closeCB, NULL);
2446 XmStringFree(s1);
2448 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2449 form,
2450 XmNlabelString, s1=XmStringCreateSimple("Help"),
2451 XmNmnemonic, 'H',
2452 XmNleftAttachment, XmATTACH_POSITION,
2453 XmNleftPosition, 86,
2454 XmNrightAttachment, XmATTACH_POSITION,
2455 XmNrightPosition, 99,
2456 XmNbottomAttachment, XmATTACH_FORM,
2457 XmNbottomOffset, BORDER, NULL);
2458 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2459 XmStringFree(s1);
2461 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2462 form,
2463 XmNleftAttachment, XmATTACH_POSITION,
2464 XmNleftPosition, 1,
2465 XmNrightAttachment, XmATTACH_POSITION,
2466 XmNrightPosition, 99,
2467 XmNbottomAttachment, XmATTACH_WIDGET,
2468 XmNbottomWidget, okBtn,
2469 XmNbottomOffset, BORDER, NULL);
2470 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2471 contextFrame, NULL);
2472 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2473 XmNlabelString, s1=XmStringCreateSimple(
2474 "Context requirements for incremental re-parsing after changes"),
2475 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2476 XmStringFree(s1);
2478 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2479 xmTextWidgetClass, contextForm,
2480 XmNcolumns, 5,
2481 XmNmaxLength, 12,
2482 XmNleftAttachment, XmATTACH_POSITION,
2483 XmNleftPosition, 15,
2484 XmNrightAttachment, XmATTACH_POSITION,
2485 XmNrightPosition, 25, NULL);
2486 RemapDeleteKey(HighlightDialog.lineContextW);
2488 XtVaCreateManagedWidget("lineContLbl",
2489 xmLabelGadgetClass, contextForm,
2490 XmNlabelString, s1=XmStringCreateSimple("lines"),
2491 XmNmnemonic, 'l',
2492 XmNuserData, HighlightDialog.lineContextW,
2493 XmNalignment, XmALIGNMENT_BEGINNING,
2494 XmNleftAttachment, XmATTACH_WIDGET,
2495 XmNleftWidget, HighlightDialog.lineContextW,
2496 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2497 XmNtopWidget, HighlightDialog.lineContextW,
2498 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2499 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2500 XmStringFree(s1);
2502 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2503 xmTextWidgetClass, contextForm,
2504 XmNcolumns, 5,
2505 XmNmaxLength, 12,
2506 XmNleftAttachment, XmATTACH_POSITION,
2507 XmNleftPosition, 58,
2508 XmNrightAttachment, XmATTACH_POSITION,
2509 XmNrightPosition, 68, NULL);
2510 RemapDeleteKey(HighlightDialog.lineContextW);
2512 XtVaCreateManagedWidget("charContLbl",
2513 xmLabelGadgetClass, contextForm,
2514 XmNlabelString, s1=XmStringCreateSimple("characters"),
2515 XmNmnemonic, 'c',
2516 XmNuserData, HighlightDialog.charContextW,
2517 XmNalignment, XmALIGNMENT_BEGINNING,
2518 XmNleftAttachment, XmATTACH_WIDGET,
2519 XmNleftWidget, HighlightDialog.charContextW,
2520 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2521 XmNtopWidget, HighlightDialog.charContextW,
2522 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2523 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2524 XmStringFree(s1);
2526 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2527 form,
2528 XmNleftAttachment, XmATTACH_POSITION,
2529 XmNleftPosition, 1,
2530 XmNtopAttachment, XmATTACH_WIDGET,
2531 XmNtopWidget, lmForm,
2532 XmNrightAttachment, XmATTACH_POSITION,
2533 XmNrightPosition, 99,
2534 XmNbottomAttachment, XmATTACH_WIDGET,
2535 XmNbottomWidget, contextFrame,
2536 XmNbottomOffset, BORDER, NULL);
2537 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2538 patternsFrame, NULL);
2539 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2540 patternsFrame,
2541 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2542 XmNmnemonic, 'P',
2543 XmNmarginHeight, 0,
2544 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2545 XmStringFree(s1);
2547 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2548 patternsForm,
2549 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2550 XmNmarginHeight, 0,
2551 XmNalignment, XmALIGNMENT_BEGINNING,
2552 XmNleftAttachment, XmATTACH_POSITION,
2553 XmNleftPosition, LIST_RIGHT,
2554 XmNtopAttachment, XmATTACH_FORM, NULL);
2555 XmStringFree(s1);
2557 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2558 patternsForm,
2559 XmNpacking, XmPACK_COLUMN,
2560 XmNradioBehavior, True,
2561 XmNleftAttachment, XmATTACH_POSITION,
2562 XmNleftPosition, LIST_RIGHT,
2563 XmNtopAttachment, XmATTACH_WIDGET,
2564 XmNtopWidget, typeLbl, NULL);
2565 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2566 xmToggleButtonWidgetClass, typeBox,
2567 XmNset, True,
2568 XmNmarginHeight, 0,
2569 XmNlabelString, s1=XmStringCreateSimple(
2570 "Pass-1 (applied to all text when loaded or modified)"),
2571 XmNmnemonic, '1', NULL);
2572 XmStringFree(s1);
2573 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2574 patTypeCB, NULL);
2575 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2576 xmToggleButtonWidgetClass, typeBox,
2577 XmNmarginHeight, 0,
2578 XmNlabelString, s1=XmStringCreateSimple(
2579 "Pass-2 (parsing is deferred until text is exposed)"),
2580 XmNmnemonic, '2', NULL);
2581 XmStringFree(s1);
2582 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2583 patTypeCB, NULL);
2584 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2585 xmToggleButtonWidgetClass, typeBox,
2586 XmNmarginHeight, 0,
2587 XmNlabelString, s1=XmStringCreateSimple(
2588 "Sub-pattern (processed within start & end of parent)"),
2589 XmNmnemonic, 'u', NULL);
2590 XmStringFree(s1);
2591 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2592 patTypeCB, NULL);
2593 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2594 xmToggleButtonWidgetClass, typeBox,
2595 XmNmarginHeight, 0,
2596 XmNlabelString, s1=XmStringCreateSimple(
2597 "Coloring for sub-expressions of parent pattern"),
2598 XmNmnemonic, 'g', NULL);
2599 XmStringFree(s1);
2600 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2601 patTypeCB, NULL);
2603 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2604 xmLabelGadgetClass, patternsForm,
2605 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2606 XmNmarginHeight, 0,
2607 XmNalignment, XmALIGNMENT_BEGINNING,
2608 XmNleftAttachment, XmATTACH_POSITION,
2609 XmNleftPosition, LIST_RIGHT,
2610 XmNtopAttachment, XmATTACH_WIDGET,
2611 XmNtopOffset, BORDER,
2612 XmNtopWidget, typeBox, NULL);
2613 XmStringFree(s1);
2615 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2616 patternsForm,
2617 XmNpacking, XmPACK_COLUMN,
2618 XmNradioBehavior, True,
2619 XmNleftAttachment, XmATTACH_POSITION,
2620 XmNleftPosition, LIST_RIGHT,
2621 XmNtopAttachment, XmATTACH_WIDGET,
2622 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2623 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2624 xmToggleButtonWidgetClass, matchBox,
2625 XmNset, True,
2626 XmNmarginHeight, 0,
2627 XmNlabelString, s1=XmStringCreateSimple(
2628 "Highlight text matching regular expression"),
2629 XmNmnemonic, 'x', NULL);
2630 XmStringFree(s1);
2631 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2632 matchTypeCB, NULL);
2633 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2634 xmToggleButtonWidgetClass, matchBox,
2635 XmNmarginHeight, 0,
2636 XmNlabelString, s1=XmStringCreateSimple(
2637 "Highlight text between starting and ending REs"),
2638 XmNmnemonic, 'b', NULL);
2639 XmStringFree(s1);
2640 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2641 matchTypeCB, NULL);
2643 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2644 patternsForm,
2645 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2646 XmNmnemonic, 'N',
2647 XmNrows, 20,
2648 XmNalignment, XmALIGNMENT_BEGINNING,
2649 XmNleftAttachment, XmATTACH_POSITION,
2650 XmNleftPosition, LIST_RIGHT,
2651 XmNtopAttachment, XmATTACH_WIDGET,
2652 XmNtopWidget, matchBox,
2653 XmNtopOffset, BORDER, NULL);
2654 XmStringFree(s1);
2656 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2657 patternsForm,
2658 XmNleftAttachment, XmATTACH_POSITION,
2659 XmNleftPosition, LIST_RIGHT,
2660 XmNtopAttachment, XmATTACH_WIDGET,
2661 XmNtopWidget, nameLbl,
2662 XmNrightAttachment, XmATTACH_POSITION,
2663 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2664 RemapDeleteKey(HighlightDialog.nameW);
2665 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2667 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2668 xmLabelGadgetClass, patternsForm,
2669 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2670 XmNmnemonic, 't',
2671 XmNrows, 20,
2672 XmNalignment, XmALIGNMENT_BEGINNING,
2673 XmNleftAttachment, XmATTACH_POSITION,
2674 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2675 XmNtopAttachment, XmATTACH_WIDGET,
2676 XmNtopWidget, matchBox,
2677 XmNtopOffset, BORDER, NULL);
2678 XmStringFree(s1);
2680 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2681 xmTextWidgetClass, patternsForm,
2682 XmNleftAttachment, XmATTACH_POSITION,
2683 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2684 XmNtopAttachment, XmATTACH_WIDGET,
2685 XmNtopWidget, HighlightDialog.parentLbl,
2686 XmNrightAttachment, XmATTACH_POSITION,
2687 XmNrightPosition, 99, NULL);
2688 RemapDeleteKey(HighlightDialog.parentW);
2689 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2690 HighlightDialog.parentW, NULL);
2692 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2693 xmLabelGadgetClass, patternsForm,
2694 XmNalignment, XmALIGNMENT_BEGINNING,
2695 XmNmnemonic, 'R',
2696 XmNtopAttachment, XmATTACH_WIDGET,
2697 XmNtopWidget, HighlightDialog.parentW,
2698 XmNtopOffset, BORDER,
2699 XmNleftAttachment, XmATTACH_POSITION,
2700 XmNleftPosition, 1, NULL);
2702 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2703 xmTextWidgetClass, patternsForm,
2704 XmNleftAttachment, XmATTACH_POSITION,
2705 XmNleftPosition, 1,
2706 XmNrightAttachment, XmATTACH_POSITION,
2707 XmNrightPosition, 99,
2708 XmNbottomAttachment, XmATTACH_POSITION,
2709 XmNbottomPosition, 99, NULL);
2710 RemapDeleteKey(HighlightDialog.errorW);
2712 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2713 xmLabelGadgetClass, patternsForm,
2714 XmNlabelString, s1=XmStringCreateSimple(
2715 "Regular Expression Indicating Error in Match (Optional)"),
2716 XmNmnemonic, 'o',
2717 XmNuserData, HighlightDialog.errorW,
2718 XmNalignment, XmALIGNMENT_BEGINNING,
2719 XmNleftAttachment, XmATTACH_POSITION,
2720 XmNleftPosition, 1,
2721 XmNbottomAttachment, XmATTACH_WIDGET,
2722 XmNbottomWidget, HighlightDialog.errorW, NULL);
2723 XmStringFree(s1);
2725 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2726 xmTextWidgetClass, patternsForm,
2727 XmNleftAttachment, XmATTACH_POSITION,
2728 XmNleftPosition, 1,
2729 XmNbottomAttachment, XmATTACH_WIDGET,
2730 XmNbottomWidget, HighlightDialog.errorLbl,
2731 XmNbottomOffset, BORDER,
2732 XmNrightAttachment, XmATTACH_POSITION,
2733 XmNrightPosition, 99, NULL);
2734 RemapDeleteKey(HighlightDialog.endW);
2736 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2737 xmLabelGadgetClass, patternsForm,
2738 XmNmnemonic, 'E',
2739 XmNuserData, HighlightDialog.endW,
2740 XmNalignment, XmALIGNMENT_BEGINNING,
2741 XmNleftAttachment, XmATTACH_POSITION,
2742 XmNleftPosition, 1,
2743 XmNbottomAttachment, XmATTACH_WIDGET,
2744 XmNbottomWidget, HighlightDialog.endW, NULL);
2746 n = 0;
2747 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2748 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2749 XtSetArg(args[n], XmNwordWrap, True); n++;
2750 XtSetArg(args[n], XmNrows, 3); n++;
2751 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2752 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2753 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2754 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2755 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2756 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2757 XtSetArg(args[n], XmNleftPosition, 1); n++;
2758 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2759 XtSetArg(args[n], XmNrightPosition, 99); n++;
2760 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2761 AddMouseWheelSupport(HighlightDialog.startW);
2762 XtManageChild(HighlightDialog.startW);
2763 MakeSingleLineTextW(HighlightDialog.startW);
2764 RemapDeleteKey(HighlightDialog.startW);
2765 XtVaSetValues(HighlightDialog.startLbl,
2766 XmNuserData,HighlightDialog.startW, NULL);
2768 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2769 patternsForm,
2770 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2771 XmNmnemonic, 'i',
2772 XmNrightAttachment, XmATTACH_POSITION,
2773 XmNrightPosition, LIST_RIGHT-1,
2774 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2775 XmNbottomWidget, HighlightDialog.parentW, NULL);
2776 XmStringFree(s1);
2777 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2779 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2780 n = 0;
2781 XtSetArg(args[n], XmNspacing, 0); n++;
2782 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2783 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2784 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2785 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2786 XtSetArg(args[n], XmNleftPosition, 1); n++;
2787 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2788 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2789 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2790 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2791 "styleOptMenu", args, n);
2792 XtManageChild(HighlightDialog.styleOptMenu);
2794 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2795 patternsForm,
2796 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2797 XmNmnemonic, 'S',
2798 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2799 XmNalignment, XmALIGNMENT_BEGINNING,
2800 XmNleftAttachment, XmATTACH_POSITION,
2801 XmNleftPosition, 1,
2802 XmNbottomAttachment, XmATTACH_WIDGET,
2803 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2804 XmStringFree(s1);
2806 n = 0;
2807 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2808 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2809 XtSetArg(args[n], XmNleftPosition, 1); n++;
2810 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2811 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2812 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2813 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2814 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2815 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2816 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2817 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2818 NULL, freeItemCB);
2819 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2821 /* Set initial default button */
2822 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2823 XtVaSetValues(form, XmNcancelButton, closeBtn, NULL);
2825 /* Handle mnemonic selection of buttons and focus to dialog */
2826 AddDialogMnemonicHandler(form, FALSE);
2828 /* Fill in the dialog information for the selected language mode */
2829 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2830 patSet->lineContext);
2831 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2832 patSet->charContext);
2833 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2834 updateLabels();
2836 /* Realize all of the widgets in the new dialog */
2837 RealizeWithoutForcingPosition(HighlightDialog.shell);
2841 ** If a syntax highlighting dialog is up, ask to have the option menu for
2842 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2844 static void updateHighlightStyleMenu(void)
2846 Widget oldMenu;
2847 int patIndex;
2849 if (HighlightDialog.shell == NULL)
2850 return;
2852 oldMenu = HighlightDialog.stylePulldown;
2853 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2854 XtParent(XtParent(oldMenu)));
2855 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2856 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2857 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2858 if (patIndex == -1)
2859 setStyleMenu("Plain");
2860 else
2861 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2863 XtDestroyWidget(oldMenu);
2867 ** If a syntax highlighting dialog is up, ask to have the option menu for
2868 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2870 void UpdateLanguageModeMenu(void)
2872 Widget oldMenu;
2874 if (HighlightDialog.shell == NULL)
2875 return;
2877 oldMenu = HighlightDialog.lmPulldown;
2878 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2879 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2880 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2881 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2882 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2884 XtDestroyWidget(oldMenu);
2887 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2889 int i;
2891 freeNonNull(HighlightDialog.langModeName);
2892 for (i=0; i<HighlightDialog.nPatterns; i++)
2893 freePatternSrc(HighlightDialog.patterns[i], True);
2894 HighlightDialog.shell = NULL;
2897 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2899 char *modeName;
2900 patternSet *oldPatSet, *newPatSet;
2901 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2902 int i, resp;
2904 /* Get the newly selected mode name. If it's the same, do nothing */
2905 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2906 if (!strcmp(modeName, HighlightDialog.langModeName))
2907 return;
2909 /* Look up the original version of the patterns being edited */
2910 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2911 if (oldPatSet == NULL)
2912 oldPatSet = &emptyPatSet;
2914 /* Get the current information displayed by the dialog. If it's bad,
2915 give the user the chance to throw it out or go back and fix it. If
2916 it has changed, give the user the chance to apply discard or cancel. */
2917 newPatSet = getDialogPatternSet();
2919 if (newPatSet == NULL)
2921 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2922 "Incomplete Language Mode", "Discard incomplete entry\n"
2923 "for current language mode?", "Keep", "Discard") == 1)
2925 SetLangModeMenu(HighlightDialog.lmOptMenu,
2926 HighlightDialog.langModeName);
2927 return;
2929 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2931 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2932 "Apply changes for language mode %s?", "Apply Changes",
2933 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2934 if (resp == 3)
2936 SetLangModeMenu(HighlightDialog.lmOptMenu,
2937 HighlightDialog.langModeName);
2938 return;
2940 if (resp == 1)
2942 updatePatternSet();
2946 if (newPatSet != NULL)
2947 freePatternSet(newPatSet);
2949 /* Free the old dialog information */
2950 freeNonNull(HighlightDialog.langModeName);
2951 for (i=0; i<HighlightDialog.nPatterns; i++)
2952 freePatternSrc(HighlightDialog.patterns[i], True);
2954 /* Fill the dialog with the new language mode information */
2955 HighlightDialog.langModeName = XtNewString(modeName);
2956 newPatSet = FindPatternSet(modeName);
2957 if (newPatSet == NULL) {
2958 HighlightDialog.nPatterns = 0;
2959 SetIntText(HighlightDialog.lineContextW, 1);
2960 SetIntText(HighlightDialog.charContextW, 0);
2961 } else {
2962 for (i=0; i<newPatSet->nPatterns; i++)
2963 HighlightDialog.patterns[i] =
2964 copyPatternSrc(&newPatSet->patterns[i], NULL);
2965 HighlightDialog.nPatterns = newPatSet->nPatterns;
2966 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2967 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2969 ChangeManagedListData(HighlightDialog.managedListW);
2972 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2974 EditLanguageModes();
2977 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2979 Widget selectedItem;
2980 char *style;
2982 XtVaGetValues(HighlightDialog.styleOptMenu,
2983 XmNmenuHistory, &selectedItem,
2984 NULL);
2985 XtVaGetValues(selectedItem,
2986 XmNuserData, &style,
2987 NULL);
2988 EditHighlightStyles(style);
2991 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2993 /* change the patterns */
2994 if (!updatePatternSet())
2995 return;
2997 /* pop down and destroy the dialog */
2998 CloseAllPopupsFor(HighlightDialog.shell);
2999 XtDestroyWidget(HighlightDialog.shell);
3002 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
3004 /* change the patterns */
3005 updatePatternSet();
3008 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
3010 if (checkHighlightDialogData())
3012 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
3013 "Patterns compiled without error", "OK");
3017 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
3019 patternSet *defaultPatSet;
3020 int i, psn;
3022 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
3023 if (defaultPatSet == NULL)
3025 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
3026 "There is no default pattern set\nfor language mode %s",
3027 "OK", HighlightDialog.langModeName);
3028 return;
3031 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
3032 "Are you sure you want to discard\n"
3033 "all changes to syntax highlighting\n"
3034 "patterns for language mode %s?", "Discard", "Cancel",
3035 HighlightDialog.langModeName) == 2)
3037 return;
3040 /* if a stored version of the pattern set exists, replace it, if it
3041 doesn't, add a new one */
3042 for (psn=0; psn<NPatternSets; psn++)
3043 if (!strcmp(HighlightDialog.langModeName,
3044 PatternSets[psn]->languageMode))
3045 break;
3046 if (psn < NPatternSets) {
3047 freePatternSet(PatternSets[psn]);
3048 PatternSets[psn] = defaultPatSet;
3049 } else
3050 PatternSets[NPatternSets++] = defaultPatSet;
3052 /* Free the old dialog information */
3053 for (i=0; i<HighlightDialog.nPatterns; i++)
3054 freePatternSrc(HighlightDialog.patterns[i], True);
3056 /* Update the dialog */
3057 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3058 for (i=0; i<defaultPatSet->nPatterns; i++)
3059 HighlightDialog.patterns[i] =
3060 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3061 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3062 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3063 ChangeManagedListData(HighlightDialog.managedListW);
3066 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3068 int i, psn;
3070 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3071 "Are you sure you want to delete\n"
3072 "syntax highlighting patterns for\n"
3073 "language mode %s?", "Yes, Delete", "Cancel",
3074 HighlightDialog.langModeName) == 2)
3076 return;
3079 /* if a stored version of the pattern set exists, delete it from the list */
3080 for (psn=0; psn<NPatternSets; psn++)
3081 if (!strcmp(HighlightDialog.langModeName,
3082 PatternSets[psn]->languageMode))
3083 break;
3084 if (psn < NPatternSets) {
3085 freePatternSet(PatternSets[psn]);
3086 memmove(&PatternSets[psn], &PatternSets[psn+1],
3087 (NPatternSets-1 - psn) * sizeof(patternSet *));
3088 NPatternSets--;
3091 /* Free the old dialog information */
3092 for (i=0; i<HighlightDialog.nPatterns; i++)
3093 freePatternSrc(HighlightDialog.patterns[i], True);
3095 /* Clear out the dialog */
3096 HighlightDialog.nPatterns = 0;
3097 SetIntText(HighlightDialog.lineContextW, 1);
3098 SetIntText(HighlightDialog.charContextW, 0);
3099 ChangeManagedListData(HighlightDialog.managedListW);
3102 static void closeCB(Widget w, XtPointer clientData, XtPointer callData)
3104 /* pop down and destroy the dialog */
3105 CloseAllPopupsFor(HighlightDialog.shell);
3106 XtDestroyWidget(HighlightDialog.shell);
3109 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3111 Help(HELP_PATTERNS);
3114 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3116 updateLabels();
3119 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3121 updateLabels();
3124 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3125 void *cbArg)
3127 highlightPattern *pat;
3129 /* If the dialog is currently displaying the "new" entry and the
3130 fields are empty, that's just fine */
3131 if (oldItem == NULL && dialogEmpty())
3132 return NULL;
3134 /* If there are no problems reading the data, just return it */
3135 pat = readDialogFields(True);
3136 if (pat != NULL)
3137 return (void *)pat;
3139 /* If there are problems, and the user didn't ask for the fields to be
3140 read, give more warning */
3141 if (!explicitRequest)
3143 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3144 "Discard incomplete entry\nfor current pattern?", "Keep",
3145 "Discard") == 2)
3147 return oldItem == NULL
3148 ? NULL
3149 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3153 /* Do readDialogFields again without "silent" mode to display warning */
3154 pat = readDialogFields(False);
3155 *abort = True;
3156 return NULL;
3159 static void setDisplayedCB(void *item, void *cbArg)
3161 highlightPattern *pat = (highlightPattern *)item;
3162 int isSubpat, isDeferred, isColorOnly, isRange;
3164 if (item == NULL) {
3165 XmTextSetString(HighlightDialog.nameW, "");
3166 XmTextSetString(HighlightDialog.parentW, "");
3167 XmTextSetString(HighlightDialog.startW, "");
3168 XmTextSetString(HighlightDialog.endW, "");
3169 XmTextSetString(HighlightDialog.errorW, "");
3170 RadioButtonChangeState(HighlightDialog.topLevelW, True, False);
3171 RadioButtonChangeState(HighlightDialog.deferredW, False, False);
3172 RadioButtonChangeState(HighlightDialog.subPatW, False, False);
3173 RadioButtonChangeState(HighlightDialog.colorPatW, False, False);
3174 RadioButtonChangeState(HighlightDialog.simpleW, True, False);
3175 RadioButtonChangeState(HighlightDialog.rangeW, False, False);
3176 setStyleMenu("Plain");
3177 } else {
3178 isSubpat = pat->subPatternOf != NULL;
3179 isDeferred = pat->flags & DEFER_PARSING;
3180 isColorOnly = pat->flags & COLOR_ONLY;
3181 isRange = pat->endRE != NULL;
3182 XmTextSetString(HighlightDialog.nameW, pat->name);
3183 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3184 XmTextSetString(HighlightDialog.startW, pat->startRE);
3185 XmTextSetString(HighlightDialog.endW, pat->endRE);
3186 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3187 RadioButtonChangeState(HighlightDialog.topLevelW,
3188 !isSubpat && !isDeferred, False);
3189 RadioButtonChangeState(HighlightDialog.deferredW,
3190 !isSubpat && isDeferred, False);
3191 RadioButtonChangeState(HighlightDialog.subPatW,
3192 isSubpat && !isColorOnly, False);
3193 RadioButtonChangeState(HighlightDialog.colorPatW,
3194 isSubpat && isColorOnly, False);
3195 RadioButtonChangeState(HighlightDialog.simpleW, !isRange, False);
3196 RadioButtonChangeState(HighlightDialog.rangeW, isRange, False);
3197 setStyleMenu(pat->style);
3199 updateLabels();
3202 static void freeItemCB(void *item)
3204 freePatternSrc((highlightPattern *)item, True);
3208 ** Do a test compile of the patterns currently displayed in the highlight
3209 ** patterns dialog, and display warning dialogs if there are problems
3211 static int checkHighlightDialogData(void)
3213 patternSet *patSet;
3214 int result;
3216 /* Get the pattern information from the dialog */
3217 patSet = getDialogPatternSet();
3218 if (patSet == NULL)
3219 return False;
3221 /* Compile the patterns */
3222 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3223 freePatternSet(patSet);
3224 return result;
3228 ** Update the text field labels and sensitivity of various fields, based on
3229 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3230 ** patterns dialog.
3232 static void updateLabels(void)
3234 char *startLbl, *endLbl;
3235 int endSense, errSense, matchSense, parentSense;
3236 XmString s1;
3238 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3239 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3240 Regular Expression (\\1, &, etc.)";
3241 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3242 Regular Expression";
3243 endSense = True;
3244 errSense = False;
3245 matchSense = False;
3246 parentSense = True;
3247 } else {
3248 endLbl = "Ending Regular Expression";
3249 matchSense = True;
3250 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3251 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3252 startLbl = "Regular Expression to Match";
3253 endSense = False;
3254 errSense = False;
3255 } else {
3256 startLbl = "Starting Regular Expression";
3257 endSense = True;
3258 errSense = True;
3262 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3263 XtSetSensitive(HighlightDialog.parentW, parentSense);
3264 XtSetSensitive(HighlightDialog.endW, endSense);
3265 XtSetSensitive(HighlightDialog.endLbl, endSense);
3266 XtSetSensitive(HighlightDialog.errorW, errSense);
3267 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3268 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3269 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3270 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3271 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3272 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3273 s1=XmStringCreateSimple(startLbl), NULL);
3274 XmStringFree(s1);
3275 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3276 s1=XmStringCreateSimple(endLbl), NULL);
3277 XmStringFree(s1);
3281 ** Set the styles menu in the currently displayed highlight dialog to show
3282 ** a particular style
3284 static void setStyleMenu(const char *styleName)
3286 int i;
3287 Cardinal nItems;
3288 WidgetList items;
3289 Widget selectedItem;
3290 char *itemStyle;
3292 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3293 XmNnumChildren, &nItems, NULL);
3294 if (nItems == 0)
3295 return;
3296 selectedItem = items[0];
3297 for (i=0; i<(int)nItems; i++) {
3298 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3299 if (!strcmp(itemStyle, styleName)) {
3300 selectedItem = items[i];
3301 break;
3304 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3308 ** Read the pattern fields of the highlight dialog, and produce an allocated
3309 ** highlightPattern structure reflecting the contents, or pop up dialogs
3310 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3311 ** dialogs). Returns NULL on error.
3313 static highlightPattern *readDialogFields(int silent)
3315 highlightPattern *pat;
3316 char *inPtr, *outPtr, *style;
3317 Widget selectedItem;
3318 int colorOnly;
3320 /* Allocate a pattern source structure to return, zero out fields
3321 so that the whole pattern can be freed on error with freePatternSrc */
3322 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3323 pat->endRE = NULL;
3324 pat->errorRE = NULL;
3325 pat->style = NULL;
3326 pat->subPatternOf = NULL;
3328 /* read the type buttons */
3329 pat->flags = 0;
3330 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3331 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3332 pat->flags |= DEFER_PARSING;
3333 else if (colorOnly)
3334 pat->flags = COLOR_ONLY;
3336 /* read the name field */
3337 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3338 "highlight pattern name", silent);
3339 if (pat->name == NULL) {
3340 XtFree((char *)pat);
3341 return NULL;
3344 if (*pat->name == '\0')
3346 if (!silent)
3348 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3349 "Please specify a name\nfor the pattern", "OK");
3350 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3352 XtFree(pat->name);
3353 XtFree((char *)pat);
3354 return NULL;
3357 /* read the startRE field */
3358 pat->startRE = XmTextGetString(HighlightDialog.startW);
3359 if (*pat->startRE == '\0')
3361 if (!silent)
3363 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3364 "Please specify a regular\nexpression to match", "OK");
3365 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3367 freePatternSrc(pat, True);
3368 return NULL;
3371 /* Make sure coloring patterns contain only sub-expression references
3372 and put it in replacement regular-expression form */
3373 if (colorOnly)
3375 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3377 if (*inPtr!=' ' && *inPtr!='\t')
3379 *outPtr++ = *inPtr;
3383 *outPtr = '\0';
3384 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3385 || (*pat->startRE != '\\' && *pat->startRE != '&')
3386 || strstr(pat->startRE, "\\\\") != NULL)
3388 if (!silent)
3390 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3391 "The expression field in patterns which specify highlighting for\n"
3392 "a parent, must contain only sub-expression references in regular\n"
3393 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3394 "Expressions and Help -> Syntax Highlighting for more information",
3395 "OK");
3396 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3398 freePatternSrc(pat, True);
3399 return NULL;
3403 /* read the parent field */
3404 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3406 if (TextWidgetIsBlank(HighlightDialog.parentW))
3408 if (!silent)
3410 DialogF(DF_WARN, HighlightDialog.shell, 1,
3411 "Specify Parent Pattern",
3412 "Please specify a parent pattern", "OK");
3413 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3415 freePatternSrc(pat, True);
3416 return NULL;
3418 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3421 /* read the styles option menu */
3422 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3423 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3424 pat->style = XtMalloc(strlen(style) + 1);
3425 strcpy(pat->style, style);
3428 /* read the endRE field */
3429 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3431 pat->endRE = XmTextGetString(HighlightDialog.endW);
3432 if (!colorOnly && *pat->endRE == '\0')
3434 if (!silent)
3436 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3437 "Please specify an ending\nregular expression",
3438 "OK");
3439 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3441 freePatternSrc(pat, True);
3442 return NULL;
3446 /* read the errorRE field */
3447 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3448 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3449 if (*pat->errorRE == '\0') {
3450 XtFree(pat->errorRE);
3451 pat->errorRE = NULL;
3454 return pat;
3458 ** Returns true if the pattern fields of the highlight dialog are set to
3459 ** the default ("New" pattern) state.
3461 static int dialogEmpty(void)
3463 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3464 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3465 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3466 TextWidgetIsBlank(HighlightDialog.parentW) &&
3467 TextWidgetIsBlank(HighlightDialog.startW) &&
3468 TextWidgetIsBlank(HighlightDialog.endW) &&
3469 TextWidgetIsBlank(HighlightDialog.errorW);
3473 ** Update the pattern set being edited in the Syntax Highlighting dialog
3474 ** with the information that the dialog is currently displaying, and
3475 ** apply changes to any window which is currently using the patterns.
3477 static int updatePatternSet(void)
3479 patternSet *patSet;
3480 WindowInfo *window;
3481 int psn;
3483 /* Make sure the patterns are valid and compile */
3484 if (!checkHighlightDialogData())
3485 return False;
3487 /* Get the current data */
3488 patSet = getDialogPatternSet();
3489 if (patSet == NULL)
3490 return False;
3492 /* Find the pattern being modified */
3493 for (psn=0; psn<NPatternSets; psn++)
3494 if (!strcmp(HighlightDialog.langModeName,
3495 PatternSets[psn]->languageMode))
3496 break;
3498 /* If it's a new pattern, add it at the end, otherwise free the
3499 existing pattern set and replace it */
3500 if (psn == NPatternSets) {
3501 PatternSets[NPatternSets++] = patSet;
3502 } else {
3503 freePatternSet(PatternSets[psn]);
3504 PatternSets[psn] = patSet;
3507 /* Find windows that are currently using this pattern set and
3508 re-do the highlighting */
3509 for (window=WindowList; window!=NULL; window=window->next) {
3510 if (window->highlightSyntax &&
3511 window->languageMode != PLAIN_LANGUAGE_MODE) {
3512 if (!strcmp(LanguageModeName(window->languageMode),
3513 patSet->languageMode)) {
3514 StopHighlighting(window);
3515 StartHighlighting(window, True);
3520 /* Note that preferences have been changed */
3521 MarkPrefsChanged();
3523 return True;
3527 ** Get the current information that the user has entered in the syntax
3528 ** highlighting dialog. Return NULL if the data is currently invalid
3530 static patternSet *getDialogPatternSet(void)
3532 int i, lineContext, charContext;
3533 patternSet *patSet;
3535 /* Get the current contents of the "patterns" dialog fields */
3536 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3537 return NULL;
3539 /* Get the line and character context values */
3540 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3541 "context lines", True) != TEXT_READ_OK)
3542 return NULL;
3543 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3544 "context lines", True) != TEXT_READ_OK)
3545 return NULL;
3547 /* Allocate a new pattern set structure and copy the fields read from the
3548 dialog, including the modified pattern list into it */
3549 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3550 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3551 patSet->lineContext = lineContext;
3552 patSet->charContext = charContext;
3553 patSet->nPatterns = HighlightDialog.nPatterns;
3554 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3555 HighlightDialog.nPatterns);
3556 for (i=0; i<HighlightDialog.nPatterns; i++)
3557 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3558 return patSet;
3562 ** Return True if "patSet1" and "patSet2" differ
3564 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3566 int i;
3567 highlightPattern *pat1, *pat2;
3569 if (patSet1->lineContext != patSet2->lineContext)
3570 return True;
3571 if (patSet1->charContext != patSet2->charContext)
3572 return True;
3573 if (patSet1->nPatterns != patSet2->nPatterns)
3574 return True;
3575 for (i=0; i<patSet2->nPatterns; i++) {
3576 pat1 = &patSet1->patterns[i];
3577 pat2 = &patSet2->patterns[i];
3578 if (pat1->flags != pat2->flags)
3579 return True;
3580 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3581 return True;
3582 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3583 return True;
3584 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3585 return True;
3586 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3587 return True;
3588 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3589 return True;
3590 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3591 return True;
3593 return False;
3597 ** Copy a highlight pattern data structure and all of the allocated data
3598 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3599 ** otherwise allocate a new highlightPattern structure and return it as the
3600 ** function value.
3602 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3603 highlightPattern *copyTo)
3605 highlightPattern *newPat;
3607 if (copyTo == NULL)
3608 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3609 else
3610 newPat = copyTo;
3611 newPat->name = XtNewString(pat->name);
3612 newPat->startRE = XtNewString(pat->startRE);
3613 newPat->endRE = XtNewString(pat->endRE);
3614 newPat->errorRE = XtNewString(pat->errorRE);
3615 newPat->style = XtNewString(pat->style);
3616 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3617 newPat->flags = pat->flags;
3618 return newPat;
3621 static void freeNonNull(void *ptr)
3623 if (ptr != NULL)
3624 XtFree((char *)ptr);
3628 ** Free the allocated memory contained in a highlightPattern data structure
3629 ** If "freeStruct" is true, free the structure itself as well.
3631 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3633 XtFree(pat->name);
3634 freeNonNull(pat->startRE);
3635 freeNonNull(pat->endRE);
3636 freeNonNull(pat->errorRE);
3637 freeNonNull(pat->style);
3638 freeNonNull(pat->subPatternOf);
3639 if (freeStruct)
3640 XtFree((char *)pat);
3644 ** Free the allocated memory contained in a patternSet data structure
3645 ** If "freeStruct" is true, free the structure itself as well.
3647 static void freePatternSet(patternSet *p)
3649 int i;
3651 for (i=0; i<p->nPatterns; i++)
3652 freePatternSrc(&p->patterns[i], False);
3653 XtFree(p->languageMode);
3654 XtFree((char *)p->patterns);
3655 XtFree((char *)p);
3658 #if 0
3660 ** Free the allocated memory contained in a patternSet data structure
3661 ** If "freeStruct" is true, free the structure itself as well.
3663 static int lookupNamedPattern(patternSet *p, char *patternName)
3665 int i;
3667 for (i=0; i<p->nPatterns; i++)
3668 if (strcmp(p->patterns[i].name, patternName))
3669 return i;
3670 return -1;
3672 #endif
3675 ** Find the index into the HighlightStyles array corresponding to "styleName".
3676 ** If styleName is not found, return -1.
3678 static int lookupNamedStyle(const char *styleName)
3680 int i;
3682 for (i = 0; i < NHighlightStyles; i++)
3684 if (!strcmp(styleName, HighlightStyles[i]->name))
3686 return i;
3690 return -1;
3694 ** Returns a unique number of a given style name
3696 int IndexOfNamedStyle(const char *styleName)
3698 return lookupNamedStyle(styleName);
3702 ** Write the string representation of int "i" to a static area, and
3703 ** return a pointer to it.
3705 static char *intToStr(int i)
3707 static char outBuf[12];
3709 sprintf(outBuf, "%d", i);
3710 return outBuf;