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