From Ivan Skytte Jørgensen: remove duplicate declarations
[nedit.git] / source / highlightData.c
blob6a993125964520fa281809efa7ebc2f062d54987
1 static const char CVSID[] = "$Id: highlightData.c,v 1.78 2006/12/02 10:27:06 yooden 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 freeItemCB(void *item);
157 static void freePatternSrc(highlightPattern *pat, int freeStruct);
158 static void freePatternSet(patternSet *p);
160 /* list of available highlight styles */
161 static int NHighlightStyles = 0;
162 static highlightStyleRec *HighlightStyles[MAX_HIGHLIGHT_STYLES];
164 /* Highlight styles dialog information */
165 static struct {
166 Widget shell;
167 Widget nameW;
168 Widget colorW;
169 Widget bgColorW;
170 Widget recogW;
171 Widget plainW, boldW, italicW, boldItalicW;
172 Widget managedListW;
173 highlightStyleRec **highlightStyleList;
174 int nHighlightStyles;
175 } HSDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0};
177 /* Highlight dialog information */
178 static struct {
179 Widget shell;
180 Widget lmOptMenu;
181 Widget lmPulldown;
182 Widget styleOptMenu;
183 Widget stylePulldown;
184 Widget nameW;
185 Widget topLevelW;
186 Widget deferredW;
187 Widget subPatW;
188 Widget colorPatW;
189 Widget simpleW;
190 Widget rangeW;
191 Widget parentW;
192 Widget startW;
193 Widget endW;
194 Widget errorW;
195 Widget lineContextW;
196 Widget charContextW;
197 Widget managedListW;
198 Widget parentLbl;
199 Widget startLbl;
200 Widget endLbl;
201 Widget errorLbl;
202 Widget matchLbl;
203 char *langModeName;
204 int nPatterns;
205 highlightPattern **patterns;
206 } HighlightDialog = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
207 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
208 NULL, NULL, NULL, NULL, NULL, 0, NULL };
210 /* Pattern sources loaded from the .nedit file or set by the user */
211 static int NPatternSets = 0;
212 static patternSet *PatternSets[MAX_LANGUAGE_MODES];
214 static char *DefaultPatternSets[] = {
215 "Ada:1:0{\n\
216 Comments:\"--\":\"$\"::Comment::\n\
217 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
218 Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\
219 Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
220 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
221 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
222 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
223 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
224 Withs Use:\"(?#Make \\s work across newlines)(?n(?iwith|use)(?#Leading W/S)\\s+(?#First package name)(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]*)*)(?#Additional package names [optional])(?:\\s*,\\s*(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*))*(?#Trailing W/S)\\s*;)+\":::Preprocessor::\n\
225 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
226 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
227 Reserved Words:\"(?i(?=[a-gil-pr-uwx]))<(?iabort|abs|accept|access|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)>\":::Keyword::D\n\
228 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
229 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
230 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
231 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
232 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
233 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
234 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
235 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
236 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
237 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
238 "Awk:2:0{\n\
239 Comment:\"#\":\"$\"::Comment::\n\
240 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
241 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
242 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
243 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
244 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
245 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
246 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
247 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
248 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
249 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
250 Numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
251 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
252 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
253 newline escape:\"\\\\$\":::Preprocessor1::\n\
254 Function:\"function\":::Preprocessor1::D}",
255 "C++:1:0{\n\
256 comment:\"/\\*\":\"\\*/\"::Comment::\n\
257 cplus comment:\"//\":\"(?<!\\\\)$\"::Comment::\n\
258 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
259 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
260 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
261 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
262 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
263 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
264 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
265 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
266 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
267 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
268 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\
269 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\
270 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\
271 braces:\"[{}]\":::Keyword::D}",
272 "C:1:0 {\n\
273 comment:\"/\\*\":\"\\*/\"::Comment::\n\
274 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
275 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
276 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
277 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
278 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
279 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
280 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
281 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
282 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
283 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\
284 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\
285 keyword:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
286 braces:\"[{}]\":::Keyword::D}",
287 "CSS:1:0{\n\
288 comment:\"/\\*\":\"\\*/\"::Comment::\n\
289 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
290 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
291 import url:\"\\1\":::Subroutine1:import rule:C\n\
292 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
293 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
294 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
295 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
296 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
297 charset name:\"\\1\":::String:charset rule:C\n\
298 font-face rule:\"@font-face\":::Preprocessor::\n\
299 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
300 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
301 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
302 declaration:\"\\{\":\"\\}\"::Warning::\n\
303 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
304 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
305 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\
306 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
307 value delims:\"&\":\"&\"::Keyword:value:C\n\
308 value modifier:\"!important|inherit\":::Keyword:value:\n\
309 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
310 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\
311 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\
312 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\
313 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
314 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
315 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\
316 integer value:\"<\\d+>\":::Numeric Const:value:\n\
317 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
318 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
319 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
320 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
321 sq string value:\"'\":\"'\":\"\\n\":String:value:\n\
322 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
323 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
324 operators:\"[,/]\":::Keyword:value:\n\
325 selector id:\"#[-\\w]+>\":::Pointer::\n\
326 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
327 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
328 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
329 selector operators:\"[,>*+]\":::Keyword::\n\
330 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
331 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
332 free text:\".\":::Warning::\n\
333 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
334 "Csh:1:0{\n\
335 Comment:\"#\":\"$\"::Comment::\n\
336 Single Quote String:\"'\":\"([^\\\\]'|^')\":\"\\n\":String::\n\
337 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
338 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
339 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
340 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
341 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\
342 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\
343 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
344 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
345 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\
346 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\
347 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
348 "Fortran:2:0{\n\
349 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
350 Bang Comment:\"!\":\"$\"::Comment::\n\
351 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
352 String:\"'\":\"'\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
353 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\
354 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
355 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
356 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
357 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
358 "Java:3:0{\n\
359 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
360 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
361 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
362 comment:\"/\\*\":\"\\*/\"::Comment::\n\
363 cplus comment:\"//\":\"$\"::Comment::\n\
364 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
365 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])\":::String1:string:\n\
366 single quoted:\"'\":\"'\":\"\\n\":String::\n\
367 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])(?=')\":::String1:single quoted:\n\
368 single quoted char:\".(?=')\":::String:single quoted:\n\
369 single quoted error:\".\":::Flag:single quoted:\n\
370 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
371 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
372 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
373 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
374 classdef:\"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
375 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
376 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
377 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
378 extends comma:\",\":::Keyword:extends:\n\
379 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
380 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
381 extends error:\".\":::Flag:extends:\n\
382 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
383 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
384 impl_throw comma:\",\":::Keyword:impl_throw:\n\
385 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
386 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
387 impl_throw error:\".\":::Flag:impl_throw:\n\
388 case:\"<case>\":\":\"::Label::\n\
389 case single quoted:\"'\\\\?[^']'\":::Character Const:case:\n\
390 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
391 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
392 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
393 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
394 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
395 case error:\".\":::Flag:case:\n\
396 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
397 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
398 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
399 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
400 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
401 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
402 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
403 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
404 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
405 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
406 keyword - modifiers:\"<(?:abstract|final|native|private|protected|public|static|transient|synchronized|volatile)>\":::Keyword::\n\
407 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
408 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
409 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
410 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
411 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
412 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
413 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
414 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
415 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
416 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
417 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
418 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
419 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
420 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
421 error:\".\":::Flag::D}",
422 #ifndef VMS
423 /* The VAX C compiler cannot compile this definition */
424 "JavaScript:1:0{\n\
425 DSComment:\"//\":\"$\"::Comment::\n\
426 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
427 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\
428 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\
429 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\
430 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
431 Braces:\"[{}]\":::Keyword::\n\
432 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
433 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
434 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
435 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
436 Parentheses:\"[\\(\\)]\":::Plain::\n\
437 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\
438 SQStrings:\"'\":\"'\":\"\\n\":String::\n\
439 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
440 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
441 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\
442 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\
443 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
444 #endif /*VMS*/
445 "LaTeX:1:0{\n\
446 Comment:\"%\":\"$\"::Text Comment::\n\
447 Parameter:\"#[0-9]*\":::Text Arg::\n\
448 Special Chars:\"[{}&]\":::Keyword::\n\
449 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
450 Super Sub 1 Char:\"(?:\\^|_)(?:\\\\\\l+|#\\d|[^{\\\\])\":::Text Arg2::\n\
451 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
452 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
453 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
454 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
455 Inline Math:\"(?<!#\\d)(?:\\$|\\\\\\()\":\"\\$|\\\\\\)\":\"\\\\\\(|(?n[^\\\\]%)\":LaTeX Math::\n\
456 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
457 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
458 No Arg Command:\"\\\\(?:left|right)[\\[\\]{}()]\":::Text Key::\n\
459 Command:\"[_^]|[\\\\@](?:a'|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_='`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
460 Cmd Brace Args:\"\\{\":\"}\":\"(?<=^%)|\\\\]|\\$\\$|\\\\end\\{equation\\}\":Text Arg2:Command:\n\
461 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
462 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
463 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
464 Cmd Bracket Args:\"\\[\":\"\\]\":\"$|\\\\\\]\":Text Arg2:Command:\n\
465 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
466 Sub Cmd Bracket Args Esc:\"\\\\\\}\":::Plain:Sub Cmd Bracket Args:\n\
467 Sub Cmd Bracket Args:\"\\{\":\"\\}\":\"$|\\\\\\]\":Preprocessor1:Cmd Bracket Args:\n\
468 Sub Command:\"(?:[_^]|(?:[\\\\@](?:[A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
469 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
470 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
471 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
472 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
473 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
474 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
475 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
476 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
477 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
478 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
479 "Lex:1:0{\n\
480 comment:\"/\\*\":\"\\*/\"::Comment::\n\
481 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
482 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
483 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
484 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
485 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
486 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
487 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
488 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
489 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
490 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\
491 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\
492 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
493 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\
494 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\
495 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
496 braces:\"[{}]\":::Keyword::D\n\
497 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
498 "Makefile:8:0{\n\
499 Comment:\"#\":\"$\"::Comment::\n\
500 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
501 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
502 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
503 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
504 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\
505 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
506 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
507 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
508 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
509 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
510 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
511 Continuation:\"\\\\$\":::Keyword::\n\
512 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
513 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
514 Escaped Dollar:\"\\$\\$\":::Comment::\n\
515 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
516 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
517 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
518 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
519 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
520 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
521 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
522 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
523 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
524 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
525 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
526 "Matlab:1:0{\n\
527 Comment:\"%\":\"$\"::Comment::\n\
528 Comment in Octave:\"#\":\"$\"::Comment::\n\
529 Keyword:\"<(break|clear|else|elseif|for|function|global|if|return|then|while|end(if|for|while|function))>\":::Keyword::\n\
530 Transpose:\"[\\w.]('+)\":::Plain::\n\
531 Paren transposed:\"\\)('+)\":::Keyword::\n\
532 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
533 Parentheses:\"[\\(\\)]\":::Keyword::\n\
534 Brackets transposed:\"\\]('+)\":::Text Key1::\n\
535 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
536 Brackets:\"[\\[\\]]\":::Text Key1::\n\
537 Braces transposed:\"\\}('+)\":::Text Arg::\n\
538 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
539 Braces:\"[\\{\\}]\":::Text Arg::\n\
540 String:\"'\":\"'\"::String::\n\
541 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
542 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
543 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
544 Shell command:\"!\":\"$\"::String1::\n\
545 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
546 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
547 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
548 Logical operators:\"~|&|\\|\":::Text Arg2::}",
549 "NEdit Macro:2:0{\n\
550 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
551 Comment:\"#\":\"$\"::Comment::\n\
552 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\
553 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\
554 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\
555 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\
556 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\
557 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\
558 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
559 Braces:\"[{}\\[\\]]\":::Keyword::\n\
560 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
561 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
562 String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
563 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
564 Macro Definition:\"(?<=define)\\s+\\w+\":::Subroutine1::\n\
565 Custom Macro:\"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])\":::Subroutine1::\n\
566 Variables:\"\\w+\":::Identifier1::D}",
567 "Pascal:1:0{\n\
568 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
569 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
570 String:\"'\":\"'\":\"\\n\":String::D\n\
571 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
572 Parentheses:\"\\(|\\)\":::Keyword::D\n\
573 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
574 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
575 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
576 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
577 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
578 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
579 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
580 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
581 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
582 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
583 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
584 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
585 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
586 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
587 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
588 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
589 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
590 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
591 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\
592 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
593 Assignment:\":=\":::Plain::D\n\
594 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
595 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
596 "Perl:2:0{\n\
597 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
598 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
599 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
600 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\
601 dq here doc content:\".\":::String:dq here doc:\n\
602 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
603 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
604 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
605 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\
606 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
607 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
608 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
609 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\
610 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
611 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
612 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
613 sq here doc content:\".\":::String1:sq here doc:\n\
614 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
615 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
616 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
617 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
618 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
619 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
620 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
621 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
622 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
623 word list content:\".\":::String1:word list:\n\
624 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
625 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
626 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
627 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\
628 bq here doc content:\".\":::String1:bq here doc:\n\
629 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
630 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
631 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\
632 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
633 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
634 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\
635 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
636 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
637 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
638 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
639 comment:\"#\":\"$\"::Comment::\n\
640 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
641 label identifier:\"\\2\\5\":::Label:label:C\n\
642 label keyword:\"\\3\\6\":::Keyword:label:C\n\
643 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\
644 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
645 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
646 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
647 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
648 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
649 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
650 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
651 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
652 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
653 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
654 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
655 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
656 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
657 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\
658 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
659 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\
660 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
661 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
662 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
663 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
664 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
665 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
666 end token delim:\"&\":::Preprocessor:end token:C\n\
667 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
668 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
669 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
670 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
671 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
672 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
673 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
674 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\
675 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
676 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
677 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
678 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
679 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
680 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
681 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
682 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
683 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
684 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
685 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\
686 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
687 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
688 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
689 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
690 "PostScript:1:0{\n\
691 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
692 Comment:\"%\":\"$\"::Comment::\n\
693 string:\"\\(\":\"\\)\"::String::\n\
694 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
695 string2:\"\\(\":\"\\)\"::String:string:\n\
696 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
697 string3:\"\\(\":\"\\)\"::String:string2:\n\
698 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
699 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
700 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
701 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
702 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
703 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\
704 Array:\"[\\[\\]]\":::Storage Type::D\n\
705 Procedure:\"[{}]\":::Subroutine::D\n\
706 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\
707 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\
708 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\
709 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
710 "Python:2:0{\n\
711 Comment:\"#\":\"$\"::Comment::\n\
712 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
713 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
714 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
715 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
716 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\
717 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\
718 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\
719 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\
720 Representation:\"`\":\"`\":\"$\":String2::\n\
721 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
722 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\
723 Multiline import:\"<from>.*?\\(\":\"\\)\"::Preprocessor::\n\
724 Multiline import comment:\"#\":\"$\"::Comment:Multiline import:\n\
725 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
726 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
727 Member definition:\"<(def)\\s+(?:(__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|enter|eq|exit|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|index|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|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))(?=(?:\\s*(?:\\\\\\n\\s*)?\\(\\s*|\\s*\\(\\s*(?:\\\\?\\n\\s*)?)self>)\":::Plain::\n\
728 Member def color:\"\\1\":::Keyword:Member definition:C\n\
729 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
730 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
731 Member def error:\"\\7\":::Flag:Member definition:C\n\
732 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
733 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
734 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
735 Function definition:\"<(def)\\s+(?:(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|all|any|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|self|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
736 Function def color:\"\\1\":::Keyword:Function definition:C\n\
737 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
738 Function def error:\"\\3\":::Flag:Function definition:C\n\
739 Class definition:\"<(class)\\s+(?:(ArithmeticError|AssertionError|AttributeError|BaseException|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|FutureWarning|GeneratorExit|IOError|ImportError|ImportWarning|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|PendingDeprecationWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|all|any|apply|basestring|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|self|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
740 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
741 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
742 Class def error:\"\\3\":::Flag:Class definition:C\n\
743 Member reference:\"\\.\\s*(?:\\\\?\\n\\s*)?(?:((__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|enter|eq|exit|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|index|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|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
744 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
745 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
746 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
747 Member ref error:\"\\8\":::Flag:Member reference:C\n\
748 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
749 Keyword:\"<(?:and|as|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|with|yield)>\":::Keyword::\n\
750 Built-in function:\"<(?:__import__|abs|all|any|basestring|bool|callable|chr|classmethod|cmp|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|exit|file|filter|float|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|quit|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
751 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
752 Built-in exceptions:\"<(?:ArithmeticError|AssertionError|AttributeError|BaseException|EOFError|EnvironmentError|Exception|FloatingPointError|GeneratorExit|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StandardError|StopIteration|SyntaxError|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError|UnicodeTranslateError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
753 Built-in warnings:\"<(?:DeprecationWarning|FutureWarning|ImportWarning|PendingDeprecationWarning|RuntimeWarning|SyntaxWarning|UnicodeWarning|UserWarning|Warning)>\":::Identifier1::\n\
754 Deprecated function:\"<(?:apply|buffer|coerce|intern)>\":::Warning::\n\
755 Braces and parens:\"[[{()}\\]]\":::Keyword::D\n\
756 Decorator:\"(@)\":\"$\":\"#\":Preprocessor1::\n\
757 Decorator continuation:\"\\\\\\n\":::Preprocessor1:Decorator:\n\
758 Decorator marker:\"\\1\":::Storage Type:Decorator:C}",
759 "Regex:1:0{\n\
760 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
761 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
762 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
763 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
764 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
765 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\
766 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
767 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\
768 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
769 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
770 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
771 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
772 "SGML HTML:6:0{\n\
773 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
774 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
775 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
776 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
777 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\
778 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
779 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
780 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
781 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
782 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
783 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
784 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
785 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
786 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
787 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
788 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
789 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
790 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
791 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
792 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
793 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
794 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
795 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
796 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
797 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
798 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
799 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
800 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
801 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
802 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
803 "SQL:1:0{\n\
804 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
805 comment:\"--\":\"$\"::Comment::\n\
806 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
807 string:\"'\":\"'\"::String::\n\
808 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\
809 comment2:\"/\\*\":\"\\*/\"::Comment::}",
810 "Sh Ksh Bash:1:0{\n\
811 README:\"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
812 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
813 single quoted string:\"'\":\"'\"::String1::\n\
814 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
815 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
816 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
817 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
818 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
819 dqncs single quoted string:\"'\":\"'\"::String1:dq new command sub:\n\
820 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
821 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
822 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
823 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
824 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
825 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
826 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
827 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
828 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
829 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
830 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
831 command substitution:\"`\":\"`\"::Subroutine::\n\
832 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
833 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
834 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
835 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
836 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
837 ncs new command substitution:\"\\$\\(\":\"\\)\"::Subroutine:new command substitution:\n\
838 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
839 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
840 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
841 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
842 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
843 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
844 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
845 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
846 comments in line:\"#\":\"$\"::Comment::\n\
847 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
848 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
849 command options:\"(?<=\\s)-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
850 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
851 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}",
852 "Tcl:1:0{\n\
853 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
854 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
855 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
856 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
857 Comment:\"#\":\"$\"::Comment::\n\
858 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\
859 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\
860 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
861 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
862 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
863 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
864 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
865 Namespace:\"\\w+::\":::Keyword::}",
866 "VHDL:1:0{\n\
867 Comments:\"--\":\"$\"::Comment::\n\
868 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
869 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
870 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
871 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
872 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
873 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
874 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\
875 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
876 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
877 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
878 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
879 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
880 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
881 "Verilog:1:0{\n\
882 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
883 cplus comment:\"//\":\"$\"::Comment::\n\
884 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
885 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
886 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\
887 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\
888 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
889 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\
890 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
891 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
892 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
893 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
894 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
895 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
896 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
897 "XML:1:0{\n\
898 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
899 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
900 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
901 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
902 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
903 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
904 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
905 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
906 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
907 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
908 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
909 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
910 doctype root element:\"\\2\":::Identifier:doctype:C\n\
911 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
912 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
913 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
914 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
915 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
916 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
917 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
918 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
919 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
920 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
921 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
922 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
923 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
924 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
925 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
926 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
927 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
928 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
929 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
930 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
931 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
932 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
933 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
934 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
935 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
936 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
937 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
938 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
939 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
940 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
941 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
942 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
943 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
944 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
945 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
946 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
947 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
948 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
949 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
950 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
951 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
952 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
953 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
954 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
955 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
956 element name:\"\\2\":::Identifier:element:C\n\
957 element assign:\"=\":::Keyword:element:\n\
958 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
959 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
960 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
961 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
962 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
963 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
964 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
965 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
966 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
967 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
968 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
969 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
970 "X Resources:2:0{\n\
971 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
972 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
973 Comment:\"^\\s*!\":\"$\"::Comment::\n\
974 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
975 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
976 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
977 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
978 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
979 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
980 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
981 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
982 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
983 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
984 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
985 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
986 Free Text:\"^.*$\":::Flag::}",
987 "Yacc:1:0{\n\
988 comment:\"/\\*\":\"\\*/\"::Comment::\n\
989 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
990 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
991 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
992 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
993 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
994 preprocessor string:\"L?\"\"\":\"\"\"\":\"\\n\":Preprocessor1:preprocessor line:\n\
995 prepr string esc chars:\"\\\\(?:.|\\n)\":::String1:preprocessor string:\n\
996 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
997 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\
998 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\
999 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
1000 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
1001 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\
1002 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
1003 braces:\"[{}]\":::Keyword::D\n\
1004 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
1005 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
1010 ** Read a string (from the value of the styles resource) containing highlight
1011 ** styles information, parse it, and load it into the stored highlight style
1012 ** list (HighlightStyles) for this NEdit session.
1014 int LoadStylesString(char *inString)
1016 char *errMsg, *fontStr;
1017 char *inPtr = inString;
1018 highlightStyleRec *hs;
1019 int i;
1021 for (;;) {
1023 /* skip over blank space */
1024 inPtr += strspn(inPtr, " \t");
1026 /* Allocate a language mode structure in which to store the info. */
1027 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1029 /* read style name */
1030 hs->name = ReadSymbolicField(&inPtr);
1031 if (hs->name == NULL)
1032 return styleError(inString,inPtr, "style name required");
1033 if (!SkipDelimiter(&inPtr, &errMsg)) {
1034 XtFree(hs->name);
1035 XtFree((char *)hs);
1036 return styleError(inString,inPtr, errMsg);
1039 /* read color */
1040 hs->color = ReadSymbolicField(&inPtr);
1041 if (hs->color == NULL) {
1042 XtFree(hs->name);
1043 XtFree((char *)hs);
1044 return styleError(inString,inPtr, "color name required");
1046 hs->bgColor = NULL;
1047 if (SkipOptSeparator('/', &inPtr)) {
1048 /* read bgColor */
1049 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1051 if (!SkipDelimiter(&inPtr, &errMsg)) {
1052 freeHighlightStyleRec(hs);
1053 return styleError(inString,inPtr, errMsg);
1056 /* read the font type */
1057 fontStr = ReadSymbolicField(&inPtr);
1058 for (i=0; i<N_FONT_TYPES; i++) {
1059 if (!strcmp(FontTypeNames[i], fontStr)) {
1060 hs->font = i;
1061 break;
1064 if (i == N_FONT_TYPES) {
1065 XtFree(fontStr);
1066 freeHighlightStyleRec(hs);
1067 return styleError(inString, inPtr, "unrecognized font type");
1069 XtFree(fontStr);
1071 /* pattern set was read correctly, add/change it in the list */
1072 for (i=0; i<NHighlightStyles; i++) {
1073 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1074 freeHighlightStyleRec(HighlightStyles[i]);
1075 HighlightStyles[i] = hs;
1076 break;
1079 if (i == NHighlightStyles) {
1080 HighlightStyles[NHighlightStyles++] = hs;
1081 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1082 return styleError(inString, inPtr,
1083 "maximum allowable number of styles exceeded");
1086 /* if the string ends here, we're done */
1087 inPtr += strspn(inPtr, " \t\n");
1088 if (*inPtr == '\0')
1089 return True;
1094 ** Create a string in the correct format for the styles resource, containing
1095 ** all of the highlight styles information from the stored highlight style
1096 ** list (HighlightStyles) for this NEdit session.
1098 char *WriteStylesString(void)
1100 int i;
1101 char *outStr;
1102 textBuffer *outBuf;
1103 highlightStyleRec *style;
1105 outBuf = BufCreate();
1106 for (i=0; i<NHighlightStyles; i++) {
1107 style = HighlightStyles[i];
1108 BufInsert(outBuf, outBuf->length, "\t");
1109 BufInsert(outBuf, outBuf->length, style->name);
1110 BufInsert(outBuf, outBuf->length, ":");
1111 BufInsert(outBuf, outBuf->length, style->color);
1112 if (style->bgColor) {
1113 BufInsert(outBuf, outBuf->length, "/");
1114 BufInsert(outBuf, outBuf->length, style->bgColor);
1116 BufInsert(outBuf, outBuf->length, ":");
1117 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1118 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1121 /* Get the output, and lop off the trailing newlines */
1122 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1123 BufFree(outBuf);
1124 return outStr;
1128 ** Read a string representing highlight pattern sets and add them
1129 ** to the PatternSets list of loaded highlight patterns. Note that the
1130 ** patterns themselves are not parsed until they are actually used.
1132 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1133 ** that they may contain regular expressions are of the older syntax where
1134 ** braces were not quoted, and \0 was a legal substitution character).
1136 int LoadHighlightString(char *inString, int convertOld)
1138 char *inPtr = inString;
1139 patternSet *patSet;
1140 int i;
1142 for (;;) {
1144 /* Read each pattern set, abort on error */
1145 patSet = readPatternSet(&inPtr, convertOld);
1146 if (patSet == NULL)
1147 return False;
1149 /* Add/change the pattern set in the list */
1150 for (i=0; i<NPatternSets; i++) {
1151 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1152 freePatternSet(PatternSets[i]);
1153 PatternSets[i] = patSet;
1154 break;
1157 if (i == NPatternSets) {
1158 PatternSets[NPatternSets++] = patSet;
1159 if (NPatternSets > MAX_LANGUAGE_MODES)
1160 return False;
1163 /* if the string ends here, we're done */
1164 inPtr += strspn(inPtr, " \t\n");
1165 if (*inPtr == '\0')
1166 return True;
1171 ** Create a string in the correct format for the highlightPatterns resource,
1172 ** containing all of the highlight pattern information from the stored
1173 ** highlight pattern list (PatternSets) for this NEdit session.
1175 char *WriteHighlightString(void)
1177 char *outStr, *str, *escapedStr;
1178 textBuffer *outBuf;
1179 int psn, written = False;
1180 patternSet *patSet;
1182 outBuf = BufCreate();
1183 for (psn=0; psn<NPatternSets; psn++) {
1184 patSet = PatternSets[psn];
1185 if (patSet->nPatterns == 0)
1186 continue;
1187 written = True;
1188 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1189 BufInsert(outBuf, outBuf->length, ":");
1190 if (isDefaultPatternSet(patSet))
1191 BufInsert(outBuf, outBuf->length, "Default\n\t");
1192 else {
1193 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1194 BufInsert(outBuf, outBuf->length, ":");
1195 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1196 BufInsert(outBuf, outBuf->length, "{\n");
1197 BufInsert(outBuf, outBuf->length,
1198 str = createPatternsString(patSet, "\t\t"));
1199 XtFree(str);
1200 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1204 /* Get the output string, and lop off the trailing newline and tab */
1205 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1206 BufFree(outBuf);
1208 /* Protect newlines and backslashes from translation by the resource
1209 reader */
1210 escapedStr = EscapeSensitiveChars(outStr);
1211 XtFree(outStr);
1212 return escapedStr;
1216 ** Update regular expressions in stored pattern sets to version 5.1 regular
1217 ** expression syntax, in which braces and \0 have different meanings
1219 static void convertOldPatternSet(patternSet *patSet)
1221 int p;
1222 highlightPattern *pattern;
1224 for (p=0; p<patSet->nPatterns; p++) {
1225 pattern = &patSet->patterns[p];
1226 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1227 pattern->name, pattern->flags & COLOR_ONLY);
1228 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1229 pattern->name, pattern->flags & COLOR_ONLY);
1230 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1231 pattern->name, pattern->flags & COLOR_ONLY);
1236 ** Convert a single regular expression, patternRE, to version 5.1 regular
1237 ** expression syntax. It will convert either a match expression or a
1238 ** substitution expression, which must be specified by the setting of
1239 ** isSubsExpr. Error messages are directed to stderr, and include the
1240 ** pattern set name and pattern name as passed in patSetName and patName.
1242 static void convertPatternExpr(char **patternRE, char *patSetName,
1243 char *patName, int isSubsExpr)
1245 char *newRE, *errorText;
1247 if (*patternRE == NULL)
1248 return;
1249 if (isSubsExpr) {
1250 newRE = XtMalloc(strlen(*patternRE) + 5000);
1251 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1252 XtFree(*patternRE);
1253 *patternRE = XtNewString(newRE);
1254 XtFree(newRE);
1255 } else{
1256 newRE = ConvertRE(*patternRE, &errorText);
1257 if (newRE == NULL) {
1258 fprintf(stderr, "NEdit error converting old format regular "
1259 "expression in pattern set %s, pattern %s: %s\n",
1260 patSetName, patName, errorText);
1262 XtFree(*patternRE);
1263 *patternRE = newRE;
1268 ** Find the font (font struct) associated with a named style.
1269 ** This routine must only be called with a valid styleName (call
1270 ** NamedStyleExists to find out whether styleName is valid).
1272 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1274 int styleNo=lookupNamedStyle(styleName),fontNum;
1275 XFontStruct *font;
1277 if (styleNo<0)
1278 return GetDefaultFontStruct(window->fontList);
1279 fontNum = HighlightStyles[styleNo]->font;
1280 if (fontNum == BOLD_FONT)
1281 font = window->boldFontStruct;
1282 else if (fontNum == ITALIC_FONT)
1283 font = window->italicFontStruct;
1284 else if (fontNum == BOLD_ITALIC_FONT)
1285 font = window->boldItalicFontStruct;
1286 else /* fontNum == PLAIN_FONT */
1287 font = GetDefaultFontStruct(window->fontList);
1289 /* If font isn't loaded, silently substitute primary font */
1290 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1293 int FontOfNamedStyleIsBold(char *styleName)
1295 int styleNo=lookupNamedStyle(styleName),fontNum;
1297 if (styleNo<0)
1298 return 0;
1299 fontNum = HighlightStyles[styleNo]->font;
1300 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1303 int FontOfNamedStyleIsItalic(char *styleName)
1305 int styleNo=lookupNamedStyle(styleName),fontNum;
1307 if (styleNo<0)
1308 return 0;
1309 fontNum = HighlightStyles[styleNo]->font;
1310 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1314 ** Find the color associated with a named style. This routine must only be
1315 ** called with a valid styleName (call NamedStyleExists to find out whether
1316 ** styleName is valid).
1318 char *ColorOfNamedStyle(const char *styleName)
1320 int styleNo=lookupNamedStyle(styleName);
1322 if (styleNo<0)
1323 return "black";
1324 return HighlightStyles[styleNo]->color;
1328 ** Find the background color associated with a named style.
1330 char *BgColorOfNamedStyle(const char *styleName)
1332 int styleNo=lookupNamedStyle(styleName);
1334 if (styleNo<0)
1335 return "";
1336 return HighlightStyles[styleNo]->bgColor;
1340 ** Determine whether a named style exists
1342 int NamedStyleExists(const char *styleName)
1344 return lookupNamedStyle(styleName) != -1;
1348 ** Look through the list of pattern sets, and find the one for a particular
1349 ** language. Returns NULL if not found.
1351 patternSet *FindPatternSet(const char *langModeName)
1353 int i;
1355 if (langModeName == NULL)
1356 return NULL;
1358 for (i=0; i<NPatternSets; i++)
1359 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1360 return PatternSets[i];
1361 return NULL;
1366 ** Returns True if there are highlight patterns, or potential patterns
1367 ** not yet committed in the syntax highlighting dialog for a language mode,
1369 int LMHasHighlightPatterns(const char *languageMode)
1371 if (FindPatternSet(languageMode) != NULL)
1372 return True;
1373 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1374 languageMode) && HighlightDialog.nPatterns != 0;
1378 ** Change the language mode name of pattern sets for language "oldName" to
1379 ** "newName" in both the stored patterns, and the pattern set currently being
1380 ** edited in the dialog.
1382 void RenameHighlightPattern(const char *oldName, const char *newName)
1384 int i;
1386 for (i=0; i<NPatternSets; i++) {
1387 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1388 XtFree(PatternSets[i]->languageMode);
1389 PatternSets[i]->languageMode = XtNewString(newName);
1392 if (HighlightDialog.shell != NULL) {
1393 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1394 XtFree(HighlightDialog.langModeName);
1395 HighlightDialog.langModeName = XtNewString(newName);
1401 ** Create a pulldown menu pane with the names of the current highlight styles.
1402 ** XmNuserData for each item contains a pointer to the name.
1404 static Widget createHighlightStylesMenu(Widget parent)
1406 Widget menu;
1407 int i;
1408 XmString s1;
1410 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1411 for (i=0; i<NHighlightStyles; i++) {
1412 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1413 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1414 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1415 XmStringFree(s1);
1417 return menu;
1420 static char *createPatternsString(patternSet *patSet, char *indentStr)
1422 char *outStr, *str;
1423 textBuffer *outBuf;
1424 int pn;
1425 highlightPattern *pat;
1427 outBuf = BufCreate();
1428 for (pn=0; pn<patSet->nPatterns; pn++) {
1429 pat = &patSet->patterns[pn];
1430 BufInsert(outBuf, outBuf->length, indentStr);
1431 BufInsert(outBuf, outBuf->length, pat->name);
1432 BufInsert(outBuf, outBuf->length, ":");
1433 if (pat->startRE != NULL) {
1434 BufInsert(outBuf, outBuf->length,
1435 str=MakeQuotedString(pat->startRE));
1436 XtFree(str);
1438 BufInsert(outBuf, outBuf->length, ":");
1439 if (pat->endRE != NULL) {
1440 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1441 XtFree(str);
1443 BufInsert(outBuf, outBuf->length, ":");
1444 if (pat->errorRE != NULL) {
1445 BufInsert(outBuf, outBuf->length,
1446 str=MakeQuotedString(pat->errorRE));
1447 XtFree(str);
1449 BufInsert(outBuf, outBuf->length, ":");
1450 BufInsert(outBuf, outBuf->length, pat->style);
1451 BufInsert(outBuf, outBuf->length, ":");
1452 if (pat->subPatternOf != NULL)
1453 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1454 BufInsert(outBuf, outBuf->length, ":");
1455 if (pat->flags & DEFER_PARSING)
1456 BufInsert(outBuf, outBuf->length, "D");
1457 if (pat->flags & PARSE_SUBPATS_FROM_START)
1458 BufInsert(outBuf, outBuf->length, "R");
1459 if (pat->flags & COLOR_ONLY)
1460 BufInsert(outBuf, outBuf->length, "C");
1461 BufInsert(outBuf, outBuf->length, "\n");
1463 outStr = BufGetAll(outBuf);
1464 BufFree(outBuf);
1465 return outStr;
1469 ** Read in a pattern set character string, and advance *inPtr beyond it.
1470 ** Returns NULL and outputs an error to stderr on failure.
1472 static patternSet *readPatternSet(char **inPtr, int convertOld)
1474 char *errMsg, *stringStart = *inPtr;
1475 patternSet patSet, *retPatSet;
1477 /* remove leading whitespace */
1478 *inPtr += strspn(*inPtr, " \t\n");
1480 /* read language mode field */
1481 patSet.languageMode = ReadSymbolicField(inPtr);
1482 if (patSet.languageMode == NULL)
1483 return highlightError(stringStart, *inPtr,
1484 "language mode must be specified");
1485 if (!SkipDelimiter(inPtr, &errMsg))
1486 return highlightError(stringStart, *inPtr, errMsg);
1488 /* look for "Default" keyword, and if it's there, return the default
1489 pattern set */
1490 if (!strncmp(*inPtr, "Default", 7)) {
1491 *inPtr += 7;
1492 retPatSet = readDefaultPatternSet(patSet.languageMode);
1493 XtFree(patSet.languageMode);
1494 if (retPatSet == NULL)
1495 return highlightError(stringStart, *inPtr,
1496 "No default pattern set");
1497 return retPatSet;
1500 /* read line context field */
1501 if (!ReadNumericField(inPtr, &patSet.lineContext))
1502 return highlightError(stringStart, *inPtr,
1503 "unreadable line context field");
1504 if (!SkipDelimiter(inPtr, &errMsg))
1505 return highlightError(stringStart, *inPtr, errMsg);
1507 /* read character context field */
1508 if (!ReadNumericField(inPtr, &patSet.charContext))
1509 return highlightError(stringStart, *inPtr,
1510 "unreadable character context field");
1512 /* read pattern list */
1513 patSet.patterns = readHighlightPatterns(inPtr,
1514 True, &errMsg, &patSet.nPatterns);
1515 if (patSet.patterns == NULL)
1516 return highlightError(stringStart, *inPtr, errMsg);
1518 /* pattern set was read correctly, make an allocated copy to return */
1519 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1520 memcpy(retPatSet, &patSet, sizeof(patternSet));
1522 /* Convert pre-5.1 pattern sets which use old regular expression
1523 syntax to quote braces and use & rather than \0 */
1524 if (convertOld)
1525 convertOldPatternSet(retPatSet);
1527 return retPatSet;
1531 ** Parse a set of highlight patterns into an array of highlightPattern
1532 ** structures, and a language mode name. If unsuccessful, returns NULL with
1533 ** (statically allocated) message in "errMsg".
1535 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1536 char **errMsg, int *nPatterns)
1538 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1540 /* skip over blank space */
1541 *inPtr += strspn(*inPtr, " \t\n");
1543 /* look for initial brace */
1544 if (withBraces) {
1545 if (**inPtr != '{') {
1546 *errMsg = "pattern list must begin with \"{\"";
1547 return False;
1549 (*inPtr)++;
1553 ** parse each pattern in the list
1555 pat = patternList;
1556 while (True) {
1557 *inPtr += strspn(*inPtr, " \t\n");
1558 if (**inPtr == '\0') {
1559 if (withBraces) {
1560 *errMsg = "end of pattern list not found";
1561 return NULL;
1562 } else
1563 break;
1564 } else if (**inPtr == '}') {
1565 (*inPtr)++;
1566 break;
1568 if (pat - patternList >= MAX_PATTERNS) {
1569 *errMsg = "max number of patterns exceeded\n";
1570 return NULL;
1572 if (!readHighlightPattern(inPtr, errMsg, pat++))
1573 return NULL;
1576 /* allocate a more appropriately sized list to return patterns */
1577 *nPatterns = pat - patternList;
1578 returnedList = (highlightPattern *)XtMalloc(
1579 sizeof(highlightPattern) * *nPatterns);
1580 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1581 return returnedList;
1584 static int readHighlightPattern(char **inPtr, char **errMsg,
1585 highlightPattern *pattern)
1587 /* read the name field */
1588 pattern->name = ReadSymbolicField(inPtr);
1589 if (pattern->name == NULL) {
1590 *errMsg = "pattern name is required";
1591 return False;
1593 if (!SkipDelimiter(inPtr, errMsg))
1594 return False;
1596 /* read the start pattern */
1597 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1598 return False;
1599 if (!SkipDelimiter(inPtr, errMsg))
1600 return False;
1602 /* read the end pattern */
1603 if (**inPtr == ':')
1604 pattern->endRE = NULL;
1605 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1606 return False;
1607 if (!SkipDelimiter(inPtr, errMsg))
1608 return False;
1610 /* read the error pattern */
1611 if (**inPtr == ':')
1612 pattern->errorRE = NULL;
1613 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1614 return False;
1615 if (!SkipDelimiter(inPtr, errMsg))
1616 return False;
1618 /* read the style field */
1619 pattern->style = ReadSymbolicField(inPtr);
1620 if (pattern->style == NULL) {
1621 *errMsg = "style field required in pattern";
1622 return False;
1624 if (!SkipDelimiter(inPtr, errMsg))
1625 return False;
1627 /* read the sub-pattern-of field */
1628 pattern->subPatternOf = ReadSymbolicField(inPtr);
1629 if (!SkipDelimiter(inPtr, errMsg))
1630 return False;
1632 /* read flags field */
1633 pattern->flags = 0;
1634 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1635 if (**inPtr == 'D')
1636 pattern->flags |= DEFER_PARSING;
1637 else if (**inPtr == 'R')
1638 pattern->flags |= PARSE_SUBPATS_FROM_START;
1639 else if (**inPtr == 'C')
1640 pattern->flags |= COLOR_ONLY;
1641 else if (**inPtr != ' ' && **inPtr != '\t') {
1642 *errMsg = "unreadable flag field";
1643 return False;
1646 return True;
1650 ** Given a language mode name, determine if there is a default (built-in)
1651 ** pattern set available for that language mode, and if so, read it and
1652 ** return a new allocated copy of it. The returned pattern set should be
1653 ** freed by the caller with freePatternSet()
1655 static patternSet *readDefaultPatternSet(const char *langModeName)
1657 int i, modeNameLen;
1658 char *strPtr;
1660 modeNameLen = strlen(langModeName);
1661 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1662 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1663 DefaultPatternSets[i][modeNameLen] == ':') {
1664 strPtr = DefaultPatternSets[i];
1665 return readPatternSet(&strPtr, False);
1668 return NULL;
1672 ** Return True if patSet exactly matches one of the default pattern sets
1674 static int isDefaultPatternSet(patternSet *patSet)
1676 patternSet *defaultPatSet;
1677 int retVal;
1679 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1680 if (defaultPatSet == NULL)
1681 return False;
1682 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1683 freePatternSet(defaultPatSet);
1684 return retVal;
1688 ** Short-hand functions for formating and outputing errors for
1690 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1691 const char *message)
1693 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1694 return NULL;
1698 static int styleError(const char *stringStart, const char *stoppedAt,
1699 const char *message)
1701 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1702 return False;
1706 ** Present a dialog for editing highlight style information
1708 void EditHighlightStyles(const char *initialStyle)
1710 #define HS_LIST_RIGHT 60
1711 #define HS_LEFT_MARGIN_POS 1
1712 #define HS_RIGHT_MARGIN_POS 99
1713 #define HS_H_MARGIN 10
1714 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1715 Widget fontBox, sep1, okBtn, applyBtn, closeBtn;
1716 XmString s1;
1717 int i, ac;
1718 Arg args[20];
1720 /* if the dialog is already displayed, just pop it to the top and return */
1721 if (HSDialog.shell != NULL) {
1722 if (initialStyle != NULL)
1723 setStyleByName(initialStyle);
1724 RaiseDialogWindow(HSDialog.shell);
1725 return;
1728 /* Copy the list of highlight style information to one that the user
1729 can freely edit (via the dialog and managed-list code) */
1730 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1731 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1732 for (i=0; i<NHighlightStyles; i++)
1733 HSDialog.highlightStyleList[i] =
1734 copyHighlightStyleRec(HighlightStyles[i]);
1735 HSDialog.nHighlightStyles = NHighlightStyles;
1737 /* Create a form widget in an application shell */
1738 ac = 0;
1739 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1740 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1741 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1742 HSDialog.shell = CreateWidget(TheAppShell, "textStyles",
1743 topLevelShellWidgetClass, args, ac);
1744 AddSmallIcon(HSDialog.shell);
1745 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1746 HSDialog.shell, XmNautoUnmanage, False,
1747 XmNresizePolicy, XmRESIZE_NONE, NULL);
1748 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1749 AddMotifCloseCallback(HSDialog.shell, hsCloseCB, NULL);
1751 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1752 XmNlabelString, s1=MKSTRING(
1753 "To modify the properties of an existing highlight style, select the name\n\
1754 from the list on the left. Select \"New\" to add a new style to the list."),
1755 XmNmnemonic, 'N',
1756 XmNtopAttachment, XmATTACH_POSITION,
1757 XmNtopPosition, 2,
1758 XmNleftAttachment, XmATTACH_POSITION,
1759 XmNleftPosition, HS_LEFT_MARGIN_POS,
1760 XmNrightAttachment, XmATTACH_POSITION,
1761 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1762 XmStringFree(s1);
1764 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1765 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1766 XmNmnemonic, 'm',
1767 XmNalignment, XmALIGNMENT_BEGINNING,
1768 XmNleftAttachment, XmATTACH_POSITION,
1769 XmNleftPosition, HS_LIST_RIGHT,
1770 XmNtopAttachment, XmATTACH_WIDGET,
1771 XmNtopOffset, HS_H_MARGIN,
1772 XmNtopWidget, topLbl, NULL);
1773 XmStringFree(s1);
1775 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1776 XmNleftAttachment, XmATTACH_POSITION,
1777 XmNleftPosition, HS_LIST_RIGHT,
1778 XmNtopAttachment, XmATTACH_WIDGET,
1779 XmNtopWidget, nameLbl,
1780 XmNrightAttachment, XmATTACH_POSITION,
1781 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1782 RemapDeleteKey(HSDialog.nameW);
1783 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1785 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1786 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1787 XmNmnemonic, 'C',
1788 XmNalignment, XmALIGNMENT_BEGINNING,
1789 XmNleftAttachment, XmATTACH_POSITION,
1790 XmNleftPosition, HS_LIST_RIGHT,
1791 XmNtopAttachment, XmATTACH_WIDGET,
1792 XmNtopOffset, HS_H_MARGIN,
1793 XmNtopWidget, HSDialog.nameW, NULL);
1794 XmStringFree(s1);
1796 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1797 XmNleftAttachment, XmATTACH_POSITION,
1798 XmNleftPosition, HS_LIST_RIGHT,
1799 XmNtopAttachment, XmATTACH_WIDGET,
1800 XmNtopWidget, colorLbl,
1801 XmNrightAttachment, XmATTACH_POSITION,
1802 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1803 RemapDeleteKey(HSDialog.colorW);
1804 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1806 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1807 XmNlabelString,
1808 s1=XmStringCreateSimple("Background Color (optional)"),
1809 XmNmnemonic, 'g',
1810 XmNalignment, XmALIGNMENT_BEGINNING,
1811 XmNleftAttachment, XmATTACH_POSITION,
1812 XmNleftPosition, HS_LIST_RIGHT,
1813 XmNtopAttachment, XmATTACH_WIDGET,
1814 XmNtopOffset, HS_H_MARGIN,
1815 XmNtopWidget, HSDialog.colorW, NULL);
1816 XmStringFree(s1);
1818 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1819 xmTextWidgetClass, form,
1820 XmNleftAttachment, XmATTACH_POSITION,
1821 XmNleftPosition, HS_LIST_RIGHT,
1822 XmNtopAttachment, XmATTACH_WIDGET,
1823 XmNtopWidget, bgColorLbl,
1824 XmNrightAttachment, XmATTACH_POSITION,
1825 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1826 RemapDeleteKey(HSDialog.bgColorW);
1827 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1829 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1830 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1831 XmNalignment, XmALIGNMENT_BEGINNING,
1832 XmNleftAttachment, XmATTACH_POSITION,
1833 XmNleftPosition, HS_LIST_RIGHT,
1834 XmNtopAttachment, XmATTACH_WIDGET,
1835 XmNtopOffset, HS_H_MARGIN,
1836 XmNtopWidget, HSDialog.bgColorW, NULL);
1837 XmStringFree(s1);
1839 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1840 XmNpacking, XmPACK_COLUMN,
1841 XmNnumColumns, 2,
1842 XmNradioBehavior, True,
1843 XmNleftAttachment, XmATTACH_POSITION,
1844 XmNleftPosition, HS_LIST_RIGHT,
1845 XmNtopAttachment, XmATTACH_WIDGET,
1846 XmNtopWidget, fontLbl, NULL);
1847 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1848 xmToggleButtonWidgetClass, fontBox,
1849 XmNset, True,
1850 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1851 XmNmnemonic, 'P', NULL);
1852 XmStringFree(s1);
1853 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1854 xmToggleButtonWidgetClass, fontBox,
1855 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1856 XmNmnemonic, 'B', NULL);
1857 XmStringFree(s1);
1858 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1859 xmToggleButtonWidgetClass, fontBox,
1860 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1861 XmNmnemonic, 'I', NULL);
1862 XmStringFree(s1);
1863 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1864 xmToggleButtonWidgetClass, fontBox,
1865 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1866 XmNmnemonic, 'o', NULL);
1867 XmStringFree(s1);
1869 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1870 XmNlabelString, s1=XmStringCreateSimple("OK"),
1871 XmNmarginWidth, BUTTON_WIDTH_MARGIN,
1872 XmNleftAttachment, XmATTACH_POSITION,
1873 XmNleftPosition, 10,
1874 XmNrightAttachment, XmATTACH_POSITION,
1875 XmNrightPosition, 30,
1876 XmNbottomAttachment, XmATTACH_POSITION,
1877 XmNbottomPosition, 99, NULL);
1878 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1879 XmStringFree(s1);
1881 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1882 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1883 XmNmnemonic, 'A',
1884 XmNleftAttachment, XmATTACH_POSITION,
1885 XmNleftPosition, 40,
1886 XmNrightAttachment, XmATTACH_POSITION,
1887 XmNrightPosition, 60,
1888 XmNbottomAttachment, XmATTACH_POSITION,
1889 XmNbottomPosition, 99, NULL);
1890 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1891 XmStringFree(s1);
1893 closeBtn = XtVaCreateManagedWidget("close",
1894 xmPushButtonWidgetClass, form,
1895 XmNlabelString, s1=XmStringCreateSimple("Close"),
1896 XmNleftAttachment, XmATTACH_POSITION,
1897 XmNleftPosition, 70,
1898 XmNrightAttachment, XmATTACH_POSITION,
1899 XmNrightPosition, 90,
1900 XmNbottomAttachment, XmATTACH_POSITION,
1901 XmNbottomPosition, 99,
1902 NULL);
1903 XtAddCallback(closeBtn, XmNactivateCallback, hsCloseCB, NULL);
1904 XmStringFree(s1);
1906 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1907 XmNleftAttachment, XmATTACH_FORM,
1908 XmNtopAttachment, XmATTACH_WIDGET,
1909 XmNtopWidget, fontBox,
1910 XmNtopOffset, HS_H_MARGIN,
1911 XmNrightAttachment, XmATTACH_FORM,
1912 XmNbottomAttachment, XmATTACH_WIDGET,
1913 XmNbottomWidget, closeBtn, 0,
1914 XmNbottomOffset, HS_H_MARGIN, NULL);
1916 ac = 0;
1917 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1918 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1919 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1920 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1921 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1922 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1923 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1924 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1925 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1926 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1927 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1928 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1929 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1930 form, hsFreeItemCB);
1931 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1933 /* Set initial default button */
1934 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1935 XtVaSetValues(form, XmNcancelButton, closeBtn, NULL);
1937 /* If there's a suggestion for an initial selection, make it */
1938 if (initialStyle != NULL)
1939 setStyleByName(initialStyle);
1941 /* Handle mnemonic selection of buttons and focus to dialog */
1942 AddDialogMnemonicHandler(form, FALSE);
1944 /* Realize all of the widgets in the new dialog */
1945 RealizeWithoutForcingPosition(HSDialog.shell);
1948 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1950 int i;
1952 for (i=0; i<HSDialog.nHighlightStyles; i++)
1953 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1954 XtFree((char *)HSDialog.highlightStyleList);
1957 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1959 if (!updateHSList())
1960 return;
1962 /* pop down and destroy the dialog */
1963 XtDestroyWidget(HSDialog.shell);
1964 HSDialog.shell = NULL;
1967 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1969 updateHSList();
1972 static void hsCloseCB(Widget w, XtPointer clientData, XtPointer callData)
1974 /* pop down and destroy the dialog */
1975 XtDestroyWidget(HSDialog.shell);
1976 HSDialog.shell = NULL;
1979 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1980 void *cbArg)
1982 highlightStyleRec *hs;
1984 /* If the dialog is currently displaying the "new" entry and the
1985 fields are empty, that's just fine */
1986 if (oldItem == NULL && hsDialogEmpty())
1987 return NULL;
1989 /* If there are no problems reading the data, just return it */
1990 hs = readHSDialogFields(True);
1991 if (hs != NULL)
1992 return (void *)hs;
1994 /* If there are problems, and the user didn't ask for the fields to be
1995 read, give more warning */
1996 if (!explicitRequest)
1998 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1999 "Discard incomplete entry\nfor current highlight style?",
2000 "Keep", "Discard") == 2)
2002 return oldItem == NULL
2003 ? NULL
2004 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
2008 /* Do readHSDialogFields again without "silent" mode to display warning */
2009 hs = readHSDialogFields(False);
2010 *abort = True;
2011 return NULL;
2014 static void hsSetDisplayedCB(void *item, void *cbArg)
2016 highlightStyleRec *hs = (highlightStyleRec *)item;
2018 if (item == NULL) {
2019 XmTextSetString(HSDialog.nameW, "");
2020 XmTextSetString(HSDialog.colorW, "");
2021 XmTextSetString(HSDialog.bgColorW, "");
2022 RadioButtonChangeState(HSDialog.plainW, True, False);
2023 RadioButtonChangeState(HSDialog.boldW, False, False);
2024 RadioButtonChangeState(HSDialog.italicW, False, False);
2025 RadioButtonChangeState(HSDialog.boldItalicW, False, False);
2026 } else {
2027 if (strcmp(hs->name, "Plain") == 0) {
2028 /* you should not be able to delete the reserved style "Plain" */
2029 int i, others = 0;
2030 int nList = HSDialog.nHighlightStyles;
2031 highlightStyleRec **list = HSDialog.highlightStyleList;
2032 /* do we have other styles called Plain? */
2033 for (i = 0; i < nList; i++) {
2034 if (list[i] != hs && strcmp(list[i]->name, "Plain") == 0) {
2035 others++;
2038 if (others == 0) {
2039 /* this is the last style entry named "Plain" */
2040 Widget form = (Widget)cbArg;
2041 Widget deleteBtn = XtNameToWidget(form, "*delete");
2042 /* disable delete button */
2043 if (deleteBtn) {
2044 XtSetSensitive(deleteBtn, False);
2048 XmTextSetString(HSDialog.nameW, hs->name);
2049 XmTextSetString(HSDialog.colorW, hs->color);
2050 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2051 RadioButtonChangeState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2052 RadioButtonChangeState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2053 RadioButtonChangeState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2054 RadioButtonChangeState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2055 False);
2059 static void hsFreeItemCB(void *item)
2061 freeHighlightStyleRec((highlightStyleRec *)item);
2064 static highlightStyleRec *readHSDialogFields(int silent)
2066 highlightStyleRec *hs;
2067 Display *display = XtDisplay(HSDialog.shell);
2068 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2069 XColor rgb;
2071 /* Allocate a language mode structure to return */
2072 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2074 /* read the name field */
2075 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2076 "highlight style name", silent);
2077 if (hs->name == NULL) {
2078 XtFree((char *)hs);
2079 return NULL;
2082 if (*hs->name == '\0')
2084 if (!silent)
2086 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2087 "Please specify a name\nfor the highlight style", "OK");
2088 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2090 XtFree(hs->name);
2091 XtFree((char *)hs);
2092 return NULL;
2095 /* read the color field */
2096 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2097 if (hs->color == NULL) {
2098 XtFree(hs->name);
2099 XtFree((char *)hs);
2100 return NULL;
2103 if (*hs->color == '\0')
2105 if (!silent)
2107 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2108 "Please specify a color\nfor the highlight style",
2109 "OK");
2110 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2112 XtFree(hs->name);
2113 XtFree(hs->color);
2114 XtFree((char *)hs);
2115 return NULL;
2118 /* Verify that the color is a valid X color spec */
2119 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2120 &rgb))
2122 if (!silent)
2124 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2125 "Invalid X color specification: %s\n", "OK",
2126 hs->color);
2127 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2129 XtFree(hs->name);
2130 XtFree(hs->color);
2131 XtFree((char *)hs);
2132 return NULL;;
2135 /* read the background color field - this may be empty */
2136 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2137 "bgColor", silent);
2138 if (hs->bgColor && *hs->bgColor == '\0') {
2139 XtFree(hs->bgColor);
2140 hs->bgColor = NULL;
2143 /* Verify that the background color (if present) is a valid X color spec */
2144 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2145 hs->bgColor, &rgb))
2147 if (!silent)
2149 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2150 "Invalid X background color specification: %s\n", "OK",
2151 hs->bgColor);
2152 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2154 XtFree(hs->name);
2155 XtFree(hs->color);
2156 XtFree(hs->bgColor);
2157 XtFree((char *)hs);
2158 return NULL;;
2161 /* read the font buttons */
2162 if (XmToggleButtonGetState(HSDialog.boldW))
2163 hs->font = BOLD_FONT;
2164 else if (XmToggleButtonGetState(HSDialog.italicW))
2165 hs->font = ITALIC_FONT;
2166 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2167 hs->font = BOLD_ITALIC_FONT;
2168 else
2169 hs->font = PLAIN_FONT;
2171 return hs;
2175 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2176 ** it contains.
2178 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2180 highlightStyleRec *newHS;
2182 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2183 newHS->name = XtMalloc(strlen(hs->name)+1);
2184 strcpy(newHS->name, hs->name);
2185 if (hs->color == NULL)
2186 newHS->color = NULL;
2187 else {
2188 newHS->color = XtMalloc(strlen(hs->color)+1);
2189 strcpy(newHS->color, hs->color);
2191 if (hs->bgColor == NULL)
2192 newHS->bgColor = NULL;
2193 else {
2194 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2195 strcpy(newHS->bgColor, hs->bgColor);
2197 newHS->font = hs->font;
2198 return newHS;
2202 ** Free all of the allocated data in a highlightStyleRec, including the
2203 ** structure itself.
2205 static void freeHighlightStyleRec(highlightStyleRec *hs)
2207 XtFree(hs->name);
2208 XtFree(hs->color);
2209 XtFree((char *)hs);
2213 ** Select a particular style in the highlight styles dialog
2215 static void setStyleByName(const char *style)
2217 int i;
2219 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2220 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2221 SelectManagedListItem(HSDialog.managedListW, i);
2222 break;
2228 ** Return True if the fields of the highlight styles dialog are consistent
2229 ** with a blank "New" style in the dialog.
2231 static int hsDialogEmpty(void)
2233 return TextWidgetIsBlank(HSDialog.nameW) &&
2234 TextWidgetIsBlank(HSDialog.colorW) &&
2235 XmToggleButtonGetState(HSDialog.plainW);
2239 ** Apply the changes made in the highlight styles dialog to the stored
2240 ** highlight style information in HighlightStyles
2242 static int updateHSList(void)
2244 WindowInfo *window;
2245 int i;
2247 /* Get the current contents of the dialog fields */
2248 if (!UpdateManagedList(HSDialog.managedListW, True))
2249 return False;
2251 /* Replace the old highlight styles list with the new one from the dialog */
2252 for (i=0; i<NHighlightStyles; i++)
2253 freeHighlightStyleRec(HighlightStyles[i]);
2254 for (i=0; i<HSDialog.nHighlightStyles; i++)
2255 HighlightStyles[i] =
2256 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2257 NHighlightStyles = HSDialog.nHighlightStyles;
2259 /* If a syntax highlighting dialog is up, update its menu */
2260 updateHighlightStyleMenu();
2262 /* Redisplay highlighted windows which use changed style(s) */
2263 for (window=WindowList; window!=NULL; window=window->next)
2264 UpdateHighlightStyles(window);
2266 /* Note that preferences have been changed */
2267 MarkPrefsChanged();
2269 return True;
2273 ** Present a dialog for editing highlight pattern information
2275 void EditHighlightPatterns(WindowInfo *window)
2277 #define BORDER 4
2278 #define LIST_RIGHT 41
2279 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2280 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2281 Widget okBtn, applyBtn, checkBtn, deleteBtn, closeBtn, helpBtn;
2282 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2283 patternSet *patSet;
2284 XmString s1;
2285 int i, n, nPatterns;
2286 Arg args[20];
2288 /* if the dialog is already displayed, just pop it to the top and return */
2289 if (HighlightDialog.shell != NULL) {
2290 RaiseDialogWindow(HighlightDialog.shell);
2291 return;
2294 if (LanguageModeName(0) == NULL)
2296 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2297 "No Language Modes available for syntax highlighting\n"
2298 "Add language modes under Preferenses->Language Modes",
2299 "OK");
2300 return;
2303 /* Decide on an initial language mode */
2304 HighlightDialog.langModeName = XtNewString(
2305 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2306 window->languageMode));
2308 /* Find the associated pattern set (patSet) to edit */
2309 patSet = FindPatternSet(HighlightDialog.langModeName);
2311 /* Copy the list of patterns to one that the user can freely edit */
2312 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2313 sizeof(highlightPattern *) * MAX_PATTERNS);
2314 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2315 for (i=0; i<nPatterns; i++)
2316 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2317 HighlightDialog.nPatterns = nPatterns;
2320 /* Create a form widget in an application shell */
2321 n = 0;
2322 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2323 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2324 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2325 HighlightDialog.shell = CreateWidget(TheAppShell, "syntaxHighlight",
2326 topLevelShellWidgetClass, args, n);
2327 AddSmallIcon(HighlightDialog.shell);
2328 form = XtVaCreateManagedWidget("editHighlightPatterns",
2329 xmFormWidgetClass, HighlightDialog.shell,
2330 XmNautoUnmanage, False,
2331 XmNresizePolicy, XmRESIZE_NONE,
2332 NULL);
2333 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2334 AddMotifCloseCallback(HighlightDialog.shell, closeCB, NULL);
2336 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2337 form,
2338 XmNleftAttachment, XmATTACH_POSITION,
2339 XmNleftPosition, 1,
2340 XmNtopAttachment, XmATTACH_POSITION,
2341 XmNtopPosition, 1,
2342 XmNrightAttachment, XmATTACH_POSITION,
2343 XmNrightPosition, 99,
2344 NULL);
2346 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2347 NULL);
2348 n = 0;
2349 XtSetArg(args[n], XmNspacing, 0); n++;
2350 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2351 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2352 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2353 XtSetArg(args[n], XmNleftPosition, 50); n++;
2354 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2355 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2356 XtManageChild(lmOptMenu);
2357 HighlightDialog.lmOptMenu = lmOptMenu;
2359 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2360 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2361 XmNmnemonic, 'M',
2362 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2363 XmNalignment, XmALIGNMENT_END,
2364 XmNrightAttachment, XmATTACH_POSITION,
2365 XmNrightPosition, 50,
2366 XmNtopAttachment, XmATTACH_FORM,
2367 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2368 XmNbottomWidget, lmOptMenu, NULL);
2369 XmStringFree(s1);
2371 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2372 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2373 XmNmnemonic, 'A',
2374 XmNrightAttachment, XmATTACH_FORM,
2375 XmNtopAttachment, XmATTACH_FORM, NULL);
2376 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2377 XmStringFree(s1);
2379 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2380 XmNlabelString, s1=XmStringCreateSimple("OK"),
2381 XmNmarginWidth, BUTTON_WIDTH_MARGIN,
2382 XmNleftAttachment, XmATTACH_POSITION,
2383 XmNleftPosition, 1,
2384 XmNrightAttachment, XmATTACH_POSITION,
2385 XmNrightPosition, 13,
2386 XmNbottomAttachment, XmATTACH_FORM,
2387 XmNbottomOffset, BORDER, NULL);
2388 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2389 XmStringFree(s1);
2391 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2392 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2393 XmNmnemonic, 'y',
2394 XmNleftAttachment, XmATTACH_POSITION,
2395 XmNleftPosition, 13,
2396 XmNrightAttachment, XmATTACH_POSITION,
2397 XmNrightPosition, 26,
2398 XmNbottomAttachment, XmATTACH_FORM,
2399 XmNbottomOffset, BORDER, NULL);
2400 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2401 XmStringFree(s1);
2403 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2404 XmNlabelString, s1=XmStringCreateSimple("Check"),
2405 XmNmnemonic, 'k',
2406 XmNleftAttachment, XmATTACH_POSITION,
2407 XmNleftPosition, 26,
2408 XmNrightAttachment, XmATTACH_POSITION,
2409 XmNrightPosition, 39,
2410 XmNbottomAttachment, XmATTACH_FORM,
2411 XmNbottomOffset, BORDER, NULL);
2412 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2413 XmStringFree(s1);
2415 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2416 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2417 XmNmnemonic, 'D',
2418 XmNleftAttachment, XmATTACH_POSITION,
2419 XmNleftPosition, 39,
2420 XmNrightAttachment, XmATTACH_POSITION,
2421 XmNrightPosition, 52,
2422 XmNbottomAttachment, XmATTACH_FORM,
2423 XmNbottomOffset, BORDER, NULL);
2424 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2425 XmStringFree(s1);
2427 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2428 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2429 XmNmnemonic, 'f',
2430 XmNleftAttachment, XmATTACH_POSITION,
2431 XmNleftPosition, 52,
2432 XmNrightAttachment, XmATTACH_POSITION,
2433 XmNrightPosition, 73,
2434 XmNbottomAttachment, XmATTACH_FORM,
2435 XmNbottomOffset, BORDER, NULL);
2436 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2437 XmStringFree(s1);
2439 closeBtn = XtVaCreateManagedWidget("close", xmPushButtonWidgetClass,
2440 form,
2441 XmNlabelString, s1=XmStringCreateSimple("Close"),
2442 XmNleftAttachment, XmATTACH_POSITION,
2443 XmNleftPosition, 73,
2444 XmNrightAttachment, XmATTACH_POSITION,
2445 XmNrightPosition, 86,
2446 XmNbottomAttachment, XmATTACH_FORM,
2447 XmNbottomOffset, BORDER, NULL);
2448 XtAddCallback(closeBtn, XmNactivateCallback, closeCB, NULL);
2449 XmStringFree(s1);
2451 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2452 form,
2453 XmNlabelString, s1=XmStringCreateSimple("Help"),
2454 XmNmnemonic, 'H',
2455 XmNleftAttachment, XmATTACH_POSITION,
2456 XmNleftPosition, 86,
2457 XmNrightAttachment, XmATTACH_POSITION,
2458 XmNrightPosition, 99,
2459 XmNbottomAttachment, XmATTACH_FORM,
2460 XmNbottomOffset, BORDER, NULL);
2461 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2462 XmStringFree(s1);
2464 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2465 form,
2466 XmNleftAttachment, XmATTACH_POSITION,
2467 XmNleftPosition, 1,
2468 XmNrightAttachment, XmATTACH_POSITION,
2469 XmNrightPosition, 99,
2470 XmNbottomAttachment, XmATTACH_WIDGET,
2471 XmNbottomWidget, okBtn,
2472 XmNbottomOffset, BORDER, NULL);
2473 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2474 contextFrame, NULL);
2475 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2476 XmNlabelString, s1=XmStringCreateSimple(
2477 "Context requirements for incremental re-parsing after changes"),
2478 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2479 XmStringFree(s1);
2481 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2482 xmTextWidgetClass, contextForm,
2483 XmNcolumns, 5,
2484 XmNmaxLength, 12,
2485 XmNleftAttachment, XmATTACH_POSITION,
2486 XmNleftPosition, 15,
2487 XmNrightAttachment, XmATTACH_POSITION,
2488 XmNrightPosition, 25, NULL);
2489 RemapDeleteKey(HighlightDialog.lineContextW);
2491 XtVaCreateManagedWidget("lineContLbl",
2492 xmLabelGadgetClass, contextForm,
2493 XmNlabelString, s1=XmStringCreateSimple("lines"),
2494 XmNmnemonic, 'l',
2495 XmNuserData, HighlightDialog.lineContextW,
2496 XmNalignment, XmALIGNMENT_BEGINNING,
2497 XmNleftAttachment, XmATTACH_WIDGET,
2498 XmNleftWidget, HighlightDialog.lineContextW,
2499 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2500 XmNtopWidget, HighlightDialog.lineContextW,
2501 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2502 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2503 XmStringFree(s1);
2505 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2506 xmTextWidgetClass, contextForm,
2507 XmNcolumns, 5,
2508 XmNmaxLength, 12,
2509 XmNleftAttachment, XmATTACH_POSITION,
2510 XmNleftPosition, 58,
2511 XmNrightAttachment, XmATTACH_POSITION,
2512 XmNrightPosition, 68, NULL);
2513 RemapDeleteKey(HighlightDialog.lineContextW);
2515 XtVaCreateManagedWidget("charContLbl",
2516 xmLabelGadgetClass, contextForm,
2517 XmNlabelString, s1=XmStringCreateSimple("characters"),
2518 XmNmnemonic, 'c',
2519 XmNuserData, HighlightDialog.charContextW,
2520 XmNalignment, XmALIGNMENT_BEGINNING,
2521 XmNleftAttachment, XmATTACH_WIDGET,
2522 XmNleftWidget, HighlightDialog.charContextW,
2523 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2524 XmNtopWidget, HighlightDialog.charContextW,
2525 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2526 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2527 XmStringFree(s1);
2529 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2530 form,
2531 XmNleftAttachment, XmATTACH_POSITION,
2532 XmNleftPosition, 1,
2533 XmNtopAttachment, XmATTACH_WIDGET,
2534 XmNtopWidget, lmForm,
2535 XmNrightAttachment, XmATTACH_POSITION,
2536 XmNrightPosition, 99,
2537 XmNbottomAttachment, XmATTACH_WIDGET,
2538 XmNbottomWidget, contextFrame,
2539 XmNbottomOffset, BORDER, NULL);
2540 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2541 patternsFrame, NULL);
2542 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2543 patternsFrame,
2544 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2545 XmNmnemonic, 'P',
2546 XmNmarginHeight, 0,
2547 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2548 XmStringFree(s1);
2550 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2551 patternsForm,
2552 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2553 XmNmarginHeight, 0,
2554 XmNalignment, XmALIGNMENT_BEGINNING,
2555 XmNleftAttachment, XmATTACH_POSITION,
2556 XmNleftPosition, LIST_RIGHT,
2557 XmNtopAttachment, XmATTACH_FORM, NULL);
2558 XmStringFree(s1);
2560 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2561 patternsForm,
2562 XmNpacking, XmPACK_COLUMN,
2563 XmNradioBehavior, True,
2564 XmNleftAttachment, XmATTACH_POSITION,
2565 XmNleftPosition, LIST_RIGHT,
2566 XmNtopAttachment, XmATTACH_WIDGET,
2567 XmNtopWidget, typeLbl, NULL);
2568 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2569 xmToggleButtonWidgetClass, typeBox,
2570 XmNset, True,
2571 XmNmarginHeight, 0,
2572 XmNlabelString, s1=XmStringCreateSimple(
2573 "Pass-1 (applied to all text when loaded or modified)"),
2574 XmNmnemonic, '1', NULL);
2575 XmStringFree(s1);
2576 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2577 patTypeCB, NULL);
2578 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2579 xmToggleButtonWidgetClass, typeBox,
2580 XmNmarginHeight, 0,
2581 XmNlabelString, s1=XmStringCreateSimple(
2582 "Pass-2 (parsing is deferred until text is exposed)"),
2583 XmNmnemonic, '2', NULL);
2584 XmStringFree(s1);
2585 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2586 patTypeCB, NULL);
2587 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2588 xmToggleButtonWidgetClass, typeBox,
2589 XmNmarginHeight, 0,
2590 XmNlabelString, s1=XmStringCreateSimple(
2591 "Sub-pattern (processed within start & end of parent)"),
2592 XmNmnemonic, 'u', NULL);
2593 XmStringFree(s1);
2594 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2595 patTypeCB, NULL);
2596 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2597 xmToggleButtonWidgetClass, typeBox,
2598 XmNmarginHeight, 0,
2599 XmNlabelString, s1=XmStringCreateSimple(
2600 "Coloring for sub-expressions of parent pattern"),
2601 XmNmnemonic, 'g', NULL);
2602 XmStringFree(s1);
2603 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2604 patTypeCB, NULL);
2606 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2607 xmLabelGadgetClass, patternsForm,
2608 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2609 XmNmarginHeight, 0,
2610 XmNalignment, XmALIGNMENT_BEGINNING,
2611 XmNleftAttachment, XmATTACH_POSITION,
2612 XmNleftPosition, LIST_RIGHT,
2613 XmNtopAttachment, XmATTACH_WIDGET,
2614 XmNtopOffset, BORDER,
2615 XmNtopWidget, typeBox, NULL);
2616 XmStringFree(s1);
2618 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2619 patternsForm,
2620 XmNpacking, XmPACK_COLUMN,
2621 XmNradioBehavior, True,
2622 XmNleftAttachment, XmATTACH_POSITION,
2623 XmNleftPosition, LIST_RIGHT,
2624 XmNtopAttachment, XmATTACH_WIDGET,
2625 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2626 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2627 xmToggleButtonWidgetClass, matchBox,
2628 XmNset, True,
2629 XmNmarginHeight, 0,
2630 XmNlabelString, s1=XmStringCreateSimple(
2631 "Highlight text matching regular expression"),
2632 XmNmnemonic, 'x', NULL);
2633 XmStringFree(s1);
2634 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2635 matchTypeCB, NULL);
2636 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2637 xmToggleButtonWidgetClass, matchBox,
2638 XmNmarginHeight, 0,
2639 XmNlabelString, s1=XmStringCreateSimple(
2640 "Highlight text between starting and ending REs"),
2641 XmNmnemonic, 'b', NULL);
2642 XmStringFree(s1);
2643 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2644 matchTypeCB, NULL);
2646 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2647 patternsForm,
2648 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2649 XmNmnemonic, 'N',
2650 XmNrows, 20,
2651 XmNalignment, XmALIGNMENT_BEGINNING,
2652 XmNleftAttachment, XmATTACH_POSITION,
2653 XmNleftPosition, LIST_RIGHT,
2654 XmNtopAttachment, XmATTACH_WIDGET,
2655 XmNtopWidget, matchBox,
2656 XmNtopOffset, BORDER, NULL);
2657 XmStringFree(s1);
2659 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2660 patternsForm,
2661 XmNleftAttachment, XmATTACH_POSITION,
2662 XmNleftPosition, LIST_RIGHT,
2663 XmNtopAttachment, XmATTACH_WIDGET,
2664 XmNtopWidget, nameLbl,
2665 XmNrightAttachment, XmATTACH_POSITION,
2666 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2667 RemapDeleteKey(HighlightDialog.nameW);
2668 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2670 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2671 xmLabelGadgetClass, patternsForm,
2672 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2673 XmNmnemonic, 't',
2674 XmNrows, 20,
2675 XmNalignment, XmALIGNMENT_BEGINNING,
2676 XmNleftAttachment, XmATTACH_POSITION,
2677 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2678 XmNtopAttachment, XmATTACH_WIDGET,
2679 XmNtopWidget, matchBox,
2680 XmNtopOffset, BORDER, NULL);
2681 XmStringFree(s1);
2683 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2684 xmTextWidgetClass, patternsForm,
2685 XmNleftAttachment, XmATTACH_POSITION,
2686 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2687 XmNtopAttachment, XmATTACH_WIDGET,
2688 XmNtopWidget, HighlightDialog.parentLbl,
2689 XmNrightAttachment, XmATTACH_POSITION,
2690 XmNrightPosition, 99, NULL);
2691 RemapDeleteKey(HighlightDialog.parentW);
2692 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2693 HighlightDialog.parentW, NULL);
2695 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2696 xmLabelGadgetClass, patternsForm,
2697 XmNalignment, XmALIGNMENT_BEGINNING,
2698 XmNmnemonic, 'R',
2699 XmNtopAttachment, XmATTACH_WIDGET,
2700 XmNtopWidget, HighlightDialog.parentW,
2701 XmNtopOffset, BORDER,
2702 XmNleftAttachment, XmATTACH_POSITION,
2703 XmNleftPosition, 1, NULL);
2705 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2706 xmTextWidgetClass, patternsForm,
2707 XmNleftAttachment, XmATTACH_POSITION,
2708 XmNleftPosition, 1,
2709 XmNrightAttachment, XmATTACH_POSITION,
2710 XmNrightPosition, 99,
2711 XmNbottomAttachment, XmATTACH_POSITION,
2712 XmNbottomPosition, 99, NULL);
2713 RemapDeleteKey(HighlightDialog.errorW);
2715 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2716 xmLabelGadgetClass, patternsForm,
2717 XmNlabelString, s1=XmStringCreateSimple(
2718 "Regular Expression Indicating Error in Match (Optional)"),
2719 XmNmnemonic, 'o',
2720 XmNuserData, HighlightDialog.errorW,
2721 XmNalignment, XmALIGNMENT_BEGINNING,
2722 XmNleftAttachment, XmATTACH_POSITION,
2723 XmNleftPosition, 1,
2724 XmNbottomAttachment, XmATTACH_WIDGET,
2725 XmNbottomWidget, HighlightDialog.errorW, NULL);
2726 XmStringFree(s1);
2728 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2729 xmTextWidgetClass, patternsForm,
2730 XmNleftAttachment, XmATTACH_POSITION,
2731 XmNleftPosition, 1,
2732 XmNbottomAttachment, XmATTACH_WIDGET,
2733 XmNbottomWidget, HighlightDialog.errorLbl,
2734 XmNbottomOffset, BORDER,
2735 XmNrightAttachment, XmATTACH_POSITION,
2736 XmNrightPosition, 99, NULL);
2737 RemapDeleteKey(HighlightDialog.endW);
2739 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2740 xmLabelGadgetClass, patternsForm,
2741 XmNmnemonic, 'E',
2742 XmNuserData, HighlightDialog.endW,
2743 XmNalignment, XmALIGNMENT_BEGINNING,
2744 XmNleftAttachment, XmATTACH_POSITION,
2745 XmNleftPosition, 1,
2746 XmNbottomAttachment, XmATTACH_WIDGET,
2747 XmNbottomWidget, HighlightDialog.endW, NULL);
2749 n = 0;
2750 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2751 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2752 XtSetArg(args[n], XmNwordWrap, True); n++;
2753 XtSetArg(args[n], XmNrows, 3); n++;
2754 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2755 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2756 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2757 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2758 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2759 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2760 XtSetArg(args[n], XmNleftPosition, 1); n++;
2761 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2762 XtSetArg(args[n], XmNrightPosition, 99); n++;
2763 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2764 AddMouseWheelSupport(HighlightDialog.startW);
2765 XtManageChild(HighlightDialog.startW);
2766 MakeSingleLineTextW(HighlightDialog.startW);
2767 RemapDeleteKey(HighlightDialog.startW);
2768 XtVaSetValues(HighlightDialog.startLbl,
2769 XmNuserData,HighlightDialog.startW, NULL);
2771 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2772 patternsForm,
2773 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2774 XmNmnemonic, 'i',
2775 XmNrightAttachment, XmATTACH_POSITION,
2776 XmNrightPosition, LIST_RIGHT-1,
2777 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2778 XmNbottomWidget, HighlightDialog.parentW, NULL);
2779 XmStringFree(s1);
2780 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2782 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2783 n = 0;
2784 XtSetArg(args[n], XmNspacing, 0); n++;
2785 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2786 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2787 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2788 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2789 XtSetArg(args[n], XmNleftPosition, 1); n++;
2790 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2791 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2792 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2793 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2794 "styleOptMenu", args, n);
2795 XtManageChild(HighlightDialog.styleOptMenu);
2797 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2798 patternsForm,
2799 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2800 XmNmnemonic, 'S',
2801 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2802 XmNalignment, XmALIGNMENT_BEGINNING,
2803 XmNleftAttachment, XmATTACH_POSITION,
2804 XmNleftPosition, 1,
2805 XmNbottomAttachment, XmATTACH_WIDGET,
2806 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2807 XmStringFree(s1);
2809 n = 0;
2810 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2811 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2812 XtSetArg(args[n], XmNleftPosition, 1); n++;
2813 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2814 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2815 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2816 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2817 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2818 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2819 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2820 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2821 NULL, freeItemCB);
2822 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2824 /* Set initial default button */
2825 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2826 XtVaSetValues(form, XmNcancelButton, closeBtn, NULL);
2828 /* Handle mnemonic selection of buttons and focus to dialog */
2829 AddDialogMnemonicHandler(form, FALSE);
2831 /* Fill in the dialog information for the selected language mode */
2832 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2833 patSet->lineContext);
2834 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2835 patSet->charContext);
2836 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2837 updateLabels();
2839 /* Realize all of the widgets in the new dialog */
2840 RealizeWithoutForcingPosition(HighlightDialog.shell);
2844 ** If a syntax highlighting dialog is up, ask to have the option menu for
2845 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2847 static void updateHighlightStyleMenu(void)
2849 Widget oldMenu;
2850 int patIndex;
2852 if (HighlightDialog.shell == NULL)
2853 return;
2855 oldMenu = HighlightDialog.stylePulldown;
2856 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2857 XtParent(XtParent(oldMenu)));
2858 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2859 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2860 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2861 if (patIndex == -1)
2862 setStyleMenu("Plain");
2863 else
2864 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2866 XtDestroyWidget(oldMenu);
2870 ** If a syntax highlighting dialog is up, ask to have the option menu for
2871 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2873 void UpdateLanguageModeMenu(void)
2875 Widget oldMenu;
2877 if (HighlightDialog.shell == NULL)
2878 return;
2880 oldMenu = HighlightDialog.lmPulldown;
2881 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2882 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2883 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2884 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2885 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2887 XtDestroyWidget(oldMenu);
2890 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2892 int i;
2894 XtFree((char*) HighlightDialog.langModeName);
2895 for (i=0; i<HighlightDialog.nPatterns; i++)
2896 freePatternSrc(HighlightDialog.patterns[i], True);
2897 HighlightDialog.shell = NULL;
2900 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2902 char *modeName;
2903 patternSet *oldPatSet, *newPatSet;
2904 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2905 int i, resp;
2907 /* Get the newly selected mode name. If it's the same, do nothing */
2908 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2909 if (!strcmp(modeName, HighlightDialog.langModeName))
2910 return;
2912 /* Look up the original version of the patterns being edited */
2913 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2914 if (oldPatSet == NULL)
2915 oldPatSet = &emptyPatSet;
2917 /* Get the current information displayed by the dialog. If it's bad,
2918 give the user the chance to throw it out or go back and fix it. If
2919 it has changed, give the user the chance to apply discard or cancel. */
2920 newPatSet = getDialogPatternSet();
2922 if (newPatSet == NULL)
2924 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2925 "Incomplete Language Mode", "Discard incomplete entry\n"
2926 "for current language mode?", "Keep", "Discard") == 1)
2928 SetLangModeMenu(HighlightDialog.lmOptMenu,
2929 HighlightDialog.langModeName);
2930 return;
2932 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2934 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2935 "Apply changes for language mode %s?", "Apply Changes",
2936 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2937 if (resp == 3)
2939 SetLangModeMenu(HighlightDialog.lmOptMenu,
2940 HighlightDialog.langModeName);
2941 return;
2943 if (resp == 1)
2945 updatePatternSet();
2949 if (newPatSet != NULL)
2950 freePatternSet(newPatSet);
2952 /* Free the old dialog information */
2953 XtFree((char*) HighlightDialog.langModeName);
2954 for (i=0; i<HighlightDialog.nPatterns; i++)
2955 freePatternSrc(HighlightDialog.patterns[i], True);
2957 /* Fill the dialog with the new language mode information */
2958 HighlightDialog.langModeName = XtNewString(modeName);
2959 newPatSet = FindPatternSet(modeName);
2960 if (newPatSet == NULL) {
2961 HighlightDialog.nPatterns = 0;
2962 SetIntText(HighlightDialog.lineContextW, 1);
2963 SetIntText(HighlightDialog.charContextW, 0);
2964 } else {
2965 for (i=0; i<newPatSet->nPatterns; i++)
2966 HighlightDialog.patterns[i] =
2967 copyPatternSrc(&newPatSet->patterns[i], NULL);
2968 HighlightDialog.nPatterns = newPatSet->nPatterns;
2969 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2970 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2972 ChangeManagedListData(HighlightDialog.managedListW);
2975 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2977 EditLanguageModes();
2980 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2982 Widget selectedItem;
2983 char *style;
2985 XtVaGetValues(HighlightDialog.styleOptMenu,
2986 XmNmenuHistory, &selectedItem,
2987 NULL);
2988 XtVaGetValues(selectedItem,
2989 XmNuserData, &style,
2990 NULL);
2991 EditHighlightStyles(style);
2994 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2996 /* change the patterns */
2997 if (!updatePatternSet())
2998 return;
3000 /* pop down and destroy the dialog */
3001 CloseAllPopupsFor(HighlightDialog.shell);
3002 XtDestroyWidget(HighlightDialog.shell);
3005 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
3007 /* change the patterns */
3008 updatePatternSet();
3011 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
3013 if (checkHighlightDialogData())
3015 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
3016 "Patterns compiled without error", "OK");
3020 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
3022 patternSet *defaultPatSet;
3023 int i, psn;
3025 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
3026 if (defaultPatSet == NULL)
3028 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
3029 "There is no default pattern set\nfor language mode %s",
3030 "OK", HighlightDialog.langModeName);
3031 return;
3034 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
3035 "Are you sure you want to discard\n"
3036 "all changes to syntax highlighting\n"
3037 "patterns for language mode %s?", "Discard", "Cancel",
3038 HighlightDialog.langModeName) == 2)
3040 return;
3043 /* if a stored version of the pattern set exists, replace it, if it
3044 doesn't, add a new one */
3045 for (psn=0; psn<NPatternSets; psn++)
3046 if (!strcmp(HighlightDialog.langModeName,
3047 PatternSets[psn]->languageMode))
3048 break;
3049 if (psn < NPatternSets) {
3050 freePatternSet(PatternSets[psn]);
3051 PatternSets[psn] = defaultPatSet;
3052 } else
3053 PatternSets[NPatternSets++] = defaultPatSet;
3055 /* Free the old dialog information */
3056 for (i=0; i<HighlightDialog.nPatterns; i++)
3057 freePatternSrc(HighlightDialog.patterns[i], True);
3059 /* Update the dialog */
3060 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3061 for (i=0; i<defaultPatSet->nPatterns; i++)
3062 HighlightDialog.patterns[i] =
3063 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3064 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3065 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3066 ChangeManagedListData(HighlightDialog.managedListW);
3069 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3071 int i, psn;
3073 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3074 "Are you sure you want to delete\n"
3075 "syntax highlighting patterns for\n"
3076 "language mode %s?", "Yes, Delete", "Cancel",
3077 HighlightDialog.langModeName) == 2)
3079 return;
3082 /* if a stored version of the pattern set exists, delete it from the list */
3083 for (psn=0; psn<NPatternSets; psn++)
3084 if (!strcmp(HighlightDialog.langModeName,
3085 PatternSets[psn]->languageMode))
3086 break;
3087 if (psn < NPatternSets) {
3088 freePatternSet(PatternSets[psn]);
3089 memmove(&PatternSets[psn], &PatternSets[psn+1],
3090 (NPatternSets-1 - psn) * sizeof(patternSet *));
3091 NPatternSets--;
3094 /* Free the old dialog information */
3095 for (i=0; i<HighlightDialog.nPatterns; i++)
3096 freePatternSrc(HighlightDialog.patterns[i], True);
3098 /* Clear out the dialog */
3099 HighlightDialog.nPatterns = 0;
3100 SetIntText(HighlightDialog.lineContextW, 1);
3101 SetIntText(HighlightDialog.charContextW, 0);
3102 ChangeManagedListData(HighlightDialog.managedListW);
3105 static void closeCB(Widget w, XtPointer clientData, XtPointer callData)
3107 /* pop down and destroy the dialog */
3108 CloseAllPopupsFor(HighlightDialog.shell);
3109 XtDestroyWidget(HighlightDialog.shell);
3112 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3114 Help(HELP_PATTERNS);
3117 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3119 updateLabels();
3122 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3124 updateLabels();
3127 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3128 void *cbArg)
3130 highlightPattern *pat;
3132 /* If the dialog is currently displaying the "new" entry and the
3133 fields are empty, that's just fine */
3134 if (oldItem == NULL && dialogEmpty())
3135 return NULL;
3137 /* If there are no problems reading the data, just return it */
3138 pat = readDialogFields(True);
3139 if (pat != NULL)
3140 return (void *)pat;
3142 /* If there are problems, and the user didn't ask for the fields to be
3143 read, give more warning */
3144 if (!explicitRequest)
3146 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3147 "Discard incomplete entry\nfor current pattern?", "Keep",
3148 "Discard") == 2)
3150 return oldItem == NULL
3151 ? NULL
3152 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3156 /* Do readDialogFields again without "silent" mode to display warning */
3157 pat = readDialogFields(False);
3158 *abort = True;
3159 return NULL;
3162 static void setDisplayedCB(void *item, void *cbArg)
3164 highlightPattern *pat = (highlightPattern *)item;
3165 int isSubpat, isDeferred, isColorOnly, isRange;
3167 if (item == NULL) {
3168 XmTextSetString(HighlightDialog.nameW, "");
3169 XmTextSetString(HighlightDialog.parentW, "");
3170 XmTextSetString(HighlightDialog.startW, "");
3171 XmTextSetString(HighlightDialog.endW, "");
3172 XmTextSetString(HighlightDialog.errorW, "");
3173 RadioButtonChangeState(HighlightDialog.topLevelW, True, False);
3174 RadioButtonChangeState(HighlightDialog.deferredW, False, False);
3175 RadioButtonChangeState(HighlightDialog.subPatW, False, False);
3176 RadioButtonChangeState(HighlightDialog.colorPatW, False, False);
3177 RadioButtonChangeState(HighlightDialog.simpleW, True, False);
3178 RadioButtonChangeState(HighlightDialog.rangeW, False, False);
3179 setStyleMenu("Plain");
3180 } else {
3181 isSubpat = pat->subPatternOf != NULL;
3182 isDeferred = pat->flags & DEFER_PARSING;
3183 isColorOnly = pat->flags & COLOR_ONLY;
3184 isRange = pat->endRE != NULL;
3185 XmTextSetString(HighlightDialog.nameW, pat->name);
3186 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3187 XmTextSetString(HighlightDialog.startW, pat->startRE);
3188 XmTextSetString(HighlightDialog.endW, pat->endRE);
3189 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3190 RadioButtonChangeState(HighlightDialog.topLevelW,
3191 !isSubpat && !isDeferred, False);
3192 RadioButtonChangeState(HighlightDialog.deferredW,
3193 !isSubpat && isDeferred, False);
3194 RadioButtonChangeState(HighlightDialog.subPatW,
3195 isSubpat && !isColorOnly, False);
3196 RadioButtonChangeState(HighlightDialog.colorPatW,
3197 isSubpat && isColorOnly, False);
3198 RadioButtonChangeState(HighlightDialog.simpleW, !isRange, False);
3199 RadioButtonChangeState(HighlightDialog.rangeW, isRange, False);
3200 setStyleMenu(pat->style);
3202 updateLabels();
3205 static void freeItemCB(void *item)
3207 freePatternSrc((highlightPattern *)item, True);
3211 ** Do a test compile of the patterns currently displayed in the highlight
3212 ** patterns dialog, and display warning dialogs if there are problems
3214 static int checkHighlightDialogData(void)
3216 patternSet *patSet;
3217 int result;
3219 /* Get the pattern information from the dialog */
3220 patSet = getDialogPatternSet();
3221 if (patSet == NULL)
3222 return False;
3224 /* Compile the patterns */
3225 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3226 freePatternSet(patSet);
3227 return result;
3231 ** Update the text field labels and sensitivity of various fields, based on
3232 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3233 ** patterns dialog.
3235 static void updateLabels(void)
3237 char *startLbl, *endLbl;
3238 int endSense, errSense, matchSense, parentSense;
3239 XmString s1;
3241 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3242 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3243 Regular Expression (\\1, &, etc.)";
3244 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3245 Regular Expression";
3246 endSense = True;
3247 errSense = False;
3248 matchSense = False;
3249 parentSense = True;
3250 } else {
3251 endLbl = "Ending Regular Expression";
3252 matchSense = True;
3253 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3254 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3255 startLbl = "Regular Expression to Match";
3256 endSense = False;
3257 errSense = False;
3258 } else {
3259 startLbl = "Starting Regular Expression";
3260 endSense = True;
3261 errSense = True;
3265 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3266 XtSetSensitive(HighlightDialog.parentW, parentSense);
3267 XtSetSensitive(HighlightDialog.endW, endSense);
3268 XtSetSensitive(HighlightDialog.endLbl, endSense);
3269 XtSetSensitive(HighlightDialog.errorW, errSense);
3270 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3271 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3272 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3273 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3274 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3275 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3276 s1=XmStringCreateSimple(startLbl), NULL);
3277 XmStringFree(s1);
3278 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3279 s1=XmStringCreateSimple(endLbl), NULL);
3280 XmStringFree(s1);
3284 ** Set the styles menu in the currently displayed highlight dialog to show
3285 ** a particular style
3287 static void setStyleMenu(const char *styleName)
3289 int i;
3290 Cardinal nItems;
3291 WidgetList items;
3292 Widget selectedItem;
3293 char *itemStyle;
3295 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3296 XmNnumChildren, &nItems, NULL);
3297 if (nItems == 0)
3298 return;
3299 selectedItem = items[0];
3300 for (i=0; i<(int)nItems; i++) {
3301 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3302 if (!strcmp(itemStyle, styleName)) {
3303 selectedItem = items[i];
3304 break;
3307 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3311 ** Read the pattern fields of the highlight dialog, and produce an allocated
3312 ** highlightPattern structure reflecting the contents, or pop up dialogs
3313 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3314 ** dialogs). Returns NULL on error.
3316 static highlightPattern *readDialogFields(int silent)
3318 highlightPattern *pat;
3319 char *inPtr, *outPtr, *style;
3320 Widget selectedItem;
3321 int colorOnly;
3323 /* Allocate a pattern source structure to return, zero out fields
3324 so that the whole pattern can be freed on error with freePatternSrc */
3325 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3326 pat->endRE = NULL;
3327 pat->errorRE = NULL;
3328 pat->style = NULL;
3329 pat->subPatternOf = NULL;
3331 /* read the type buttons */
3332 pat->flags = 0;
3333 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3334 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3335 pat->flags |= DEFER_PARSING;
3336 else if (colorOnly)
3337 pat->flags = COLOR_ONLY;
3339 /* read the name field */
3340 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3341 "highlight pattern name", silent);
3342 if (pat->name == NULL) {
3343 XtFree((char *)pat);
3344 return NULL;
3347 if (*pat->name == '\0')
3349 if (!silent)
3351 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3352 "Please specify a name\nfor the pattern", "OK");
3353 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3355 XtFree(pat->name);
3356 XtFree((char *)pat);
3357 return NULL;
3360 /* read the startRE field */
3361 pat->startRE = XmTextGetString(HighlightDialog.startW);
3362 if (*pat->startRE == '\0')
3364 if (!silent)
3366 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3367 "Please specify a regular\nexpression to match", "OK");
3368 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3370 freePatternSrc(pat, True);
3371 return NULL;
3374 /* Make sure coloring patterns contain only sub-expression references
3375 and put it in replacement regular-expression form */
3376 if (colorOnly)
3378 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3380 if (*inPtr!=' ' && *inPtr!='\t')
3382 *outPtr++ = *inPtr;
3386 *outPtr = '\0';
3387 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3388 || (*pat->startRE != '\\' && *pat->startRE != '&')
3389 || strstr(pat->startRE, "\\\\") != NULL)
3391 if (!silent)
3393 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3394 "The expression field in patterns which specify highlighting for\n"
3395 "a parent, must contain only sub-expression references in regular\n"
3396 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3397 "Expressions and Help -> Syntax Highlighting for more information",
3398 "OK");
3399 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3401 freePatternSrc(pat, True);
3402 return NULL;
3406 /* read the parent field */
3407 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3409 if (TextWidgetIsBlank(HighlightDialog.parentW))
3411 if (!silent)
3413 DialogF(DF_WARN, HighlightDialog.shell, 1,
3414 "Specify Parent Pattern",
3415 "Please specify a parent pattern", "OK");
3416 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3418 freePatternSrc(pat, True);
3419 return NULL;
3421 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3424 /* read the styles option menu */
3425 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3426 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3427 pat->style = XtMalloc(strlen(style) + 1);
3428 strcpy(pat->style, style);
3431 /* read the endRE field */
3432 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3434 pat->endRE = XmTextGetString(HighlightDialog.endW);
3435 if (!colorOnly && *pat->endRE == '\0')
3437 if (!silent)
3439 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3440 "Please specify an ending\nregular expression",
3441 "OK");
3442 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3444 freePatternSrc(pat, True);
3445 return NULL;
3449 /* read the errorRE field */
3450 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3451 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3452 if (*pat->errorRE == '\0') {
3453 XtFree(pat->errorRE);
3454 pat->errorRE = NULL;
3457 return pat;
3461 ** Returns true if the pattern fields of the highlight dialog are set to
3462 ** the default ("New" pattern) state.
3464 static int dialogEmpty(void)
3466 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3467 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3468 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3469 TextWidgetIsBlank(HighlightDialog.parentW) &&
3470 TextWidgetIsBlank(HighlightDialog.startW) &&
3471 TextWidgetIsBlank(HighlightDialog.endW) &&
3472 TextWidgetIsBlank(HighlightDialog.errorW);
3476 ** Update the pattern set being edited in the Syntax Highlighting dialog
3477 ** with the information that the dialog is currently displaying, and
3478 ** apply changes to any window which is currently using the patterns.
3480 static int updatePatternSet(void)
3482 patternSet *patSet;
3483 WindowInfo *window;
3484 int psn, oldNum = -1;
3487 /* Make sure the patterns are valid and compile */
3488 if (!checkHighlightDialogData())
3489 return False;
3491 /* Get the current data */
3492 patSet = getDialogPatternSet();
3493 if (patSet == NULL)
3494 return False;
3496 /* Find the pattern being modified */
3497 for (psn=0; psn<NPatternSets; psn++)
3498 if (!strcmp(HighlightDialog.langModeName,
3499 PatternSets[psn]->languageMode))
3500 break;
3502 /* If it's a new pattern, add it at the end, otherwise free the
3503 existing pattern set and replace it */
3504 if (psn == NPatternSets) {
3505 PatternSets[NPatternSets++] = patSet;
3506 oldNum = 0;
3507 } else {
3508 oldNum = PatternSets[psn]->nPatterns;
3509 freePatternSet(PatternSets[psn]);
3510 PatternSets[psn] = patSet;
3513 /* Find windows that are currently using this pattern set and
3514 re-do the highlighting */
3515 for (window = WindowList; window != NULL; window = window->next) {
3516 if (patSet->nPatterns > 0) {
3517 if (window->languageMode != PLAIN_LANGUAGE_MODE
3518 && 0 == strcmp(LanguageModeName(window->languageMode),
3519 patSet->languageMode)) {
3520 /* The user worked on the current document's language mode, so
3521 we have to make some changes immediately. For inactive
3522 modes, the changes will be activated on activation. */
3523 if (oldNum == 0) {
3524 /* Highlighting (including menu entry) was deactivated in
3525 this function or in preferences.c::reapplyLanguageMode()
3526 if the old set had no patterns, so reactivate menu entry. */
3527 if (IsTopDocument(window)) {
3528 XtSetSensitive(window->highlightItem, True);
3531 /* Reactivate highlighting if it's default */
3532 window->highlightSyntax = GetPrefHighlightSyntax();
3535 if (window->highlightSyntax) {
3536 StopHighlighting(window);
3537 if (IsTopDocument(window)) {
3538 XtSetSensitive(window->highlightItem, True);
3539 SetToggleButtonState(window, window->highlightItem,
3540 True, False);
3542 StartHighlighting(window, True);
3545 } else {
3546 /* No pattern in pattern set. This will probably not happen much,
3547 but you never know. */
3548 StopHighlighting(window);
3549 window->highlightSyntax = False;
3551 if (IsTopDocument(window)) {
3552 XtSetSensitive(window->highlightItem, False);
3553 SetToggleButtonState(window, window->highlightItem, False, False);
3558 /* Note that preferences have been changed */
3559 MarkPrefsChanged();
3561 return True;
3565 ** Get the current information that the user has entered in the syntax
3566 ** highlighting dialog. Return NULL if the data is currently invalid
3568 static patternSet *getDialogPatternSet(void)
3570 int i, lineContext, charContext;
3571 patternSet *patSet;
3573 /* Get the current contents of the "patterns" dialog fields */
3574 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3575 return NULL;
3577 /* Get the line and character context values */
3578 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3579 "context lines", True) != TEXT_READ_OK)
3580 return NULL;
3581 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3582 "context lines", True) != TEXT_READ_OK)
3583 return NULL;
3585 /* Allocate a new pattern set structure and copy the fields read from the
3586 dialog, including the modified pattern list into it */
3587 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3588 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3589 patSet->lineContext = lineContext;
3590 patSet->charContext = charContext;
3591 patSet->nPatterns = HighlightDialog.nPatterns;
3592 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3593 HighlightDialog.nPatterns);
3594 for (i=0; i<HighlightDialog.nPatterns; i++)
3595 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3596 return patSet;
3600 ** Return True if "patSet1" and "patSet2" differ
3602 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3604 int i;
3605 highlightPattern *pat1, *pat2;
3607 if (patSet1->lineContext != patSet2->lineContext)
3608 return True;
3609 if (patSet1->charContext != patSet2->charContext)
3610 return True;
3611 if (patSet1->nPatterns != patSet2->nPatterns)
3612 return True;
3613 for (i=0; i<patSet2->nPatterns; i++) {
3614 pat1 = &patSet1->patterns[i];
3615 pat2 = &patSet2->patterns[i];
3616 if (pat1->flags != pat2->flags)
3617 return True;
3618 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3619 return True;
3620 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3621 return True;
3622 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3623 return True;
3624 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3625 return True;
3626 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3627 return True;
3628 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3629 return True;
3631 return False;
3635 ** Copy a highlight pattern data structure and all of the allocated data
3636 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3637 ** otherwise allocate a new highlightPattern structure and return it as the
3638 ** function value.
3640 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3641 highlightPattern *copyTo)
3643 highlightPattern *newPat;
3645 if (copyTo == NULL)
3646 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3647 else
3648 newPat = copyTo;
3649 newPat->name = XtNewString(pat->name);
3650 newPat->startRE = XtNewString(pat->startRE);
3651 newPat->endRE = XtNewString(pat->endRE);
3652 newPat->errorRE = XtNewString(pat->errorRE);
3653 newPat->style = XtNewString(pat->style);
3654 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3655 newPat->flags = pat->flags;
3656 return newPat;
3660 ** Free the allocated memory contained in a highlightPattern data structure
3661 ** If "freeStruct" is true, free the structure itself as well.
3663 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3665 XtFree(pat->name);
3666 XtFree((char*) pat->startRE);
3667 XtFree((char*) pat->endRE);
3668 XtFree((char*) pat->errorRE);
3669 XtFree((char*) pat->style);
3670 XtFree((char*) pat->subPatternOf);
3671 if (freeStruct)
3672 XtFree((char *)pat);
3676 ** Free the allocated memory contained in a patternSet data structure
3677 ** If "freeStruct" is true, free the structure itself as well.
3679 static void freePatternSet(patternSet *p)
3681 int i;
3683 for (i=0; i<p->nPatterns; i++)
3684 freePatternSrc(&p->patterns[i], False);
3685 XtFree(p->languageMode);
3686 XtFree((char *)p->patterns);
3687 XtFree((char *)p);
3690 #if 0
3692 ** Free the allocated memory contained in a patternSet data structure
3693 ** If "freeStruct" is true, free the structure itself as well.
3695 static int lookupNamedPattern(patternSet *p, char *patternName)
3697 int i;
3699 for (i=0; i<p->nPatterns; i++)
3700 if (strcmp(p->patterns[i].name, patternName))
3701 return i;
3702 return -1;
3704 #endif
3707 ** Find the index into the HighlightStyles array corresponding to "styleName".
3708 ** If styleName is not found, return -1.
3710 static int lookupNamedStyle(const char *styleName)
3712 int i;
3714 for (i = 0; i < NHighlightStyles; i++)
3716 if (!strcmp(styleName, HighlightStyles[i]->name))
3718 return i;
3722 return -1;
3726 ** Returns a unique number of a given style name
3728 int IndexOfNamedStyle(const char *styleName)
3730 return lookupNamedStyle(styleName);
3734 ** Write the string representation of int "i" to a static area, and
3735 ** return a pointer to it.
3737 static char *intToStr(int i)
3739 static char outBuf[12];
3741 sprintf(outBuf, "%d", i);
3742 return outBuf;