Commit SF patch #970491: Forbid deletion of the "Plain" Text
[nedit.git] / source / highlightData.c
blob38c5804b8b66dfec9938732fe5d41075313188f4
1 static const char CVSID[] = "$Id: highlightData.c,v 1.62 2004/06/10 17:01:26 edg Exp $";
2 /*******************************************************************************
3 * *
4 * highlightData.c -- Maintain, and allow user to edit, highlight pattern list *
5 * used for syntax highlighting *
6 * *
7 * Copyright (C) 1999 Mark Edel *
8 * *
9 * This is free software; you can redistribute it and/or modify it under the *
10 * terms of the GNU General Public License as published by the Free Software *
11 * Foundation; either version 2 of the License, or (at your option) any later *
12 * version. *
13 * *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
17 * for more details. *
18 * *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
22 * *
23 * Nirvana Text Editor *
24 * April, 1997 *
25 * *
26 * Written by Mark Edel *
27 * *
28 *******************************************************************************/
30 #ifdef HAVE_CONFIG_H
31 #include "../config.h"
32 #endif
34 #include "highlightData.h"
35 #include "textBuf.h"
36 #include "nedit.h"
37 #include "highlight.h"
38 #include "regularExp.h"
39 #include "preferences.h"
40 #include "help.h"
41 #include "window.h"
42 #include "regexConvert.h"
43 #include "../util/misc.h"
44 #include "../util/DialogF.h"
45 #include "../util/managedList.h"
47 #include <stdio.h>
48 #include <string.h>
49 #include <limits.h>
50 #ifdef VMS
51 #include "../util/VMSparam.h"
52 #else
53 #ifndef __MVS__
54 #include <sys/param.h>
55 #endif
56 #endif /*VMS*/
58 #include <Xm/Xm.h>
59 #include <Xm/Form.h>
60 #include <Xm/Frame.h>
61 #include <Xm/Text.h>
62 #include <Xm/LabelG.h>
63 #include <Xm/PushB.h>
64 #include <Xm/ToggleB.h>
65 #include <Xm/RowColumn.h>
66 #include <Xm/SeparatoG.h>
68 #ifdef HAVE_DEBUG_H
69 #include "../debug.h"
70 #endif
72 /* Maximum allowed number of styles (also limited by representation of
73 styles as a byte - 'b') */
74 #define MAX_HIGHLIGHT_STYLES 128
76 /* Maximum number of patterns allowed in a pattern set (regular expression
77 limitations are probably much more restrictive). */
78 #define MAX_PATTERNS 127
80 /* Names for the fonts that can be used for syntax highlighting */
81 #define N_FONT_TYPES 4
82 enum fontTypes {PLAIN_FONT, ITALIC_FONT, BOLD_FONT, BOLD_ITALIC_FONT};
83 static const char *FontTypeNames[N_FONT_TYPES] =
84 {"Plain", "Italic", "Bold", "Bold Italic"};
86 typedef struct {
87 char *name;
88 char *color;
89 char *bgColor;
90 int font;
91 } highlightStyleRec;
93 static int styleError(const char *stringStart, const char *stoppedAt,
94 const char *message);
95 #if 0
96 static int lookupNamedPattern(patternSet *p, char *patternName);
97 #endif
98 static int lookupNamedStyle(const char *styleName);
99 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
100 char **errMsg, int *nPatterns);
101 static int readHighlightPattern(char **inPtr, char **errMsg,
102 highlightPattern *pattern);
103 static patternSet *readDefaultPatternSet(const char *langModeName);
104 static int isDefaultPatternSet(patternSet *patSet);
105 static patternSet *readPatternSet(char **inPtr, int convertOld);
106 static patternSet *highlightError(char *stringStart, char *stoppedAt,
107 const char *message);
108 static char *intToStr(int i);
109 static char *createPatternsString(patternSet *patSet, char *indentStr);
110 static void setStyleByName(const char *style);
111 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData);
112 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData);
113 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData);
114 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData);
115 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs);
116 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
117 void *cbArg);
118 static void hsSetDisplayedCB(void *item, void *cbArg);
119 static highlightStyleRec *readHSDialogFields(int silent);
120 static void hsFreeItemCB(void *item);
121 static void freeHighlightStyleRec(highlightStyleRec *hs);
122 static int hsDialogEmpty(void);
123 static int updateHSList(void);
124 static void updateHighlightStyleMenu(void);
125 static void convertOldPatternSet(patternSet *patSet);
126 static void convertPatternExpr(char **patternRE, char *patSetName,
127 char *patName, int isSubsExpr);
128 static Widget createHighlightStylesMenu(Widget parent);
129 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData);
130 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData);
131 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData);
132 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData);
133 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData);
134 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData);
135 static int checkHighlightDialogData(void);
136 static void updateLabels(void);
137 static void okCB(Widget w, XtPointer clientData, XtPointer callData);
138 static void applyCB(Widget w, XtPointer clientData, XtPointer callData);
139 static void checkCB(Widget w, XtPointer clientData, XtPointer callData);
140 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData);
141 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData);
142 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData);
143 static void helpCB(Widget w, XtPointer clientData, XtPointer callData);
144 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
145 void *cbArg);
146 static void setDisplayedCB(void *item, void *cbArg);
147 static void setStyleMenu(const char *styleName);
148 static highlightPattern *readDialogFields(int silent);
149 static int dialogEmpty(void);
150 static int updatePatternSet(void);
151 static patternSet *getDialogPatternSet(void);
152 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2);
153 static highlightPattern *copyPatternSrc(highlightPattern *pat,
154 highlightPattern *copyTo);
155 static void freeNonNull(void *ptr);
156 static void freeItemCB(void *item);
157 static void freePatternSrc(highlightPattern *pat, int freeStruct);
158 static void freePatternSet(patternSet *p);
160 /* list of available highlight styles */
161 static int NHighlightStyles = 0;
162 static highlightStyleRec *HighlightStyles[MAX_HIGHLIGHT_STYLES];
164 /* Highlight styles dialog information */
165 static struct {
166 Widget shell;
167 Widget nameW;
168 Widget colorW;
169 Widget bgColorW;
170 Widget recogW;
171 Widget plainW, boldW, italicW, boldItalicW;
172 Widget managedListW;
173 highlightStyleRec **highlightStyleList;
174 int nHighlightStyles;
175 } HSDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0};
177 /* Highlight dialog information */
178 static struct {
179 Widget shell;
180 Widget lmOptMenu;
181 Widget lmPulldown;
182 Widget styleOptMenu;
183 Widget stylePulldown;
184 Widget nameW;
185 Widget topLevelW;
186 Widget deferredW;
187 Widget subPatW;
188 Widget colorPatW;
189 Widget simpleW;
190 Widget rangeW;
191 Widget parentW;
192 Widget startW;
193 Widget endW;
194 Widget errorW;
195 Widget lineContextW;
196 Widget charContextW;
197 Widget managedListW;
198 Widget parentLbl;
199 Widget startLbl;
200 Widget endLbl;
201 Widget errorLbl;
202 Widget matchLbl;
203 char *langModeName;
204 int nPatterns;
205 highlightPattern **patterns;
206 } HighlightDialog = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
207 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
208 NULL, NULL, NULL, NULL, NULL, 0, NULL };
210 /* Pattern sources loaded from the .nedit file or set by the user */
211 static int NPatternSets = 0;
212 static patternSet *PatternSets[MAX_LANGUAGE_MODES];
214 static char *DefaultPatternSets[] = {
215 "Ada:1:0{\n\
216 Comments:\"--\":\"$\"::Comment::\n\
217 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
218 Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\
219 Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
220 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
221 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
222 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
223 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
224 Withs Use:\"(?#Make \\s work across newlines)(?n(?iwith|use)(?#Leading W/S)\\s+(?#First package name)(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*)(?#Additional package names [optional])(?:\\s*,\\s*(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*))*(?#Trailing W/S)\\s*;)+\":::Preprocessor::\n\
225 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
226 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
227 Reserved Words:\"(?i(?=[a-gil-pr-uwx]))<(?iabort|abs|accept|access|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)>\":::Keyword::D\n\
228 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
229 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
230 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
231 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
232 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
233 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
234 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
235 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
236 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
237 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
238 "Awk:2:0{\n\
239 Comment:\"#\":\"$\"::Comment::\n\
240 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
241 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
242 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
243 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
244 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
245 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
246 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
247 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
248 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
249 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
250 Numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
251 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
252 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
253 newline escape:\"\\\\$\":::Preprocessor1::\n\
254 Function:\"function\":::Preprocessor1::D}",
255 "C++:1:0{\n\
256 comment:\"/\\*\":\"\\*/\"::Comment::\n\
257 cplus comment:\"//\":\"$\"::Comment::\n\
258 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
259 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
260 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
261 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
262 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
263 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
264 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
265 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
266 numeric constant:\"(?<!\\Y)(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
267 storage keyword:\"<(?:class|typename|typeid|template|friend|virtual|inline|explicit|operator|public|private|protected|const|extern|auto|register|static|mutable|unsigned|signed|volatile|char|double|float|int|long|short|bool|wchar_t|void|typedef|struct|union|enum|asm|export)>\":::Storage Type::D\n\
268 keyword:\"<(?:new|delete|this|return|goto|if|else|case|default|switch|break|continue|while|do|for|try|catch|throw|sizeof|true|false|namespace|using|dynamic_cast|static_cast|reinterpret_cast|const_cast)>\":::Keyword::D\n\
269 braces:\"[{}]\":::Keyword::D}",
270 "C:1:0 {\n\
271 comment:\"/\\*\":\"\\*/\"::Comment::\n\
272 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
273 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
274 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
275 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
276 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
277 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
278 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
279 numeric constant:\"(?<!\\Y)(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
280 storage keyword:\"<(?:const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
281 keyword:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
282 braces:\"[{}]\":::Keyword::D}",
283 "CSS:1:0{\n\
284 comment:\"/\\*\":\"\\*/\"::Comment::\n\
285 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
286 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
287 import url:\"\\1\":::Subroutine1:import rule:C\n\
288 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
289 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
290 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
291 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
292 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
293 charset name:\"\\1\":::String:charset rule:C\n\
294 font-face rule:\"@font-face\":::Preprocessor::\n\
295 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
296 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
297 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
298 declaration:\"\\{\":\"\\}\"::Warning::\n\
299 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
300 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
301 property:\"<(azimuth|background(-(attachment|color|image|position|repeat))?|border(-(bottom(-(color|style|width))?|-(color|style|width)|collapse|color|left(-(color|style|width))?|right(-(color|style|width))?|spacing|style|top(-(color|style|width))?|width))?|bottom|caption-side|clear|clip|color|content|counter-(increment|reset)|cue(-(after|before))?|cursor|direction|display|elevation|empty-cells|float|font(-(family|size|size-adjust|stretch|style|variant|weight))?|height|left|letter-spacing|line-height|list-style(-(image|position|type))?|margin(-(bottom|left|right|top))?|marker-offset|marks|max-(height|width)|min-(height|width)|orphans|outline(-(color|style|width))?|overflow|padding(-(bottom|left|right|top))?|page(-break-(after|before|inside))?|pause(-(after|before))?|pitch(-range)?|play-during|position|quotes|richness|right|size|speak(-(header|numeral|punctuation))?|speech-rate|stress|table-layout|text(-(align|decoration|indent|shadow|transform))|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index)>\":::Identifier1:declaration:\n\
302 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
303 value delims:\"&\":\"&\"::Keyword:value:C\n\
304 value modifier:\"!important|inherit\":::Keyword:value:\n\
305 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
306 clip value:\"<rect\\(\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*\\)\":::Subroutine:value:\n\
307 function value:\"<attr\\([^)]+\\)|<counter\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)|<counters\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*,\\s*(\"\"[^\"\"]*\"\"|'[^']*')\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)\":::Subroutine:value:\n\
308 color value:\"(#[A-Fa-f\\d]{6}>|#[A-Fa-f\\d]{3}>|rgb\\(([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\)|rgb\\(([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\)|<(?iaqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)>|<transparent>)\":::Text Arg2:value:\n\
309 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
310 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
311 named value:\"<(100|200|300|400|500|600|700|800|900|above|absolute|always|armenian|auto|avoid|baseline|behind|below|bidi-override|blink|block|bold|bolder|both|bottom|capitalize|caption|center(?:-left|-right)?|child|circle|cjk-ideographic|close-quote|code|collapse|compact|condensed|continuous|crop|cross(?:hair)?|cursive|dashed|decimal(?:-leading-zero)?|default|digits|disc|dotted|double|e-resize|embed|expanded|extra(?:-condensed|-expanded)|fantasy|far(?:-left|-right)|fast(?:er)?|female|fixed|georgian|groove|hebrew|help|hidden|hide|high(?:er)?|hiragana(?:-iroha)?|icon|inherit|inline(?:-table)?|inset|inside|italic|justify|katakana(?:-iroha)?|landscape|larger?|left(?:-side|wards)?|level|lighter|line-through|list-item|loud|low(?:er(?:-alpha|-greek|-latin|-roman|case)?)?|ltr|male|marker|medium|menu|message-box|middle|mix|monospace|move|n-resize|narrower|ne-resize|no(?:-close-quote|-open-quote|-repeat)|none|normal|nowrap|nw-resize|oblique|once|open-quote|out(?:set|side)|overline|pointer|portrait|pre|relative|repeat(?:-x|-y)?|ridge|right(?:-side|wards)?|rtl|run-in|s-resize|sans-serif|scroll|se-resize|semi(?:-condensed|-expanded)|separate|serif|show|silent|slow(?:er)?|small(?:-caps|-caption|er)?|soft|solid|spell-out|square|static|status-bar|sub|super|sw-resize|table(?:-caption|-cell|-column(?:-group)?|-footer-group|-header-group|-row(?:-group)?)?|text(?:-bottom|-top)?|thick|thin|top|ultra(?:-condensed|-expanded)|underline|upper(?:-alpha|-latin|-roman|case)|visible|w-resize|wait|wider|x-(?:fast|high|large|loud|low|slow|small|soft)|xx-(large|small))>\":::Text Arg2:value:\n\
312 integer value:\"<\\d+>\":::Numeric Const:value:\n\
313 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
314 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
315 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
316 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
317 sq string value:\"'\":\"'\":\"\\n\":String:value:\n\
318 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
319 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
320 operators:\"[,/]\":::Keyword:value:\n\
321 selector id:\"#[-\\w]+>\":::Pointer::\n\
322 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
323 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
324 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
325 selector operators:\"[,>*+]\":::Keyword::\n\
326 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
327 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
328 free text:\".\":::Warning::\n\
329 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
330 "Csh:1:0{\n\
331 Comment:\"#\":\"$\"::Comment::\n\
332 Single Quote String:\"'\":\"([^\\\\]'|^')\":\"\\n\":String::\n\
333 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
334 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
335 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
336 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
337 Variable Ref:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1::\n\
338 Variable in String:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1:Double Quote String:\n\
339 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
340 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
341 Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alias|bg|break|breaksw|case|cd|chdir|continue|default|echo|eval|exec|exit|fg|goto|glob|hashstat|history|jobs|kill|limit|login|logout|nohup|notify|nice|onintr|popd|pushd|printenv|read|rehash|repeat|set|setenv|shift|source|suspend|time|umask|unalias|unhash|unlimit|unset|unsetenv|wait)>\":::Keyword::D\n\
342 Tcsh Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alloc|bindkey|builtins|complete|echotc|filetest|hup|log|sched|settc|setty|stop|telltc|uncomplete|where|which|dirs|ls-F)>\":::Keyword::D\n\
343 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
344 "Fortran:2:0{\n\
345 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
346 Bang Comment:\"!\":\"$\"::Comment::\n\
347 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
348 String:\"'\":\"'\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
349 Keywords:\"<(?iaccept|automatic|backspace|block|call|close|common|continue|data|decode|delete|dimension|do|else|elseif|encode|enddo|end *file|endif|end|entry|equivalence|exit|external|format|function|go *to|if|implicit|include|inquire|intrinsic|logical|map|none|on|open|parameter|pause|pointer|print|program|read|record|return|rewind|save|static|stop|structure|subroutine|system|then|type|union|unlock|virtual|volatile|while|write)>\":::Keyword::D\n\
350 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
351 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
352 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
353 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
354 "Java:3:0{\n\
355 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
356 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
357 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
358 comment:\"/\\*\":\"\\*/\"::Comment::\n\
359 cplus comment:\"//\":\"$\"::Comment::\n\
360 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
361 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])\":::String1:string:\n\
362 single quoted:\"'\":\"'\":\"\\n\":String::\n\
363 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])(?=')\":::String1:single quoted:\n\
364 single quoted char:\".(?=')\":::String:single quoted:\n\
365 single quoted error:\".\":::Flag:single quoted:\n\
366 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
367 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
368 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
369 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
370 classdef:\"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
371 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
372 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
373 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
374 extends comma:\",\":::Keyword:extends:\n\
375 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
376 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
377 extends error:\".\":::Flag:extends:\n\
378 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
379 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
380 impl_throw comma:\",\":::Keyword:impl_throw:\n\
381 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
382 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
383 impl_throw error:\".\":::Flag:impl_throw:\n\
384 case:\"<case>\":\":\"::Label::\n\
385 case single quoted:\"'\\\\?[^']'\":::Character Const:case:\n\
386 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
387 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
388 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
389 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
390 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
391 case error:\".\":::Flag:case:\n\
392 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
393 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
394 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
395 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
396 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
397 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
398 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
399 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
400 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
401 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
402 keyword - modifiers:\"<(?:abstract|final|native|private|protected|public|static|transient|synchronized|volatile)>\":::Keyword::\n\
403 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
404 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
405 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
406 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
407 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
408 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
409 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
410 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
411 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
412 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
413 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
414 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
415 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
416 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
417 error:\".\":::Flag::D}",
418 #ifndef VMS
419 /* The VAX C compiler cannot compile this definition */
420 "JavaScript:1:0{\n\
421 DSComment:\"//\":\"$\"::Comment::\n\
422 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
423 DQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|#[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]\":::Text Arg1:DQStrings:\n\
424 SQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|(#)[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-F-af0-9]\":::Text Arg1:SQStrings:\n\
425 Numeric:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::\n\
426 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
427 Braces:\"[{}]\":::Keyword::\n\
428 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
429 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
430 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
431 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
432 Parentheses:\"[\\(\\)]\":::Plain::\n\
433 BuiltInObjectType:\"<(anchor|Applet|Area|Array|button|checkbox|Date|document|elements|FileUpload|form|frame|Function|hidden|history|Image|link|location|Math|navigator|Option|password|Plugin|radio|reset|select|string|submit|text|textarea|window)>\":::Storage Type::\n\
434 SQStrings:\"'\":\"'\":\"\\n\":String::\n\
435 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
436 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
437 PredefinedMethods:\"<(abs|acos|alert|anchor|asin|atan|atan2|back|big|blink|blur|bold|ceil|charAt|clear|clearTimeout|click|close|confirm|cos|escape|eval|exp|fixed|floor|focus|fontcolor|fontsize|forward|getDate|getDay|getHours|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getYear|go|indexOf|isNaN|italics|javaEnabled|join|lastIndexOf|link|log|max|min|open|parse|parseFloat|parseInt|pow|prompt|random|reload|replace|reset|reverse|round|scroll|select|setDate|setHours|setMinutes|setMonth|setSeconds|setTimeout|setTime|setYear|sin|small|sort|split|sqrt|strike|sub|submit|substring|sup|taint|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|unescape|untaint|UTC|write|writeln)>\":::Keyword::\n\
438 Properties:\"<(action|alinkColor|anchors|appCodeName|appName|appVersion|bgColor|border|checked|complete|cookie|defaultChecked|defaultSelected|defaultStatus|defaultValue|description|E|elements|enabledPlugin|encoding|fgColor|filename|forms|frames|hash|height|host|hostname|href|hspace|index|lastModified|length|linkColor|links|LN2|LN10|LOG2E|LOG10E|lowsrc|method|name|opener|options|parent|pathname|PI|port|protocol|prototype|referrer|search|selected|selectedIndex|self|SQRT1_2|SQRT2|src|status|target|text|title|top|type|URL|userAgent|value|vlinkColor|vspace|width|window)>\":::Storage Type::\n\
439 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
440 #endif /*VMS*/
441 "LaTeX:1:0{\n\
442 Comment:\"%\":\"$\"::Text Comment::\n\
443 Parameter:\"#[0-9]*\":::Text Arg::\n\
444 Special Chars:\"[{}&]\":::Keyword::\n\
445 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
446 Super Sub 1 Char:\"(?:\\^|_)(?:\\\\\\l+|#\\d|[^{\\\\])\":::Text Arg2::\n\
447 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
448 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
449 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
450 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
451 Inline Math:\"(?<!#\\d)(?:\\$|\\\\\\()\":\"\\$|\\\\\\)\":\"\\\\\\(|(?n[^\\\\]%)\":LaTeX Math::\n\
452 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
453 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
454 No Arg Command:\"\\\\(?:left|right)[\\[\\]{}()]\":::Text Key::\n\
455 Command:\"[_^]|[\\\\@](?:a'|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_='`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
456 Cmd Brace Args:\"\\{\":\"}\":\"(?<=^%)|\\\\]|\\$\\$|\\\\end\\{equation\\}\":Text Arg2:Command:\n\
457 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
458 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
459 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
460 Cmd Bracket Args:\"\\[\":\"\\]\":\"$|\\\\\\]\":Text Arg2:Command:\n\
461 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
462 Sub Cmd Bracket Args Esc:\"\\\\\\}\":::Plain:Sub Cmd Bracket Args:\n\
463 Sub Cmd Bracket Args:\"\\{\":\"\\}\":\"$|\\\\\\]\":Preprocessor1:Cmd Bracket Args:\n\
464 Sub Command:\"(?:[_^]|(?:[\\\\@](?:[A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
465 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
466 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
467 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
468 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
469 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
470 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
471 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
472 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
473 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
474 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
475 "Lex:1:0{\n\
476 comment:\"/\\*\":\"\\*/\"::Comment::\n\
477 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
478 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
479 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
480 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
481 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
482 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
483 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
484 numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
485 storage keyword:\"<(const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
486 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
487 lex keyword:\"<(yylval|yytext|input|unput|output|lex_input|lex_output|yylex|yymore|yyless|yyin|yyout|yyleng|yywtext|yywleng|yyterminate|REJECT|ECHO|BEGIN|YY_NEW_FILE|yy_create_buffer|yy_switch_to_buffer|yy_delete_buffer|YY_CURRENT_BUFFER|YY_BUFFER_STATE|YY_DECL|YY_INPUT|yywrap|YY_USER_ACTION|YY_USER_INIT|YY_BREAK)>\":::Text Arg::D\n\
488 stdlib:\"<(BUFSIZ|CHAR_BIT|CHAR_MAX|CHAR_MIN|CLOCKS_PER_SEC|DBL_DIG|DBL_EPSILON|DBL_MANT_DIG|DBL_MAX|DBL_MAX_10_EXP|DBL_MAX_EXP|DBL_MIN|DBL_MIN_10_EXP|DBL_MIN_EXP|EDOM|EOF|ERANGE|EXIT_FAILURE|EXIT_SUCCESS|FILE|FILENAME_MAX|FLT_DIG|FLT_EPSILON|FLT_MANT_DIG|FLT_MAX|FLT_MAX_10_EXP|FLT_MAX_EXP|FLT_MIN|FLT_MIN_10_EXP|FLT_MIN_EXP|FLT_RADIX|FLT_ROUNDS|FOPEN_MAX|HUGE_VAL|INT_MAX|INT_MIN|LC_ALL|LC_COLLATE|LC_CTYPE|LC_MONETARY|LC_NUMERIC|LC_TIME|LDBL_DIG|LDBL_EPSILON|LDBL_MANT_DIG|LDBL_MAX|LDBL_MAX_10_EXP|LDBL_MAX_EXP|LDBL_MIN|LDBL_MIN_10_EXP|LDBL_MIN_EXP|LONG_MAX|LONG_MIN|L_tmpnam|MB_CUR_MAX|MB_LEN_MAX|NULL|RAND_MAX|SCHAR_MAX|SCHAR_MIN|SEEK_CUR|SEEK_END|SEEK_SET|SHRT_MAX|SHRT_MIN|SIGABRT|SIGFPE|SIGILL|SIGINT|SIGSEGV|SIGTERM|SIG_DFL|SIG_ERR|SIG_IGN|TMP_MAX|UCHAR_MAX|UINT_MAX|ULONG_MAX|USHRT_MAX|WCHAR_MAX|WCHAR_MIN|WEOF|_IOFBF|_IOLBF|_IONBF|abort|abs|acos|asctime|asin|assert|atan|atan2|atexit|atof|atoi|atol|bsearch|btowc|calloc|ceil|clearerr|clock|clock_t|cos|cosh|ctime|difftime|div|div_t|errno|exit|exp|fabs|fclose|feof|ferror|fflush|fgetc|fgetpos|fgets|fgetwc|fgetws|floor|fmod|fopen|fpos_t|fprintf|fputc|fputs|fputwc|fputws|fread|free|freopen|frexp|fscanf|fseek|fsetpos|ftell|fwide|fwprintf|fwrite|fwscanf|getc|getchar|getenv|gets|getwc|getwchar|gmtime|isalnum|isalpha|iscntrl|isdigit|isgraph|islower|isprint|ispunct|isspace|isupper|iswalnum|iswalpha|iswcntrl|iswctype|iswdigit|iswgraph|iswlower|iswprint|iswpunct|iswspace|iswupper|iswxdigit|isxdigit|jmp_buf|labs|lconv|ldexp|ldiv|ldiv_t|localeconv|localtime|log|log10|longjmp|malloc|mblen|mbrlen|mbrtowc|mbsinit|mbsrtowcs|mbstate_t|mbstowcs|mbtowc|memchr|memcmp|memcpy|memmove|memset|mktime|modf|offsetof|perror|pow|printf|ptrdiff_t|putc|puts|putwc|putwchar|qsort|raise|rand|realloc|remove|rename|rewind|scanf|setbuf|setjmp|setlocale|setvbuf|sig_atomic_t|signal|sin|sinh|size_t|sprintf|sqrt|srand|sscanf|stderr|stdin|stdout|strcat|strchr|strcmp|strcoll|strcpy|strcspn|strerror|strftime|strlen|strncat|strncmp|strncpy|stroul|strpbrk|strrchr|strspn|strstr|strtod|strtok|strtol|strxfrm|swprintf|swscanf|system|tan|tanh|time|time_t|tm|tmpfile|tmpnam|tolower|toupper|towctrans|towlower|towupper|ungetc|ungetwc|va_arg|va_end|va_list|va_start|vfwprintf|vprintf|vsprintf|vswprintf|vwprintf|wint_t|wmemchr|wmemcmp|wmemcpy|wmemmove|wmemset|wprintf|wscanf)>\":::Subroutine::D\n\
489 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
490 braces:\"[{}]\":::Keyword::D\n\
491 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
492 "Makefile:8:0{\n\
493 Comment:\"#\":\"$\"::Comment::\n\
494 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
495 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
496 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
497 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
498 Dependency Line:\"^( *| [ \\t]*)(.DEFAULT|.DELETE_ON_ERROR|.EXPORT_ALL_VARIABLES.IGNORE|.INTERMEDIATE|.PHONY|.POSIX|.PRECIOUS|.SECONDARY|.SILENT|.SUFFIXES)*(([A-Za-z0-9./$(){} _@^<*?%+-]*(\\\\\\n)){,8}[A-Za-z0-9./$(){} _@^<*?%+-]*)::?\":\"$|;\"::Text Key1::\n\
499 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
500 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
501 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
502 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
503 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
504 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
505 Continuation:\"\\\\$\":::Keyword::\n\
506 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
507 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
508 Escaped Dollar:\"\\$\\$\":::Comment::\n\
509 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
510 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
511 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
512 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
513 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
514 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
515 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
516 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
517 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
518 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
519 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
520 "Matlab:1:0{\n\
521 Comment:\"%\":\"$\"::Comment::\n\
522 Comment in Octave:\"#\":\"$\"::Plain::\n\
523 Keyword:\"<(break|clear|else|elseif|end|for|function|global|if|return|then|while)>\":::Keyword::\n\
524 Transpose:\"[\\w.]('+)\":::Plain::\n\
525 Paren transposed:\"\\)('+)\":::Keyword::\n\
526 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
527 Parentheses:\"[\\(\\)]\":::Keyword::\n\
528 Brackets transposed:\"\\]('+)\":::Text Key1::\n\
529 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
530 Brackets:\"[\\[\\]]\":::Text Key1::\n\
531 Braces transposed:\"\\}('+)\":::Text Arg::\n\
532 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
533 Braces:\"[\\{\\}]\":::Text Arg::\n\
534 String:\"'\":\"'\"::String::\n\
535 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
536 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
537 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
538 Shell command:\"!\":\"$\"::String1::\n\
539 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
540 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
541 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
542 Logical operators:\"~|&|\\|\":::Text Arg2::}",
543 "NEdit Macro:2:0{\n\
544 README:\"NEdit Macro syntax highlighting patterns, version 2.6, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
545 Comment:\"#\":\"$\"::Comment::\n\
546 Built-in Misc Vars:\"(?<!\\Y)\\$(?:active_pane|args|calltip_ID|column|cursor|display_width|empty_array|file_name|file_path|language_mode|line|locked|max_font_width|min_font_width|modified|n_display_lines|n_panes|rangeset_list|read_only|selection_(?:start|end|left|right)|server_name|text_length|top_line)>\":::Identifier::\n\
547 Built-in Pref Vars:\"(?<!\\Y)\\$(?:auto_indent|em_tab_dist|file_format|font_name|font_name_bold|font_name_bold_italic|font_name_italic|highlight_syntax|incremental_backup|incremental_search_line|make_backup_copy|match_syntax_based|overtype_mode|show_line_numbers|show_matching|statistics_line|tab_dist|use_tabs|wrap_margin|wrap_text)>\":::Identifier2::\n\
548 Built-in Special Vars:\"(?<!\\Y)\\$(?:[1-9]|list_dialog_button|n_args|read_status|search_end|shell_cmd_status|string_dialog_button|sub_sep)>\":::String1::\n\
549 Built-in Subrs:\"<(?:append_file|beep|calltip|clipboard_to_string|dialog|focus_window|get_character|get_pattern_(by_name|at_pos)|get_range|get_selection|get_style_(by_name|at_pos)|getenv|kill_calltip|length|list_dialog|max|min|rangeset_(?:add|create|destroy|get_by_name|includes|info|invert|range|set_color|set_mode|set_name|subtract)|read_file|replace_in_string|replace_range|replace_selection|replace_substring|search|search_string|select|select_rectangle|set_cursor_pos|set_language_mode|set_locked|shell_command|split|string_compare|string_dialog|string_to_clipboard|substring|t_print|tolower|toupper|valid_number|write_file)>\":::Subroutine::\n\
550 Menu Actions:\"<(?:new|open|open-dialog|open_dialog|open-selected|open_selected|close|save|save-as|save_as|save-as-dialog|save_as_dialog|revert-to-saved|revert_to_saved|revert_to_saved_dialog|include-file|include_file|include-file-dialog|include_file_dialog|load-macro-file|load_macro_file|load-macro-file-dialog|load_macro_file_dialog|load-tags-file|load_tags_file|load-tags-file-dialog|load_tags_file_dialog|unload_tags_file|load_tips_file|load_tips_file_dialog|unload_tips_file|print|print-selection|print_selection|exit|undo|redo|delete|select-all|select_all|shift-left|shift_left|shift-left-by-tab|shift_left_by_tab|shift-right|shift_right|shift-right-by-tab|shift_right_by_tab|find|find-dialog|find_dialog|find-again|find_again|find-selection|find_selection|find_incremental|start_incremental_find|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_again|replace_find|replace_find_same|replace_find_again|goto-line-number|goto_line_number|goto-line-number-dialog|goto_line_number_dialog|goto-selected|goto_selected|mark|mark-dialog|mark_dialog|goto-mark|goto_mark|goto-mark-dialog|goto_mark_dialog|match|select_to_matching|goto_matching|find-definition|find_definition|show_tip|split-window|split_window|close-pane|close_pane|uppercase|lowercase|fill-paragraph|fill_paragraph|control-code-dialog|control_code_dialog|filter-selection-dialog|filter_selection_dialog|filter-selection|filter_selection|execute-command|execute_command|execute-command-dialog|execute_command_dialog|execute-command-line|execute_command_line|shell-menu-command|shell_menu_command|macro-menu-command|macro_menu_command|bg_menu_command|post_window_bg_menu|beginning-of-selection|beginning_of_selection|end-of-selection|end_of_selection|repeat_macro|repeat_dialog|raise_window|focus_pane|set_statistics_line|set_incremental_search_line|set_show_line_numbers|set_auto_indent|set_wrap_text|set_wrap_margin|set_highlight_syntax|set_make_backup_copy|set_incremental_backup|set_show_matching|set_match_syntax_based|set_overtype_mode|set_locked|set_tab_dist|set_em_tab_dist|set_use_tabs|set_fonts|set_language_mode)(?=\\s*\\()\":::Subroutine::\n\
551 Text Actions:\"<(?:self-insert|self_insert|grab-focus|grab_focus|extend-adjust|extend_adjust|extend-start|extend_start|extend-end|extend_end|secondary-adjust|secondary_adjust|secondary-or-drag-adjust|secondary_or_drag_adjust|secondary-start|secondary_start|secondary-or-drag-start|secondary_or_drag_start|process-bdrag|process_bdrag|move-destination|move_destination|move-to|move_to|move-to-or-end-drag|move_to_or_end_drag|end_drag|copy-to|copy_to|copy-to-or-end-drag|copy_to_or_end_drag|exchange|process-cancel|process_cancel|paste-clipboard|paste_clipboard|copy-clipboard|copy_clipboard|cut-clipboard|cut_clipboard|copy-primary|copy_primary|cut-primary|cut_primary|newline|newline-and-indent|newline_and_indent|newline-no-indent|newline_no_indent|delete-selection|delete_selection|delete-previous-character|delete_previous_character|delete-next-character|delete_next_character|delete-previous-word|delete_previous_word|delete-next-word|delete_next_word|delete-to-start-of-line|delete_to_start_of_line|delete-to-end-of-line|delete_to_end_of_line|forward-character|forward_character|backward-character|backward_character|key-select|key_select|process-up|process_up|process-down|process_down|process-shift-up|process_shift_up|process-shift-down|process_shift_down|process-home|process_home|forward-word|forward_word|backward-word|backward_word|forward-paragraph|forward_paragraph|backward-paragraph|backward_paragraph|beginning-of-line|beginning_of_line|end-of-line|end_of_line|beginning-of-file|beginning_of_file|end-of-file|end_of_file|next-page|next_page|previous-page|previous_page|page-left|page_left|page-right|page_right|toggle-overstrike|toggle_overstrike|scroll-up|scroll_up|scroll-down|scroll_down|scroll_left|scroll_right|scroll-to-line|scroll_to_line|select-all|select_all|deselect-all|deselect_all|focusIn|focusOut|process-return|process_return|process-tab|process_tab|insert-string|insert_string|mouse_pan)>\":::Subroutine::\n\
552 Keyword:\"<(?:break|continue|define|delete|else|for|if|in|return|while)>\":::Keyword::\n\
553 Braces:\"[{}\\[\\]]\":::Keyword::\n\
554 Global Variable:\"\\$[A-Za-z0-9_]+\":::Identifier1::\n\
555 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
556 String Escape Char:\"\\\\(?:.|\\n)\":::Text Escape:String:\n\
557 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
558 Macro Definition:\"(?<=define)\\s+\\w+\":::Subroutine1::\n\
559 Custom Macro:\"\\w+(?=\\s*(?:\\\\\\n)?\\s*[\\(])\":::Subroutine1::\n\
560 Variables:\"\\w+\":::Identifier1::D}",
561 "Pascal:1:0{\n\
562 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
563 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
564 String:\"'\":\"'\":\"\\n\":String::D\n\
565 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
566 Parentheses:\"\\(|\\)\":::Keyword::D\n\
567 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
568 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
569 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
570 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
571 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
572 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
573 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
574 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
575 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
576 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
577 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
578 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
579 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
580 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
581 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
582 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
583 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
584 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
585 X Predefined Func:\"<(?iArg|Binding|Card|Cmplx|Date|Empty|Eq|Ge|Gt|Im|Index|LastPosition|Le|Length|Lt|Ne|Polar|Position|Re|SubStr|Time|Trim)>\":::Preprocessor1::D\n\
586 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
587 Assignment:\":=\":::Plain::D\n\
588 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
589 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
590 "Perl:2:0{\n\
591 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
592 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
593 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
594 dq here doc variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:dq here doc:\n\
595 dq here doc content:\".\":::String:dq here doc:\n\
596 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
597 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
598 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
599 dq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:dq string:\n\
600 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
601 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
602 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
603 gen dq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:gen dq string:\n\
604 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
605 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
606 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
607 sq here doc content:\".\":::String1:sq here doc:\n\
608 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
609 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
610 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
611 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
612 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
613 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
614 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
615 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
616 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
617 word list content:\".\":::String1:word list:\n\
618 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
619 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
620 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
621 bq here doc variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:bq here doc:\n\
622 bq here doc content:\".\":::String1:bq here doc:\n\
623 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
624 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
625 bq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:bq string:\n\
626 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
627 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
628 gen bq string variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:gen bq string:\n\
629 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
630 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
631 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
632 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
633 comment:\"#\":\"$\"::Comment::\n\
634 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
635 label identifier:\"\\2\\5\":::Label:label:C\n\
636 label keyword:\"\\3\\6\":::Keyword:label:C\n\
637 handle:\"(\\<)[A-Z_]+(\\>)|(bind|binmode|close(?:dir)?|connect|eof|fcntl|fileno|flock|getc|getpeername|getsockname|getsockopt|ioctl|listen|open(?:dir)?|recv|read(?:dir)?|rewinddir|seek(?:dir)?|send|setsockopt|shutdown|socket|sysopen|sysread|sysseek|syswrite|tell(?:dir)?|write)>\\s*(\\(?)\\s*[A-Z_]+>|<(accept|pipe|socketpair)>\\s*(\\(?)\\s*[A-Z_]+\\s*(,)\\s*[A-Z_]+>|(print|printf|select)>\\s*(\\(?)\\s*[A-Z_]+>(?!\\s*,)\":::Storage Type::\n\
638 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
639 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
640 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
641 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
642 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
643 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
644 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
645 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
646 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
647 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
648 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
649 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
650 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
651 variables:\"\\$([-_./,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1::\n\
652 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
653 library functions:\"<((?# arithmetic functions)abs|atan2|cos|exp|int|log|rand|sin|sqrt|srand|time|(?# conversion functions)chr|gmtime|hex|localtime|oct|ord|vec|(?# structure conversion)pack|unpack|(?# string functions)chomp|chop|crypt|eval(?=\\s*[^{])|index|lc|lcfirst|length|quotemeta|rindex|substr|uc|ucfirst|(?# array and hash functions)delete|each|exists|grep|join|keys|map|pop|push|reverse|scalar|shift|sort|splice|split|unshift|values|(?# search and replace functions)pos|study|(?# file operations)chmod|chown|link|lstat|mkdir|readlink|rename|rmdir|stat|symlink|truncate|unlink|utime|(?# input/output)binmode|close|eof|fcntl|fileno|flock|getc|ioctl|open|pipe|print|printf|read|readline|readpipe|seek|select|sprintf|sysopen|sysread|sysseek|syswrite|tell|(?# formats)formline|write|(?# tying variables)tie|tied|untie|(?# directory reading routines)closedir|opendir|readdir|rewinddir|seekdir|telldir|(?# system interaction)alarm|chdir|chroot|die|exec|exit|fork|getlogin|getpgrp|getppid|getpriority|glob|kill|setpgrp|setpriority|sleep|syscall|system|times|umask|wait|waitpid|warn|(?# networking)accept|bind|connect|getpeername|getsockname|getsockopt|listen|recv|send|setsockopt|shutdown|socket|socketpair|(?# system V ipc)msgctl|msgget|msgrcv|msgsnd|semctl|semget|semop|shmctl|shmget|shmread|shmwrite|(?# miscellaneous)defined|do|dump|eval(?=\\s*\\{)|local|my|ref|reset|undef|(?# informations from system databases)endpwent|getpwent|getpwnam|getpwuid|setpwent|endgrent|getgrent|getgrgid|getgrnam|setgrent|endnetent|getnetbyaddr|getnetbyname|getnetent|setnetent|endhostend|gethostbyaddr|gethostbyname|gethostent|sethostent|endservent|getservbyname|getservbyport|getservent|setservent|endprotoent|getprotobyname|getprotobynumber|getprotoent|setprotoent)>\":::Subroutine::\n\
654 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
655 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
656 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
657 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
658 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
659 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
660 end token delim:\"&\":::Preprocessor:end token:C\n\
661 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
662 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
663 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
664 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
665 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
666 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
667 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
668 re match variables:\"\\$([-_.,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:re match:\n\
669 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
670 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
671 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
672 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
673 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
674 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
675 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
676 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
677 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
678 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
679 re sub variables:\"\\$([-_.,\"\"\\\\*?#;!@$<>(%=~^|&`'+[\\]]|:(?!:)|\\^[ADEFHILMOPSTWX]|ARGV|\\d{1,2})|(@|\\$#)(ARGV|EXPORT|EXPORT_OK|F|INC|ISA|_)>|%(ENV|EXPORT_TAGS|INC|SIG)>|(\\$#?|@|%)(::)?[\\l_](\\w|::(?=\\w))*|(\\$#?|@|%)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|(\\$|@|%)(?=\\{)\":::Identifier1:re sub:\n\
680 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
681 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
682 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
683 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
684 "PostScript:1:0{\n\
685 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
686 Comment:\"%\":\"$\"::Comment::\n\
687 string:\"\\(\":\"\\)\"::String::\n\
688 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
689 string2:\"\\(\":\"\\)\"::String:string:\n\
690 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
691 string3:\"\\(\":\"\\)\"::String:string2:\n\
692 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
693 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
694 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
695 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
696 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
697 Number:\"(?<!\\Y)((([2-9]|[1-2][0-9]|3[0-6])#[0-9a-zA-Z]*)|(((\\+|-)?[0-9]+\\.?[0-9]*)|((\\+|-)?\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(?!\\Y)\":::Numeric Const::D\n\
698 Array:\"[\\[\\]]\":::Storage Type::D\n\
699 Procedure:\"[{}]\":::Subroutine::D\n\
700 Operator1:\"(?<!\\Y)(=|==|abs|add|aload|anchorsearch|and|arc|arcn|arcto|array|ashow|astore|atan|awidthshow|begin|bind|bitshift|bytesavailable|cachestatus|ceiling|charpath|clear|cleardictstack|cleartomark|clip|clippath|closefile|closepath|concat|concatmatrix|copy|copypage|cos|count|countdictstack|countexecstack|counttomark|currentdash|currentdict|currentfile|currentflat|currentfont|currentgray|currenthsbcolor|currentlinecap|currentlinejoin|currentlinewidth|currentmatrix|currentmiterlimit|currentpoint|currentrgbcolor|currentscreen|currenttransfer|curveto|cvi|cvlit|cvn|cvr|cvrs|cvs|cvx|def|defaultmatrix|definefont|dict|dictstack|div|dtransform|dup|echo|eexec|end|eoclip|eofill|eq|erasepage|errordict|exch|exec|execstack|executeonly|executive|exit|exitserver|exp|false|file|fill|findfont|flattenpath|floor|flush|flushfile|FontDirectory|for|forall|ge|get|getinterval|grestore|grestoreall|gsave|gt|handleerror|identmatrix|idiv|idtransform|if|ifelse|image|imagemask|index|initclip|initgraphics|initmatrix|internaldict|invertmatrix|itransform|known|kshow|le|length|lineto|ln|load|log|loop|lt|makefont|mark|matrix|maxlength|mod|moveto|mul|ne|neg|newpath|noaccess|not|null|nulldevice|or|pathbbox|pathforall|pop|print|prompt|pstack|put|putinterval|quit|rand|rcheck|rcurveto|read|readhexstring|readline|readonly|readstring|repeat|resetfile|restore|reversepath|rlineto|rmoveto|roll|rotate|round|rrand|run|save|scale|scalefont|search|serverdict|setcachedevice|setcachelimit|setcharwidth|setdash|setflat|setfont|setgray|sethsbcolor|setlinecap|setlinejoin|setlinewidth|setmatrix|setmiterlimit|setrgbcolor|setscreen|settransfer|show|showpage|sin|sqrt|srand|stack|StandardEncoding|start|status|statusdict|stop|stopped|store|string|stringwidth|stroke|strokepath|sub|systemdict|token|transform|translate|true|truncate|type|userdict|usertime|version|vmstatus|wcheck|where|widthshow|write|writehexstring|writestring|xcheck|xor)(?!\\Y)\":::Keyword::D\n\
701 Operator2:\"<(arct|colorimage|cshow|currentblackgeneration|currentcacheparams|currentcmykcolor|currentcolor|currentcolorrendering|currentcolorscreen|currentcolorspace|currentcolortransfer|currentdevparams|currentglobal|currentgstate|currenthalftone|currentobjectformat|currentoverprint|currentpacking|currentpagedevice|currentshared|currentstrokeadjust|currentsystemparams|currentundercolorremoval|currentuserparams|defineresource|defineuserobject|deletefile|execform|execuserobject|filenameforall|fileposition|filter|findencoding|findresource|gcheck|globaldict|GlobalFontDirectory|glyphshow|gstate|ineofill|infill|instroke|inueofill|inufill|inustroke|ISOLatin1Encoding|languagelevel|makepattern|packedarray|printobject|product|realtime|rectclip|rectfill|rectstroke|renamefile|resourceforall|resourcestatus|revision|rootfont|scheck|selectfont|serialnumber|setbbox|setblackgeneration|setcachedevice2|setcacheparams|setcmykcolor|setcolor|setcolorrendering|setcolorscreen|setcolorspace|setcolortransfer|setdevparams|setfileposition|setglobal|setgstate|sethalftone|setobjectformat|setoverprint|setpacking|setpagedevice|setpattern|setshared|setstrokeadjust|setsystemparams|setucacheparams|setundercolorremoval|setuserparams|setvmthreshold|shareddict|SharedFontDirectory|startjob|uappend|ucache|ucachestatus|ueofill|ufill|undef|undefinefont|undefineresource|undefineuserobject|upath|UserObjects|ustroke|ustrokepath|vmreclaim|writeobject|xshow|xyshow|yshow)>\":::Keyword::D\n\
702 Operator3:\"<(GetHalftoneName|GetPageDeviceName|GetSubstituteCRD|StartData|addglyph|beginbfchar|beginbfrange|begincidchar|begincidrange|begincmap|begincodespacerange|beginnotdefchar|beginnotdefrange|beginrearrangedfont|beginusematrix|cliprestore|clipsave|composefont|currentsmoothness|currenttrapparams|endbfchar|endbfrange|endcidchar|endcidrange|endcmap|endcodespacerange|endnotdefchar|endnotdefrange|endrearrangedfont|endusematrix|findcolorrendering|removeall|removeglyphs|setsmoothness|settrapparams|settrapzone|shfill|usecmap|usefont)>\":::Keyword::D\n\
703 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
704 "Python:2:0{\n\
705 Comment:\"#\":\"$\"::Comment::\n\
706 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
707 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
708 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
709 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
710 String escape chars 3s:\"\\\\(?:\\n|\\\\|'|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String3s:\n\
711 String escape chars 3d:\"\\\\(?:\\n|\\\\|'|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String3d:\n\
712 String escape chars 1s:\"\\\\(?:\\n|\\\\|'|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String1s:\n\
713 String escape chars 1d:\"\\\\(?:\\n|\\\\|'|\"\"|a|b|f|n|r|t|v|[0-7]{1,3}|x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|U[\\da-fA-F]{8})\":::String1:String1d:\n\
714 Representation:\"`\":\"`\":\"$\":String2::\n\
715 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
716 Number:\"(?<!\\Y)(?:(?:(?:[1-9]\\d*|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[eE][\\-+]?\\d+|(?:[1-9]\\d*|0)?\\.\\d+|(?:[1-9]\\d*|0)\\.)[jJ]?|(?:[1-9]\\d*|0)[jJ]|(?:0|[1-9]\\d*|0[0-7]+|0[xX][\\da-fA-F]+)[lL]?)(?!\\Y)\":::Numeric Const::\n\
717 Import:\"<(?:import|from)>\":\";|$\":\"#\":Preprocessor::\n\
718 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
719 Member definition:\"<(def)\\s+(?:(__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|eq|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|irshift|isub|iter|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|truediv|xor)__)|((__(?:bases|class|dict)__)|(__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))(?=(?:\\s*(?:\\\\\\n\\s*)?\\(\\s*|\\s*\\(\\s*(?:\\\\?\\n\\s*)?)self>)\":::Plain::\n\
720 Member def color:\"\\1\":::Keyword:Member definition:C\n\
721 Member def special:\"\\2\":::Subroutine:Member definition:C\n\
722 Member def deprecated:\"\\3\":::Warning:Member definition:C\n\
723 Member def error:\"\\7\":::Flag:Member definition:C\n\
724 Static method definition:\"<(def)\\s+(__(?:new)__)\":::Plain::\n\
725 Static def color:\"\\1\":::Keyword:Static method definition:C\n\
726 Static def special:\"\\2\":::Subroutine:Static method definition:C\n\
727 Function definition:\"<(def)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|self|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
728 Function def color:\"\\1\":::Keyword:Function definition:C\n\
729 Function def deprecated:\"\\2\":::Warning:Function definition:C\n\
730 Function def error:\"\\3\":::Flag:Function definition:C\n\
731 Class definition:\"<(class)\\s+(?:(ArithmeticError|AssertionError|AttributeError|DeprecationWarning|EOFError|Ellipsis|EnvironmentError|Exception|False|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplemented|NotImplementedError|OSError|OverflowError|OverflowWarning|ReferenceError|RuntimeError|RuntimeWarning|StandardError|StopIteration|SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|True|TypeError|UnboundLocalError|UnicodeError|UserWarning|ValueError|Warning|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|copyright|credits|delattr|dict|dir|divmod|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|license|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|self|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
732 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
733 Class def deprecated:\"\\2\":::Warning:Class definition:C\n\
734 Class def error:\"\\3\":::Flag:Class definition:C\n\
735 Member reference:\"\\.\\s*(?:\\\\?\\n\\s*)?(?:((__(?:abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|eq|float|floordiv|ge|getattr|getitem|gt|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|irshift|isub|iter|ixor|le|len|long|lshift|lt|mod|mul|ne|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|truediv|xor)__)|(__(?:new)__))|((__(?:delslice|getslice|setslice)__)|(__(?:members|methods)__))|(__(?:bases|class|dict)__)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
736 Member special method:\"\\1\":::Subroutine:Member reference:C\n\
737 Member deprecated:\"\\4\":::Warning:Member reference:C\n\
738 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
739 Member ref error:\"\\8\":::Flag:Member reference:C\n\
740 Storage keyword:\"<(?:class|global|lambda)>\":::Storage Type::\n\
741 Keyword:\"<(?:and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|yield)>\":::Keyword::\n\
742 Built-in function:\"<(?:__import__|abs|apply|bool|buffer|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|eval|execfile|file|filter|float|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|min|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|round|setattr|slice|staticmethod|str|super|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
743 Built-in name:\"<(?:Ellipsis|False|None|NotImplemented|True|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
744 Built-in exceptions:\"<(?:ArithmeticError|AssertionError|AttributeError|EOFError|EnvironmentError|Exception|FloatingPointError|IOError|ImportError|IndentationError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StandardError|StopIteration|SyntaxError|SystemError|SystemExit|TabError|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
745 Built-in warnings:\"<(?:DeprecationWarning|OverflowWarning|RuntimeWarning|SyntaxWarning|UserWarning|Warning)>\":::Identifier1::\n\
746 Braces and parens:\"[[{()}\\]]\":::Keyword::D}",
747 "Regex:1:0{\n\
748 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
749 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
750 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
751 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
752 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
753 Numeric Escape:\"(?#Negative lookahead is to exclude \\x0 and \\00)(?!\\\\[xX0]0*(?:[^\\da-fA-F]|$))\\\\(?:[xX]0*[1-9a-fA-F][\\da-fA-F]?|0*[1-3]?[0-7]?[0-7])\":::Numeric Const::\n\
754 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
755 Counting Quantifiers:\"(?#Properly limits range numbers to 0-65535)\\{(?:[0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])?(?:,(?:[0-5]?\\d?\\d?\\d?\\d|6[0-4]\\d\\d\\d|65[0-4]\\d\\d|655[0-2]\\d|6553[0-5])?)?\\}\\??\":::Numeric Const::\n\
756 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
757 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
758 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
759 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
760 "SGML HTML:6:0{\n\
761 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
762 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
763 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
764 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
765 entity declaration:\"((?ientity))[ \\t\\n][ \\t]*\\n?[ \\t]*(%[ \\t\\n][ \\t]*\\n?[ \\t]*)?(\\l[\\l\\d\\-\\.]*|#((?idefault)))[ \\t\\n][ \\t]*\\n?[ \\t]*((?i[cs]data|pi|starttag|endtag|m[ds]))?\":::Preprocessor:markup declaration:\n\
766 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
767 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
768 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
769 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
770 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
771 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
772 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
773 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
774 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
775 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
776 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
777 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
778 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
779 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
780 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
781 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
782 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
783 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
784 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
785 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
786 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
787 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
788 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
789 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
790 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
791 "SQL:1:0{\n\
792 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
793 comment:\"--\":\"$\"::Comment::\n\
794 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
795 string:\"'\":\"'\"::String::\n\
796 keywords2:\"END IF;|(?<!\\Y)(CREATE|REPLACE|BEGIN|END|FUNCTION|RETURN|FETCH|OPEN|CLOSE| IS|NOTFOUND|CURSOR|IF|ELSE|THEN|INTO|IS|IN|WHEN|OTHERS|GRANT|ON|TO|EXCEPTION|SHOW|SET|OUT|PRAGMA|AS|PACKAGE)>\":::Preprocessor1::\n\
797 comment2:\"/\\*\":\"\\*/\"::Comment::}",
798 "Sh Ksh Bash:1:0{\n\
799 README:\"Shell syntax highlighting patterns, version 2.2, maintainer Thorsten Haude, nedit at thorstenhau.de\":::Flag::D\n\
800 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
801 single quoted string:\"'\":\"'\"::String1::\n\
802 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
803 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
804 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
805 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
806 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
807 dqncs single quoted string:\"'\":\"'\"::String1:dq new command sub:\n\
808 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
809 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
810 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
811 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
812 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
813 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
814 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
815 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
816 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
817 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
818 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
819 command substitution:\"`\":\"`\"::Subroutine::\n\
820 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
821 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
822 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
823 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
824 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
825 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
826 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
827 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
828 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
829 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
830 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
831 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
832 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
833 comments in line:\"#\":\"$\"::Comment::\n\
834 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
835 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
836 command options:\"(?<=\\s)-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
837 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
838 built ins:\"(?<!\\Y)(:|\\.|source|alias|bg|bind|break|builtin|cd|chdir|command|compgen|complete|continue|declare|dirs|disown|echo|enable|eval|exec|exit|export|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|print|printf|pushd|pwd|read|readonly|return|set|shift|shopt|stop|suspend|test|times|trap|type|typeset|ulimit|umask|unalias|unset|wait|whence)(?!\\Y)[\\s\\n;]\":::Subroutine1::D}",
839 "Tcl:1:0{\n\
840 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
841 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
842 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
843 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
844 Comment:\"#\":\"$\"::Comment::\n\
845 Keywords:\"<(after\\s+(\\d+|cancel|idle|info)?|append|array\\s+(anymore|donesearch|exists|get|names|nextelement|set|size|startsearch|unset)|bell|bgerror|binary\\s+(format|scan)|bind(tags)?|body|break|case|catch|cd|class|clipboard\\s+(clear|append)|clock\\s+(clicks|format|scan|seconds)|close|code|common|concat|configbody|constructor|continue|delete\\s+(class|object|namespace)|destroy|destructor|else|elseif|encoding\\s+(convertfrom|convertto|names|system)|ensemble|eof|error|eval|event\\s+(add|delete|generate|info)|exec|exit|expr|fblocked|fconfigure|fcopy|file\\s+(atime|attributes|channels|copy|delete|dirname|executable|exists|extension|isdirectory|isfile|join|lstat|mkdir|mtime|nativename|owned|pathtype|readable|readlink|rename|rootname|size|split|stat|tail|type|volume|writable)|fileevent|find\\s+(classes|objects)|flush|focus|font\\s+(actual|configure|create|delete|families|measure|metrics|names)|foreach|format|gets|glob(al)?|grab\\s+(current|release|set|status|(-global\\s+)?\\w+)|grid(\\s+bbox|(column|row)?configure|forget|info|location|propagate|remove|size|slaves)?|history\\s+(add|change|clear|event|info|keep|nextid|redo)|if|image\\s+(create|delete|height|names|type|width)|incr|info\\s+(args|body|cmdcount|commands|complete|default|exists|globals|hostname|level|library|loaded|locals|nameofexecutable|patchlevel|procs|script|sharedlibextension|tclversion|vars)|inherit|interp\\s+(alias(es)?|create|delete|eval|exists|expose|hide|hidden|invokehidden|issafe|marktrusted|share|slaves|target|transfer)|join|lappend|lindex|linsert|list|llength|load|local|lrange|lreplace|lsearch|lsort|method|memory\\s+(info|(trace|validate)\\s+(on|off)|trace_on_at_malloc|break_on_malloc|display)|namespace\\s+(children|code|current|delete|eval|export|forget|import|inscope|origin|parent|qualifiers|tail|which)|open|option\\s+(add|clear|get|read(file))|pack\\s+(configure|forget|info|propagate|slaves)?|package\\s+(forget|ifneeded|names|present|provide|require|unknown|vcompare|versions|vsatisfies)|pid|place\\s+(configure|forget|info|slaves)?|proc|puts|pwd|raise|read|regexp|regsub|rename|resource\\s+(close|delete|files|list|open|read|types|write)|return|scan|scope(dobject)?|seek|selection\\s+(clear|get|handle|own)|send|set|socket|source|split|string\\s+(bytelength|compare|equal|first|index|is|last|length|map|match|range|repeat|replace|tolower|totitle|toupper|trim|trimleft|trimright|wordend|wordstart)|subst|switch|tell|time|tk\\s+(appname|scaling|useinputmethods)|tk_(bindForTraversal|bisque|chooseColor|chooseDirectory|dialog|focusFollowsMouse|focusNext|focusPrev|getOpenFile|getSaveFile|menuBar|messageBox|optionMenu|popup|setPalette)|tkerror|tkwait\\s+(variable|visibility|window)|trace\\s+(variable|vdelete|vinfo)|unknown|unset|update|uplevel|upvar|usual|variable|while|winfo\\s+(atom|atomname|cells|children|class|colormapfull|containing|depth|exists|fpixels|geometry|height|id|interp|ismapped|manager|name|parent|pathname|pixels|pointerx|pointerxy|pointery|reqheight|reqwidth|rgb|rootx|rooty|screen(cells|depth|height|mmheigth|mmidth|visual|width)?|server|toplevel|viewable|visual(id|savailable)?|vroot(height|width|x|y)|width|x|y)|wm\\s+(aspect|client|colormapwindows|command|deiconify|focusmodel|frame|geometry|grid|group|iconbitmap|icon(ify|mask|name|position|window)|(max|min)size|overrideredirect|positionfrom|protocol|resizable|sizefrom|state|title|transient|withdraw))(?!\\Y)\":::Keyword::D\n\
846 Widgets:\"<(button(box){0,1}|calendar|canvas(printbox|printdialog){0,1}|check(box|button)|combobox|date(entry|field)|dialog(shell){0,1}|entry(field){0,1}|(ext){0,1}fileselection(box|dialog)|feedback|finddialog|frame|hierarchy|hyperhelp|label(edframe|edwidget){0,1}|listbox|mainwindow|menu(bar|button){0,1}|message(box|dialog){0,1}|notebook|optionmenu|panedwindow|promptdialog|pushbutton|radio(box|button)|scale|scrollbar|scrolled(canvas|frame|html|listbox|text)|selection(box|dialog)|shell|spin(date|int|ner|time)|tab(notebook|set)|text|time(entry|field)|toolbar|toplevel|watch)>\":::Identifier::\n\
847 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
848 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
849 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
850 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
851 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
852 Namespace:\"\\w+::\":::Keyword::}",
853 "VHDL:1:0{\n\
854 Comments:\"--\":\"$\"::Comment::\n\
855 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
856 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
857 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
858 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
859 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
860 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
861 Reserved Words:\"<(?iabs|access|after|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|disconnect|downto|else|elsif|end|entity|error|exit|failure|file|for|function|generate|generic|guarded|if|in|inout|is|label|library|linkage|loop|map|mod|nand|new|next|nor|not|note|null|of|on|open|or|others|out|package|port|procedure|process|range|record|register|rem|report|return|select|severity|then|to|transport|units|until|use|wait|warning|when|while|with|xor|group|impure|inertial|literal|postponed|pure|reject|rol|ror|shared|sla|sll|sra|srl|unaffected|xnor)>\":::Keyword::D\n\
862 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
863 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
864 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
865 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
866 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
867 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
868 "Verilog:1:0{\n\
869 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
870 cplus comment:\"//\":\"$\"::Comment::\n\
871 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
872 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
873 Reserved WordsA:\"(?<!\\Y)(module|endmodule|parameter|specify|endspecify|begin|end|initial|always|if|else|task|endtask|force|release|attribute|case|case[xz]|default|endattribute|endcase|endfunction|endprimitive|endtable|for|forever|function|primitive|table|while|;)(?!\\Y)\":::Keyword::\n\
874 Predefined Types:\"<(and|assign|buf|bufif[01]|cmos|deassign|defparam|disable|edge|event|force|fork|highz[01]|initial|inout|input|integer|join|large|macromodule|medium|nand|negedge|nmos|nor|not|notif[01]|or|output|parameter|pmos|posedge|pullup|rcmos|real|realtime|reg|release|repeat|rnmos|rpmos|rtran|rtranif[01]|scalered|signed|small|specparam|strength|strong[01]|supply[01]|time|tran|tranif[01]|tri[01]?|triand|trior|trireg|unsigned|vectored|wait|wand|weak[01]|wire|wor|xnor|xor)>\":::Storage Type::D\n\
875 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
876 Numeric Literals:\"(?<!\\Y)([0-9]*'[dD][0-9xz\\\\?_]+|[0-9]*'[hH][0-9a-fxz\\\\?_]+|[0-9]*'[oO][0-7xz\\\\?_]+|[0-9]*'[bB][01xz\\\\?_]+|[0-9.]+((e|E)(\\\\+|-)?)?[0-9]*|[0-9]+)(?!\\Y)\":::Numeric Const::\n\
877 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
878 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
879 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
880 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
881 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
882 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
883 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
884 "XML:1:0{\n\
885 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
886 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
887 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
888 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
889 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
890 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
891 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
892 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
893 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
894 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
895 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
896 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
897 doctype root element:\"\\2\":::Identifier:doctype:C\n\
898 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
899 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
900 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
901 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
902 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
903 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
904 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
905 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
906 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
907 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
908 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
909 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
910 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
911 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
912 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
913 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
914 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
915 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
916 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
917 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
918 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
919 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
920 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
921 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
922 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
923 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
924 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
925 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
926 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
927 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
928 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
929 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
930 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
931 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
932 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
933 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
934 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
935 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
936 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
937 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
938 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
939 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
940 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
941 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
942 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
943 element name:\"\\2\":::Identifier:element:C\n\
944 element assign:\"=\":::Keyword:element:\n\
945 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
946 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
947 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
948 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
949 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
950 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
951 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
952 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
953 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
954 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
955 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
956 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
957 "X Resources:2:0{\n\
958 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
959 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
960 Comment:\"^\\s*!\":\"$\"::Comment::\n\
961 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
962 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
963 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
964 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
965 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
966 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
967 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
968 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
969 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
970 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
971 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
972 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
973 Free Text:\"^.*$\":::Flag::}",
974 "Yacc:1:0{\n\
975 comment:\"/\\*\":\"\\*/\"::Comment::\n\
976 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
977 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
978 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
979 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
980 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
981 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
982 numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
983 storage keyword:\"<(const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
984 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
985 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
986 yacc keyword:\"<(error|YYABORT|YYACCEPT|YYBACKUP|YYERROR|YYINITDEPTH|YYLTYPE|YYMAXDEPTH|YYRECOVERING|YYSTYPE|yychar|yyclearin|yydebug|yyerrok|yyerror|yylex|yylval|yylloc|yynerrs|yyparse)>\":::Text Arg::D\n\
987 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
988 braces:\"[{}]\":::Keyword::D\n\
989 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
990 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
995 ** Read a string (from the value of the styles resource) containing highlight
996 ** styles information, parse it, and load it into the stored highlight style
997 ** list (HighlightStyles) for this NEdit session.
999 int LoadStylesString(char *inString)
1001 char *errMsg, *fontStr;
1002 char *inPtr = inString;
1003 highlightStyleRec *hs;
1004 int i;
1006 for (;;) {
1008 /* skip over blank space */
1009 inPtr += strspn(inPtr, " \t");
1011 /* Allocate a language mode structure in which to store the info. */
1012 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
1014 /* read style name */
1015 hs->name = ReadSymbolicField(&inPtr);
1016 if (hs->name == NULL)
1017 return styleError(inString,inPtr, "style name required");
1018 if (!SkipDelimiter(&inPtr, &errMsg)) {
1019 XtFree(hs->name);
1020 XtFree((char *)hs);
1021 return styleError(inString,inPtr, errMsg);
1024 /* read color */
1025 hs->color = ReadSymbolicField(&inPtr);
1026 if (hs->color == NULL) {
1027 XtFree(hs->name);
1028 XtFree((char *)hs);
1029 return styleError(inString,inPtr, "color name required");
1031 hs->bgColor = NULL;
1032 if (SkipOptSeparator('/', &inPtr)) {
1033 /* read bgColor */
1034 hs->bgColor = ReadSymbolicField(&inPtr); /* no error if fails */
1036 if (!SkipDelimiter(&inPtr, &errMsg)) {
1037 freeHighlightStyleRec(hs);
1038 return styleError(inString,inPtr, errMsg);
1041 /* read the font type */
1042 fontStr = ReadSymbolicField(&inPtr);
1043 for (i=0; i<N_FONT_TYPES; i++) {
1044 if (!strcmp(FontTypeNames[i], fontStr)) {
1045 hs->font = i;
1046 break;
1049 if (i == N_FONT_TYPES) {
1050 XtFree(fontStr);
1051 freeHighlightStyleRec(hs);
1052 return styleError(inString, inPtr, "unrecognized font type");
1054 XtFree(fontStr);
1056 /* pattern set was read correctly, add/change it in the list */
1057 for (i=0; i<NHighlightStyles; i++) {
1058 if (!strcmp(HighlightStyles[i]->name, hs->name)) {
1059 freeHighlightStyleRec(HighlightStyles[i]);
1060 HighlightStyles[i] = hs;
1061 break;
1064 if (i == NHighlightStyles) {
1065 HighlightStyles[NHighlightStyles++] = hs;
1066 if (NHighlightStyles > MAX_HIGHLIGHT_STYLES)
1067 return styleError(inString, inPtr,
1068 "maximum allowable number of styles exceeded");
1071 /* if the string ends here, we're done */
1072 inPtr += strspn(inPtr, " \t\n");
1073 if (*inPtr == '\0')
1074 return True;
1079 ** Create a string in the correct format for the styles resource, containing
1080 ** all of the highlight styles information from the stored highlight style
1081 ** list (HighlightStyles) for this NEdit session.
1083 char *WriteStylesString(void)
1085 int i;
1086 char *outStr;
1087 textBuffer *outBuf;
1088 highlightStyleRec *style;
1090 outBuf = BufCreate();
1091 for (i=0; i<NHighlightStyles; i++) {
1092 style = HighlightStyles[i];
1093 BufInsert(outBuf, outBuf->length, "\t");
1094 BufInsert(outBuf, outBuf->length, style->name);
1095 BufInsert(outBuf, outBuf->length, ":");
1096 BufInsert(outBuf, outBuf->length, style->color);
1097 if (style->bgColor) {
1098 BufInsert(outBuf, outBuf->length, "/");
1099 BufInsert(outBuf, outBuf->length, style->bgColor);
1101 BufInsert(outBuf, outBuf->length, ":");
1102 BufInsert(outBuf, outBuf->length, FontTypeNames[style->font]);
1103 BufInsert(outBuf, outBuf->length, "\\n\\\n");
1106 /* Get the output, and lop off the trailing newlines */
1107 outStr = BufGetRange(outBuf, 0, outBuf->length - (i==1?0:4));
1108 BufFree(outBuf);
1109 return outStr;
1113 ** Read a string representing highlight pattern sets and add them
1114 ** to the PatternSets list of loaded highlight patterns. Note that the
1115 ** patterns themselves are not parsed until they are actually used.
1117 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1118 ** that they may contain regular expressions are of the older syntax where
1119 ** braces were not quoted, and \0 was a legal substitution character).
1121 int LoadHighlightString(char *inString, int convertOld)
1123 char *inPtr = inString;
1124 patternSet *patSet;
1125 int i;
1127 for (;;) {
1129 /* Read each pattern set, abort on error */
1130 patSet = readPatternSet(&inPtr, convertOld);
1131 if (patSet == NULL)
1132 return False;
1134 /* Add/change the pattern set in the list */
1135 for (i=0; i<NPatternSets; i++) {
1136 if (!strcmp(PatternSets[i]->languageMode, patSet->languageMode)) {
1137 freePatternSet(PatternSets[i]);
1138 PatternSets[i] = patSet;
1139 break;
1142 if (i == NPatternSets) {
1143 PatternSets[NPatternSets++] = patSet;
1144 if (NPatternSets > MAX_LANGUAGE_MODES)
1145 return False;
1148 /* if the string ends here, we're done */
1149 inPtr += strspn(inPtr, " \t\n");
1150 if (*inPtr == '\0')
1151 return True;
1156 ** Create a string in the correct format for the highlightPatterns resource,
1157 ** containing all of the highlight pattern information from the stored
1158 ** highlight pattern list (PatternSets) for this NEdit session.
1160 char *WriteHighlightString(void)
1162 char *outStr, *str, *escapedStr;
1163 textBuffer *outBuf;
1164 int psn, written = False;
1165 patternSet *patSet;
1167 outBuf = BufCreate();
1168 for (psn=0; psn<NPatternSets; psn++) {
1169 patSet = PatternSets[psn];
1170 if (patSet->nPatterns == 0)
1171 continue;
1172 written = True;
1173 BufInsert(outBuf, outBuf->length, patSet->languageMode);
1174 BufInsert(outBuf, outBuf->length, ":");
1175 if (isDefaultPatternSet(patSet))
1176 BufInsert(outBuf, outBuf->length, "Default\n\t");
1177 else {
1178 BufInsert(outBuf, outBuf->length, intToStr(patSet->lineContext));
1179 BufInsert(outBuf, outBuf->length, ":");
1180 BufInsert(outBuf, outBuf->length, intToStr(patSet->charContext));
1181 BufInsert(outBuf, outBuf->length, "{\n");
1182 BufInsert(outBuf, outBuf->length,
1183 str = createPatternsString(patSet, "\t\t"));
1184 XtFree(str);
1185 BufInsert(outBuf, outBuf->length, "\t}\n\t");
1189 /* Get the output string, and lop off the trailing newline and tab */
1190 outStr = BufGetRange(outBuf, 0, outBuf->length - (written?2:0));
1191 BufFree(outBuf);
1193 /* Protect newlines and backslashes from translation by the resource
1194 reader */
1195 escapedStr = EscapeSensitiveChars(outStr);
1196 XtFree(outStr);
1197 return escapedStr;
1201 ** Update regular expressions in stored pattern sets to version 5.1 regular
1202 ** expression syntax, in which braces and \0 have different meanings
1204 static void convertOldPatternSet(patternSet *patSet)
1206 int p;
1207 highlightPattern *pattern;
1209 for (p=0; p<patSet->nPatterns; p++) {
1210 pattern = &patSet->patterns[p];
1211 convertPatternExpr(&pattern->startRE, patSet->languageMode,
1212 pattern->name, pattern->flags & COLOR_ONLY);
1213 convertPatternExpr(&pattern->endRE, patSet->languageMode,
1214 pattern->name, pattern->flags & COLOR_ONLY);
1215 convertPatternExpr(&pattern->errorRE, patSet->languageMode,
1216 pattern->name, pattern->flags & COLOR_ONLY);
1221 ** Convert a single regular expression, patternRE, to version 5.1 regular
1222 ** expression syntax. It will convert either a match expression or a
1223 ** substitution expression, which must be specified by the setting of
1224 ** isSubsExpr. Error messages are directed to stderr, and include the
1225 ** pattern set name and pattern name as passed in patSetName and patName.
1227 static void convertPatternExpr(char **patternRE, char *patSetName,
1228 char *patName, int isSubsExpr)
1230 char *newRE, *errorText;
1232 if (*patternRE == NULL)
1233 return;
1234 if (isSubsExpr) {
1235 newRE = XtMalloc(strlen(*patternRE) + 5000);
1236 ConvertSubstituteRE(*patternRE, newRE, strlen(*patternRE) + 5000);
1237 XtFree(*patternRE);
1238 *patternRE = XtNewString(newRE);
1239 XtFree(newRE);
1240 } else{
1241 newRE = ConvertRE(*patternRE, &errorText);
1242 if (newRE == NULL) {
1243 fprintf(stderr, "NEdit error converting old format regular "
1244 "expression in pattern set %s, pattern %s: %s\n",
1245 patSetName, patName, errorText);
1247 XtFree(*patternRE);
1248 *patternRE = newRE;
1253 ** Find the font (font struct) associated with a named style.
1254 ** This routine must only be called with a valid styleName (call
1255 ** NamedStyleExists to find out whether styleName is valid).
1257 XFontStruct *FontOfNamedStyle(WindowInfo *window, const char *styleName)
1259 int styleNo=lookupNamedStyle(styleName),fontNum;
1260 XFontStruct *font;
1262 if (styleNo<0)
1263 return GetDefaultFontStruct(window->fontList);
1264 fontNum = HighlightStyles[styleNo]->font;
1265 if (fontNum == BOLD_FONT)
1266 font = window->boldFontStruct;
1267 else if (fontNum == ITALIC_FONT)
1268 font = window->italicFontStruct;
1269 else if (fontNum == BOLD_ITALIC_FONT)
1270 font = window->boldItalicFontStruct;
1271 else /* fontNum == PLAIN_FONT */
1272 font = GetDefaultFontStruct(window->fontList);
1274 /* If font isn't loaded, silently substitute primary font */
1275 return font == NULL ? GetDefaultFontStruct(window->fontList) : font;
1278 int FontOfNamedStyleIsBold(char *styleName)
1280 int styleNo=lookupNamedStyle(styleName),fontNum;
1282 if (styleNo<0)
1283 return 0;
1284 fontNum = HighlightStyles[styleNo]->font;
1285 return (fontNum == BOLD_FONT || fontNum == BOLD_ITALIC_FONT);
1288 int FontOfNamedStyleIsItalic(char *styleName)
1290 int styleNo=lookupNamedStyle(styleName),fontNum;
1292 if (styleNo<0)
1293 return 0;
1294 fontNum = HighlightStyles[styleNo]->font;
1295 return (fontNum == ITALIC_FONT || fontNum == BOLD_ITALIC_FONT);
1299 ** Find the color associated with a named style. This routine must only be
1300 ** called with a valid styleName (call NamedStyleExists to find out whether
1301 ** styleName is valid).
1303 char *ColorOfNamedStyle(const char *styleName)
1305 int styleNo=lookupNamedStyle(styleName);
1307 if (styleNo<0)
1308 return "black";
1309 return HighlightStyles[styleNo]->color;
1313 ** Find the background color associated with a named style.
1315 char *BgColorOfNamedStyle(const char *styleName)
1317 int styleNo=lookupNamedStyle(styleName);
1319 if (styleNo<0)
1320 return "";
1321 return HighlightStyles[styleNo]->bgColor;
1325 ** Determine whether a named style exists
1327 int NamedStyleExists(const char *styleName)
1329 return lookupNamedStyle(styleName) != -1;
1333 ** Look through the list of pattern sets, and find the one for a particular
1334 ** language. Returns NULL if not found.
1336 patternSet *FindPatternSet(const char *langModeName)
1338 int i;
1340 if (langModeName == NULL)
1341 return NULL;
1343 for (i=0; i<NPatternSets; i++)
1344 if (!strcmp(langModeName, PatternSets[i]->languageMode))
1345 return PatternSets[i];
1346 return NULL;
1351 ** Returns True if there are highlight patterns, or potential patterns
1352 ** not yet committed in the syntax highlighting dialog for a language mode,
1354 int LMHasHighlightPatterns(const char *languageMode)
1356 if (FindPatternSet(languageMode) != NULL)
1357 return True;
1358 return HighlightDialog.shell!=NULL && !strcmp(HighlightDialog.langModeName,
1359 languageMode) && HighlightDialog.nPatterns != 0;
1363 ** Change the language mode name of pattern sets for language "oldName" to
1364 ** "newName" in both the stored patterns, and the pattern set currently being
1365 ** edited in the dialog.
1367 void RenameHighlightPattern(const char *oldName, const char *newName)
1369 int i;
1371 for (i=0; i<NPatternSets; i++) {
1372 if (!strcmp(oldName, PatternSets[i]->languageMode)) {
1373 XtFree(PatternSets[i]->languageMode);
1374 PatternSets[i]->languageMode = XtNewString(newName);
1377 if (HighlightDialog.shell != NULL) {
1378 if (!strcmp(HighlightDialog.langModeName, oldName)) {
1379 XtFree(HighlightDialog.langModeName);
1380 HighlightDialog.langModeName = XtNewString(newName);
1386 ** Create a pulldown menu pane with the names of the current highlight styles.
1387 ** XmNuserData for each item contains a pointer to the name.
1389 static Widget createHighlightStylesMenu(Widget parent)
1391 Widget menu;
1392 int i;
1393 XmString s1;
1395 menu = CreatePulldownMenu(parent, "highlightStyles", NULL, 0);
1396 for (i=0; i<NHighlightStyles; i++) {
1397 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass,menu,
1398 XmNlabelString, s1=XmStringCreateSimple(HighlightStyles[i]->name),
1399 XmNuserData, (void *)HighlightStyles[i]->name, NULL);
1400 XmStringFree(s1);
1402 return menu;
1405 static char *createPatternsString(patternSet *patSet, char *indentStr)
1407 char *outStr, *str;
1408 textBuffer *outBuf;
1409 int pn;
1410 highlightPattern *pat;
1412 outBuf = BufCreate();
1413 for (pn=0; pn<patSet->nPatterns; pn++) {
1414 pat = &patSet->patterns[pn];
1415 BufInsert(outBuf, outBuf->length, indentStr);
1416 BufInsert(outBuf, outBuf->length, pat->name);
1417 BufInsert(outBuf, outBuf->length, ":");
1418 if (pat->startRE != NULL) {
1419 BufInsert(outBuf, outBuf->length,
1420 str=MakeQuotedString(pat->startRE));
1421 XtFree(str);
1423 BufInsert(outBuf, outBuf->length, ":");
1424 if (pat->endRE != NULL) {
1425 BufInsert(outBuf, outBuf->length, str=MakeQuotedString(pat->endRE));
1426 XtFree(str);
1428 BufInsert(outBuf, outBuf->length, ":");
1429 if (pat->errorRE != NULL) {
1430 BufInsert(outBuf, outBuf->length,
1431 str=MakeQuotedString(pat->errorRE));
1432 XtFree(str);
1434 BufInsert(outBuf, outBuf->length, ":");
1435 BufInsert(outBuf, outBuf->length, pat->style);
1436 BufInsert(outBuf, outBuf->length, ":");
1437 if (pat->subPatternOf != NULL)
1438 BufInsert(outBuf, outBuf->length, pat->subPatternOf);
1439 BufInsert(outBuf, outBuf->length, ":");
1440 if (pat->flags & DEFER_PARSING)
1441 BufInsert(outBuf, outBuf->length, "D");
1442 if (pat->flags & PARSE_SUBPATS_FROM_START)
1443 BufInsert(outBuf, outBuf->length, "R");
1444 if (pat->flags & COLOR_ONLY)
1445 BufInsert(outBuf, outBuf->length, "C");
1446 BufInsert(outBuf, outBuf->length, "\n");
1448 outStr = BufGetAll(outBuf);
1449 BufFree(outBuf);
1450 return outStr;
1454 ** Read in a pattern set character string, and advance *inPtr beyond it.
1455 ** Returns NULL and outputs an error to stderr on failure.
1457 static patternSet *readPatternSet(char **inPtr, int convertOld)
1459 char *errMsg, *stringStart = *inPtr;
1460 patternSet patSet, *retPatSet;
1462 /* remove leading whitespace */
1463 *inPtr += strspn(*inPtr, " \t\n");
1465 /* read language mode field */
1466 patSet.languageMode = ReadSymbolicField(inPtr);
1467 if (patSet.languageMode == NULL)
1468 return highlightError(stringStart, *inPtr,
1469 "language mode must be specified");
1470 if (!SkipDelimiter(inPtr, &errMsg))
1471 return highlightError(stringStart, *inPtr, errMsg);
1473 /* look for "Default" keyword, and if it's there, return the default
1474 pattern set */
1475 if (!strncmp(*inPtr, "Default", 7)) {
1476 *inPtr += 7;
1477 retPatSet = readDefaultPatternSet(patSet.languageMode);
1478 XtFree(patSet.languageMode);
1479 if (retPatSet == NULL)
1480 return highlightError(stringStart, *inPtr,
1481 "No default pattern set");
1482 return retPatSet;
1485 /* read line context field */
1486 if (!ReadNumericField(inPtr, &patSet.lineContext))
1487 return highlightError(stringStart, *inPtr,
1488 "unreadable line context field");
1489 if (!SkipDelimiter(inPtr, &errMsg))
1490 return highlightError(stringStart, *inPtr, errMsg);
1492 /* read character context field */
1493 if (!ReadNumericField(inPtr, &patSet.charContext))
1494 return highlightError(stringStart, *inPtr,
1495 "unreadable character context field");
1497 /* read pattern list */
1498 patSet.patterns = readHighlightPatterns(inPtr,
1499 True, &errMsg, &patSet.nPatterns);
1500 if (patSet.patterns == NULL)
1501 return highlightError(stringStart, *inPtr, errMsg);
1503 /* pattern set was read correctly, make an allocated copy to return */
1504 retPatSet = (patternSet *)XtMalloc(sizeof(patternSet));
1505 memcpy(retPatSet, &patSet, sizeof(patternSet));
1507 /* Convert pre-5.1 pattern sets which use old regular expression
1508 syntax to quote braces and use & rather than \0 */
1509 if (convertOld)
1510 convertOldPatternSet(retPatSet);
1512 return retPatSet;
1516 ** Parse a set of highlight patterns into an array of highlightPattern
1517 ** structures, and a language mode name. If unsuccessful, returns NULL with
1518 ** (statically allocated) message in "errMsg".
1520 static highlightPattern *readHighlightPatterns(char **inPtr, int withBraces,
1521 char **errMsg, int *nPatterns)
1523 highlightPattern *pat, *returnedList, patternList[MAX_PATTERNS];
1525 /* skip over blank space */
1526 *inPtr += strspn(*inPtr, " \t\n");
1528 /* look for initial brace */
1529 if (withBraces) {
1530 if (**inPtr != '{') {
1531 *errMsg = "pattern list must begin with \"{\"";
1532 return False;
1534 (*inPtr)++;
1538 ** parse each pattern in the list
1540 pat = patternList;
1541 while (True) {
1542 *inPtr += strspn(*inPtr, " \t\n");
1543 if (**inPtr == '\0') {
1544 if (withBraces) {
1545 *errMsg = "end of pattern list not found";
1546 return NULL;
1547 } else
1548 break;
1549 } else if (**inPtr == '}') {
1550 (*inPtr)++;
1551 break;
1553 if (!readHighlightPattern(inPtr, errMsg, pat++))
1554 return NULL;
1555 if (pat - patternList > MAX_PATTERNS) {
1556 *errMsg = "max number of patterns exceeded\n";
1557 return NULL;
1561 /* allocate a more appropriately sized list to return patterns */
1562 *nPatterns = pat - patternList;
1563 returnedList = (highlightPattern *)XtMalloc(
1564 sizeof(highlightPattern) * *nPatterns);
1565 memcpy(returnedList, patternList, sizeof(highlightPattern) * *nPatterns);
1566 return returnedList;
1569 static int readHighlightPattern(char **inPtr, char **errMsg,
1570 highlightPattern *pattern)
1572 /* read the name field */
1573 pattern->name = ReadSymbolicField(inPtr);
1574 if (pattern->name == NULL) {
1575 *errMsg = "pattern name is required";
1576 return False;
1578 if (!SkipDelimiter(inPtr, errMsg))
1579 return False;
1581 /* read the start pattern */
1582 if (!ReadQuotedString(inPtr, errMsg, &pattern->startRE))
1583 return False;
1584 if (!SkipDelimiter(inPtr, errMsg))
1585 return False;
1587 /* read the end pattern */
1588 if (**inPtr == ':')
1589 pattern->endRE = NULL;
1590 else if (!ReadQuotedString(inPtr, errMsg, &pattern->endRE))
1591 return False;
1592 if (!SkipDelimiter(inPtr, errMsg))
1593 return False;
1595 /* read the error pattern */
1596 if (**inPtr == ':')
1597 pattern->errorRE = NULL;
1598 else if (!ReadQuotedString(inPtr, errMsg, &pattern->errorRE))
1599 return False;
1600 if (!SkipDelimiter(inPtr, errMsg))
1601 return False;
1603 /* read the style field */
1604 pattern->style = ReadSymbolicField(inPtr);
1605 if (pattern->style == NULL) {
1606 *errMsg = "style field required in pattern";
1607 return False;
1609 if (!SkipDelimiter(inPtr, errMsg))
1610 return False;
1612 /* read the sub-pattern-of field */
1613 pattern->subPatternOf = ReadSymbolicField(inPtr);
1614 if (!SkipDelimiter(inPtr, errMsg))
1615 return False;
1617 /* read flags field */
1618 pattern->flags = 0;
1619 for (; **inPtr != '\n' && **inPtr != '}'; (*inPtr)++) {
1620 if (**inPtr == 'D')
1621 pattern->flags |= DEFER_PARSING;
1622 else if (**inPtr == 'R')
1623 pattern->flags |= PARSE_SUBPATS_FROM_START;
1624 else if (**inPtr == 'C')
1625 pattern->flags |= COLOR_ONLY;
1626 else if (**inPtr != ' ' && **inPtr != '\t') {
1627 *errMsg = "unreadable flag field";
1628 return False;
1631 return True;
1635 ** Given a language mode name, determine if there is a default (built-in)
1636 ** pattern set available for that language mode, and if so, read it and
1637 ** return a new allocated copy of it. The returned pattern set should be
1638 ** freed by the caller with freePatternSet()
1640 static patternSet *readDefaultPatternSet(const char *langModeName)
1642 int i, modeNameLen;
1643 char *strPtr;
1645 modeNameLen = strlen(langModeName);
1646 for (i=0; i<(int)XtNumber(DefaultPatternSets); i++) {
1647 if (!strncmp(langModeName, DefaultPatternSets[i], modeNameLen) &&
1648 DefaultPatternSets[i][modeNameLen] == ':') {
1649 strPtr = DefaultPatternSets[i];
1650 return readPatternSet(&strPtr, False);
1653 return NULL;
1657 ** Return True if patSet exactly matches one of the default pattern sets
1659 static int isDefaultPatternSet(patternSet *patSet)
1661 patternSet *defaultPatSet;
1662 int retVal;
1664 defaultPatSet = readDefaultPatternSet(patSet->languageMode);
1665 if (defaultPatSet == NULL)
1666 return False;
1667 retVal = !patternSetsDiffer(patSet, defaultPatSet);
1668 freePatternSet(defaultPatSet);
1669 return retVal;
1673 ** Short-hand functions for formating and outputing errors for
1675 static patternSet *highlightError(char *stringStart, char *stoppedAt,
1676 const char *message)
1678 ParseError(NULL, stringStart, stoppedAt, "highlight pattern", message);
1679 return NULL;
1683 static int styleError(const char *stringStart, const char *stoppedAt,
1684 const char *message)
1686 ParseError(NULL, stringStart, stoppedAt, "style specification", message);
1687 return False;
1691 ** Present a dialog for editing highlight style information
1693 void EditHighlightStyles(const char *initialStyle)
1695 #define HS_LIST_RIGHT 60
1696 #define HS_LEFT_MARGIN_POS 1
1697 #define HS_RIGHT_MARGIN_POS 99
1698 #define HS_H_MARGIN 10
1699 Widget form, nameLbl, topLbl, colorLbl, bgColorLbl, fontLbl;
1700 Widget fontBox, sep1, okBtn, applyBtn, dismissBtn;
1701 XmString s1;
1702 int i, ac;
1703 Arg args[20];
1705 /* if the dialog is already displayed, just pop it to the top and return */
1706 if (HSDialog.shell != NULL) {
1707 if (initialStyle != NULL)
1708 setStyleByName(initialStyle);
1709 RaiseShellWindow(HSDialog.shell);
1710 return;
1713 /* Copy the list of highlight style information to one that the user
1714 can freely edit (via the dialog and managed-list code) */
1715 HSDialog.highlightStyleList = (highlightStyleRec **)XtMalloc(
1716 sizeof(highlightStyleRec *) * MAX_HIGHLIGHT_STYLES);
1717 for (i=0; i<NHighlightStyles; i++)
1718 HSDialog.highlightStyleList[i] =
1719 copyHighlightStyleRec(HighlightStyles[i]);
1720 HSDialog.nHighlightStyles = NHighlightStyles;
1722 /* Create a form widget in an application shell */
1723 ac = 0;
1724 XtSetArg(args[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
1725 XtSetArg(args[ac], XmNiconName, "NEdit Text Drawing Styles"); ac++;
1726 XtSetArg(args[ac], XmNtitle, "Text Drawing Styles"); ac++;
1727 HSDialog.shell = CreateWidget(TheAppShell, "textStyles",
1728 topLevelShellWidgetClass, args, ac);
1729 AddSmallIcon(HSDialog.shell);
1730 form = XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass,
1731 HSDialog.shell, XmNautoUnmanage, False,
1732 XmNresizePolicy, XmRESIZE_NONE, NULL);
1733 XtAddCallback(form, XmNdestroyCallback, hsDestroyCB, NULL);
1734 AddMotifCloseCallback(HSDialog.shell, hsDismissCB, NULL);
1736 topLbl = XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass, form,
1737 XmNlabelString, s1=MKSTRING(
1738 "To modify the properties of an existing highlight style, select the name\n\
1739 from the list on the left. Select \"New\" to add a new style to the list."),
1740 XmNmnemonic, 'N',
1741 XmNtopAttachment, XmATTACH_POSITION,
1742 XmNtopPosition, 2,
1743 XmNleftAttachment, XmATTACH_POSITION,
1744 XmNleftPosition, HS_LEFT_MARGIN_POS,
1745 XmNrightAttachment, XmATTACH_POSITION,
1746 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1747 XmStringFree(s1);
1749 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass, form,
1750 XmNlabelString, s1=XmStringCreateSimple("Name:"),
1751 XmNmnemonic, 'm',
1752 XmNalignment, XmALIGNMENT_BEGINNING,
1753 XmNleftAttachment, XmATTACH_POSITION,
1754 XmNleftPosition, HS_LIST_RIGHT,
1755 XmNtopAttachment, XmATTACH_WIDGET,
1756 XmNtopOffset, HS_H_MARGIN,
1757 XmNtopWidget, topLbl, NULL);
1758 XmStringFree(s1);
1760 HSDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass, form,
1761 XmNleftAttachment, XmATTACH_POSITION,
1762 XmNleftPosition, HS_LIST_RIGHT,
1763 XmNtopAttachment, XmATTACH_WIDGET,
1764 XmNtopWidget, nameLbl,
1765 XmNrightAttachment, XmATTACH_POSITION,
1766 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1767 RemapDeleteKey(HSDialog.nameW);
1768 XtVaSetValues(nameLbl, XmNuserData, HSDialog.nameW, NULL);
1770 colorLbl = XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass, form,
1771 XmNlabelString, s1=XmStringCreateSimple("Foreground Color:"),
1772 XmNmnemonic, 'C',
1773 XmNalignment, XmALIGNMENT_BEGINNING,
1774 XmNleftAttachment, XmATTACH_POSITION,
1775 XmNleftPosition, HS_LIST_RIGHT,
1776 XmNtopAttachment, XmATTACH_WIDGET,
1777 XmNtopOffset, HS_H_MARGIN,
1778 XmNtopWidget, HSDialog.nameW, NULL);
1779 XmStringFree(s1);
1781 HSDialog.colorW = XtVaCreateManagedWidget("color", xmTextWidgetClass, form,
1782 XmNleftAttachment, XmATTACH_POSITION,
1783 XmNleftPosition, HS_LIST_RIGHT,
1784 XmNtopAttachment, XmATTACH_WIDGET,
1785 XmNtopWidget, colorLbl,
1786 XmNrightAttachment, XmATTACH_POSITION,
1787 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1788 RemapDeleteKey(HSDialog.colorW);
1789 XtVaSetValues(colorLbl, XmNuserData, HSDialog.colorW, NULL);
1791 bgColorLbl = XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass, form,
1792 XmNlabelString,
1793 s1=XmStringCreateSimple("Background Color (optional)"),
1794 XmNmnemonic, 'g',
1795 XmNalignment, XmALIGNMENT_BEGINNING,
1796 XmNleftAttachment, XmATTACH_POSITION,
1797 XmNleftPosition, HS_LIST_RIGHT,
1798 XmNtopAttachment, XmATTACH_WIDGET,
1799 XmNtopOffset, HS_H_MARGIN,
1800 XmNtopWidget, HSDialog.colorW, NULL);
1801 XmStringFree(s1);
1803 HSDialog.bgColorW = XtVaCreateManagedWidget("bgColor",
1804 xmTextWidgetClass, form,
1805 XmNleftAttachment, XmATTACH_POSITION,
1806 XmNleftPosition, HS_LIST_RIGHT,
1807 XmNtopAttachment, XmATTACH_WIDGET,
1808 XmNtopWidget, bgColorLbl,
1809 XmNrightAttachment, XmATTACH_POSITION,
1810 XmNrightPosition, HS_RIGHT_MARGIN_POS, NULL);
1811 RemapDeleteKey(HSDialog.bgColorW);
1812 XtVaSetValues(bgColorLbl, XmNuserData, HSDialog.bgColorW, NULL);
1814 fontLbl = XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass, form,
1815 XmNlabelString, s1=XmStringCreateSimple("Font:"),
1816 XmNalignment, XmALIGNMENT_BEGINNING,
1817 XmNleftAttachment, XmATTACH_POSITION,
1818 XmNleftPosition, HS_LIST_RIGHT,
1819 XmNtopAttachment, XmATTACH_WIDGET,
1820 XmNtopOffset, HS_H_MARGIN,
1821 XmNtopWidget, HSDialog.bgColorW, NULL);
1822 XmStringFree(s1);
1824 fontBox = XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass, form,
1825 XmNpacking, XmPACK_COLUMN,
1826 XmNnumColumns, 2,
1827 XmNradioBehavior, True,
1828 XmNleftAttachment, XmATTACH_POSITION,
1829 XmNleftPosition, HS_LIST_RIGHT,
1830 XmNtopAttachment, XmATTACH_WIDGET,
1831 XmNtopWidget, fontLbl, NULL);
1832 HSDialog.plainW = XtVaCreateManagedWidget("plain",
1833 xmToggleButtonWidgetClass, fontBox,
1834 XmNset, True,
1835 XmNlabelString, s1=XmStringCreateSimple("Plain"),
1836 XmNmnemonic, 'P', NULL);
1837 XmStringFree(s1);
1838 HSDialog.boldW = XtVaCreateManagedWidget("bold",
1839 xmToggleButtonWidgetClass, fontBox,
1840 XmNlabelString, s1=XmStringCreateSimple("Bold"),
1841 XmNmnemonic, 'B', NULL);
1842 XmStringFree(s1);
1843 HSDialog.italicW = XtVaCreateManagedWidget("italic",
1844 xmToggleButtonWidgetClass, fontBox,
1845 XmNlabelString, s1=XmStringCreateSimple("Italic"),
1846 XmNmnemonic, 'I', NULL);
1847 XmStringFree(s1);
1848 HSDialog.boldItalicW = XtVaCreateManagedWidget("boldItalic",
1849 xmToggleButtonWidgetClass, fontBox,
1850 XmNlabelString, s1=XmStringCreateSimple("Bold Italic"),
1851 XmNmnemonic, 'o', NULL);
1852 XmStringFree(s1);
1854 okBtn = XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass,form,
1855 XmNlabelString, s1=XmStringCreateSimple("OK"),
1856 XmNleftAttachment, XmATTACH_POSITION,
1857 XmNleftPosition, 10,
1858 XmNrightAttachment, XmATTACH_POSITION,
1859 XmNrightPosition, 30,
1860 XmNbottomAttachment, XmATTACH_POSITION,
1861 XmNbottomPosition, 99, NULL);
1862 XtAddCallback(okBtn, XmNactivateCallback, hsOkCB, NULL);
1863 XmStringFree(s1);
1865 applyBtn = XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass,form,
1866 XmNlabelString, s1=XmStringCreateSimple("Apply"),
1867 XmNmnemonic, 'A',
1868 XmNleftAttachment, XmATTACH_POSITION,
1869 XmNleftPosition, 40,
1870 XmNrightAttachment, XmATTACH_POSITION,
1871 XmNrightPosition, 60,
1872 XmNbottomAttachment, XmATTACH_POSITION,
1873 XmNbottomPosition, 99, NULL);
1874 XtAddCallback(applyBtn, XmNactivateCallback, hsApplyCB, NULL);
1875 XmStringFree(s1);
1877 dismissBtn = XtVaCreateManagedWidget("dismiss",xmPushButtonWidgetClass,form,
1878 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
1879 XmNleftAttachment, XmATTACH_POSITION,
1880 XmNleftPosition, 70,
1881 XmNrightAttachment, XmATTACH_POSITION,
1882 XmNrightPosition, 90,
1883 XmNbottomAttachment, XmATTACH_POSITION,
1884 XmNbottomPosition, 99, NULL);
1885 XtAddCallback(dismissBtn, XmNactivateCallback, hsDismissCB, NULL);
1886 XmStringFree(s1);
1888 sep1 = XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass, form,
1889 XmNleftAttachment, XmATTACH_FORM,
1890 XmNtopAttachment, XmATTACH_WIDGET,
1891 XmNtopWidget, fontBox,
1892 XmNtopOffset, HS_H_MARGIN,
1893 XmNrightAttachment, XmATTACH_FORM,
1894 XmNbottomAttachment, XmATTACH_WIDGET,
1895 XmNbottomWidget, dismissBtn, 0,
1896 XmNbottomOffset, HS_H_MARGIN, NULL);
1898 ac = 0;
1899 XtSetArg(args[ac], XmNtopAttachment, XmATTACH_WIDGET); ac++;
1900 XtSetArg(args[ac], XmNtopOffset, HS_H_MARGIN); ac++;
1901 XtSetArg(args[ac], XmNtopWidget, topLbl); ac++;
1902 XtSetArg(args[ac], XmNleftAttachment, XmATTACH_POSITION); ac++;
1903 XtSetArg(args[ac], XmNleftPosition, HS_LEFT_MARGIN_POS); ac++;
1904 XtSetArg(args[ac], XmNrightAttachment, XmATTACH_POSITION); ac++;
1905 XtSetArg(args[ac], XmNrightPosition, HS_LIST_RIGHT-1); ac++;
1906 XtSetArg(args[ac], XmNbottomAttachment, XmATTACH_WIDGET); ac++;
1907 XtSetArg(args[ac], XmNbottomWidget, sep1); ac++;
1908 XtSetArg(args[ac], XmNbottomOffset, HS_H_MARGIN); ac++;
1909 HSDialog.managedListW = CreateManagedList(form, "list", args, ac,
1910 (void **)HSDialog.highlightStyleList, &HSDialog.nHighlightStyles,
1911 MAX_HIGHLIGHT_STYLES, 20, hsGetDisplayedCB, NULL, hsSetDisplayedCB,
1912 form, hsFreeItemCB);
1913 XtVaSetValues(topLbl, XmNuserData, HSDialog.managedListW, NULL);
1915 /* Set initial default button */
1916 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
1917 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
1919 /* If there's a suggestion for an initial selection, make it */
1920 if (initialStyle != NULL)
1921 setStyleByName(initialStyle);
1923 /* Handle mnemonic selection of buttons and focus to dialog */
1924 AddDialogMnemonicHandler(form, FALSE);
1926 /* Realize all of the widgets in the new dialog */
1927 RealizeWithoutForcingPosition(HSDialog.shell);
1930 static void hsDestroyCB(Widget w, XtPointer clientData, XtPointer callData)
1932 int i;
1934 for (i=0; i<HSDialog.nHighlightStyles; i++)
1935 freeHighlightStyleRec(HSDialog.highlightStyleList[i]);
1936 XtFree((char *)HSDialog.highlightStyleList);
1939 static void hsOkCB(Widget w, XtPointer clientData, XtPointer callData)
1941 if (!updateHSList())
1942 return;
1944 /* pop down and destroy the dialog */
1945 XtDestroyWidget(HSDialog.shell);
1946 HSDialog.shell = NULL;
1949 static void hsApplyCB(Widget w, XtPointer clientData, XtPointer callData)
1951 updateHSList();
1954 static void hsDismissCB(Widget w, XtPointer clientData, XtPointer callData)
1956 /* pop down and destroy the dialog */
1957 XtDestroyWidget(HSDialog.shell);
1958 HSDialog.shell = NULL;
1961 static void *hsGetDisplayedCB(void *oldItem, int explicitRequest, int *abort,
1962 void *cbArg)
1964 highlightStyleRec *hs;
1966 /* If the dialog is currently displaying the "new" entry and the
1967 fields are empty, that's just fine */
1968 if (oldItem == NULL && hsDialogEmpty())
1969 return NULL;
1971 /* If there are no problems reading the data, just return it */
1972 hs = readHSDialogFields(True);
1973 if (hs != NULL)
1974 return (void *)hs;
1976 /* If there are problems, and the user didn't ask for the fields to be
1977 read, give more warning */
1978 if (!explicitRequest)
1980 if (DialogF(DF_WARN, HSDialog.shell, 2, "Incomplete Style",
1981 "Discard incomplete entry\nfor current highlight style?",
1982 "Keep", "Discard") == 2)
1984 return oldItem == NULL
1985 ? NULL
1986 : (void *)copyHighlightStyleRec((highlightStyleRec *)oldItem);
1990 /* Do readHSDialogFields again without "silent" mode to display warning */
1991 hs = readHSDialogFields(False);
1992 *abort = True;
1993 return NULL;
1996 static void hsSetDisplayedCB(void *item, void *cbArg)
1998 highlightStyleRec *hs = (highlightStyleRec *)item;
2000 if (item == NULL) {
2001 XmTextSetString(HSDialog.nameW, "");
2002 XmTextSetString(HSDialog.colorW, "");
2003 XmTextSetString(HSDialog.bgColorW, "");
2004 RadioButtonChangeState(HSDialog.plainW, True, False);
2005 RadioButtonChangeState(HSDialog.boldW, False, False);
2006 RadioButtonChangeState(HSDialog.italicW, False, False);
2007 RadioButtonChangeState(HSDialog.boldItalicW, False, False);
2008 } else {
2009 if (strcmp(hs->name, "Plain") == 0) {
2010 /* you should not be able to delete the reserved style "Plain" */
2011 int i, others = 0;
2012 int nList = HSDialog.nHighlightStyles;
2013 highlightStyleRec **list = HSDialog.highlightStyleList;
2014 /* do we have other styles called Plain? */
2015 for (i = 0; i < nList; i++) {
2016 if (list[i] != hs && strcmp(list[i]->name, "Plain") == 0) {
2017 others++;
2020 if (others == 0) {
2021 /* this is the last style entry named "Plain" */
2022 Widget form = (Widget)cbArg;
2023 Widget list = NULL;
2024 Widget deleteBtn = XtNameToWidget(form, "*delete");
2025 /* disable delete button */
2026 if (deleteBtn) {
2027 XtSetSensitive(deleteBtn, False);
2031 XmTextSetString(HSDialog.nameW, hs->name);
2032 XmTextSetString(HSDialog.colorW, hs->color);
2033 XmTextSetString(HSDialog.bgColorW, hs->bgColor ? hs->bgColor : "");
2034 RadioButtonChangeState(HSDialog.plainW, hs->font==PLAIN_FONT, False);
2035 RadioButtonChangeState(HSDialog.boldW, hs->font==BOLD_FONT, False);
2036 RadioButtonChangeState(HSDialog.italicW, hs->font==ITALIC_FONT, False);
2037 RadioButtonChangeState(HSDialog.boldItalicW, hs->font==BOLD_ITALIC_FONT,
2038 False);
2042 static void hsFreeItemCB(void *item)
2044 freeHighlightStyleRec((highlightStyleRec *)item);
2047 static highlightStyleRec *readHSDialogFields(int silent)
2049 highlightStyleRec *hs;
2050 Display *display = XtDisplay(HSDialog.shell);
2051 int screenNum = XScreenNumberOfScreen(XtScreen(HSDialog.shell));
2052 XColor rgb;
2054 /* Allocate a language mode structure to return */
2055 hs = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2057 /* read the name field */
2058 hs->name = ReadSymbolicFieldTextWidget(HSDialog.nameW,
2059 "highlight style name", silent);
2060 if (hs->name == NULL) {
2061 XtFree((char *)hs);
2062 return NULL;
2065 if (*hs->name == '\0')
2067 if (!silent)
2069 DialogF(DF_WARN, HSDialog.shell, 1, "Highlight Style",
2070 "Please specify a name\nfor the highlight style", "Dismiss");
2071 XmProcessTraversal(HSDialog.nameW, XmTRAVERSE_CURRENT);
2073 XtFree(hs->name);
2074 XtFree((char *)hs);
2075 return NULL;
2078 /* read the color field */
2079 hs->color = ReadSymbolicFieldTextWidget(HSDialog.colorW, "color", silent);
2080 if (hs->color == NULL) {
2081 XtFree(hs->name);
2082 XtFree((char *)hs);
2083 return NULL;
2086 if (*hs->color == '\0')
2088 if (!silent)
2090 DialogF(DF_WARN, HSDialog.shell, 1, "Style Color",
2091 "Please specify a color\nfor the highlight style",
2092 "Dismiss");
2093 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2095 XtFree(hs->name);
2096 XtFree(hs->color);
2097 XtFree((char *)hs);
2098 return NULL;
2101 /* Verify that the color is a valid X color spec */
2102 if (!XParseColor(display, DefaultColormap(display, screenNum), hs->color,
2103 &rgb))
2105 if (!silent)
2107 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2108 "Invalid X color specification: %s\n", "Dismiss",
2109 hs->color);
2110 XmProcessTraversal(HSDialog.colorW, XmTRAVERSE_CURRENT);
2112 XtFree(hs->name);
2113 XtFree(hs->color);
2114 XtFree((char *)hs);
2115 return NULL;;
2118 /* read the background color field - this may be empty */
2119 hs->bgColor = ReadSymbolicFieldTextWidget(HSDialog.bgColorW,
2120 "bgColor", silent);
2121 if (hs->bgColor && *hs->bgColor == '\0') {
2122 XtFree(hs->bgColor);
2123 hs->bgColor = NULL;
2126 /* Verify that the background color (if present) is a valid X color spec */
2127 if (hs->bgColor && !XParseColor(display, DefaultColormap(display, screenNum),
2128 hs->bgColor, &rgb))
2130 if (!silent)
2132 DialogF(DF_WARN, HSDialog.shell, 1, "Invalid Color",
2133 "Invalid X background color specification: %s\n", "Dismiss",
2134 hs->bgColor);
2135 XmProcessTraversal(HSDialog.bgColorW, XmTRAVERSE_CURRENT);
2137 XtFree(hs->name);
2138 XtFree(hs->color);
2139 XtFree(hs->bgColor);
2140 XtFree((char *)hs);
2141 return NULL;;
2144 /* read the font buttons */
2145 if (XmToggleButtonGetState(HSDialog.boldW))
2146 hs->font = BOLD_FONT;
2147 else if (XmToggleButtonGetState(HSDialog.italicW))
2148 hs->font = ITALIC_FONT;
2149 else if (XmToggleButtonGetState(HSDialog.boldItalicW))
2150 hs->font = BOLD_ITALIC_FONT;
2151 else
2152 hs->font = PLAIN_FONT;
2154 return hs;
2158 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2159 ** it contains.
2161 static highlightStyleRec *copyHighlightStyleRec(highlightStyleRec *hs)
2163 highlightStyleRec *newHS;
2165 newHS = (highlightStyleRec *)XtMalloc(sizeof(highlightStyleRec));
2166 newHS->name = XtMalloc(strlen(hs->name)+1);
2167 strcpy(newHS->name, hs->name);
2168 if (hs->color == NULL)
2169 newHS->color = NULL;
2170 else {
2171 newHS->color = XtMalloc(strlen(hs->color)+1);
2172 strcpy(newHS->color, hs->color);
2174 if (hs->bgColor == NULL)
2175 newHS->bgColor = NULL;
2176 else {
2177 newHS->bgColor = XtMalloc(strlen(hs->bgColor)+1);
2178 strcpy(newHS->bgColor, hs->bgColor);
2180 newHS->font = hs->font;
2181 return newHS;
2185 ** Free all of the allocated data in a highlightStyleRec, including the
2186 ** structure itself.
2188 static void freeHighlightStyleRec(highlightStyleRec *hs)
2190 XtFree(hs->name);
2191 if (hs->color != NULL)
2192 XtFree(hs->color);
2193 XtFree((char *)hs);
2197 ** Select a particular style in the highlight styles dialog
2199 static void setStyleByName(const char *style)
2201 int i;
2203 for (i=0; i<HSDialog.nHighlightStyles; i++) {
2204 if (!strcmp(HSDialog.highlightStyleList[i]->name, style)) {
2205 SelectManagedListItem(HSDialog.managedListW, i);
2206 break;
2212 ** Return True if the fields of the highlight styles dialog are consistent
2213 ** with a blank "New" style in the dialog.
2215 static int hsDialogEmpty(void)
2217 return TextWidgetIsBlank(HSDialog.nameW) &&
2218 TextWidgetIsBlank(HSDialog.colorW) &&
2219 XmToggleButtonGetState(HSDialog.plainW);
2223 ** Apply the changes made in the highlight styles dialog to the stored
2224 ** highlight style information in HighlightStyles
2226 static int updateHSList(void)
2228 WindowInfo *window;
2229 int i;
2231 /* Get the current contents of the dialog fields */
2232 if (!UpdateManagedList(HSDialog.managedListW, True))
2233 return False;
2235 /* Replace the old highlight styles list with the new one from the dialog */
2236 for (i=0; i<NHighlightStyles; i++)
2237 freeHighlightStyleRec(HighlightStyles[i]);
2238 for (i=0; i<HSDialog.nHighlightStyles; i++)
2239 HighlightStyles[i] =
2240 copyHighlightStyleRec(HSDialog.highlightStyleList[i]);
2241 NHighlightStyles = HSDialog.nHighlightStyles;
2243 /* If a syntax highlighting dialog is up, update its menu */
2244 updateHighlightStyleMenu();
2246 /* Redisplay highlighted windows which use changed style(s) */
2247 for (window=WindowList; window!=NULL; window=window->next)
2248 UpdateHighlightStyles(window);
2250 /* Note that preferences have been changed */
2251 MarkPrefsChanged();
2253 return True;
2257 ** Present a dialog for editing highlight pattern information
2259 void EditHighlightPatterns(WindowInfo *window)
2261 #define BORDER 4
2262 #define LIST_RIGHT 41
2263 Widget form, lmOptMenu, patternsForm, patternsFrame, patternsLbl;
2264 Widget lmForm, contextFrame, contextForm, styleLbl, styleBtn;
2265 Widget okBtn, applyBtn, checkBtn, deleteBtn, dismissBtn, helpBtn;
2266 Widget restoreBtn, nameLbl, typeLbl, typeBox, lmBtn, matchBox;
2267 patternSet *patSet;
2268 XmString s1;
2269 int i, n, nPatterns;
2270 Arg args[20];
2272 /* if the dialog is already displayed, just pop it to the top and return */
2273 if (HighlightDialog.shell != NULL) {
2274 RaiseShellWindow(HighlightDialog.shell);
2275 return;
2278 if (LanguageModeName(0) == NULL)
2280 DialogF(DF_WARN, window->shell, 1, "No Language Modes",
2281 "No Language Modes available for syntax highlighting\n"
2282 "Add language modes under Preferenses->Language Modes",
2283 "Dismiss");
2284 return;
2287 /* Decide on an initial language mode */
2288 HighlightDialog.langModeName = XtNewString(
2289 LanguageModeName(window->languageMode == PLAIN_LANGUAGE_MODE ? 0 :
2290 window->languageMode));
2292 /* Find the associated pattern set (patSet) to edit */
2293 patSet = FindPatternSet(HighlightDialog.langModeName);
2295 /* Copy the list of patterns to one that the user can freely edit */
2296 HighlightDialog.patterns = (highlightPattern **)XtMalloc(
2297 sizeof(highlightPattern *) * MAX_PATTERNS);
2298 nPatterns = patSet == NULL ? 0 : patSet->nPatterns;
2299 for (i=0; i<nPatterns; i++)
2300 HighlightDialog.patterns[i] = copyPatternSrc(&patSet->patterns[i],NULL);
2301 HighlightDialog.nPatterns = nPatterns;
2304 /* Create a form widget in an application shell */
2305 n = 0;
2306 XtSetArg(args[n], XmNdeleteResponse, XmDO_NOTHING); n++;
2307 XtSetArg(args[n], XmNiconName, "NEdit Highlight Patterns"); n++;
2308 XtSetArg(args[n], XmNtitle, "Syntax Highlighting Patterns"); n++;
2309 HighlightDialog.shell = CreateWidget(TheAppShell, "syntaxHighlight",
2310 topLevelShellWidgetClass, args, n);
2311 AddSmallIcon(HighlightDialog.shell);
2312 form = XtVaCreateManagedWidget("editHighlightPatterns", xmFormWidgetClass,
2313 HighlightDialog.shell, XmNautoUnmanage, False,
2314 XmNresizePolicy, XmRESIZE_NONE, NULL);
2315 XtAddCallback(form, XmNdestroyCallback, destroyCB, NULL);
2316 AddMotifCloseCallback(HighlightDialog.shell, dismissCB, NULL);
2318 lmForm = XtVaCreateManagedWidget("lmForm", xmFormWidgetClass,
2319 form,
2320 XmNleftAttachment, XmATTACH_POSITION,
2321 XmNleftPosition, 1,
2322 XmNtopAttachment, XmATTACH_POSITION,
2323 XmNtopPosition, 1,
2324 XmNrightAttachment, XmATTACH_POSITION,
2325 XmNrightPosition, 99, NULL);
2327 HighlightDialog.lmPulldown = CreateLanguageModeMenu(lmForm, langModeCB,
2328 NULL);
2329 n = 0;
2330 XtSetArg(args[n], XmNspacing, 0); n++;
2331 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2332 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2333 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2334 XtSetArg(args[n], XmNleftPosition, 50); n++;
2335 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.lmPulldown); n++;
2336 lmOptMenu = XmCreateOptionMenu(lmForm, "langModeOptMenu", args, n);
2337 XtManageChild(lmOptMenu);
2338 HighlightDialog.lmOptMenu = lmOptMenu;
2340 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass, lmForm,
2341 XmNlabelString, s1=XmStringCreateSimple("Language Mode:"),
2342 XmNmnemonic, 'M',
2343 XmNuserData, XtParent(HighlightDialog.lmOptMenu),
2344 XmNalignment, XmALIGNMENT_END,
2345 XmNrightAttachment, XmATTACH_POSITION,
2346 XmNrightPosition, 50,
2347 XmNtopAttachment, XmATTACH_FORM,
2348 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2349 XmNbottomWidget, lmOptMenu, NULL);
2350 XmStringFree(s1);
2352 lmBtn = XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass, lmForm,
2353 XmNlabelString, s1=MKSTRING("Add / Modify\nLanguage Mode..."),
2354 XmNmnemonic, 'A',
2355 XmNrightAttachment, XmATTACH_FORM,
2356 XmNtopAttachment, XmATTACH_FORM, NULL);
2357 XtAddCallback(lmBtn, XmNactivateCallback, lmDialogCB, NULL);
2358 XmStringFree(s1);
2360 okBtn = XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass, form,
2361 XmNlabelString, s1=XmStringCreateSimple("OK"),
2362 XmNleftAttachment, XmATTACH_POSITION,
2363 XmNleftPosition, 1,
2364 XmNrightAttachment, XmATTACH_POSITION,
2365 XmNrightPosition, 13,
2366 XmNbottomAttachment, XmATTACH_FORM,
2367 XmNbottomOffset, BORDER, NULL);
2368 XtAddCallback(okBtn, XmNactivateCallback, okCB, NULL);
2369 XmStringFree(s1);
2371 applyBtn = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, form,
2372 XmNlabelString, s1=XmStringCreateSimple("Apply"),
2373 XmNmnemonic, 'y',
2374 XmNleftAttachment, XmATTACH_POSITION,
2375 XmNleftPosition, 13,
2376 XmNrightAttachment, XmATTACH_POSITION,
2377 XmNrightPosition, 26,
2378 XmNbottomAttachment, XmATTACH_FORM,
2379 XmNbottomOffset, BORDER, NULL);
2380 XtAddCallback(applyBtn, XmNactivateCallback, applyCB, NULL);
2381 XmStringFree(s1);
2383 checkBtn = XtVaCreateManagedWidget("check", xmPushButtonWidgetClass, form,
2384 XmNlabelString, s1=XmStringCreateSimple("Check"),
2385 XmNmnemonic, 'k',
2386 XmNleftAttachment, XmATTACH_POSITION,
2387 XmNleftPosition, 26,
2388 XmNrightAttachment, XmATTACH_POSITION,
2389 XmNrightPosition, 39,
2390 XmNbottomAttachment, XmATTACH_FORM,
2391 XmNbottomOffset, BORDER, NULL);
2392 XtAddCallback(checkBtn, XmNactivateCallback, checkCB, NULL);
2393 XmStringFree(s1);
2395 deleteBtn = XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass, form,
2396 XmNlabelString, s1=XmStringCreateSimple("Delete"),
2397 XmNmnemonic, 'D',
2398 XmNleftAttachment, XmATTACH_POSITION,
2399 XmNleftPosition, 39,
2400 XmNrightAttachment, XmATTACH_POSITION,
2401 XmNrightPosition, 52,
2402 XmNbottomAttachment, XmATTACH_FORM,
2403 XmNbottomOffset, BORDER, NULL);
2404 XtAddCallback(deleteBtn, XmNactivateCallback, deleteCB, NULL);
2405 XmStringFree(s1);
2407 restoreBtn = XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass, form,
2408 XmNlabelString, s1=XmStringCreateSimple("Restore Defaults"),
2409 XmNmnemonic, 'f',
2410 XmNleftAttachment, XmATTACH_POSITION,
2411 XmNleftPosition, 52,
2412 XmNrightAttachment, XmATTACH_POSITION,
2413 XmNrightPosition, 73,
2414 XmNbottomAttachment, XmATTACH_FORM,
2415 XmNbottomOffset, BORDER, NULL);
2416 XtAddCallback(restoreBtn, XmNactivateCallback, restoreCB, NULL);
2417 XmStringFree(s1);
2419 dismissBtn = XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass,
2420 form,
2421 XmNlabelString, s1=XmStringCreateSimple("Dismiss"),
2422 XmNleftAttachment, XmATTACH_POSITION,
2423 XmNleftPosition, 73,
2424 XmNrightAttachment, XmATTACH_POSITION,
2425 XmNrightPosition, 86,
2426 XmNbottomAttachment, XmATTACH_FORM,
2427 XmNbottomOffset, BORDER, NULL);
2428 XtAddCallback(dismissBtn, XmNactivateCallback, dismissCB, NULL);
2429 XmStringFree(s1);
2431 helpBtn = XtVaCreateManagedWidget("help", xmPushButtonWidgetClass,
2432 form,
2433 XmNlabelString, s1=XmStringCreateSimple("Help"),
2434 XmNmnemonic, 'H',
2435 XmNleftAttachment, XmATTACH_POSITION,
2436 XmNleftPosition, 86,
2437 XmNrightAttachment, XmATTACH_POSITION,
2438 XmNrightPosition, 99,
2439 XmNbottomAttachment, XmATTACH_FORM,
2440 XmNbottomOffset, BORDER, NULL);
2441 XtAddCallback(helpBtn, XmNactivateCallback, helpCB, NULL);
2442 XmStringFree(s1);
2444 contextFrame = XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass,
2445 form,
2446 XmNleftAttachment, XmATTACH_POSITION,
2447 XmNleftPosition, 1,
2448 XmNrightAttachment, XmATTACH_POSITION,
2449 XmNrightPosition, 99,
2450 XmNbottomAttachment, XmATTACH_WIDGET,
2451 XmNbottomWidget, okBtn,
2452 XmNbottomOffset, BORDER, NULL);
2453 contextForm = XtVaCreateManagedWidget("contextForm", xmFormWidgetClass,
2454 contextFrame, NULL);
2455 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass, contextFrame,
2456 XmNlabelString, s1=XmStringCreateSimple(
2457 "Context requirements for incremental re-parsing after changes"),
2458 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2459 XmStringFree(s1);
2461 HighlightDialog.lineContextW = XtVaCreateManagedWidget("lineContext",
2462 xmTextWidgetClass, contextForm,
2463 XmNcolumns, 5,
2464 XmNmaxLength, 12,
2465 XmNleftAttachment, XmATTACH_POSITION,
2466 XmNleftPosition, 15,
2467 XmNrightAttachment, XmATTACH_POSITION,
2468 XmNrightPosition, 25, NULL);
2469 RemapDeleteKey(HighlightDialog.lineContextW);
2471 XtVaCreateManagedWidget("lineContLbl",
2472 xmLabelGadgetClass, contextForm,
2473 XmNlabelString, s1=XmStringCreateSimple("lines"),
2474 XmNmnemonic, 'l',
2475 XmNuserData, HighlightDialog.lineContextW,
2476 XmNalignment, XmALIGNMENT_BEGINNING,
2477 XmNleftAttachment, XmATTACH_WIDGET,
2478 XmNleftWidget, HighlightDialog.lineContextW,
2479 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2480 XmNtopWidget, HighlightDialog.lineContextW,
2481 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2482 XmNbottomWidget, HighlightDialog.lineContextW, NULL);
2483 XmStringFree(s1);
2485 HighlightDialog.charContextW = XtVaCreateManagedWidget("charContext",
2486 xmTextWidgetClass, contextForm,
2487 XmNcolumns, 5,
2488 XmNmaxLength, 12,
2489 XmNleftAttachment, XmATTACH_POSITION,
2490 XmNleftPosition, 58,
2491 XmNrightAttachment, XmATTACH_POSITION,
2492 XmNrightPosition, 68, NULL);
2493 RemapDeleteKey(HighlightDialog.lineContextW);
2495 XtVaCreateManagedWidget("charContLbl",
2496 xmLabelGadgetClass, contextForm,
2497 XmNlabelString, s1=XmStringCreateSimple("characters"),
2498 XmNmnemonic, 'c',
2499 XmNuserData, HighlightDialog.charContextW,
2500 XmNalignment, XmALIGNMENT_BEGINNING,
2501 XmNleftAttachment, XmATTACH_WIDGET,
2502 XmNleftWidget, HighlightDialog.charContextW,
2503 XmNtopAttachment, XmATTACH_OPPOSITE_WIDGET,
2504 XmNtopWidget, HighlightDialog.charContextW,
2505 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2506 XmNbottomWidget, HighlightDialog.charContextW, NULL);
2507 XmStringFree(s1);
2509 patternsFrame = XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass,
2510 form,
2511 XmNleftAttachment, XmATTACH_POSITION,
2512 XmNleftPosition, 1,
2513 XmNtopAttachment, XmATTACH_WIDGET,
2514 XmNtopWidget, lmForm,
2515 XmNrightAttachment, XmATTACH_POSITION,
2516 XmNrightPosition, 99,
2517 XmNbottomAttachment, XmATTACH_WIDGET,
2518 XmNbottomWidget, contextFrame,
2519 XmNbottomOffset, BORDER, NULL);
2520 patternsForm = XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass,
2521 patternsFrame, NULL);
2522 patternsLbl = XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass,
2523 patternsFrame,
2524 XmNlabelString, s1=XmStringCreateSimple("Patterns"),
2525 XmNmnemonic, 'P',
2526 XmNmarginHeight, 0,
2527 XmNchildType, XmFRAME_TITLE_CHILD, NULL);
2528 XmStringFree(s1);
2530 typeLbl = XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass,
2531 patternsForm,
2532 XmNlabelString, s1=XmStringCreateSimple("Pattern Type:"),
2533 XmNmarginHeight, 0,
2534 XmNalignment, XmALIGNMENT_BEGINNING,
2535 XmNleftAttachment, XmATTACH_POSITION,
2536 XmNleftPosition, LIST_RIGHT,
2537 XmNtopAttachment, XmATTACH_FORM, NULL);
2538 XmStringFree(s1);
2540 typeBox = XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass,
2541 patternsForm,
2542 XmNpacking, XmPACK_COLUMN,
2543 XmNradioBehavior, True,
2544 XmNleftAttachment, XmATTACH_POSITION,
2545 XmNleftPosition, LIST_RIGHT,
2546 XmNtopAttachment, XmATTACH_WIDGET,
2547 XmNtopWidget, typeLbl, NULL);
2548 HighlightDialog.topLevelW = XtVaCreateManagedWidget("top",
2549 xmToggleButtonWidgetClass, typeBox,
2550 XmNset, True,
2551 XmNmarginHeight, 0,
2552 XmNlabelString, s1=XmStringCreateSimple(
2553 "Pass-1 (applied to all text when loaded or modified)"),
2554 XmNmnemonic, '1', NULL);
2555 XmStringFree(s1);
2556 XtAddCallback(HighlightDialog.topLevelW, XmNvalueChangedCallback,
2557 patTypeCB, NULL);
2558 HighlightDialog.deferredW = XtVaCreateManagedWidget("deferred",
2559 xmToggleButtonWidgetClass, typeBox,
2560 XmNmarginHeight, 0,
2561 XmNlabelString, s1=XmStringCreateSimple(
2562 "Pass-2 (parsing is deferred until text is exposed)"),
2563 XmNmnemonic, '2', NULL);
2564 XmStringFree(s1);
2565 XtAddCallback(HighlightDialog.deferredW, XmNvalueChangedCallback,
2566 patTypeCB, NULL);
2567 HighlightDialog.subPatW = XtVaCreateManagedWidget("subPat",
2568 xmToggleButtonWidgetClass, typeBox,
2569 XmNmarginHeight, 0,
2570 XmNlabelString, s1=XmStringCreateSimple(
2571 "Sub-pattern (processed within start & end of parent)"),
2572 XmNmnemonic, 'u', NULL);
2573 XmStringFree(s1);
2574 XtAddCallback(HighlightDialog.subPatW, XmNvalueChangedCallback,
2575 patTypeCB, NULL);
2576 HighlightDialog.colorPatW = XtVaCreateManagedWidget("color",
2577 xmToggleButtonWidgetClass, typeBox,
2578 XmNmarginHeight, 0,
2579 XmNlabelString, s1=XmStringCreateSimple(
2580 "Coloring for sub-expressions of parent pattern"),
2581 XmNmnemonic, 'g', NULL);
2582 XmStringFree(s1);
2583 XtAddCallback(HighlightDialog.colorPatW, XmNvalueChangedCallback,
2584 patTypeCB, NULL);
2586 HighlightDialog.matchLbl = XtVaCreateManagedWidget("matchLbl",
2587 xmLabelGadgetClass, patternsForm,
2588 XmNlabelString, s1=XmStringCreateSimple("Matching:"),
2589 XmNmarginHeight, 0,
2590 XmNalignment, XmALIGNMENT_BEGINNING,
2591 XmNleftAttachment, XmATTACH_POSITION,
2592 XmNleftPosition, LIST_RIGHT,
2593 XmNtopAttachment, XmATTACH_WIDGET,
2594 XmNtopOffset, BORDER,
2595 XmNtopWidget, typeBox, NULL);
2596 XmStringFree(s1);
2598 matchBox = XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass,
2599 patternsForm,
2600 XmNpacking, XmPACK_COLUMN,
2601 XmNradioBehavior, True,
2602 XmNleftAttachment, XmATTACH_POSITION,
2603 XmNleftPosition, LIST_RIGHT,
2604 XmNtopAttachment, XmATTACH_WIDGET,
2605 XmNtopWidget, HighlightDialog.matchLbl, NULL);
2606 HighlightDialog.simpleW = XtVaCreateManagedWidget("simple",
2607 xmToggleButtonWidgetClass, matchBox,
2608 XmNset, True,
2609 XmNmarginHeight, 0,
2610 XmNlabelString, s1=XmStringCreateSimple(
2611 "Highlight text matching regular expression"),
2612 XmNmnemonic, 'x', NULL);
2613 XmStringFree(s1);
2614 XtAddCallback(HighlightDialog.simpleW, XmNvalueChangedCallback,
2615 matchTypeCB, NULL);
2616 HighlightDialog.rangeW = XtVaCreateManagedWidget("range",
2617 xmToggleButtonWidgetClass, matchBox,
2618 XmNmarginHeight, 0,
2619 XmNlabelString, s1=XmStringCreateSimple(
2620 "Highlight text between starting and ending REs"),
2621 XmNmnemonic, 'b', NULL);
2622 XmStringFree(s1);
2623 XtAddCallback(HighlightDialog.rangeW, XmNvalueChangedCallback,
2624 matchTypeCB, NULL);
2626 nameLbl = XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass,
2627 patternsForm,
2628 XmNlabelString, s1=XmStringCreateSimple("Pattern Name"),
2629 XmNmnemonic, 'N',
2630 XmNrows, 20,
2631 XmNalignment, XmALIGNMENT_BEGINNING,
2632 XmNleftAttachment, XmATTACH_POSITION,
2633 XmNleftPosition, LIST_RIGHT,
2634 XmNtopAttachment, XmATTACH_WIDGET,
2635 XmNtopWidget, matchBox,
2636 XmNtopOffset, BORDER, NULL);
2637 XmStringFree(s1);
2639 HighlightDialog.nameW = XtVaCreateManagedWidget("name", xmTextWidgetClass,
2640 patternsForm,
2641 XmNleftAttachment, XmATTACH_POSITION,
2642 XmNleftPosition, LIST_RIGHT,
2643 XmNtopAttachment, XmATTACH_WIDGET,
2644 XmNtopWidget, nameLbl,
2645 XmNrightAttachment, XmATTACH_POSITION,
2646 XmNrightPosition, (99 + LIST_RIGHT)/2, NULL);
2647 RemapDeleteKey(HighlightDialog.nameW);
2648 XtVaSetValues(nameLbl, XmNuserData, HighlightDialog.nameW, NULL);
2650 HighlightDialog.parentLbl = XtVaCreateManagedWidget("parentLbl",
2651 xmLabelGadgetClass, patternsForm,
2652 XmNlabelString, s1=XmStringCreateSimple("Parent Pattern"),
2653 XmNmnemonic, 't',
2654 XmNrows, 20,
2655 XmNalignment, XmALIGNMENT_BEGINNING,
2656 XmNleftAttachment, XmATTACH_POSITION,
2657 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2658 XmNtopAttachment, XmATTACH_WIDGET,
2659 XmNtopWidget, matchBox,
2660 XmNtopOffset, BORDER, NULL);
2661 XmStringFree(s1);
2663 HighlightDialog.parentW = XtVaCreateManagedWidget("parent",
2664 xmTextWidgetClass, patternsForm,
2665 XmNleftAttachment, XmATTACH_POSITION,
2666 XmNleftPosition, (99 + LIST_RIGHT)/2 + 1,
2667 XmNtopAttachment, XmATTACH_WIDGET,
2668 XmNtopWidget, HighlightDialog.parentLbl,
2669 XmNrightAttachment, XmATTACH_POSITION,
2670 XmNrightPosition, 99, NULL);
2671 RemapDeleteKey(HighlightDialog.parentW);
2672 XtVaSetValues(HighlightDialog.parentLbl, XmNuserData,
2673 HighlightDialog.parentW, NULL);
2675 HighlightDialog.startLbl = XtVaCreateManagedWidget("startLbl",
2676 xmLabelGadgetClass, patternsForm,
2677 XmNalignment, XmALIGNMENT_BEGINNING,
2678 XmNmnemonic, 'R',
2679 XmNtopAttachment, XmATTACH_WIDGET,
2680 XmNtopWidget, HighlightDialog.parentW,
2681 XmNtopOffset, BORDER,
2682 XmNleftAttachment, XmATTACH_POSITION,
2683 XmNleftPosition, 1, NULL);
2685 HighlightDialog.errorW = XtVaCreateManagedWidget("error",
2686 xmTextWidgetClass, patternsForm,
2687 XmNleftAttachment, XmATTACH_POSITION,
2688 XmNleftPosition, 1,
2689 XmNrightAttachment, XmATTACH_POSITION,
2690 XmNrightPosition, 99,
2691 XmNbottomAttachment, XmATTACH_POSITION,
2692 XmNbottomPosition, 99, NULL);
2693 RemapDeleteKey(HighlightDialog.errorW);
2695 HighlightDialog.errorLbl = XtVaCreateManagedWidget("errorLbl",
2696 xmLabelGadgetClass, patternsForm,
2697 XmNlabelString, s1=XmStringCreateSimple(
2698 "Regular Expression Indicating Error in Match (Optional)"),
2699 XmNmnemonic, 'o',
2700 XmNuserData, HighlightDialog.errorW,
2701 XmNalignment, XmALIGNMENT_BEGINNING,
2702 XmNleftAttachment, XmATTACH_POSITION,
2703 XmNleftPosition, 1,
2704 XmNbottomAttachment, XmATTACH_WIDGET,
2705 XmNbottomWidget, HighlightDialog.errorW, NULL);
2706 XmStringFree(s1);
2708 HighlightDialog.endW = XtVaCreateManagedWidget("end",
2709 xmTextWidgetClass, patternsForm,
2710 XmNleftAttachment, XmATTACH_POSITION,
2711 XmNleftPosition, 1,
2712 XmNbottomAttachment, XmATTACH_WIDGET,
2713 XmNbottomWidget, HighlightDialog.errorLbl,
2714 XmNbottomOffset, BORDER,
2715 XmNrightAttachment, XmATTACH_POSITION,
2716 XmNrightPosition, 99, NULL);
2717 RemapDeleteKey(HighlightDialog.endW);
2719 HighlightDialog.endLbl = XtVaCreateManagedWidget("endLbl",
2720 xmLabelGadgetClass, patternsForm,
2721 XmNmnemonic, 'E',
2722 XmNuserData, HighlightDialog.endW,
2723 XmNalignment, XmALIGNMENT_BEGINNING,
2724 XmNleftAttachment, XmATTACH_POSITION,
2725 XmNleftPosition, 1,
2726 XmNbottomAttachment, XmATTACH_WIDGET,
2727 XmNbottomWidget, HighlightDialog.endW, NULL);
2729 n = 0;
2730 XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
2731 XtSetArg(args[n], XmNscrollHorizontal, False); n++;
2732 XtSetArg(args[n], XmNwordWrap, True); n++;
2733 XtSetArg(args[n], XmNrows, 3); n++;
2734 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2735 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.endLbl); n++;
2736 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2737 XtSetArg(args[n], XmNtopAttachment, XmATTACH_WIDGET); n++;
2738 XtSetArg(args[n], XmNtopWidget, HighlightDialog.startLbl); n++;
2739 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2740 XtSetArg(args[n], XmNleftPosition, 1); n++;
2741 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2742 XtSetArg(args[n], XmNrightPosition, 99); n++;
2743 HighlightDialog.startW = XmCreateScrolledText(patternsForm, "start",args,n);
2744 AddMouseWheelSupport(HighlightDialog.startW);
2745 XtManageChild(HighlightDialog.startW);
2746 MakeSingleLineTextW(HighlightDialog.startW);
2747 RemapDeleteKey(HighlightDialog.startW);
2748 XtVaSetValues(HighlightDialog.startLbl,
2749 XmNuserData,HighlightDialog.startW, NULL);
2751 styleBtn = XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass,
2752 patternsForm,
2753 XmNlabelString, s1=MKSTRING("Add / Modify\nStyle..."),
2754 XmNmnemonic, 'i',
2755 XmNrightAttachment, XmATTACH_POSITION,
2756 XmNrightPosition, LIST_RIGHT-1,
2757 XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET,
2758 XmNbottomWidget, HighlightDialog.parentW, NULL);
2759 XmStringFree(s1);
2760 XtAddCallback(styleBtn, XmNactivateCallback, styleDialogCB, NULL);
2762 HighlightDialog.stylePulldown = createHighlightStylesMenu(patternsForm);
2763 n = 0;
2764 XtSetArg(args[n], XmNspacing, 0); n++;
2765 XtSetArg(args[n], XmNmarginWidth, 0); n++;
2766 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_OPPOSITE_WIDGET); n++;
2767 XtSetArg(args[n], XmNbottomWidget, HighlightDialog.parentW); n++;
2768 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2769 XtSetArg(args[n], XmNleftPosition, 1); n++;
2770 XtSetArg(args[n], XmNrightAttachment, XmATTACH_WIDGET); n++;
2771 XtSetArg(args[n], XmNrightWidget, styleBtn); n++;
2772 XtSetArg(args[n], XmNsubMenuId, HighlightDialog.stylePulldown); n++;
2773 HighlightDialog.styleOptMenu = XmCreateOptionMenu(patternsForm,
2774 "styleOptMenu", args, n);
2775 XtManageChild(HighlightDialog.styleOptMenu);
2777 styleLbl = XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass,
2778 patternsForm,
2779 XmNlabelString, s1=XmStringCreateSimple("Highlight Style"),
2780 XmNmnemonic, 'S',
2781 XmNuserData, XtParent(HighlightDialog.styleOptMenu),
2782 XmNalignment, XmALIGNMENT_BEGINNING,
2783 XmNleftAttachment, XmATTACH_POSITION,
2784 XmNleftPosition, 1,
2785 XmNbottomAttachment, XmATTACH_WIDGET,
2786 XmNbottomWidget, HighlightDialog.styleOptMenu, NULL);
2787 XmStringFree(s1);
2789 n = 0;
2790 XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++;
2791 XtSetArg(args[n], XmNleftAttachment, XmATTACH_POSITION); n++;
2792 XtSetArg(args[n], XmNleftPosition, 1); n++;
2793 XtSetArg(args[n], XmNrightAttachment, XmATTACH_POSITION); n++;
2794 XtSetArg(args[n], XmNrightPosition, LIST_RIGHT-1); n++;
2795 XtSetArg(args[n], XmNbottomAttachment, XmATTACH_WIDGET); n++;
2796 XtSetArg(args[n], XmNbottomWidget, styleLbl); n++;
2797 XtSetArg(args[n], XmNbottomOffset, BORDER); n++;
2798 HighlightDialog.managedListW = CreateManagedList(patternsForm, "list", args,
2799 n, (void **)HighlightDialog.patterns, &HighlightDialog.nPatterns,
2800 MAX_PATTERNS, 18, getDisplayedCB, NULL, setDisplayedCB,
2801 NULL, freeItemCB);
2802 XtVaSetValues(patternsLbl, XmNuserData, HighlightDialog.managedListW, NULL);
2804 /* Set initial default button */
2805 XtVaSetValues(form, XmNdefaultButton, okBtn, NULL);
2806 XtVaSetValues(form, XmNcancelButton, dismissBtn, NULL);
2808 /* Handle mnemonic selection of buttons and focus to dialog */
2809 AddDialogMnemonicHandler(form, FALSE);
2811 /* Fill in the dialog information for the selected language mode */
2812 SetIntText(HighlightDialog.lineContextW, patSet==NULL ? 1 :
2813 patSet->lineContext);
2814 SetIntText(HighlightDialog.charContextW, patSet==NULL ? 0 :
2815 patSet->charContext);
2816 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2817 updateLabels();
2819 /* Realize all of the widgets in the new dialog */
2820 RealizeWithoutForcingPosition(HighlightDialog.shell);
2824 ** If a syntax highlighting dialog is up, ask to have the option menu for
2825 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2827 static void updateHighlightStyleMenu(void)
2829 Widget oldMenu;
2830 int patIndex;
2832 if (HighlightDialog.shell == NULL)
2833 return;
2835 oldMenu = HighlightDialog.stylePulldown;
2836 HighlightDialog.stylePulldown = createHighlightStylesMenu(
2837 XtParent(XtParent(oldMenu)));
2838 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.styleOptMenu),
2839 XmNsubMenuId, HighlightDialog.stylePulldown, NULL);
2840 patIndex = ManagedListSelectedIndex(HighlightDialog.managedListW);
2841 if (patIndex == -1)
2842 setStyleMenu("Plain");
2843 else
2844 setStyleMenu(HighlightDialog.patterns[patIndex]->style);
2846 XtDestroyWidget(oldMenu);
2850 ** If a syntax highlighting dialog is up, ask to have the option menu for
2851 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2853 void UpdateLanguageModeMenu(void)
2855 Widget oldMenu;
2857 if (HighlightDialog.shell == NULL)
2858 return;
2860 oldMenu = HighlightDialog.lmPulldown;
2861 HighlightDialog.lmPulldown = CreateLanguageModeMenu(
2862 XtParent(XtParent(oldMenu)), langModeCB, NULL);
2863 XtVaSetValues(XmOptionButtonGadget(HighlightDialog.lmOptMenu),
2864 XmNsubMenuId, HighlightDialog.lmPulldown, NULL);
2865 SetLangModeMenu(HighlightDialog.lmOptMenu, HighlightDialog.langModeName);
2867 XtDestroyWidget(oldMenu);
2870 static void destroyCB(Widget w, XtPointer clientData, XtPointer callData)
2872 int i;
2874 freeNonNull(HighlightDialog.langModeName);
2875 for (i=0; i<HighlightDialog.nPatterns; i++)
2876 freePatternSrc(HighlightDialog.patterns[i], True);
2877 HighlightDialog.shell = NULL;
2880 static void langModeCB(Widget w, XtPointer clientData, XtPointer callData)
2882 char *modeName;
2883 patternSet *oldPatSet, *newPatSet;
2884 patternSet emptyPatSet = {NULL, 1, 0, 0, NULL};
2885 int i, resp;
2887 /* Get the newly selected mode name. If it's the same, do nothing */
2888 XtVaGetValues(w, XmNuserData, &modeName, NULL);
2889 if (!strcmp(modeName, HighlightDialog.langModeName))
2890 return;
2892 /* Look up the original version of the patterns being edited */
2893 oldPatSet = FindPatternSet(HighlightDialog.langModeName);
2894 if (oldPatSet == NULL)
2895 oldPatSet = &emptyPatSet;
2897 /* Get the current information displayed by the dialog. If it's bad,
2898 give the user the chance to throw it out or go back and fix it. If
2899 it has changed, give the user the chance to apply discard or cancel. */
2900 newPatSet = getDialogPatternSet();
2902 if (newPatSet == NULL)
2904 if (DialogF(DF_WARN, HighlightDialog.shell, 2,
2905 "Incomplete Language Mode", "Discard incomplete entry\n"
2906 "for current language mode?", "Keep", "Discard") == 1)
2908 SetLangModeMenu(HighlightDialog.lmOptMenu,
2909 HighlightDialog.langModeName);
2910 return;
2912 } else if (patternSetsDiffer(oldPatSet, newPatSet))
2914 resp = DialogF(DF_WARN, HighlightDialog.shell, 3, "Language Mode",
2915 "Apply changes for language mode %s?", "Apply Changes",
2916 "Discard Changes", "Cancel", HighlightDialog.langModeName);
2917 if (resp == 3)
2919 SetLangModeMenu(HighlightDialog.lmOptMenu,
2920 HighlightDialog.langModeName);
2921 return;
2923 if (resp == 1)
2925 updatePatternSet();
2929 if (newPatSet != NULL)
2930 freePatternSet(newPatSet);
2932 /* Free the old dialog information */
2933 freeNonNull(HighlightDialog.langModeName);
2934 for (i=0; i<HighlightDialog.nPatterns; i++)
2935 freePatternSrc(HighlightDialog.patterns[i], True);
2937 /* Fill the dialog with the new language mode information */
2938 HighlightDialog.langModeName = XtNewString(modeName);
2939 newPatSet = FindPatternSet(modeName);
2940 if (newPatSet == NULL) {
2941 HighlightDialog.nPatterns = 0;
2942 SetIntText(HighlightDialog.lineContextW, 1);
2943 SetIntText(HighlightDialog.charContextW, 0);
2944 } else {
2945 for (i=0; i<newPatSet->nPatterns; i++)
2946 HighlightDialog.patterns[i] =
2947 copyPatternSrc(&newPatSet->patterns[i], NULL);
2948 HighlightDialog.nPatterns = newPatSet->nPatterns;
2949 SetIntText(HighlightDialog.lineContextW, newPatSet->lineContext);
2950 SetIntText(HighlightDialog.charContextW, newPatSet->charContext);
2952 ChangeManagedListData(HighlightDialog.managedListW);
2955 static void lmDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2957 EditLanguageModes();
2960 static void styleDialogCB(Widget w, XtPointer clientData, XtPointer callData)
2962 Widget selectedItem;
2963 char *style;
2965 XtVaGetValues(HighlightDialog.styleOptMenu,
2966 XmNmenuHistory, &selectedItem,
2967 NULL);
2968 XtVaGetValues(selectedItem,
2969 XmNuserData, &style,
2970 NULL);
2971 EditHighlightStyles(style);
2974 static void okCB(Widget w, XtPointer clientData, XtPointer callData)
2976 /* change the patterns */
2977 if (!updatePatternSet())
2978 return;
2980 /* pop down and destroy the dialog */
2981 CloseAllPopupsFor(HighlightDialog.shell);
2982 XtDestroyWidget(HighlightDialog.shell);
2985 static void applyCB(Widget w, XtPointer clientData, XtPointer callData)
2987 /* change the patterns */
2988 updatePatternSet();
2991 static void checkCB(Widget w, XtPointer clientData, XtPointer callData)
2993 if (checkHighlightDialogData())
2995 DialogF(DF_INF, HighlightDialog.shell, 1, "Pattern compiled",
2996 "Patterns compiled without error", "Dismiss");
3000 static void restoreCB(Widget w, XtPointer clientData, XtPointer callData)
3002 patternSet *defaultPatSet;
3003 int i, psn;
3005 defaultPatSet = readDefaultPatternSet(HighlightDialog.langModeName);
3006 if (defaultPatSet == NULL)
3008 DialogF(DF_WARN, HighlightDialog.shell, 1, "No Default Pattern",
3009 "There is no default pattern set\nfor language mode %s",
3010 "Dismiss", HighlightDialog.langModeName);
3011 return;
3014 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Changes",
3015 "Are you sure you want to discard\n"
3016 "all changes to syntax highlighting\n"
3017 "patterns for language mode %s?", "Discard", "Cancel",
3018 HighlightDialog.langModeName) == 2)
3020 return;
3023 /* if a stored version of the pattern set exists, replace it, if it
3024 doesn't, add a new one */
3025 for (psn=0; psn<NPatternSets; psn++)
3026 if (!strcmp(HighlightDialog.langModeName,
3027 PatternSets[psn]->languageMode))
3028 break;
3029 if (psn < NPatternSets) {
3030 freePatternSet(PatternSets[psn]);
3031 PatternSets[psn] = defaultPatSet;
3032 } else
3033 PatternSets[NPatternSets++] = defaultPatSet;
3035 /* Free the old dialog information */
3036 for (i=0; i<HighlightDialog.nPatterns; i++)
3037 freePatternSrc(HighlightDialog.patterns[i], True);
3039 /* Update the dialog */
3040 HighlightDialog.nPatterns = defaultPatSet->nPatterns;
3041 for (i=0; i<defaultPatSet->nPatterns; i++)
3042 HighlightDialog.patterns[i] =
3043 copyPatternSrc(&defaultPatSet->patterns[i], NULL);
3044 SetIntText(HighlightDialog.lineContextW, defaultPatSet->lineContext);
3045 SetIntText(HighlightDialog.charContextW, defaultPatSet->charContext);
3046 ChangeManagedListData(HighlightDialog.managedListW);
3049 static void deleteCB(Widget w, XtPointer clientData, XtPointer callData)
3051 int i, psn;
3053 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Delete Pattern",
3054 "Are you sure you want to delete\n"
3055 "syntax highlighting patterns for\n"
3056 "language mode %s?", "Yes, Delete", "Cancel",
3057 HighlightDialog.langModeName) == 2)
3059 return;
3062 /* if a stored version of the pattern set exists, delete it from the list */
3063 for (psn=0; psn<NPatternSets; psn++)
3064 if (!strcmp(HighlightDialog.langModeName,
3065 PatternSets[psn]->languageMode))
3066 break;
3067 if (psn < NPatternSets) {
3068 freePatternSet(PatternSets[psn]);
3069 memmove(&PatternSets[psn], &PatternSets[psn+1],
3070 (NPatternSets-1 - psn) * sizeof(patternSet *));
3071 NPatternSets--;
3074 /* Free the old dialog information */
3075 for (i=0; i<HighlightDialog.nPatterns; i++)
3076 freePatternSrc(HighlightDialog.patterns[i], True);
3078 /* Clear out the dialog */
3079 HighlightDialog.nPatterns = 0;
3080 SetIntText(HighlightDialog.lineContextW, 1);
3081 SetIntText(HighlightDialog.charContextW, 0);
3082 ChangeManagedListData(HighlightDialog.managedListW);
3085 static void dismissCB(Widget w, XtPointer clientData, XtPointer callData)
3087 /* pop down and destroy the dialog */
3088 CloseAllPopupsFor(HighlightDialog.shell);
3089 XtDestroyWidget(HighlightDialog.shell);
3092 static void helpCB(Widget w, XtPointer clientData, XtPointer callData)
3094 Help(HELP_PATTERNS);
3097 static void patTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3099 updateLabels();
3102 static void matchTypeCB(Widget w, XtPointer clientData, XtPointer callData)
3104 updateLabels();
3107 static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort,
3108 void *cbArg)
3110 highlightPattern *pat;
3112 /* If the dialog is currently displaying the "new" entry and the
3113 fields are empty, that's just fine */
3114 if (oldItem == NULL && dialogEmpty())
3115 return NULL;
3117 /* If there are no problems reading the data, just return it */
3118 pat = readDialogFields(True);
3119 if (pat != NULL)
3120 return (void *)pat;
3122 /* If there are problems, and the user didn't ask for the fields to be
3123 read, give more warning */
3124 if (!explicitRequest)
3126 if (DialogF(DF_WARN, HighlightDialog.shell, 2, "Discard Entry",
3127 "Discard incomplete entry\nfor current pattern?", "Keep",
3128 "Discard") == 2)
3130 return oldItem == NULL
3131 ? NULL
3132 : (void *)copyPatternSrc((highlightPattern *)oldItem, NULL);
3136 /* Do readDialogFields again without "silent" mode to display warning */
3137 pat = readDialogFields(False);
3138 *abort = True;
3139 return NULL;
3142 static void setDisplayedCB(void *item, void *cbArg)
3144 highlightPattern *pat = (highlightPattern *)item;
3145 int isSubpat, isDeferred, isColorOnly, isRange;
3147 if (item == NULL) {
3148 XmTextSetString(HighlightDialog.nameW, "");
3149 XmTextSetString(HighlightDialog.parentW, "");
3150 XmTextSetString(HighlightDialog.startW, "");
3151 XmTextSetString(HighlightDialog.endW, "");
3152 XmTextSetString(HighlightDialog.errorW, "");
3153 RadioButtonChangeState(HighlightDialog.topLevelW, True, False);
3154 RadioButtonChangeState(HighlightDialog.deferredW, False, False);
3155 RadioButtonChangeState(HighlightDialog.subPatW, False, False);
3156 RadioButtonChangeState(HighlightDialog.colorPatW, False, False);
3157 RadioButtonChangeState(HighlightDialog.simpleW, True, False);
3158 RadioButtonChangeState(HighlightDialog.rangeW, False, False);
3159 setStyleMenu("Plain");
3160 } else {
3161 isSubpat = pat->subPatternOf != NULL;
3162 isDeferred = pat->flags & DEFER_PARSING;
3163 isColorOnly = pat->flags & COLOR_ONLY;
3164 isRange = pat->endRE != NULL;
3165 XmTextSetString(HighlightDialog.nameW, pat->name);
3166 XmTextSetString(HighlightDialog.parentW, pat->subPatternOf);
3167 XmTextSetString(HighlightDialog.startW, pat->startRE);
3168 XmTextSetString(HighlightDialog.endW, pat->endRE);
3169 XmTextSetString(HighlightDialog.errorW, pat->errorRE);
3170 RadioButtonChangeState(HighlightDialog.topLevelW,
3171 !isSubpat && !isDeferred, False);
3172 RadioButtonChangeState(HighlightDialog.deferredW,
3173 !isSubpat && isDeferred, False);
3174 RadioButtonChangeState(HighlightDialog.subPatW,
3175 isSubpat && !isColorOnly, False);
3176 RadioButtonChangeState(HighlightDialog.colorPatW,
3177 isSubpat && isColorOnly, False);
3178 RadioButtonChangeState(HighlightDialog.simpleW, !isRange, False);
3179 RadioButtonChangeState(HighlightDialog.rangeW, isRange, False);
3180 setStyleMenu(pat->style);
3182 updateLabels();
3185 static void freeItemCB(void *item)
3187 freePatternSrc((highlightPattern *)item, True);
3191 ** Do a test compile of the patterns currently displayed in the highlight
3192 ** patterns dialog, and display warning dialogs if there are problems
3194 static int checkHighlightDialogData(void)
3196 patternSet *patSet;
3197 int result;
3199 /* Get the pattern information from the dialog */
3200 patSet = getDialogPatternSet();
3201 if (patSet == NULL)
3202 return False;
3204 /* Compile the patterns */
3205 result = patSet->nPatterns == 0 ? True : TestHighlightPatterns(patSet);
3206 freePatternSet(patSet);
3207 return result;
3211 ** Update the text field labels and sensitivity of various fields, based on
3212 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3213 ** patterns dialog.
3215 static void updateLabels(void)
3217 char *startLbl, *endLbl;
3218 int endSense, errSense, matchSense, parentSense;
3219 XmString s1;
3221 if (XmToggleButtonGetState(HighlightDialog.colorPatW)) {
3222 startLbl = "Sub-expressions to Highlight in Parent's Starting \
3223 Regular Expression (\\1, &, etc.)";
3224 endLbl = "Sub-expressions to Highlight in Parent Pattern's Ending \
3225 Regular Expression";
3226 endSense = True;
3227 errSense = False;
3228 matchSense = False;
3229 parentSense = True;
3230 } else {
3231 endLbl = "Ending Regular Expression";
3232 matchSense = True;
3233 parentSense = XmToggleButtonGetState(HighlightDialog.subPatW);
3234 if (XmToggleButtonGetState(HighlightDialog.simpleW)) {
3235 startLbl = "Regular Expression to Match";
3236 endSense = False;
3237 errSense = False;
3238 } else {
3239 startLbl = "Starting Regular Expression";
3240 endSense = True;
3241 errSense = True;
3245 XtSetSensitive(HighlightDialog.parentLbl, parentSense);
3246 XtSetSensitive(HighlightDialog.parentW, parentSense);
3247 XtSetSensitive(HighlightDialog.endW, endSense);
3248 XtSetSensitive(HighlightDialog.endLbl, endSense);
3249 XtSetSensitive(HighlightDialog.errorW, errSense);
3250 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3251 XtSetSensitive(HighlightDialog.errorLbl, errSense);
3252 XtSetSensitive(HighlightDialog.simpleW, matchSense);
3253 XtSetSensitive(HighlightDialog.rangeW, matchSense);
3254 XtSetSensitive(HighlightDialog.matchLbl, matchSense);
3255 XtVaSetValues(HighlightDialog.startLbl, XmNlabelString,
3256 s1=XmStringCreateSimple(startLbl), NULL);
3257 XmStringFree(s1);
3258 XtVaSetValues(HighlightDialog.endLbl, XmNlabelString,
3259 s1=XmStringCreateSimple(endLbl), NULL);
3260 XmStringFree(s1);
3264 ** Set the styles menu in the currently displayed highlight dialog to show
3265 ** a particular style
3267 static void setStyleMenu(const char *styleName)
3269 int i;
3270 Cardinal nItems;
3271 WidgetList items;
3272 Widget selectedItem;
3273 char *itemStyle;
3275 XtVaGetValues(HighlightDialog.stylePulldown, XmNchildren, &items,
3276 XmNnumChildren, &nItems, NULL);
3277 if (nItems == 0)
3278 return;
3279 selectedItem = items[0];
3280 for (i=0; i<(int)nItems; i++) {
3281 XtVaGetValues(items[i], XmNuserData, &itemStyle, NULL);
3282 if (!strcmp(itemStyle, styleName)) {
3283 selectedItem = items[i];
3284 break;
3287 XtVaSetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, selectedItem, (char *)0);
3291 ** Read the pattern fields of the highlight dialog, and produce an allocated
3292 ** highlightPattern structure reflecting the contents, or pop up dialogs
3293 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3294 ** dialogs). Returns NULL on error.
3296 static highlightPattern *readDialogFields(int silent)
3298 highlightPattern *pat;
3299 char *inPtr, *outPtr, *style;
3300 Widget selectedItem;
3301 int colorOnly;
3303 /* Allocate a pattern source structure to return, zero out fields
3304 so that the whole pattern can be freed on error with freePatternSrc */
3305 pat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3306 pat->endRE = NULL;
3307 pat->errorRE = NULL;
3308 pat->style = NULL;
3309 pat->subPatternOf = NULL;
3311 /* read the type buttons */
3312 pat->flags = 0;
3313 colorOnly = XmToggleButtonGetState(HighlightDialog.colorPatW);
3314 if (XmToggleButtonGetState(HighlightDialog.deferredW))
3315 pat->flags |= DEFER_PARSING;
3316 else if (colorOnly)
3317 pat->flags = COLOR_ONLY;
3319 /* read the name field */
3320 pat->name = ReadSymbolicFieldTextWidget(HighlightDialog.nameW,
3321 "highlight pattern name", silent);
3322 if (pat->name == NULL) {
3323 XtFree((char *)pat);
3324 return NULL;
3327 if (*pat->name == '\0')
3329 if (!silent)
3331 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Name",
3332 "Please specify a name\nfor the pattern", "Dismiss");
3333 XmProcessTraversal(HighlightDialog.nameW, XmTRAVERSE_CURRENT);
3335 XtFree(pat->name);
3336 XtFree((char *)pat);
3337 return NULL;
3340 /* read the startRE field */
3341 pat->startRE = XmTextGetString(HighlightDialog.startW);
3342 if (*pat->startRE == '\0')
3344 if (!silent)
3346 DialogF(DF_WARN, HighlightDialog.shell, 1, "Matching Regex",
3347 "Please specify a regular\nexpression to match", "Dismiss");
3348 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3350 freePatternSrc(pat, True);
3351 return NULL;
3354 /* Make sure coloring patterns contain only sub-expression references
3355 and put it in replacement regular-expression form */
3356 if (colorOnly)
3358 for (inPtr=pat->startRE, outPtr=pat->startRE; *inPtr!='\0'; inPtr++)
3360 if (*inPtr!=' ' && *inPtr!='\t')
3362 *outPtr++ = *inPtr;
3366 *outPtr = '\0';
3367 if (strspn(pat->startRE, "&\\123456789 \t") != strlen(pat->startRE)
3368 || (*pat->startRE != '\\' && *pat->startRE != '&')
3369 || strstr(pat->startRE, "\\\\") != NULL)
3371 if (!silent)
3373 DialogF(DF_WARN, HighlightDialog.shell, 1, "Pattern Error",
3374 "The expression field in patterns which specify highlighting for\n"
3375 "a parent, must contain only sub-expression references in regular\n"
3376 "expression replacement form (&\\1\\2 etc.). See Help -> Regular\n"
3377 "Expressions and Help -> Syntax Highlighting for more information",
3378 "Dismiss");
3379 XmProcessTraversal(HighlightDialog.startW, XmTRAVERSE_CURRENT);
3381 freePatternSrc(pat, True);
3382 return NULL;
3386 /* read the parent field */
3387 if (XmToggleButtonGetState(HighlightDialog.subPatW) || colorOnly)
3389 if (TextWidgetIsBlank(HighlightDialog.parentW))
3391 if (!silent)
3393 DialogF(DF_WARN, HighlightDialog.shell, 1,
3394 "Specify Parent Pattern",
3395 "Please specify a parent pattern", "Dismiss");
3396 XmProcessTraversal(HighlightDialog.parentW, XmTRAVERSE_CURRENT);
3398 freePatternSrc(pat, True);
3399 return NULL;
3401 pat->subPatternOf = XmTextGetString(HighlightDialog.parentW);
3404 /* read the styles option menu */
3405 XtVaGetValues(HighlightDialog.styleOptMenu, XmNmenuHistory, &selectedItem, NULL);
3406 XtVaGetValues(selectedItem, XmNuserData, &style, NULL);
3407 pat->style = XtMalloc(strlen(style) + 1);
3408 strcpy(pat->style, style);
3411 /* read the endRE field */
3412 if (colorOnly || XmToggleButtonGetState(HighlightDialog.rangeW))
3414 pat->endRE = XmTextGetString(HighlightDialog.endW);
3415 if (!colorOnly && *pat->endRE == '\0')
3417 if (!silent)
3419 DialogF(DF_WARN, HighlightDialog.shell, 1, "Specify Regex",
3420 "Please specify an ending\nregular expression",
3421 "Dismiss");
3422 XmProcessTraversal(HighlightDialog.endW, XmTRAVERSE_CURRENT);
3424 freePatternSrc(pat, True);
3425 return NULL;
3429 /* read the errorRE field */
3430 if (XmToggleButtonGetState(HighlightDialog.rangeW)) {
3431 pat->errorRE = XmTextGetString(HighlightDialog.errorW);
3432 if (*pat->errorRE == '\0') {
3433 XtFree(pat->errorRE);
3434 pat->errorRE = NULL;
3437 return pat;
3441 ** Returns true if the pattern fields of the highlight dialog are set to
3442 ** the default ("New" pattern) state.
3444 static int dialogEmpty(void)
3446 return TextWidgetIsBlank(HighlightDialog.nameW) &&
3447 XmToggleButtonGetState(HighlightDialog.topLevelW) &&
3448 XmToggleButtonGetState(HighlightDialog.simpleW) &&
3449 TextWidgetIsBlank(HighlightDialog.parentW) &&
3450 TextWidgetIsBlank(HighlightDialog.startW) &&
3451 TextWidgetIsBlank(HighlightDialog.endW) &&
3452 TextWidgetIsBlank(HighlightDialog.errorW);
3456 ** Update the pattern set being edited in the Syntax Highlighting dialog
3457 ** with the information that the dialog is currently displaying, and
3458 ** apply changes to any window which is currently using the patterns.
3460 static int updatePatternSet(void)
3462 patternSet *patSet;
3463 WindowInfo *window;
3464 int psn;
3466 /* Make sure the patterns are valid and compile */
3467 if (!checkHighlightDialogData())
3468 return False;
3470 /* Get the current data */
3471 patSet = getDialogPatternSet();
3472 if (patSet == NULL)
3473 return False;
3475 /* Find the pattern being modified */
3476 for (psn=0; psn<NPatternSets; psn++)
3477 if (!strcmp(HighlightDialog.langModeName,
3478 PatternSets[psn]->languageMode))
3479 break;
3481 /* If it's a new pattern, add it at the end, otherwise free the
3482 existing pattern set and replace it */
3483 if (psn == NPatternSets) {
3484 PatternSets[NPatternSets++] = patSet;
3485 } else {
3486 freePatternSet(PatternSets[psn]);
3487 PatternSets[psn] = patSet;
3490 /* Find windows that are currently using this pattern set and
3491 re-do the highlighting */
3492 for (window=WindowList; window!=NULL; window=window->next) {
3493 if (window->highlightSyntax &&
3494 window->languageMode != PLAIN_LANGUAGE_MODE) {
3495 if (!strcmp(LanguageModeName(window->languageMode),
3496 patSet->languageMode)) {
3497 StopHighlighting(window);
3498 StartHighlighting(window, True);
3503 /* Note that preferences have been changed */
3504 MarkPrefsChanged();
3506 return True;
3510 ** Get the current information that the user has entered in the syntax
3511 ** highlighting dialog. Return NULL if the data is currently invalid
3513 static patternSet *getDialogPatternSet(void)
3515 int i, lineContext, charContext;
3516 patternSet *patSet;
3518 /* Get the current contents of the "patterns" dialog fields */
3519 if (!UpdateManagedList(HighlightDialog.managedListW, True))
3520 return NULL;
3522 /* Get the line and character context values */
3523 if (GetIntTextWarn(HighlightDialog.lineContextW, &lineContext,
3524 "context lines", True) != TEXT_READ_OK)
3525 return NULL;
3526 if (GetIntTextWarn(HighlightDialog.charContextW, &charContext,
3527 "context lines", True) != TEXT_READ_OK)
3528 return NULL;
3530 /* Allocate a new pattern set structure and copy the fields read from the
3531 dialog, including the modified pattern list into it */
3532 patSet = (patternSet *)XtMalloc(sizeof(patternSet));
3533 patSet->languageMode = XtNewString(HighlightDialog.langModeName);
3534 patSet->lineContext = lineContext;
3535 patSet->charContext = charContext;
3536 patSet->nPatterns = HighlightDialog.nPatterns;
3537 patSet->patterns = (highlightPattern *)XtMalloc(sizeof(highlightPattern) *
3538 HighlightDialog.nPatterns);
3539 for (i=0; i<HighlightDialog.nPatterns; i++)
3540 copyPatternSrc(HighlightDialog.patterns[i], &patSet->patterns[i]);
3541 return patSet;
3545 ** Return True if "patSet1" and "patSet2" differ
3547 static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2)
3549 int i;
3550 highlightPattern *pat1, *pat2;
3552 if (patSet1->lineContext != patSet2->lineContext)
3553 return True;
3554 if (patSet1->charContext != patSet2->charContext)
3555 return True;
3556 if (patSet1->nPatterns != patSet2->nPatterns)
3557 return True;
3558 for (i=0; i<patSet2->nPatterns; i++) {
3559 pat1 = &patSet1->patterns[i];
3560 pat2 = &patSet2->patterns[i];
3561 if (pat1->flags != pat2->flags)
3562 return True;
3563 if (AllocatedStringsDiffer(pat1->name, pat2->name))
3564 return True;
3565 if (AllocatedStringsDiffer(pat1->startRE, pat2->startRE))
3566 return True;
3567 if (AllocatedStringsDiffer(pat1->endRE, pat2->endRE))
3568 return True;
3569 if (AllocatedStringsDiffer(pat1->errorRE, pat2->errorRE))
3570 return True;
3571 if (AllocatedStringsDiffer(pat1->style, pat2->style))
3572 return True;
3573 if (AllocatedStringsDiffer(pat1->subPatternOf, pat2->subPatternOf))
3574 return True;
3576 return False;
3580 ** Copy a highlight pattern data structure and all of the allocated data
3581 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3582 ** otherwise allocate a new highlightPattern structure and return it as the
3583 ** function value.
3585 static highlightPattern *copyPatternSrc(highlightPattern *pat,
3586 highlightPattern *copyTo)
3588 highlightPattern *newPat;
3590 if (copyTo == NULL)
3591 newPat = (highlightPattern *)XtMalloc(sizeof(highlightPattern));
3592 else
3593 newPat = copyTo;
3594 newPat->name = XtNewString(pat->name);
3595 newPat->startRE = XtNewString(pat->startRE);
3596 newPat->endRE = XtNewString(pat->endRE);
3597 newPat->errorRE = XtNewString(pat->errorRE);
3598 newPat->style = XtNewString(pat->style);
3599 newPat->subPatternOf = XtNewString(pat->subPatternOf);
3600 newPat->flags = pat->flags;
3601 return newPat;
3604 static void freeNonNull(void *ptr)
3606 if (ptr != NULL)
3607 XtFree((char *)ptr);
3611 ** Free the allocated memory contained in a highlightPattern data structure
3612 ** If "freeStruct" is true, free the structure itself as well.
3614 static void freePatternSrc(highlightPattern *pat, int freeStruct)
3616 XtFree(pat->name);
3617 freeNonNull(pat->startRE);
3618 freeNonNull(pat->endRE);
3619 freeNonNull(pat->errorRE);
3620 freeNonNull(pat->style);
3621 freeNonNull(pat->subPatternOf);
3622 if (freeStruct)
3623 XtFree((char *)pat);
3627 ** Free the allocated memory contained in a patternSet data structure
3628 ** If "freeStruct" is true, free the structure itself as well.
3630 static void freePatternSet(patternSet *p)
3632 int i;
3634 for (i=0; i<p->nPatterns; i++)
3635 freePatternSrc(&p->patterns[i], False);
3636 XtFree(p->languageMode);
3637 XtFree((char *)p->patterns);
3638 XtFree((char *)p);
3641 #if 0
3643 ** Free the allocated memory contained in a patternSet data structure
3644 ** If "freeStruct" is true, free the structure itself as well.
3646 static int lookupNamedPattern(patternSet *p, char *patternName)
3648 int i;
3650 for (i=0; i<p->nPatterns; i++)
3651 if (strcmp(p->patterns[i].name, patternName))
3652 return i;
3653 return -1;
3655 #endif
3658 ** Find the index into the HighlightStyles array corresponding to "styleName".
3659 ** If styleName is not found, return -1.
3661 static int lookupNamedStyle(const char *styleName)
3663 int i;
3665 for (i = 0; i < NHighlightStyles; i++)
3667 if (!strcmp(styleName, HighlightStyles[i]->name))
3669 return i;
3673 return -1;
3677 ** Returns a unique number of a given style name
3679 int IndexOfNamedStyle(const char *styleName)
3681 return lookupNamedStyle(styleName);
3685 ** Write the string representation of int "i" to a static area, and
3686 ** return a pointer to it.
3688 static char *intToStr(int i)
3690 static char outBuf[12];
3692 sprintf(outBuf, "%d", i);
3693 return outBuf;