1 static const char CVSID
[] = "$Id: highlightData.c,v 1.40 2002/12/12 17:25:46 slobasso Exp $";
2 /*******************************************************************************
4 * highlightData.c -- Maintain, and allow user to edit, highlight pattern list *
5 * used for syntax highlighting *
7 * Copyright (C) 1999 Mark Edel *
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 *
14 * This software is distributed in the hope that it will be useful, but WITHOUT *
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
19 * You should have received a copy of the GNU General Public License along with *
20 * software; if not, write to the Free Software Foundation, Inc., 59 Temple *
21 * Place, Suite 330, Boston, MA 02111-1307 USA *
23 * Nirvana Text Editor *
26 * Written by Mark Edel *
28 *******************************************************************************/
31 #include "../config.h"
34 #include "highlightData.h"
37 #include "highlight.h"
38 #include "regularExp.h"
39 #include "preferences.h"
42 #include "regexConvert.h"
43 #include "../util/misc.h"
44 #include "../util/DialogF.h"
45 #include "../util/managedList.h"
51 #include "../util/VMSparam.h"
54 #include <sys/param.h>
62 #include <Xm/LabelG.h>
64 #include <Xm/ToggleB.h>
65 #include <Xm/RowColumn.h>
66 #include <Xm/SeparatoG.h>
72 /* Maximum allowed number of styles (also limited by representation of
73 styles as a byte - 'b') */
74 #define MAX_HIGHLIGHT_STYLES 128
76 /* Maximum number of patterns allowed in a pattern set (regular expression
77 limitations are probably much more restrictive). */
78 #define MAX_PATTERNS 127
80 /* Names for the fonts that can be used for syntax highlighting */
81 #define N_FONT_TYPES 4
82 enum fontTypes
{PLAIN_FONT
, ITALIC_FONT
, BOLD_FONT
, BOLD_ITALIC_FONT
};
83 static const char *FontTypeNames
[N_FONT_TYPES
] =
84 {"Plain", "Italic", "Bold", "Bold Italic"};
93 static int styleError(const char *stringStart
, const char *stoppedAt
,
96 static int lookupNamedPattern(patternSet
*p
, char *patternName
);
98 static int lookupNamedStyle(const char *styleName
);
99 static highlightPattern
*readHighlightPatterns(char **inPtr
, int withBraces
,
100 char **errMsg
, int *nPatterns
);
101 static int readHighlightPattern(char **inPtr
, char **errMsg
,
102 highlightPattern
*pattern
);
103 static patternSet
*readDefaultPatternSet(const char *langModeName
);
104 static int isDefaultPatternSet(patternSet
*patSet
);
105 static patternSet
*readPatternSet(char **inPtr
, int convertOld
);
106 static patternSet
*highlightError(char *stringStart
, char *stoppedAt
,
107 const char *message
);
108 static char *intToStr(int i
);
109 static char *createPatternsString(patternSet
*patSet
, char *indentStr
);
110 static void setStyleByName(const char *style
);
111 static void hsDestroyCB(Widget w
, XtPointer clientData
, XtPointer callData
);
112 static void hsOkCB(Widget w
, XtPointer clientData
, XtPointer callData
);
113 static void hsApplyCB(Widget w
, XtPointer clientData
, XtPointer callData
);
114 static void hsDismissCB(Widget w
, XtPointer clientData
, XtPointer callData
);
115 static highlightStyleRec
*copyHighlightStyleRec(highlightStyleRec
*hs
);
116 static void *hsGetDisplayedCB(void *oldItem
, int explicitRequest
, int *abort
,
118 static void hsSetDisplayedCB(void *item
, void *cbArg
);
119 static highlightStyleRec
*readHSDialogFields(int silent
);
120 static void hsFreeItemCB(void *item
);
121 static void freeHighlightStyleRec(highlightStyleRec
*hs
);
122 static int hsDialogEmpty(void);
123 static int updateHSList(void);
124 static void updateHighlightStyleMenu(void);
125 static void convertOldPatternSet(patternSet
*patSet
);
126 static void convertPatternExpr(char **patternRE
, char *patSetName
,
127 char *patName
, int isSubsExpr
);
128 static Widget
createHighlightStylesMenu(Widget parent
);
129 static void destroyCB(Widget w
, XtPointer clientData
, XtPointer callData
);
130 static void langModeCB(Widget w
, XtPointer clientData
, XtPointer callData
);
131 static void lmDialogCB(Widget w
, XtPointer clientData
, XtPointer callData
);
132 static void styleDialogCB(Widget w
, XtPointer clientData
, XtPointer callData
);
133 static void patTypeCB(Widget w
, XtPointer clientData
, XtPointer callData
);
134 static void matchTypeCB(Widget w
, XtPointer clientData
, XtPointer callData
);
135 static int checkHighlightDialogData(void);
136 static void updateLabels(void);
137 static void okCB(Widget w
, XtPointer clientData
, XtPointer callData
);
138 static void applyCB(Widget w
, XtPointer clientData
, XtPointer callData
);
139 static void checkCB(Widget w
, XtPointer clientData
, XtPointer callData
);
140 static void restoreCB(Widget w
, XtPointer clientData
, XtPointer callData
);
141 static void deleteCB(Widget w
, XtPointer clientData
, XtPointer callData
);
142 static void dismissCB(Widget w
, XtPointer clientData
, XtPointer callData
);
143 static void helpCB(Widget w
, XtPointer clientData
, XtPointer callData
);
144 static void *getDisplayedCB(void *oldItem
, int explicitRequest
, int *abort
,
146 static void setDisplayedCB(void *item
, void *cbArg
);
147 static void setStyleMenu(const char *styleName
);
148 static highlightPattern
*readDialogFields(int silent
);
149 static int dialogEmpty(void);
150 static int updatePatternSet(void);
151 static patternSet
*getDialogPatternSet(void);
152 static int patternSetsDiffer(patternSet
*patSet1
, patternSet
*patSet2
);
153 static highlightPattern
*copyPatternSrc(highlightPattern
*pat
,
154 highlightPattern
*copyTo
);
155 static void freeNonNull(void *ptr
);
156 static void freeItemCB(void *item
);
157 static void freePatternSrc(highlightPattern
*pat
, int freeStruct
);
158 static void freePatternSet(patternSet
*p
);
160 /* list of available highlight styles */
161 static int NHighlightStyles
= 0;
162 static highlightStyleRec
*HighlightStyles
[MAX_HIGHLIGHT_STYLES
];
164 /* Highlight styles dialog information */
171 Widget plainW
, boldW
, italicW
, boldItalicW
;
173 highlightStyleRec
**highlightStyleList
;
174 int nHighlightStyles
;
175 } HSDialog
= {NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,NULL
,0};
177 /* Highlight dialog information */
183 Widget stylePulldown
;
205 highlightPattern
**patterns
;
206 } HighlightDialog
= {NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
,
207 NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
,
208 NULL
, NULL
, NULL
, NULL
, NULL
, 0, NULL
};
210 /* Pattern sources loaded from the .nedit file or set by the user */
211 static int NPatternSets
= 0;
212 static patternSet
*PatternSets
[MAX_LANGUAGE_MODES
];
214 static char *DefaultPatternSets
[] = {
216 Comments:\"--\":\"$\"::Comment::\n\
217 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
218 Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\
219 Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\
220 Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\
221 Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\
222 Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\
223 Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\
224 Withs Use:\"(?#Make \\s work across newlines)(?n(?iwith|use)(?#Leading W/S)\\s+(?#First package name)(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*)(?#Additional package names [optional])(?:\\s*,\\s*(?:\\l[\\l\\d]*(?:(_|\\.\\l)[\\l\\d]+)*))*(?#Trailing W/S)\\s*;)+\":::Preprocessor::\n\
225 Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\
226 Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\
227 Reserved Words:\"(?i(?=[a-gil-pr-uwx]))<(?iabort|abs|accept|access|and|array|at|begin|body|case|constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function|generic|goto|if|in|is|limited|loop|mod|new|not|null|of|or|others|out|package|pragma|private|procedure|raise|range|record|rem|renames|return|reverse|select|separate|subtype|task|terminate|then|type|use|when|while|with|xor)>\":::Keyword::D\n\
228 Dot All:\"\\.(?iall)>\":::Storage Type::\n\
229 Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\
230 Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\
231 Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\
232 Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\
233 Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\
234 Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\
235 Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\
236 Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\
237 Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}",
239 Comment:\"#\":\"$\"::Comment::\n\
240 Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\
241 Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\
242 String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\
243 String escape:\"\\\\(.|\\n)\":::String1:String:\n\
244 Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\
245 Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\
246 Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\
247 Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\
248 Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\
249 BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\
250 Numeric constant:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
251 String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\
252 String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\
253 newline escape:\"\\\\$\":::Preprocessor1::\n\
254 Function:\"function\":::Preprocessor1::D}",
256 comment:\"/\\*\":\"\\*/\"::Comment::\n\
257 cplus comment:\"//\":\"$\"::Comment::\n\
258 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
259 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
260 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
261 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
262 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
263 preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\
264 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
265 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
266 numeric constant:\"(?<!\\Y)(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
267 storage keyword:\"<(?:class|typename|typeid|template|friend|virtual|inline|explicit|operator|public|private|protected|const|extern|auto|register|static|mutable|unsigned|signed|volatile|char|double|float|int|long|short|bool|wchar_t|void|typedef|struct|union|enum|asm|export)>\":::Storage Type::D\n\
268 keyword:\"<(?:new|delete|this|return|goto|if|else|case|default|switch|break|continue|while|do|for|try|catch|throw|sizeof|true|false|namespace|using|dynamic_cast|static_cast|reinterpret_cast|const_cast)>\":::Keyword::D\n\
269 braces:\"[{}]\":::Keyword::D}",
271 comment:\"/\\*\":\"\\*/\"::Comment::\n\
272 string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\
273 preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
274 string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\
275 preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\
276 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
277 preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\
278 character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
279 numeric constant:\"(?<!\\Y)(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::D\n\
280 storage keyword:\"<(?:const|extern|auto|register|static|unsigned|signed|volatile|char|double|float|int|long|short|void|typedef|struct|union|enum)>\":::Storage Type::D\n\
281 keyword:\"<(?:return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
282 braces:\"[{}]\":::Keyword::D}",
284 comment:\"/\\*\":\"\\*/\"::Comment::\n\
285 import rule:\"@import\\s+(url\\([^)]+\\))\\s*\":\";\"::Warning::\n\
286 import delim:\"&\":\"&\"::Preprocessor:import rule:C\n\
287 import url:\"\\1\":::Subroutine1:import rule:C\n\
288 import media:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:import rule:\n\
289 media rule:\"(@media)\\s+\":\"(?=\\{)\"::Warning::\n\
290 media delim:\"&\":\"&\"::Preprocessor:media rule:C\n\
291 media type:\"(all|screen|print|projection|aural|braille|embossed|handheld|tty|tv|,)\":::Preprocessor1:media rule:\n\
292 charset rule:\"@charset\\s+(\"\"[^\"\"]+\"\")\\s*;\":::Preprocessor::\n\
293 charset name:\"\\1\":::String:charset rule:C\n\
294 font-face rule:\"@font-face\":::Preprocessor::\n\
295 page rule:\"@page\":\"(?=\\{)\"::Preprocessor1::\n\
296 page delim:\"&\":\"&\"::Preprocessor:page rule:C\n\
297 page pseudo class:\":(first|left|right)\":::Storage Type:page rule:\n\
298 declaration:\"\\{\":\"\\}\"::Warning::\n\
299 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
300 declaration comment:\"/\\*\":\"\\*/\"::Comment:declaration:\n\
301 property:\"<(azimuth|background(-(attachment|color|image|position|repeat))?|border(-(bottom(-(color|style|width))?|-(color|style|width)|collapse|color|left(-(color|style|width))?|right(-(color|style|width))?|spacing|style|top(-(color|style|width))?|width))?|bottom|caption-side|clear|clip|color|content|counter-(increment|reset)|cue(-(after|before))?|cursor|direction|display|elevation|empty-cells|float|font(-(family|size|size-adjust|stretch|style|variant|weight))?|height|left|letter-spacing|line-height|list-style(-(image|position|type))?|margin(-(bottom|left|right|top))?|marker-offset|marks|max-(height|width)|min-(height|width)|orphans|outline(-(color|style|width))?|overflow|padding(-(bottom|left|right|top))?|page(-break-(after|before|inside))?|pause(-(after|before))?|pitch(-range)?|play-during|position|quotes|richness|right|size|speak(-(header|numeral|punctuation))?|speech-rate|stress|table-layout|text(-(align|decoration|indent|shadow|transform))|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index)>\":::Identifier1:declaration:\n\
302 value:\":\":\";\":\"\\}\":Warning:declaration:\n\
303 value delims:\"&\":\"&\"::Keyword:value:C\n\
304 value modifier:\"!important|inherit\":::Keyword:value:\n\
305 uri value:\"<url\\([^)]+\\)\":::Subroutine1:value:\n\
306 clip value:\"<rect\\(\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*(,|\\s)\\s*([+-]?\\d+(?:\\.\\d*)?)(in|cm|mm|pt|pc|em|ex|px)\\s*\\)\":::Subroutine:value:\n\
307 function value:\"<attr\\([^)]+\\)|<counter\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)|<counters\\((\\l|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))([-\\l\\d]|\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?))*\\s*,\\s*(\"\"[^\"\"]*\"\"|'[^']*')\\s*(,\\s*<(disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-alpha|lower-latin|upper-alpha|upper-latin|hebrew|armenian|georgian|cjk-ideographic|hiragana|katakana|hiragana-iroha|katakana-iroha|none)>)?\\)\":::Subroutine:value:\n\
308 color value:\"(#[A-Fa-f\\d]{6}>|#[A-Fa-f\\d]{3}>|rgb\\(([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\s*,\\s*([+-]?\\d+(\\.\\d*)?)\\)|rgb\\(([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\s*,\\s*([+-]?\\d+(\\.\\d*)?%)\\)|<(?iaqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow)>|<transparent>)\":::Text Arg2:value:\n\
309 dimension value:\"[+-]?(\\d*\\.\\d+|\\d+)(in|cm|mm|pt|pc|em|ex|px|deg|grad|rad|s|ms|hz|khz)>\":::Numeric Const:value:\n\
310 percentage value:\"[+-]?(\\d*\\.\\d+|\\d+)%\":::Numeric Const:value:\n\
311 named value:\"<(100|200|300|400|500|600|700|800|900|above|absolute|always|armenian|auto|avoid|baseline|behind|below|bidi-override|blink|block|bold|bolder|both|bottom|capitalize|caption|center(?:-left|-right)?|child|circle|cjk-ideographic|close-quote|code|collapse|compact|condensed|continuous|crop|cross(?:hair)?|cursive|dashed|decimal(?:-leading-zero)?|default|digits|disc|dotted|double|e-resize|embed|expanded|extra(?:-condensed|-expanded)|fantasy|far(?:-left|-right)|fast(?:er)?|female|fixed|georgian|groove|hebrew|help|hidden|hide|high(?:er)?|hiragana(?:-iroha)?|icon|inherit|inline(?:-table)?|inset|inside|italic|justify|katakana(?:-iroha)?|landscape|larger?|left(?:-side|wards)?|level|lighter|line-through|list-item|loud|low(?:er(?:-alpha|-greek|-latin|-roman|case)?)?|ltr|male|marker|medium|menu|message-box|middle|mix|monospace|move|n-resize|narrower|ne-resize|no(?:-close-quote|-open-quote|-repeat)|none|normal|nowrap|nw-resize|oblique|once|open-quote|out(?:set|side)|overline|pointer|portrait|pre|relative|repeat(?:-x|-y)?|ridge|right(?:-side|wards)?|rtl|run-in|s-resize|sans-serif|scroll|se-resize|semi(?:-condensed|-expanded)|separate|serif|show|silent|slow(?:er)?|small(?:-caps|-caption|er)?|soft|solid|spell-out|square|static|status-bar|sub|super|sw-resize|table(?:-caption|-cell|-column(?:-group)?|-footer-group|-header-group|-row(?:-group)?)?|text(?:-bottom|-top)?|thick|thin|top|ultra(?:-condensed|-expanded)|underline|upper(?:-alpha|-latin|-roman|case)|visible|w-resize|wait|wider|x-(?:fast|high|large|loud|low|slow|small|soft)|xx-(large|small))>\":::Text Arg2:value:\n\
312 integer value:\"<\\d+>\":::Numeric Const:value:\n\
313 font family:\"(?iarial|courier|impact|helvetica|lucida|symbol|times|verdana)\":::String:value:\n\
314 dq string value:\"\"\"\":\"\"\"\":\"\\n\":String:value:\n\
315 dq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:dq string value:\n\
316 dq string continuation:\"\\\\\\n\":::Text Escape:dq string value:\n\
317 sq string value:\"'\":\"'\":\"\\n\":String:value:\n\
318 sq string escape:\"\\\\([ -~\\0200-\\0377]|[\\l\\d]{1,6}\\s?)\":::Text Escape:sq string value:\n\
319 sq string continuation:\"\\\\\\n\":::Text Escape:sq string value:\n\
320 operators:\"[,/]\":::Keyword:value:\n\
321 selector id:\"#[-\\w]+>\":::Pointer::\n\
322 selector class:\"\\.[-\\w]+>\":::Storage Type::\n\
323 selector pseudo class:\":(first-child|link|visited|hover|active|focus|lang(\\([\\-\\w]+\\))?)(?!\\Y)\":::Text Arg1::\n\
324 selector attribute:\"\\[[^\\]]+\\]\":::Ada Attributes::\n\
325 selector operators:\"[,>*+]\":::Keyword::\n\
326 selector pseudo element:\":(first-letter|first-line|before|after)>\":::Text Arg::\n\
327 type selector:\"<[\\l_][-\\w]*>\":::Plain::\n\
328 free text:\".\":::Warning::\n\
329 info:\"(?# version 1.31; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Plain::D}",
331 Comment:\"#\":\"$\"::Comment::\n\
332 Single Quote String:\"'\":\"([^\\\\]'|^')\":\"\\n\":String::\n\
333 SQ String Esc Char:\"\\\\([bcfnrt$\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Single Quote String:\n\
334 Double Quote String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
335 DQ String Esc Char:\"\\\\([bcfnrt\\n\\\\]|[0-9][0-9]?[0-9]?)\":::String1:Double Quote String:\n\
336 Keywords:\"(^|[`;()])[ ]*(return|if|endif|then|else|switch|endsw|while|end|foreach|do|done)>\":::Keyword::D\n\
337 Variable Ref:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1::\n\
338 Variable in String:\"\\$([<$0-9\\*]|[#a-zA-Z_?][0-9a-zA-Z_[\\]]*(:([ehqrtx]|gh|gt|gr))?|\\{[#0-9a-zA-Z_?][a-zA-Z0-9_[\\]]*(:([ehqrtx]|gh|gt|gr))?})\":::Identifier1:Double Quote String:\n\
339 Naked Variable Cmds:\"<(unset|set|setenv|shift)[ \\t]+[0-9a-zA-Z_]*(\\[.+\\])?\":::Identifier1::\n\
340 Recolor Naked Cmd:\"\\1\":::Keyword:Naked Variable Cmds:C\n\
341 Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alias|bg|break|breaksw|case|cd|chdir|continue|default|echo|eval|exec|exit|fg|goto|glob|hashstat|history|jobs|kill|limit|login|logout|nohup|notify|nice|onintr|popd|pushd|printenv|read|rehash|repeat|set|setenv|shift|source|suspend|time|umask|unalias|unhash|unlimit|unset|unsetenv|wait)>\":::Keyword::D\n\
342 Tcsh Built In Cmds:\"(^|\\|&|[\\|`;()])[ ]*(alloc|bindkey|builtins|complete|echotc|filetest|hup|log|sched|settc|setty|stop|telltc|uncomplete|where|which|dirs|ls-F)>\":::Keyword::D\n\
343 Special Chars:\"([-{};.,<>&~=!|^%[\\]\\+\\*\\|()])\":::Keyword::D}",
345 Comment:\"^[Cc*!]\":\"$\"::Comment::\n\
346 Bang Comment:\"!\":\"$\"::Comment::\n\
347 Debug Line:\"^D\":\"$\"::Preprocessor::\n\
348 String:\"'\":\"'\":\"\\n([^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [^ \\t]| [ \\t0]| *\\t[^1-9])\":String::\n\
349 Keywords:\"<(?iaccept|automatic|backspace|block|call|close|common|continue|data|decode|delete|dimension|do|else|elseif|encode|enddo|end *file|endif|end|entry|equivalence|exit|external|format|function|go *to|if|implicit|include|inquire|intrinsic|logical|map|none|on|open|parameter|pause|pointer|print|program|read|record|return|rewind|save|static|stop|structure|subroutine|system|then|type|union|unlock|virtual|volatile|while|write)>\":::Keyword::D\n\
350 Data Types:\"<(?ibyte|character|complex|double *complex|double *precision|double|integer|real)(\\*[0-9]+)?>\":::Keyword::D\n\
351 F90 Keywords:\"<(?iallocatable|allocate|case|case|cycle|deallocate|elsewhere|namelist|recursive|rewrite|select|where|intent|optional)>\":::Keyword::D\n\
352 Continuation:\"^( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag::\n\
353 Continuation in String:\"\\n( [^ \\t0]|( | | | )?\\t[1-9])\":::Flag:String:}",
355 README:\"Java highlighting patterns for NEdit 5.1. Version 1.5 Author/maintainer: Joachim Lous - jlous at users.sourceforge.net\":::Flag::D\n\
356 doccomment:\"/\\*\\*\":\"\\*/\"::Text Comment::\n\
357 doccomment tag:\"@\\l*\":::Text Key1:doccomment:\n\
358 comment:\"/\\*\":\"\\*/\"::Comment::\n\
359 cplus comment:\"//\":\"$\"::Comment::\n\
360 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
361 string escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])\":::String1:string:\n\
362 single quoted:\"'\":\"'\":\"\\n\":String::\n\
363 single quoted escape:\"(?:\\\\u[\\dA-Faf]{4}|\\\\[0-7]{1,3}|\\\\[btnfr'\"\"\\\\])(?=')\":::String1:single quoted:\n\
364 single quoted char:\".(?=')\":::String:single quoted:\n\
365 single quoted error:\".\":::Flag:single quoted:\n\
366 hex const:\"<(?i0[X][\\dA-F]+)>\":::Numeric Const::\n\
367 long const:\"<(?i[\\d]+L)>\":::Numeric Const::\n\
368 decimal const:\"(?<!\\Y)(?i\\d+(?:\\.\\d*)?(?:E[+\\-]?\\d+)?[FD]?|\\.\\d+(?:E[+\\-]?\\d+)?[FD]?)(?!\\Y)\":::Numeric Const::\n\
369 include:\"<(?:import|package)>\":\";\":\"\\n\":Preprocessor::\n\
370 classdef:\"<(?:class|interface)>\\s*\\n?\\s*([\\l_]\\w*)\":::Keyword::\n\
371 classdef name:\"\\1\":\"\"::Storage Type:classdef:C\n\
372 extends:\"<(?:extends)>\":\"(?=(?:<implements>|[{;]))\"::Keyword::\n\
373 extends argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*(?:[,;{]|<implements>))\":::Storage Type:extends:\n\
374 extends comma:\",\":::Keyword:extends:\n\
375 extends comment:\"/\\*\":\"\\*/\"::Comment:extends:\n\
376 extends cpluscomment:\"//\":\"$\"::Comment:extends:\n\
377 extends error:\".\":::Flag:extends:\n\
378 impl_throw:\"<(?:implements|throws)>\":\"(?=[{;])\"::Keyword::\n\
379 impl_throw argument:\"<[\\l_][\\w\\.]*(?=\\s*(?:/\\*.*\\*/)?(?://.*)?\\n?\\s*[,;{])\":::Storage Type:impl_throw:\n\
380 impl_throw comma:\",\":::Keyword:impl_throw:\n\
381 impl_throw comment:\"/\\*\":\"\\*/\"::Comment:impl_throw:\n\
382 impl_throw cpluscomment:\"//\":\"$\"::Comment:impl_throw:\n\
383 impl_throw error:\".\":::Flag:impl_throw:\n\
384 case:\"<case>\":\":\"::Label::\n\
385 case single quoted:\"'\\\\?[^']'\":::Character Const:case:\n\
386 case numeric const:\"(?<!\\Y)(?i0[X][\\dA-F]+|\\d+(:?\\.\\d*)?(?:E[+\\-]?\\d+)?F?|\\.\\d+(?:E[+\\-]?\\d+)?F?|\\d+L)(?!\\Y)\":::Numeric Const:case:\n\
387 case cast:\"\\(\\s*([\\l_][\\w.]*)\\s*\\)\":::Keyword:case:\n\
388 case cast type:\"\\1\":\"\"::Storage Type:case cast:C\n\
389 case variable:\"[\\l_][\\w.]*\":::Identifier1:case:\n\
390 case signs:\"[-+*/<>^&|%()]\":::Keyword:case:\n\
391 case error:\".\":::Flag:case:\n\
392 label:\"([;{}:])\":\"[\\l_]\\w*\\s*:\":\"[^\\s\\n]\":Label::\n\
393 label qualifier:\"\\1\":\"\"::Keyword:label:C\n\
394 labelref:\"<(?:break|continue)>\\s*\\n?\\s*([\\l_]\\w*)?(?=\\s*\\n?\\s*;)\":::Keyword::\n\
395 labelref name:\"\\1\":\"\"::Label:labelref:C\n\
396 instanceof:\"<instanceof>\\s*\\n?\\s*([\\l_][\\w.]*)\":::Keyword::\n\
397 instanceof class:\"\\1\":\"\"::Storage Type:instanceof:C\n\
398 newarray:\"new\\s*[\\n\\s]\\s*([\\l_][\\w\\.]*)\\s*\\n?\\s*(?=\\[)\":::Keyword::\n\
399 newarray type:\"\\1\":\"\"::Storage Type:newarray:C\n\
400 constructor def:\"<(abstract|final|native|private|protected|public|static|synchronized)\\s*[\\n|\\s]\\s*[\\l_]\\w*\\s*\\n?\\s*(?=\\()\":::Subroutine::\n\
401 constructor def modifier:\"\\1\":\"\"::Keyword:constructor def:C\n\
402 keyword - modifiers:\"<(?:abstract|final|native|private|protected|public|static|transient|synchronized|volatile)>\":::Keyword::\n\
403 keyword - control flow:\"<(?:catch|do|else|finally|for|if|return|switch|throw|try|while)>\":::Keyword::\n\
404 keyword - calc value:\"<(?:new|super|this)>\":::Keyword::\n\
405 keyword - literal value:\"<(?:false|null|true)>\":::Numeric Const::\n\
406 function def:\"<([\\l_][\\w\\.]*)>((?:\\s*\\[\\s*\\])*)\\s*[\\n|\\s]\\s*<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
407 function def type:\"\\1\":\"\"::Storage Type:function def:C\n\
408 function def type brackets:\"\\2\":\"\"::Keyword:function def:C\n\
409 function call:\"<[\\l_]\\w*>\\s*\\n?\\s*(?=\\()\":::Plain::\n\
410 cast:\"[^\\w\\s]\\s*\\n?\\s*\\(\\s*([\\l_][\\w\\.]*)\\s*\\)\":::Keyword::\n\
411 cast type:\"\\1\":\"\"::Storage Type:cast:C\n\
412 declaration:\"<[\\l_][\\w\\.]*>((:?\\s*\\[\\s*\\]\\s*)*)(?=\\s*\\n?\\s*(?!instanceof)[\\l_]\\w*)\":::Storage Type::\n\
413 declaration brackets:\"\\1\":\"\"::Keyword:declaration:C\n\
414 variable:\"<[\\l_]\\w*>\":::Identifier1::D\n\
415 braces and parens:\"[(){}[\\]]\":::Keyword::D\n\
416 signs:\"[-+*/%=,.;:<>!|&^?]\":::Keyword::D\n\
417 error:\".\":::Flag::D}",
419 /* The VAX C compiler cannot compile this definition */
421 DSComment:\"//\":\"$\"::Comment::\n\
422 MLComment:\"/\\*\":\"\\*/\"::Comment::\n\
423 DQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|#[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]\":::Text Arg1:DQStrings:\n\
424 SQColors:\"aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|(#)[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-F-af0-9]\":::Text Arg1:SQStrings:\n\
425 Numeric:\"(?<!\\Y)((0(x|X)[0-9a-fA-F]*)|[0-9.]+((e|E)(\\+|-)?)?[0-9]*)(L|l|UL|ul|u|U|F|f)?(?!\\Y)\":::Numeric Const::\n\
426 Events:\"<(onAbort|onBlur|onClick|onChange|onDblClick|onDragDrop|onError|onFocus|onKeyDown|onKeyPress|onLoad|onMouseDown|onMouseMove|onMouseOut|onMouseOver|onMouseUp|onMove|onResize|onSelect|onSubmit|onUnload)>\":::Keyword::\n\
427 Braces:\"[{}]\":::Keyword::\n\
428 Statements:\"<(break|continue|else|for|if|in|new|return|this|typeof|var|while|with)>\":::Keyword::\n\
429 Function:\"function[\\t ]+([a-zA-Z0-9_]+)[\\t \\(]+\":\"[\\n{]\"::Keyword::\n\
430 FunctionName:\"\\1\":\"\"::Storage Type:Function:C\n\
431 FunctionArgs:\"\\(\":\"\\)\"::Text Arg:Function:\n\
432 Parentheses:\"[\\(\\)]\":::Plain::\n\
433 BuiltInObjectType:\"<(anchor|Applet|Area|Array|button|checkbox|Date|document|elements|FileUpload|form|frame|Function|hidden|history|Image|link|location|Math|navigator|Option|password|Plugin|radio|reset|select|string|submit|text|textarea|window)>\":::Storage Type::\n\
434 SQStrings:\"'\":\"'\":\"\\n\":String::\n\
435 DQStrings:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
436 EventCapturing:\"captureEvents|releaseEvents|routeEvent|handleEvent\":\"\\)\":\"\\n\":Keyword::\n\
437 PredefinedMethods:\"<(abs|acos|alert|anchor|asin|atan|atan2|back|big|blink|blur|bold|ceil|charAt|clear|clearTimeout|click|close|confirm|cos|escape|eval|exp|fixed|floor|focus|fontcolor|fontsize|forward|getDate|getDay|getHours|getMinutes|getMonth|getSeconds|getTime|getTimezoneOffset|getYear|go|indexOf|isNaN|italics|javaEnabled|join|lastIndexOf|link|log|max|min|open|parse|parseFloat|parseInt|pow|prompt|random|reload|replace|reset|reverse|round|scroll|select|setDate|setHours|setMinutes|setMonth|setSeconds|setTimeout|setTime|setYear|sin|small|sort|split|sqrt|strike|sub|submit|substring|sup|taint|tan|toGMTString|toLocaleString|toLowerCase|toString|toUpperCase|unescape|untaint|UTC|write|writeln)>\":::Keyword::\n\
438 Properties:\"<(action|alinkColor|anchors|appCodeName|appName|appVersion|bgColor|border|checked|complete|cookie|defaultChecked|defaultSelected|defaultStatus|defaultValue|description|E|elements|enabledPlugin|encoding|fgColor|filename|forms|frames|hash|height|host|hostname|href|hspace|index|lastModified|length|linkColor|links|LN2|LN10|LOG2E|LOG10E|lowsrc|method|name|opener|options|parent|pathname|PI|port|protocol|prototype|referrer|search|selected|selectedIndex|self|SQRT1_2|SQRT2|src|status|target|text|title|top|type|URL|userAgent|value|vlinkColor|vspace|width|window)>\":::Storage Type::\n\
439 Operators:\"[= ; ->]|[/]|&|\\|\":::Preprocessor::}",
442 Comment:\"%\":\"$\"::Text Comment::\n\
443 Parameter:\"#[0-9]*\":::Text Arg::\n\
444 Special Chars:\"[{}&]\":::Keyword::\n\
445 Escape Chars:\"\\\\[$&%#_{}]\":::Text Escape::\n\
446 Super Sub 1 Char:\"(\\^|_)[^{]\":::Text Arg2::\n\
447 Verbatim Begin End:\"\\\\begin\\{verbatim\\*?}\":\"\\\\end\\{verbatim\\*?}\"::Plain::\n\
448 Verbatim BG Color:\"&\":\"&\"::Keyword:Verbatim Begin End:C\n\
449 Verbatim:\"(\\\\verb\\*?)([^\\l\\s\\*]).*?(\\2)\":::Plain::\n\
450 Verbatim Color:\"\\1\\2\\3\":\"\"::Keyword:Verbatim:C\n\
451 Inline Math:\"\\$|\\\\\\(\":\"\\$|\\\\\\)\":\"\\\\\\(\":LaTeX Math::\n\
452 Inline Math Comment:\"%\":\"$\"::Text Comment:Inline Math:\n\
453 Math Color:\"&\":\"&\"::Keyword:Inline Math:C\n\
454 Math Escape Chars:\"\\\\\\$\":::Text Escape:Inline Math:\n\
455 No Arg Command:\"\\\\(left|right)[\\[\\]{}()]\":::Text Key::\n\
456 Command:\"[_^]|[\\\\@](a'|a`|a=|[A-Za-z]+\\*?|\\\\\\*|[-@_='`^\"\"|\\[\\]*:!+<>/~.,\\\\ ])\":\"nevermatch\":\"[^{[(]\":Text Key::\n\
457 Cmd Brace Args:\"\\{\":\"}\"::Text Arg2:Command:\n\
458 Brace Color:\"&\":\"&\"::Text Arg:Cmd Brace Args:C\n\
459 Cmd Paren Args:\"\\(\":\"\\)\":\"$\":Text Arg2:Command:\n\
460 Paren Color:\"&\":\"&\"::Text Arg:Cmd Paren Args:C\n\
461 Cmd Bracket Args:\"\\[\":\"\\]\":\"$\":Text Arg2:Command:\n\
462 Bracket Color:\"&\":\"&\"::Text Arg:Cmd Bracket Args:C\n\
463 Sub Command:\"([_^]|([\\\\@]([A-Za-z]+\\*?|[^A-Za-z$&%#{}~\\\\ \\t])))\":::Text Key1:Cmd Brace Args:\n\
464 Sub Brace:\"\\{\":\"}\"::Text Arg2:Cmd Brace Args:\n\
465 Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Brace:\n\
466 Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Brace:\n\
467 Sub Sub Sub Sub Brace:\"\\{\":\"}\"::Text Arg2:Sub Sub Sub Brace:\n\
468 Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Cmd Paren Args:\n\
469 Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Paren:\n\
470 Sub Sub Sub Paren:\"\\(\":\"\\)\":\"$\":Text Arg2:Sub Sub Paren:\n\
471 Sub Parameter:\"#[0-9]*\":::Text Arg:Cmd Brace Args:\n\
472 Sub Spec Chars:\"[{}$&]\":::Text Arg:Cmd Brace Args:\n\
473 Sub Esc Chars:\"\\\\[$&%#_{}~^\\\\]\":::Text Arg1:Cmd Brace Args:}",
475 comment:\"/\\*\":\"\\*/\"::Comment::\n\
476 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
477 meta string:\"\\\\\"\".*\\\\\"\"\":::String::\n\
478 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
479 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
480 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
481 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
482 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
483 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\
484 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\
485 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
486 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\
487 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\
488 label:\"<goto>|(^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:)\":::Flag::D\n\
489 braces:\"[{}]\":::Keyword::D\n\
490 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D}",
492 Comment:\"#\":\"$\"::Comment::\n\
493 Comment Continuation:\"\\\\\\n\":::Keyword:Comment:\n\
494 Assignment:\"^( *| [ \\t]*)[A-Za-z0-9_+][^ \\t]*[ \\t]*(\\+|:)?=\":\"$\"::Preprocessor::\n\
495 Assignment Continuation:\"\\\\\\n\":::Keyword:Assignment:\n\
496 Assignment Comment:\"#\":\"$\"::Comment:Assignment:\n\
497 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\
498 Dep Target Special:\"\\2\":\"\"::Text Key1:Dependency Line:C\n\
499 Dep Target:\"\\3\":\"\"::Text Key:Dependency Line:C\n\
500 Dep Continuation:\"\\\\\\n\":::Keyword:Dependency Line:\n\
501 Dep Comment:\"#\":\"$\"::Comment:Dependency Line:\n\
502 Dep Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1:Dependency Line:\n\
503 Dep Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor:Dependency Line:\n\
504 Continuation:\"\\\\$\":::Keyword::\n\
505 Macro:\"\\$([A-Za-z0-9_]|\\([^)]*\\)|\\{[^}]*})\":::Preprocessor::\n\
506 Internal Macro:\"\\$([<@*?%]|\\$@)\":::Preprocessor1::\n\
507 Escaped Dollar:\"\\$\\$\":::Comment::\n\
508 Include:\"^( *| [ \\t]*)include[ \\t]\":::Keyword::\n\
509 Exports:\"^( *| [ \\t]*)<export|unexport>[ \\t]\":\"$\"::Keyword::\n\
510 Exports var:\".[A-Za-z0-9_+]*\":\"$\"::Keyword:Exports:\n\
511 Conditionals:\"^( *| [ \\t]*)<ifeq|ifneq>[ \\t]\":::Keyword::D\n\
512 Conditionals ifdefs:\"^( *| [ \\t]*)<ifdef|ifndef>[ \\t]\":\"$\"::Keyword::D\n\
513 Conditionals ifdefs var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:Conditionals ifdefs:D\n\
514 Conditional Ends:\"^( *| [ \\t]*)<else|endif>\":::Keyword::D\n\
515 vpath:\"^( *| [ \\t]*)<vpath>[ \\t]\":::Keyword::D\n\
516 define:\"^( *| [ \\t]*)<define>[ \\t]\":\"$\"::Keyword::D\n\
517 define var:\".[A-Za-z0-9_+]*\":\"$\"::Preprocessor:define:D\n\
518 define Ends:\"^( *| [ \\t]*)<endef>\":::Keyword::D}",
520 Comment:\"%\":\"$\"::Comment::\n\
521 Comment in Octave:\"#\":\"$\"::Plain::\n\
522 Keyword:\"<(break|clear|else|elseif|end|for|function|global|if|return|then|while)>\":::Keyword::\n\
523 Transpose:\"[\\w.]('+)\":::Plain::\n\
524 Paren transposed:\"\\)('+)\":::Keyword::\n\
525 Paren transp close:\"\\1\":\"\"::Plain:Paren transposed:C\n\
526 Parentheses:\"[\\(\\)]\":::Keyword::\n\
527 Brackets transposed:\"\\]('+)\":::Text Key1::\n\
528 Brack transp close:\"\\1\":\"\"::Plain:Brackets transposed:C\n\
529 Brackets:\"[\\[\\]]\":::Text Key1::\n\
530 Braces transposed:\"\\}('+)\":::Text Arg::\n\
531 Braces transp close:\"\\1\":\"\"::Plain:Braces transposed:C\n\
532 Braces:\"[\\{\\}]\":::Text Arg::\n\
533 String:\"'\":\"'\"::String::\n\
534 Numeric const:\"(?<!\\Y)(((\\d+\\.?\\d*)|(\\.\\d+))([eE][+\\-]?\\d+)?)(?!\\Y)\":::Numeric Const::\n\
535 Three periods to end:\"(\\.\\.\\.)\":\"$\"::Comment::\n\
536 Three periods:\"\\1\":\"\"::Keyword:Three periods to end:C\n\
537 Shell command:\"!\":\"$\"::String1::\n\
538 Comment in shell cmd:\"%\":\"$\"::Comment:Shell command:\n\
539 Relational operators:\"==|~=|\\<=|\\>=|\\<|\\>\":::Text Arg1::\n\
540 Wrong logical ops:\"&&|\\|\\|\":::Plain::\n\
541 Logical operators:\"~|&|\\|\":::Text Arg2::}",
543 Comment:\"#\":\"$\"::Comment::\n\
544 Built-in Vars:\"(?<!\\Y)\\$([1-9]|column|n_args|cursor|file_name|file_path|text_length|selection_start|selection_end|selection_left|selection_right|wrap_margin|tab_dist|em_tab_dist|use_tabs|language_mode|modified|statistics_line|incremental_search_line|show_line_numbers|auto_indent|wrap_text|highlight_syntax|make_backup_copy|incremental_backup|show_matching|overtype_mode|read_only|locked|file_format|font_name|font_name_italic|font_name_bold|font_name_bold_italic|sub_sep|string_dialog_button|search_end|read_status|shell_cmd_status|list_dialog_button|min_font_width|max_font_width|top_line|n_display_lines|display_width|active_pane|n_panes|line|empty_array|backlight_string|rangeset_(label|ranges|range_index|range_start|range_end|list|color|modify_response))>\":::Identifier::\n\
545 Built-in Subrs:\"<(focus_window|shell_command|length|get_range|t_print|dialog|string_dialog|replace_range|replace_selection|set_cursor_pos|get_character|min|max|search|search_string|substring|replace_substring|read_file|write_file|append_file|beep|get_selection|replace_in_string|select|select_rectangle|toupper|tolower|string_to_clipboard|clipboard_to_string|list_dialog|getenv|set_language_mode|string_compare|split|valid_number|set_backlight_string|rangeset_(defined|inverse|add|remove|forget|get_count|select|includes_pos|set_color|set_modify_response)|highlight_(pattern_of_pos|style_of_pos|color_of_pos|color_value_of_pos|style_of_pos_is_bold|style_of_pos_is_italic|pattern_extends_from|pattern_style|style_color|style_color_value|style_is_bold|style_is_italic))>\":::Subroutine::\n\
546 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|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|replace|replace-dialog|replace_dialog|replace-all|replace_all|replace-in-selection|replace_in_selection|replace-again|replace_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|find-definition|find_definition|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)>\":::Subroutine::\n\
547 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\
548 Keyword:\"<(while|if|else|for|break|continue|return|define|in)>\":::Keyword::\n\
549 Braces:\"[{}]\":::Keyword::\n\
550 Global Variable:\"\\$[A-Za-z0-9_]*\":::Identifier1::\n\
551 String:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
552 String Escape Char:\"\\\\(.|\\n)\":::Text Escape:String:\n\
553 Numeric Const:\"(?<!\\Y)-?[0-9]+>\":::Numeric Const::\n\
554 Custom macro:\"\\w+(?=\\s*[\\({])\":::Subroutine1::\n\
555 Variables:\"\\w+\":::Identifier1::D}",
557 TP Directives:\"\\{\\$\":\"\\}\"::Comment::\n\
558 Comment:\"\\(\\*|\\{\":\"\\*\\)|\\}\"::Comment::\n\
559 String:\"'\":\"'\":\"\\n\":String::D\n\
560 Array delimitors:\"\\(\\.|\\.\\)|\\[|\\]\":::Character Const::D\n\
561 Parentheses:\"\\(|\\)\":::Keyword::D\n\
562 X Numeric Values:\"<([2-9]|[12]\\d|3[0-6])#[\\d\\l]+>\":::Text Key::D\n\
563 TP Numeric Values:\"(?<!\\Y)(#\\d+|\\$[\\da-fA-F]+)>\":::Text Key1::D\n\
564 Numeric Values:\"<\\d+(\\.\\d+)?((e|E)(\\+|-)?\\d+)?>\":::Numeric Const::D\n\
565 Reserved Words 1:\"<(?iBegin|Const|End|Program|Record|Type|Var)>\":::Keyword::D\n\
566 Reserved Words 2:\"<(?iForward|Goto|Label|Of|Packed|With)>\":::Identifier::D\n\
567 X Reserved Words:\"<(?iBindable|Export|Implementation|Import|Interface|Module|Only|Otherwise|Protected|Qualified|Restricted|Value)>\":::Identifier1::D\n\
568 TP Reserved Words:\"<(?iAbsolute|Assembler|Exit|External|Far|Inline|Interrupt|Near|Private|Unit|Uses)>\":::Text Comment::D\n\
569 Data Types:\"<(?iArray|Boolean|Char|File|Integer|Real|Set|Text)>\":::Storage Type::D\n\
570 X Data Types:\"<(?iBindingType|Complex|String|TimeStamp)>\":::Text Arg1::D\n\
571 TP Data Types:\"<(?iByte|Comp|Double|Extended|LongInt|ShortInt|Single|Word)>\":::Text Arg2::D\n\
572 Predefined Consts:\"<(?iFalse|Input|MaxInt|Nil|Output|True)>\":::String1::D\n\
573 X Predefined Consts:\"<(?iEpsReal|MaxChar|MaxReal|MinReal|StandardInput|StandardOutput)>\":::String2::D\n\
574 Conditionals:\"<(?iCase|Do|DownTo|Else|For|If|Repeat|Then|To|Until|While)>\":::Ada Attributes::D\n\
575 Proc declaration:\"<(?iProcedure)>\":::Character Const::D\n\
576 Predefined Proc:\"<(?iDispose|Get|New|Pack|Page|Put|Read|ReadLn|Reset|Rewrite|Unpack|Write|WriteLn)>\":::Subroutine::D\n\
577 X Predefined Proc:\"<(?iBind|Extend|GetTimeStamp|Halt|ReadStr|SeekRead|SeekUpdate|SeekWrite|Unbind|Update|WriteStr)>\":::Subroutine1::D\n\
578 Func declaration:\"<(?iFunction)>\":::Identifier::D\n\
579 Predefined Func:\"<(?iAbs|Arctan|Chr|Cos|Eof|Eoln|Exp|Ln|Odd|Ord|Pred|Round|Sin|Sqr|Sqrt|Succ|Trunc)>\":::Preprocessor::D\n\
580 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\
581 X Operators:\"(\\>\\<|\\*\\*)|<(?iAnd_Then|Or_Else|Pow)>\":::Text Arg1::D\n\
582 Assignment:\":=\":::Plain::D\n\
583 Operators:\"(\\<|\\>|=|\\^|@)|<(?iAnd|Div|In|Mod|Not|Or)>\":::Text Arg::D\n\
584 TP Operators:\"<(?iShl|Shr|Xor)>\":::Text Arg2::D}",
586 dq here doc:\"(\\<\\<(\"\"?))EOF(\\2.*)$\":\"^EOF>\"::Label::\n\
587 dq here doc delims:\"\\1\\3\":::Keyword:dq here doc:C\n\
588 dq here doc esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq here doc:\n\
589 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\
590 dq here doc content:\".\":::String:dq here doc:\n\
591 dq string:\"(?<!\\Y)\"\"\":\"\"\"\":\"\\n\\s*\\n\":String::\n\
592 dq string delims:\"&\":\"&\"::Keyword:dq string:C\n\
593 dq string esc chars:\"\\\\([nrtfbaeulULQE\"\"@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:dq string:\n\
594 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\
595 gen dq string:\"<qq/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String::\n\
596 gen dq string delims:\"&\":\"&\"::Keyword:gen dq string:C\n\
597 gen dq string esc chars:\"\\\\([nrtfbaeulULQE@%\\$\\\\]|0[0-7]+|x[0-9a-fA-F]+|c\\l)\":::Text Escape:gen dq string:\n\
598 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\
599 sq here doc:\"(\\<\\<')EOF('.*)$\":\"^EOF>\"::Label::\n\
600 sq here doc delims:\"\\1\\2\":::Keyword:sq here doc:C\n\
601 sq here doc esc chars:\"\\\\\\\\\":::Text Escape:sq here doc:\n\
602 sq here doc content:\".\":::String1:sq here doc:\n\
603 sq string:\"(?<!\\Y)'\":\"'\":\"\\n\\s*\\n\":String1::\n\
604 sq string delims:\"&\":\"&\"::Keyword:sq string:C\n\
605 sq string esc chars:\"\\\\(\\\\|')\":::Text Escape:sq string:\n\
606 gen sq string:\"<q/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
607 gen sq string delims:\"&\":\"&\"::Keyword:gen sq string:C\n\
608 gen sq string esc chars:\"\\\\(\\\\|/)\":::Text Escape:gen sq string:\n\
609 implicit sq:\"[-\\w]+(?=\\s*=\\>)|(\\{)[-\\w]+(\\})\":::String1::\n\
610 implicit sq delims:\"\\1\\2\":::Keyword:implicit sq:C\n\
611 word list:\"<qw\\(\":\"\\)\":\"\\n\\s*\\n\":Keyword::\n\
612 word list content:\".\":::String1:word list:\n\
613 bq here doc:\"(\\<\\<`)EOF(`.*)$\":\"^EOF>\"::Label::\n\
614 bq here doc delims:\"\\1\\2\":::Keyword:bq here doc:C\n\
615 bq here doc comment:\"#\":\"$\"::Comment:bq here doc:\n\
616 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\
617 bq here doc content:\".\":::String1:bq here doc:\n\
618 bq string:\"(?<!\\Y)`\":\"`(?!\\Y)\":\"\\n\\s*\\n\":String1::\n\
619 bq string delims:\"&\":\"&\"::Keyword:bq string:C\n\
620 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\
621 gen bq string:\"<qx/\":\"(?!\\\\)/\":\"\\n\\s*\\n\":String1::\n\
622 gen bq string delims:\"&\":\"&\"::Keyword:gen bq string:C\n\
623 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\
624 gen bq string esc chars:\"\\\\/\":::Text Escape:gen bq string:\n\
625 transliteration:\"<((y|tr)/)(\\\\/|[^/])+(/)(\\\\/|[^/])*(/[cds]*)\":::String::D\n\
626 transliteration delims:\"\\1\\4\\6\":::Keyword:transliteration:DC\n\
627 last array index:\"\\$#([\\l_](\\w|::(?=\\w))*)?\":::Identifier1::\n\
628 comment:\"#\":\"$\"::Comment::\n\
629 label:\"((?:^|;)\\s*<([A-Z_]+)>\\s*:(?=(?:[^:]|\\n)))|(goto|last|next|redo)\\s+(<((if|unless)|[A-Z_]+)>|)\":::Plain::\n\
630 label identifier:\"\\2\\5\":::Label:label:C\n\
631 label keyword:\"\\3\\6\":::Keyword:label:C\n\
632 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\
633 handle delims:\"\\1\\2\\4\\6\\7\\9\":::Keyword:handle:C\n\
634 handle functions:\"\\3\\5\\8\":::Subroutine:handle:C\n\
635 statements:\"<(if|until|while|elsif|else|unless|for(each)?|continue|last|goto|next|redo|do(?=\\s*\\{)|BEGIN|END)>\":::Keyword::D\n\
636 packages and modules:\"<(bless|caller|import|no|package|prototype|require|return|INIT|CHECK|BEGIN|END|use|new)>\":::Keyword::D\n\
637 pragm modules:\"<(attrs|autouse|base|blib|constant|diagnostics|fields|integer|less|lib|locale|ops|overload|re|sigtrap|strict|subs|vars|vmsish)>\":::Keyword::D\n\
638 standard methods:\"<(can|isa|VERSION)>\":::Keyword::D\n\
639 file tests:\"-[rwxRWXoOezsfdlSpbcugktTBMAC]>\":::Subroutine::D\n\
640 subr header:\"<sub\\s+<([\\l_]\\w*)>\":\"(?:\\{|;)\"::Keyword::D\n\
641 subr header coloring:\"\\1\":::Plain:subr header:DC\n\
642 subr prototype:\"\\(\":\"\\)\"::Flag:subr header:D\n\
643 subr prototype delims:\"&\":\"&\"::Keyword:subr prototype:DC\n\
644 subr prototype chars:\"\\\\?[@$%&*]|;\":::Identifier1:subr prototype:D\n\
645 references:\"\\\\(\\$|@|%|&)(::)?[\\l_](\\w|::(?=\\w))*|\\\\(\\$?|@|%|&)\\{(::)?[\\l_](\\w|::(?=\\w))*\\}|\\\\(\\$|@|%|&)(?=\\{)\":::Identifier1::\n\
646 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\
647 named operators:\"<(lt|gt|le|ge|eq|ne|cmp|not|and|or|xor|sub|x)>\":::Keyword::D\n\
648 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\
649 subroutine call:\"(&|-\\>)\\w(\\w|::)*(?!\\Y)|<\\w(\\w|::)*(?=\\s*\\()\":::Subroutine1::D\n\
650 symbolic operators:\">[-<>+.*/\\\\?!~=%^&:]<\":::Keyword::D\n\
651 braces and parens:\"[\\[\\]{}\\(\\)\\<\\>]\":::Keyword::D\n\
652 numerics:\"(?<!\\Y)((?i0x[\\da-f]+)|0[0-7]+|(\\d+\\.?\\d*|\\.\\d+)([eE][\\-+]?\\d+)?|[\\d_]+)(?!\\Y)\":::Numeric Const::D\n\
653 tokens:\"__(FILE|PACKAGE|LINE|DIE|WARN)__\":::Preprocessor::D\n\
654 end token:\"^__(END|DATA)__\":\"never_match_this_pattern\"::Plain::\n\
655 end token delim:\"&\":::Preprocessor:end token:C\n\
656 pod:\"(?=^=)\":\"^=cut\"::Text Comment::\n\
657 re match:\"(?<!\\Y)((m|qr|~\\s*)/)\":\"(/(gc?|[imosx])*)\"::Plain::\n\
658 re match delims:\"&\":\"&\"::Keyword:re match:C\n\
659 re match esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match:\n\
660 re match class:\"\\[\\^?\":\"\\]\"::Plain:re match:\n\
661 re match class delims:\"&\":\"&\"::Regex:re match class:C\n\
662 re match class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re match class:\n\
663 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\
664 re match comment:\"\\(\\?#[^)]*\\)\":::Comment:re match:\n\
665 re match syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re match:\n\
666 re match refs:\"\\\\[1-9]\\d?\":::Identifier1:re match:\n\
667 re sub:\"<(s/)\":\"(/)((?:\\\\/|\\\\[1-9]\\d?|[^/])*)(/[egimosx]*)\"::Plain::\n\
668 re sub delims:\"\\1\":\"\\1\\3\"::Keyword:re sub:C\n\
669 re sub subst:\"\\2\":\"\\2\"::String:re sub:C\n\
670 re sub esc chars:\"\\\\([/abdeflnrstuwzABDEGLQSUWZ+?.*$^(){}[\\]|\\\\]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub:\n\
671 re sub class:\"\\[\\^?\":\"\\]\"::Plain:re sub:\n\
672 re sub class delims:\"&\":\"&\"::Regex:re sub class:C\n\
673 re sub class esc chars:\"\\\\([abdeflnrstuwzABDEGLQSUWZ^\\]\\\\-]|0[0-7]{2}|x[0-9a-fA-F]{2})\":::Text Escape:re sub class:\n\
674 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\
675 re sub comment:\"\\(\\?#[^)]*\\)\":::Comment:re sub:\n\
676 re sub syms:\"[.^$[\\])|)]|\\{\\d+(,\\d*)?\\}\\??|\\((\\?([:=!>imsx]|\\<[=!]))?|[?+*]\\??\":::Regex:re sub:\n\
677 re sub refs:\"\\\\[1-9]\\d?\":::Identifier1:re sub:\n\
678 info:\"version: 2.02p1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl\":::Plain::}",
680 DSCcomment:\"^%[%|!]\":\"$\"::Preprocessor::\n\
681 Comment:\"%\":\"$\"::Comment::\n\
682 string:\"\\(\":\"\\)\"::String::\n\
683 string esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string:\n\
684 string2:\"\\(\":\"\\)\"::String:string:\n\
685 string2 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string2:\n\
686 string3:\"\\(\":\"\\)\"::String:string2:\n\
687 string3 esc chars:\"\\\\(n|r|t|b|f|\\\\|\\(|\\)|[0-9][0-9]?[0-9]?)?\":::String2:string3:\n\
688 ASCII 85 string:\"\\<~\":\"~\\>\":\"[^!-uz]\":String1::\n\
689 Dictionary:\"(\\<\\<|\\>\\>)\":::Storage Type::\n\
690 hex string:\"\\<\":\"\\>\":\"[^0-9a-fA-F> \\t]\":String1::\n\
691 Literal:\"/[^/%{}\\(\\)\\<\\>\\[\\]\\f\\n\\r\\t ]*\":::Text Key::\n\
692 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\
693 Array:\"[\\[\\]]\":::Storage Type::D\n\
694 Procedure:\"[{}]\":::Subroutine::D\n\
695 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\
696 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\
697 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\
698 Old operator:\"<(condition|currentcontext|currenthalftonephase|defineusername|detach|deviceinfo|eoviewclip|fork|initviewclip|join|lock|monitor|notify|rectviewclip|sethalftonephase|viewclip|viewclippath|wait|wtranslation|yield)>\":::Keyword::D}",
700 Comment:\"#\":\"$\"::Comment::\n\
701 String3s:\"[uU]?[rR]?'{3}\":\"'{3}\"::String::\n\
702 String3d:\"[uU]?[rR]?\"\"{3}\":\"\"\"{3}\"::String::\n\
703 String1s:\"[uU]?[rR]?'\":\"'\":\"$\":String::\n\
704 String1d:\"[uU]?[rR]?\"\"\":\"\"\"\":\"$\":String::\n\
705 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\
706 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\
707 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\
708 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\
709 Representation:\"`\":\"`\":\"$\":String2::\n\
710 Representation cont:\"\\\\\\n\":::String2:Representation:\n\
711 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\
712 Import:\"<(import|from)>\":\";|$\":\"#\":Preprocessor::\n\
713 Import continuation:\"\\\\\\n\":::Preprocessor:Import:\n\
714 Member definition:\"<(def)\\s+((__(abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|float|getattr|getitem|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|ipow|irshift|isub|ixor|len|long|lshift|mod|mul|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|xor)__)|((__(bases|class|dict|members|methods)__)|(__(delslice|getslice|setslice)__))|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|class|global|lambda)|([\\l_]\\w*))(?=(\\s*(\\\\\\n\\s*)?\\(\\s*|\\s*\\(\\s*(\\\\?\\n\\s*)?)self>)\":::Plain::\n\
715 Member def color:\"\\1\":::Keyword:Member definition:C\n\
716 Member def special:\"\\3\":::Subroutine:Member definition:C\n\
717 Member def deprecated:\"\\5\":::Subroutine1:Member definition:C\n\
718 Member def error:\"\\10\":::Flag:Member definition:C\n\
719 Function definition:\"<(def)\\s+((ArithmeticError|AssertionError|AttributeError|EOFError|Ellipsis|EnvironmentError|Exception|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplementedError|OSError|OverflowError|RuntimeError|StandardError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|buffer|callable|chr|cmp|coerce|compile|complex|copyright|credits|delattr|dir|divmod|eval|execfile|filter|float|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|len|license|list|locals|long|map|max|min|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|self|setattr|slice|str|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
720 Function def color:\"\\1\":::Keyword:Function definition:C\n\
721 Function def deprecated:\"\\3\":::Subroutine1:Function definition:C\n\
722 Function def error:\"\\4\":::Flag:Function definition:C\n\
723 Class definition:\"<(class)\\s+((ArithmeticError|AssertionError|AttributeError|EOFError|Ellipsis|EnvironmentError|Exception|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|None|NotImplementedError|OSError|OverflowError|RuntimeError|StandardError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError|__builtins__|__debug__|__doc__|__import__|__name__|abs|apply|buffer|callable|chr|cmp|coerce|compile|complex|copyright|credits|delattr|dir|divmod|eval|execfile|filter|float|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|len|license|list|locals|long|map|max|min|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|self|setattr|slice|str|tuple|type|unichr|unicode|vars|xrange|zip)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
724 Class def color:\"\\1\":::Storage Type:Class definition:C\n\
725 Class def deprecated:\"\\3\":::Subroutine1:Class definition:C\n\
726 Class def error:\"\\4\":::Flag:Class definition:C\n\
727 Member reference:\"\\.\\s*(\\\\?\\n\\s*)?((__(abs|add|and|call|cmp|coerce|complex|contains|del|delattr|delitem|div|divmod|float|getattr|getitem|hash|hex|iadd|iand|idiv|ilshift|imod|imul|init|int|invert|ior|ipow|ipow|irshift|isub|ixor|len|long|lshift|mod|mul|neg|nonzero|oct|or|pos|pow|radd|rand|rdiv|rdivmod|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|str|sub|xor)__)|(__(delslice|getslice|setslice)__)|(__(bases|class|dict|members|methods)__)|(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while|class|global|lambda)|([\\l_]\\w*))>\":::Plain::\n\
728 Member special method:\"\\3\":::Subroutine:Member reference:C\n\
729 Member deprecated:\"\\5\":::Subroutine1:Member reference:C\n\
730 Member special attrib:\"\\7\":::Identifier1:Member reference:C\n\
731 Member ref error:\"\\9\":::Flag:Member reference:C\n\
732 Storage keyword:\"<(class|global|lambda)>\":::Storage Type::\n\
733 Keyword:\"<(and|assert|break|continue|def|del|elif|else|except|exec|finally|for|from|if|import|in|is|not|or|pass|print|raise|return|try|while)>\":::Keyword::\n\
734 Built-in function:\"<(__import__|abs|apply|buffer|callable|chr|cmp|coerce|compile|complex|delattr|dir|divmod|eval|execfile|filter|float|getattr|globals|hasattr|hash|hex|id|input|int|intern|isinstance|issubclass|len|list|locals|long|map|max|min|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|slice|str|tuple|type|unichr|unicode|vars|xrange|zip)>\":::Subroutine::\n\
735 Built-in name:\"<(Ellipsis|None|__builtins__|__debug__|__doc__|__name__|copyright|credits|license|self)>\":::Identifier1::\n\
736 Built-in exceptions:\"<(ArithmeticError|AssertionError|AttributeError|EOFError|EnvironmentError|Exception|FloatingPointError|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|LookupError|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RuntimeError|StandardError|SyntaxError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|ValueError|WindowsError|ZeroDivisionError)>\":::Identifier1::\n\
737 Braces and parens:\"[[{()}\\]]\":::Keyword::}",
739 Comments:\"(?#This is a comment!)\\(\\?#[^)]*(?:\\)|$)\":::Comment::\n\
740 Literal Escape:\"(?#Special chars that need escapes)\\\\[abefnrtv()\\[\\]<>{}.|^$*+?&\\\\]\":::Preprocessor::\n\
741 Shortcut Escapes:\"(?#Shortcuts for common char classes)\\\\[dDlLsSwW]\":::Character Const::\n\
742 Backreferences:\"(?#Internal regex backreferences)\\\\[1-9]\":::Storage Type::\n\
743 Word Delimiter:\"(?#Special token to match NEdit [non]word-delimiters)\\\\[yY]\":::Subroutine::\n\
744 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\
745 Quantifiers:\"(?#Matches greedy and lazy quantifiers)[*+?]\\??\":::Flag::\n\
746 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\
747 Character Class:\"(?#Handles escapes, char ranges, ^-] at beginning and - at end)\\[\\^?[-\\]]?(?:(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]])(?:-(?:\\\\(?:[abdeflnrstvwDLSW\\-()\\[\\]<>{}.|^$*+?&\\\\]|[xX0][\\da-fA-F]+)|[^\\\\\\]]))?)*\\-?]\":::Character Const::\n\
748 Anchors:\"(?#\\B is the \"\"not a word boundary\"\" anchor)[$^<>]|\\\\B\":::Flag::\n\
749 Parens and Alternation:\"\\(?:\\?(?:[:=!iInN])|[()|]\":::Keyword::\n\
750 Match Themselves:\"(?#Highlight chars left over which just match themselves).\":::Text Comment::D}",
752 markup declaration:\"\\<!\":\"\\>\"::Plain::\n\
753 mdo-mdc:\"&\":\"&\"::Storage Type:markup declaration:C\n\
754 markup declaration dq string:\"\"\"\":\"\"\"\"::String1:markup declaration:\n\
755 markup declaration sq string:\"'\":\"'\"::String1:markup declaration:\n\
756 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\
757 ed name:\"\\2\":\"\"::String2:element declaration:C\n\
758 ed type:\"\\4\":\"\"::Storage Type:entity declaration:C\n\
759 doctype declaration:\"((?idoctype))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
760 dt name:\"\\2\":\"\"::String2:doctype declaration:C\n\
761 element declaration:\"((?ielement))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
762 attribute declaration:\"((?iattlist))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
763 ad name:\"\\2\":\"\"::String2:attribute declaration:C\n\
764 notation declaration:\"((?inotation))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
765 nd name:\"\\2\":\"\"::String2:notation declaration:C\n\
766 shortref declaration:\"((?ishortref))[ \\t\\n][ \\t]*\\n?[ \\t]*(\\l[\\l\\d\\-\\.]*)\":::Preprocessor:markup declaration:\n\
767 sd name:\"\\2\":\"\"::String2:shortref declaration:C\n\
768 comment:\"\\-\\-\":\"\\-\\-\"::Comment:markup declaration:\n\
769 pi:\"\\<\\?[^\\>]*\\??\\>\":::Flag::\n\
770 stag:\"(\\<)(\\(\\l[\\w\\-\\.:]*\\))?\\l[\\w\\-\\.:]*\":\"/?\\>\"::Text Key1::\n\
771 stago-tagc:\"\\1\":\"&\"::Text Arg:stag:C\n\
772 Attribute:\"([\\l\\-]+)[ \\t\\v]*\\n?[ \\t\\v]*=[ \\t\\v]*\\n?[ \\t\\v]*(\"\"([^\"\"]*\\n){,4}[^\"\"]*\"\"|'([^']*\\n){,4}[^']*'|\\&([^;]*\\n){,4}[^;]*;|[\\w\\-\\.:]+)\":::Plain:stag:\n\
773 Attribute name:\"\\1\":\"\"::Text Arg2:Attribute:C\n\
774 Attribute value:\"\\2\":\"\"::String:Attribute:C\n\
775 Boolean Attribute:\"([\\l\\-]+)\":::Text Arg1:stag:\n\
776 etag:\"(\\</)(\\(\\l[\\w\\-\\.:]*\\))?(\\l[\\w\\-\\.:]*[ \\t\\v]*\\n?[ \\t\\v]*)?(\\>)\":::Text Key1::\n\
777 etago-tagc:\"\\1\\4\":\"\"::Text Arg:etag:C\n\
778 Character reference:\"\\&((\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d]*|#\\d+|#[xX][a-fA-F\\d]+);?\":::Text Escape::\n\
779 parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape::\n\
780 md parameter entity:\"%(\\(\\l[\\l\\d\\-\\.]*\\))?\\l[\\l\\d\\-\\.]*;?\":::Text Escape:markup declaration:\n\
781 system-public id:\"<(?isystem|public|cdata)>\":::Storage Type:markup declaration:}",
783 keywords:\",|%|\\<|\\>|:=|=|<(SELECT|ON|FROM|ORDER BY|DESC|WHERE|AND|OR|NOT|NULL|TRUE|FALSE)>\":::Keyword::\n\
784 comment:\"--\":\"$\"::Comment::\n\
785 data types:\"<(CHAR|VARCHAR2\\([0-9]*\\)|INT[0-9]*|POINT|BOX|TEXT|BOOLEAN|VARCHAR2|VARCHAR|NUMBER\\([0-9]*\\)|NUMBER)(?!\\Y)\":::Storage Type::\n\
786 string:\"'\":\"'\"::String::\n\
787 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\
788 comment2:\"/\\*\":\"\\*/\"::Comment::}",
790 escaped special characters:\"\\\\[\\\\\"\"$`']\":::Keyword::\n\
791 single quoted string:\"'\":\"'\"::String1::\n\
792 double quoted string:\"\"\"\":\"\"\"\"::String::\n\
793 double quoted escape:\"\\\\[\\\\\"\"$`]\":::String2:double quoted string:\n\
794 dq command sub:\"`\":\"`\":\"\"\"\":Subroutine:double quoted string:\n\
795 dq arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\":\"\"\"\":String:double quoted string:\n\
796 dq new command sub:\"\\$\\(\":\"\\)\":\"\"\"\":Subroutine:double quoted string:\n\
797 dq variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:double quoted string:\n\
798 dq variables2:\"\\$\\{\":\"}\":\"\\n\":Identifier1:double quoted string:\n\
799 arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String::\n\
800 ae escapes:\"\\\\[\\\\$`\"\"']\":::String2:arithmetic expansion:\n\
801 ae single quoted string:\"'\":\"'\":\"\\)\\)\":String1:arithmetic expansion:\n\
802 ae command sub:\"`\":\"`\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
803 ae arithmetic expansion:\"\\$\\(\\(\":\"\\)\\)\"::String:arithmetic expansion:\n\
804 ae new command sub:\"\\$\\(\":\"\\)\":\"\\)\\)\":Subroutine:arithmetic expansion:\n\
805 ae variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:arithmetic expansion:\n\
806 ae variables2:\"\\$\\{\":\"}\":\"\\)\\)\":Identifier1:arithmetic expansion:\n\
807 comments:\"^[ \\t]*#\":\"$\"::Comment::\n\
808 command substitution:\"`\":\"`\"::Subroutine::\n\
809 cs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:command substitution:\n\
810 cs single quoted string:\"'\":\"'\":\"`\":String1:command substitution:\n\
811 cs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:command substitution:\n\
812 cs variables2:\"\\$\\{\":\"}\":\"`\":Identifier1:command substitution:\n\
813 new command substitution:\"\\$\\(\":\"\\)\"::Subroutine::\n\
814 ncs escapes:\"\\\\[\\\\$`\"\"']\":::Subroutine1:new command substitution:\n\
815 ncs single quoted string:\"'\":\"'\"::String1:new command substitution:\n\
816 ncs variables:\"\\$([-*@#?$!0-9]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1:new command substitution:\n\
817 ncs variables2:\"\\$\\{\":\"}\":\"\\)\":Identifier1:new command substitution:\n\
818 assignment:\"[a-zA-Z_][0-9a-zA-Z_]*=\":::Identifier1::\n\
819 variables:\"\\$([-*@#?$!0-9_]|[a-zA-Z_][0-9a-zA-Z_]*)\":::Identifier1::\n\
820 variables2:\"\\$\\{\":\"}\"::Identifier1::\n\
821 internal var:\"\\$\\{\":\"}\"::Identifier1:variables2:\n\
822 comments in line:\"#\":\"$\"::Comment::\n\
823 numbers:\"<(?i0x[\\da-f]+)|((\\d*\\.)?\\d+([eE][-+]?\\d+)?(?iul?|l|f)?)>\":::Numeric Const::D\n\
824 keywords:\"(?<!\\Y)(if|fi|then|else|elif|case|esac|while|for|do|done|in|select|time|until|function|\\[\\[|\\]\\])(?!\\Y)[\\s\\n]\":::Keyword::D\n\
825 command options:\"[ \\t]-[^ \\t{}[\\],()'\"\"~!@#$%^&*|\\\\<>?]+\":::Identifier::\n\
826 delimiters:\"[{};<>&~=!|^%[\\]+*|]\":::Text Key::D\n\
827 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}",
829 Double Quote String:\"\"\"\":\"\"\"\"::String::\n\
830 Single Quote String:\"'\":\"'\":\"[^\\\\][^']\":String::\n\
831 Ignore Escaped Chars:\"\\\\(.|\\n)\":::Plain::\n\
832 Variable Ref:\"\\$\\w+|\\$\\{[^}]*}|\\$|#auto\":::Identifier1::\n\
833 Comment:\"#\":\"$\"::Comment::\n\
834 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\
835 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\
836 Braces and Brackets:\"[\\[\\]{}]\":::Keyword::D\n\
837 DQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Double Quote String:\n\
838 SQ String Esc Chars:\"\\\\(.|\\n)\":::String1:Single Quote String:\n\
839 Variable in String:\"\\$\\w+|\\$\\{[^}]*}|\\$\":::Identifier1:Double Quote String:\n\
840 Storage:\"<(public|private|protected)>\":::Storage Type::\n\
841 Namespace:\"\\w+::\":::Keyword::}",
843 Comments:\"--\":\"$\"::Comment::\n\
844 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
845 Vhdl Attributes:\"'[a-zA-Z][a-zA-Z_]+\":::Ada Attributes::\n\
846 Character Literals:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
847 Numeric Literals:\"(?<!\\Y)(((2#|8#|10#|16#)[_0-9a-fA-F]*#)|[0-9.]+)(?!\\Y)\":::Numeric Const::\n\
848 Predefined Types:\"<(?ialias|constant|signal|variable|subtype|type|resolved|boolean|string|integer|natural|time)>\":::Storage Type::D\n\
849 Predefined SubTypes:\"<(?istd_logic|std_logic_vector|std_ulogic|std_ulogic_vector|bit|bit_vector)>\":::Storage Type::D\n\
850 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\
851 Identifiers:\"<([a-zA-Z][a-zA-Z0-9_]*)>\":::Plain::D\n\
852 Flag Special Comments:\"--\\<[^a-zA-Z0-9]+\\>\":::Flag:Comments:\n\
853 Instantiation:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+):([ \\t]+)([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)(port|generic|map)\":::Keyword::\n\
854 Instance Name:\"\\1\":\"\"::Identifier1:Instantiation:C\n\
855 Component Name:\"\\4\":\"\"::Identifier:Instantiation:C\n\
856 Syntax Character:\"(\\<=|=\\>|:|=|:=|;|,|\\(|\\))\":::Keyword::}",
858 Comment:\"/\\*\":\"\\*/\"::Comment::\n\
859 cplus comment:\"//\":\"$\"::Comment::\n\
860 String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
861 preprocessor line:\"^[ ]*`\":\"$\"::Preprocessor::\n\
862 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\
863 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\
864 System Functions:\"\\$[a-z_]+\":::Subroutine::D\n\
865 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\
866 Delay Word:\"(?<!\\Y)((#\\(.*\\))|(#[0-9]*))(?!\\Y)\":::Ada Attributes::D\n\
867 Simple Word:\"([a-zA-Z][a-zA-Z0-9]*)\":::Plain::D\n\
868 Instance Declaration:\"([a-zA-Z][a-zA-Z0-9_]*)([ \\t]+)([a-zA-Z][a-zA-Z0-9_$]*)([ \\t]*)\\(\":::Plain::\n\
869 Module name:\"\\1\":\"\"::Identifier:Instance Declaration:C\n\
870 Instance Name:\"\\3\":\"\"::Identifier1:Instance Declaration:C\n\
871 Pins Declaration:\"(?<!\\Y)(\\.([a-zA-Z0-9_]+))>\":::Storage Type1::\n\
872 Special Chars:\"(\\{|\\}|,|;|=|\\.)\":::Keyword::}",
874 comment:\"\\<!--\":\"--\\>\"::Comment::\n\
875 ignored section:\"\\<!\\[\\s*IGNORE\\s*\\[\":\"\\]\\]\\>\"::Text Comment::\n\
876 declaration:\"\\<\\?(?ixml)\":\"\\?\\>\"::Warning::\n\
877 declaration delims:\"&\":\"&\"::Keyword:declaration:C\n\
878 declaration attributes:\"((?iversion|encoding|standalone))=\":::Keyword:declaration:\n\
879 declaration attribute names:\"\\1\":::Preprocessor:declaration attributes:C\n\
880 declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:declaration:\n\
881 declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration sq string:\n\
882 declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:declaration:\n\
883 declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:declaration dq string:\n\
884 doctype:\"(\\<!(?idoctype))\\s+(\\<?(?!(?ixml))[\\l_][\\w:-]*\\>?)\":\"\\>\":\"\\[\":Warning::\n\
885 doctype delims:\"\\1\":\"&\"::Keyword:doctype:C\n\
886 doctype root element:\"\\2\":::Identifier:doctype:C\n\
887 doctype keyword:\"(SYSTEM|PUBLIC)\":::Keyword:doctype:\n\
888 doctype sq string:\"'\":\"'\":\"\\n\\n\":String1:doctype:\n\
889 doctype dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:doctype:\n\
890 processing instruction:\"\\<\\?\\S+\":\"\\?\\>\"::Preprocessor::\n\
891 processing instruction attribute:\"[\\l_][\\w:-]*=((\"\"[^\"\"]*\"\")|('[^']*'))\":::Preprocessor:processing instruction:\n\
892 processing instruction value:\"\\1\":::String:processing instruction attribute:C\n\
893 cdata:\"\\<!\\[(?icdata)\\[\":\"\\]\\]\\>\"::Text Comment::\n\
894 cdata delims:\"&\":\"&\"::Preprocessor:cdata:C\n\
895 element declaration:\"\\<!ELEMENT\":\"\\>\"::Warning::\n\
896 element declaration delims:\"&\":\"&\"::Keyword:element declaration:C\n\
897 element declaration entity ref:\"%(?!(?ixml))[\\l_][\\w:-]*;\":::Identifier1:element declaration:\n\
898 element declaration keyword:\"(?<!\\Y)(ANY|#PCDATA|EMPTY)>\":::Storage Type:element declaration:\n\
899 element declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:element declaration:\n\
900 element declaration operator:\"[(),?*+|]\":::Keyword:element declaration:\n\
901 entity declaration:\"\\<!ENTITY\":\"\\>\"::Warning::\n\
902 entity declaration delims:\"&\":\"&\"::Keyword:entity declaration:C\n\
903 entity declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:entity declaration:\n\
904 entity declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration sq string:\n\
905 entity declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:entity declaration:\n\
906 entity declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:entity declaration dq string:\n\
907 entity declaration keyword:\"SYSTEM|NDATA\":::Keyword:entity declaration:\n\
908 entity declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:entity declaration:\n\
909 parameter entity declaration:\"%\\s+((?!(?ixml))[\\l_][\\w:-]*)>\":::Keyword:entity declaration:\n\
910 parameter entity name:\"\\1\":::Identifier:parameter entity declaration:C\n\
911 notation:\"\\<!NOTATION\":\"\\>\"::Warning::\n\
912 notation delims:\"&\":\"&\"::Keyword:notation:C\n\
913 notation sq string:\"'\":\"'\":\"\\n\\n\":String1:notation:\n\
914 notation sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation sq string:\n\
915 notation dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:notation:\n\
916 notation dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:notation dq string:\n\
917 notation keyword:\"SYSTEM\":::Keyword:notation:\n\
918 notation name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:notation:\n\
919 attribute declaration:\"\\<!ATTLIST\":\"\\>\"::Warning::\n\
920 attribute declaration delims:\"&\":\"&\"::Keyword:attribute declaration:C\n\
921 attribute declaration sq string:\"'\":\"'\":\"\\n\\n\":String1:attribute declaration:\n\
922 attribute declaration sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration sq string:\n\
923 attribute declaration dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:attribute declaration:\n\
924 attribute declaration dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:attribute declaration dq string:\n\
925 attribute declaration namespace:\"(?ixmlns)(:[\\l_][\\w:]*)?\":::Preprocessor:attribute declaration:\n\
926 attribute declaration default modifier:\"#(REQUIRED|IMPLIED|FIXED)>\":::Keyword:attribute declaration:\n\
927 attribute declaration data type:\"<(CDATA|ENTIT(Y|IES)|ID(REFS?)?|NMTOKENS?|NOTATION)>\":::Storage Type:attribute declaration:\n\
928 attribute declaration name:\"<(?!(?ixml))[\\l_][\\w:-]*\":::Identifier:attribute declaration:\n\
929 attribute declaration operator:\"[(),?*+|]\":::Keyword:attribute declaration:\n\
930 element:\"(\\</?)((?!(?ixml))[\\l_][\\w:-]*)\":\"/?\\>\"::Warning::\n\
931 element delims:\"\\1\":\"&\"::Keyword:element:C\n\
932 element name:\"\\2\":::Identifier:element:C\n\
933 element assign:\"=\":::Keyword:element:\n\
934 element reserved attribute:\"(?ixml:(lang|space|link|attribute))(?==)\":::Text Key:element:\n\
935 element namespace:\"(?ixmlns:[\\l_]\\w*)(?==)\":::Preprocessor:element:\n\
936 element attribute:\"[\\l_][\\w:-]*(?==)\":::Text Key1:element:\n\
937 element sq string:\"'\":\"'\":\"\\n\\n\":String1:element:\n\
938 element sq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element sq string:\n\
939 element dq string:\"\"\"\":\"\"\"\":\"\\n\\n\":String:element:\n\
940 element dq string entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape:element dq string:\n\
941 entity:\"&((amp|lt|gt|quot|apos)|#x[\\da-fA-F]*|[\\l_]\\w*);\":::Text Escape::\n\
942 marked section:\"\\<!\\[\\s*(?:INCLUDE|(%(?!(?ixml))[\\l_][\\w:-]*;))\\s*\\[|\\]\\]\\>\":::Label::\n\
943 marked section entity ref:\"\\1\":::Identifier:marked section:C\n\
944 internal subset delims:\"[\\[\\]>]\":::Keyword::D\n\
945 info:\"(?# version 0.1; author/maintainer: Joor Loohuis, joor@loohuis-consulting.nl)\":::Comment::D}",
947 Preprocessor:\"^\\s*#\":\"$\"::Preprocessor::\n\
948 Preprocessor Wrap:\"\\\\\\n\":::Preprocessor1:Preprocessor:\n\
949 Comment:\"^\\s*!\":\"$\"::Comment::\n\
950 Comment Wrap:\"\\\\\\n\":::Comment:Comment:\n\
951 Resource Continued:\"^(\\s*[^:\\s]+\\s*:)(?:(\\\\.)|.)*(\\\\)\\n\":\"$\"::Plain::\n\
952 RC Space Warning:\"\\\\\\s+$\":::Flag:Resource Continued:\n\
953 RC Esc Chars:\"\\\\.\":::Text Arg2:Resource Continued:\n\
954 RC Esc Chars 2:\"\\2\":\"\"::Text Arg2:Resource Continued:C\n\
955 RC Name:\"\\1\":\"\"::Identifier:Resource Continued:C\n\
956 RC Wrap:\"\\\\\\n\":::Text Arg1:Resource Continued:\n\
957 RC Wrap2:\"\\3\":\"\"::Text Arg1:Resource Continued:C\n\
958 Resource:\"^\\s*[^:\\s]+\\s*:\":\"$\"::Plain::\n\
959 Resource Space Warning:\"\\S+\\s+$\":::Flag:Resource:\n\
960 Resource Esc Chars:\"\\\\.\":::Text Arg2:Resource:\n\
961 Resource Name:\"&\":\"\"::Identifier:Resource:C\n\
962 Free Text:\"^.*$\":::Flag::}",
964 comment:\"/\\*\":\"\\*/\"::Comment::\n\
965 string:\"\"\"\":\"\"\"\":\"\\n\":String::\n\
966 preprocessor line:\"^\\s*#\\s*(include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\
967 string escape chars:\"\\\\(.|\\n)\":::String1:string:\n\
968 preprocessor esc chars:\"\\\\(.|\\n)\":::Preprocessor1:preprocessor line:\n\
969 preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\
970 character constant:\"'\":\"'\":\"[^\\\\][^']\":Character Const::\n\
971 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\
972 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\
973 rule:\"^[ \\t]*[A-Za-z_][A-Za-z0-9_]*[ \\t]*:\":::Preprocessor1::D\n\
974 keyword:\"<(return|goto|if|else|case|default|switch|break|continue|while|do|for|sizeof)>\":::Keyword::D\n\
975 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\
976 percent keyword:\"(?<!\\Y)(%left|%nonassoc|%prec|%right|%start|%token|%type|%union)>([ \\t]*\\<.*\\>)?\":::Text Arg::D\n\
977 braces:\"[{}]\":::Keyword::D\n\
978 markers:\"(?<!\\Y)(%\\{|%\\}|%%)(?!\\Y)\":::Flag::D\n\
979 percent sub-expr:\"\\2\":::Text Arg2:percent keyword:DC}"
984 ** Read a string (from the value of the styles resource) containing highlight
985 ** styles information, parse it, and load it into the stored highlight style
986 ** list (HighlightStyles) for this NEdit session.
988 int LoadStylesString(char *inString
)
990 char *errMsg
, *fontStr
;
991 char *inPtr
= inString
;
992 highlightStyleRec
*hs
;
997 /* skip over blank space */
998 inPtr
+= strspn(inPtr
, " \t");
1000 /* Allocate a language mode structure in which to store the info. */
1001 hs
= (highlightStyleRec
*)XtMalloc(sizeof(highlightStyleRec
));
1003 /* read style name */
1004 hs
->name
= ReadSymbolicField(&inPtr
);
1005 if (hs
->name
== NULL
)
1006 return styleError(inString
,inPtr
, "style name required");
1007 if (!SkipDelimiter(&inPtr
, &errMsg
)) {
1010 return styleError(inString
,inPtr
, errMsg
);
1014 hs
->color
= ReadSymbolicField(&inPtr
);
1015 if (hs
->color
== NULL
) {
1018 return styleError(inString
,inPtr
, "color name required");
1021 if (SkipOptSeparator('/', &inPtr
, &errMsg
)) {
1023 hs
->bgColor
= ReadSymbolicField(&inPtr
); /* no error if fails */
1025 if (!SkipDelimiter(&inPtr
, &errMsg
)) {
1026 freeHighlightStyleRec(hs
);
1027 return styleError(inString
,inPtr
, errMsg
);
1030 /* read the font type */
1031 fontStr
= ReadSymbolicField(&inPtr
);
1032 for (i
=0; i
<N_FONT_TYPES
; i
++) {
1033 if (!strcmp(FontTypeNames
[i
], fontStr
)) {
1038 if (i
== N_FONT_TYPES
) {
1040 freeHighlightStyleRec(hs
);
1041 return styleError(inString
, inPtr
, "unrecognized font type");
1045 /* pattern set was read correctly, add/change it in the list */
1046 for (i
=0; i
<NHighlightStyles
; i
++) {
1047 if (!strcmp(HighlightStyles
[i
]->name
, hs
->name
)) {
1048 freeHighlightStyleRec(HighlightStyles
[i
]);
1049 HighlightStyles
[i
] = hs
;
1053 if (i
== NHighlightStyles
) {
1054 HighlightStyles
[NHighlightStyles
++] = hs
;
1055 if (NHighlightStyles
> MAX_HIGHLIGHT_STYLES
)
1056 return styleError(inString
, inPtr
,
1057 "maximum allowable number of styles exceeded");
1060 /* if the string ends here, we're done */
1061 inPtr
+= strspn(inPtr
, " \t\n");
1068 ** Create a string in the correct format for the styles resource, containing
1069 ** all of the highlight styles information from the stored highlight style
1070 ** list (HighlightStyles) for this NEdit session.
1072 char *WriteStylesString(void)
1077 highlightStyleRec
*style
;
1079 outBuf
= BufCreate();
1080 for (i
=0; i
<NHighlightStyles
; i
++) {
1081 style
= HighlightStyles
[i
];
1082 BufInsert(outBuf
, outBuf
->length
, "\t");
1083 BufInsert(outBuf
, outBuf
->length
, style
->name
);
1084 BufInsert(outBuf
, outBuf
->length
, ":");
1085 BufInsert(outBuf
, outBuf
->length
, style
->color
);
1086 if (style
->bgColor
) {
1087 BufInsert(outBuf
, outBuf
->length
, "/");
1088 BufInsert(outBuf
, outBuf
->length
, style
->bgColor
);
1090 BufInsert(outBuf
, outBuf
->length
, ":");
1091 BufInsert(outBuf
, outBuf
->length
, FontTypeNames
[style
->font
]);
1092 BufInsert(outBuf
, outBuf
->length
, "\\n\\\n");
1095 /* Get the output, and lop off the trailing newlines */
1096 outStr
= BufGetRange(outBuf
, 0, outBuf
->length
- (i
==1?0:4));
1102 ** Read a string representing highlight pattern sets and add them
1103 ** to the PatternSets list of loaded highlight patterns. Note that the
1104 ** patterns themselves are not parsed until they are actually used.
1106 ** The argument convertOld, reads patterns in pre 5.1 format (which means
1107 ** that they may contain regular expressions are of the older syntax where
1108 ** braces were not quoted, and \0 was a legal substitution character).
1110 int LoadHighlightString(char *inString
, int convertOld
)
1112 char *inPtr
= inString
;
1118 /* Read each pattern set, abort on error */
1119 patSet
= readPatternSet(&inPtr
, convertOld
);
1123 /* Add/change the pattern set in the list */
1124 for (i
=0; i
<NPatternSets
; i
++) {
1125 if (!strcmp(PatternSets
[i
]->languageMode
, patSet
->languageMode
)) {
1126 freePatternSet(PatternSets
[i
]);
1127 PatternSets
[i
] = patSet
;
1131 if (i
== NPatternSets
) {
1132 PatternSets
[NPatternSets
++] = patSet
;
1133 if (NPatternSets
> MAX_LANGUAGE_MODES
)
1137 /* if the string ends here, we're done */
1138 inPtr
+= strspn(inPtr
, " \t\n");
1145 ** Create a string in the correct format for the highlightPatterns resource,
1146 ** containing all of the highlight pattern information from the stored
1147 ** highlight pattern list (PatternSets) for this NEdit session.
1149 char *WriteHighlightString(void)
1151 char *outStr
, *str
, *escapedStr
;
1153 int psn
, written
= False
;
1156 outBuf
= BufCreate();
1157 for (psn
=0; psn
<NPatternSets
; psn
++) {
1158 patSet
= PatternSets
[psn
];
1159 if (patSet
->nPatterns
== 0)
1162 BufInsert(outBuf
, outBuf
->length
, patSet
->languageMode
);
1163 BufInsert(outBuf
, outBuf
->length
, ":");
1164 if (isDefaultPatternSet(patSet
))
1165 BufInsert(outBuf
, outBuf
->length
, "Default\n\t");
1167 BufInsert(outBuf
, outBuf
->length
, intToStr(patSet
->lineContext
));
1168 BufInsert(outBuf
, outBuf
->length
, ":");
1169 BufInsert(outBuf
, outBuf
->length
, intToStr(patSet
->charContext
));
1170 BufInsert(outBuf
, outBuf
->length
, "{\n");
1171 BufInsert(outBuf
, outBuf
->length
,
1172 str
= createPatternsString(patSet
, "\t\t"));
1174 BufInsert(outBuf
, outBuf
->length
, "\t}\n\t");
1178 /* Get the output string, and lop off the trailing newline and tab */
1179 outStr
= BufGetRange(outBuf
, 0, outBuf
->length
- (written
?2:0));
1182 /* Protect newlines and backslashes from translation by the resource
1184 escapedStr
= EscapeSensitiveChars(outStr
);
1190 ** Update regular expressions in stored pattern sets to version 5.1 regular
1191 ** expression syntax, in which braces and \0 have different meanings
1193 static void convertOldPatternSet(patternSet
*patSet
)
1196 highlightPattern
*pattern
;
1198 for (p
=0; p
<patSet
->nPatterns
; p
++) {
1199 pattern
= &patSet
->patterns
[p
];
1200 convertPatternExpr(&pattern
->startRE
, patSet
->languageMode
,
1201 pattern
->name
, pattern
->flags
& COLOR_ONLY
);
1202 convertPatternExpr(&pattern
->endRE
, patSet
->languageMode
,
1203 pattern
->name
, pattern
->flags
& COLOR_ONLY
);
1204 convertPatternExpr(&pattern
->errorRE
, patSet
->languageMode
,
1205 pattern
->name
, pattern
->flags
& COLOR_ONLY
);
1210 ** Convert a single regular expression, patternRE, to version 5.1 regular
1211 ** expression syntax. It will convert either a match expression or a
1212 ** substitution expression, which must be specified by the setting of
1213 ** isSubsExpr. Error messages are directed to stderr, and include the
1214 ** pattern set name and pattern name as passed in patSetName and patName.
1216 static void convertPatternExpr(char **patternRE
, char *patSetName
,
1217 char *patName
, int isSubsExpr
)
1219 char *newRE
, *errorText
;
1221 if (*patternRE
== NULL
)
1224 newRE
= XtMalloc(strlen(*patternRE
) + 5000);
1225 ConvertSubstituteRE(*patternRE
, newRE
, strlen(*patternRE
) + 5000);
1227 *patternRE
= XtNewString(newRE
);
1230 newRE
= ConvertRE(*patternRE
, &errorText
, NULL
);
1231 if (newRE
== NULL
) {
1232 fprintf(stderr
, "NEdit error converting old format regular "
1233 "expression in pattern set %s, pattern %s: %s\n",
1234 patSetName
, patName
, errorText
);
1242 ** Find the font (font struct) associated with a named style.
1243 ** This routine must only be called with a valid styleName (call
1244 ** NamedStyleExists to find out whether styleName is valid).
1246 XFontStruct
*FontOfNamedStyle(WindowInfo
*window
, const char *styleName
)
1248 int styleNo
=lookupNamedStyle(styleName
),fontNum
;
1252 return GetDefaultFontStruct(window
->fontList
);
1253 fontNum
= HighlightStyles
[styleNo
]->font
;
1254 if (fontNum
== BOLD_FONT
)
1255 font
= window
->boldFontStruct
;
1256 else if (fontNum
== ITALIC_FONT
)
1257 font
= window
->italicFontStruct
;
1258 else if (fontNum
== BOLD_ITALIC_FONT
)
1259 font
= window
->boldItalicFontStruct
;
1260 else /* fontNum == PLAIN_FONT */
1261 font
= GetDefaultFontStruct(window
->fontList
);
1263 /* If font isn't loaded, silently substitute primary font */
1264 return font
== NULL
? GetDefaultFontStruct(window
->fontList
) : font
;
1267 int FontOfNamedStyleIsBold(char *styleName
)
1269 int styleNo
=lookupNamedStyle(styleName
),fontNum
;
1273 fontNum
= HighlightStyles
[styleNo
]->font
;
1274 return (fontNum
== BOLD_FONT
|| fontNum
== BOLD_ITALIC_FONT
);
1277 int FontOfNamedStyleIsItalic(char *styleName
)
1279 int styleNo
=lookupNamedStyle(styleName
),fontNum
;
1283 fontNum
= HighlightStyles
[styleNo
]->font
;
1284 return (fontNum
== ITALIC_FONT
|| fontNum
== BOLD_ITALIC_FONT
);
1288 ** Find the color associated with a named style. This routine must only be
1289 ** called with a valid styleName (call NamedStyleExists to find out whether
1290 ** styleName is valid).
1292 char *ColorOfNamedStyle(const char *styleName
)
1294 int styleNo
=lookupNamedStyle(styleName
);
1298 return HighlightStyles
[styleNo
]->color
;
1302 ** Find the background color associated with a named style.
1304 char *BgColorOfNamedStyle(const char *styleName
)
1306 int styleNo
=lookupNamedStyle(styleName
);
1310 return HighlightStyles
[styleNo
]->bgColor
;
1314 ** Determine whether a named style exists
1316 int NamedStyleExists(const char *styleName
)
1318 return lookupNamedStyle(styleName
) != -1;
1322 ** Look through the list of pattern sets, and find the one for a particular
1323 ** language. Returns NULL if not found.
1325 patternSet
*FindPatternSet(const char *langModeName
)
1329 if (langModeName
== NULL
)
1332 for (i
=0; i
<NPatternSets
; i
++)
1333 if (!strcmp(langModeName
, PatternSets
[i
]->languageMode
))
1334 return PatternSets
[i
];
1340 ** Returns True if there are highlight patterns, or potential patterns
1341 ** not yet committed in the syntax highlighting dialog for a language mode,
1343 int LMHasHighlightPatterns(const char *languageMode
)
1345 if (FindPatternSet(languageMode
) != NULL
)
1347 return HighlightDialog
.shell
!=NULL
&& !strcmp(HighlightDialog
.langModeName
,
1348 languageMode
) && HighlightDialog
.nPatterns
!= 0;
1352 ** Change the language mode name of pattern sets for language "oldName" to
1353 ** "newName" in both the stored patterns, and the pattern set currently being
1354 ** edited in the dialog.
1356 void RenameHighlightPattern(const char *oldName
, const char *newName
)
1360 for (i
=0; i
<NPatternSets
; i
++) {
1361 if (!strcmp(oldName
, PatternSets
[i
]->languageMode
)) {
1362 XtFree(PatternSets
[i
]->languageMode
);
1363 PatternSets
[i
]->languageMode
= XtNewString(newName
);
1366 if (HighlightDialog
.shell
!= NULL
) {
1367 if (!strcmp(HighlightDialog
.langModeName
, oldName
)) {
1368 XtFree(HighlightDialog
.langModeName
);
1369 HighlightDialog
.langModeName
= XtNewString(newName
);
1375 ** Create a pulldown menu pane with the names of the current highlight styles.
1376 ** XmNuserData for each item contains a pointer to the name.
1378 static Widget
createHighlightStylesMenu(Widget parent
)
1384 menu
= CreatePulldownMenu(parent
, "highlightStyles", NULL
, 0);
1385 for (i
=0; i
<NHighlightStyles
; i
++) {
1386 XtVaCreateManagedWidget("highlightStyles", xmPushButtonWidgetClass
,menu
,
1387 XmNlabelString
, s1
=XmStringCreateSimple(HighlightStyles
[i
]->name
),
1388 XmNuserData
, (void *)HighlightStyles
[i
]->name
, NULL
);
1394 static char *createPatternsString(patternSet
*patSet
, char *indentStr
)
1399 highlightPattern
*pat
;
1401 outBuf
= BufCreate();
1402 for (pn
=0; pn
<patSet
->nPatterns
; pn
++) {
1403 pat
= &patSet
->patterns
[pn
];
1404 BufInsert(outBuf
, outBuf
->length
, indentStr
);
1405 BufInsert(outBuf
, outBuf
->length
, pat
->name
);
1406 BufInsert(outBuf
, outBuf
->length
, ":");
1407 if (pat
->startRE
!= NULL
) {
1408 BufInsert(outBuf
, outBuf
->length
,
1409 str
=MakeQuotedString(pat
->startRE
));
1412 BufInsert(outBuf
, outBuf
->length
, ":");
1413 if (pat
->endRE
!= NULL
) {
1414 BufInsert(outBuf
, outBuf
->length
, str
=MakeQuotedString(pat
->endRE
));
1417 BufInsert(outBuf
, outBuf
->length
, ":");
1418 if (pat
->errorRE
!= NULL
) {
1419 BufInsert(outBuf
, outBuf
->length
,
1420 str
=MakeQuotedString(pat
->errorRE
));
1423 BufInsert(outBuf
, outBuf
->length
, ":");
1424 BufInsert(outBuf
, outBuf
->length
, pat
->style
);
1425 BufInsert(outBuf
, outBuf
->length
, ":");
1426 if (pat
->subPatternOf
!= NULL
)
1427 BufInsert(outBuf
, outBuf
->length
, pat
->subPatternOf
);
1428 BufInsert(outBuf
, outBuf
->length
, ":");
1429 if (pat
->flags
& DEFER_PARSING
)
1430 BufInsert(outBuf
, outBuf
->length
, "D");
1431 if (pat
->flags
& PARSE_SUBPATS_FROM_START
)
1432 BufInsert(outBuf
, outBuf
->length
, "R");
1433 if (pat
->flags
& COLOR_ONLY
)
1434 BufInsert(outBuf
, outBuf
->length
, "C");
1435 BufInsert(outBuf
, outBuf
->length
, "\n");
1437 outStr
= BufGetAll(outBuf
);
1443 ** Read in a pattern set character string, and advance *inPtr beyond it.
1444 ** Returns NULL and outputs an error to stderr on failure.
1446 static patternSet
*readPatternSet(char **inPtr
, int convertOld
)
1448 char *errMsg
, *stringStart
= *inPtr
;
1449 patternSet patSet
, *retPatSet
;
1451 /* remove leading whitespace */
1452 *inPtr
+= strspn(*inPtr
, " \t\n");
1454 /* read language mode field */
1455 patSet
.languageMode
= ReadSymbolicField(inPtr
);
1456 if (patSet
.languageMode
== NULL
)
1457 return highlightError(stringStart
, *inPtr
,
1458 "language mode must be specified");
1459 if (!SkipDelimiter(inPtr
, &errMsg
))
1460 return highlightError(stringStart
, *inPtr
, errMsg
);
1462 /* look for "Default" keyword, and if it's there, return the default
1464 if (!strncmp(*inPtr
, "Default", 7)) {
1466 retPatSet
= readDefaultPatternSet(patSet
.languageMode
);
1467 XtFree(patSet
.languageMode
);
1468 if (retPatSet
== NULL
)
1469 return highlightError(stringStart
, *inPtr
,
1470 "No default pattern set");
1474 /* read line context field */
1475 if (!ReadNumericField(inPtr
, &patSet
.lineContext
))
1476 return highlightError(stringStart
, *inPtr
,
1477 "unreadable line context field");
1478 if (!SkipDelimiter(inPtr
, &errMsg
))
1479 return highlightError(stringStart
, *inPtr
, errMsg
);
1481 /* read character context field */
1482 if (!ReadNumericField(inPtr
, &patSet
.charContext
))
1483 return highlightError(stringStart
, *inPtr
,
1484 "unreadable character context field");
1486 /* read pattern list */
1487 patSet
.patterns
= readHighlightPatterns(inPtr
,
1488 True
, &errMsg
, &patSet
.nPatterns
);
1489 if (patSet
.patterns
== NULL
)
1490 return highlightError(stringStart
, *inPtr
, errMsg
);
1492 /* pattern set was read correctly, make an allocated copy to return */
1493 retPatSet
= (patternSet
*)XtMalloc(sizeof(patternSet
));
1494 memcpy(retPatSet
, &patSet
, sizeof(patternSet
));
1496 /* Convert pre-5.1 pattern sets which use old regular expression
1497 syntax to quote braces and use & rather than \0 */
1499 convertOldPatternSet(retPatSet
);
1505 ** Parse a set of highlight patterns into an array of highlightPattern
1506 ** structures, and a language mode name. If unsuccessful, returns NULL with
1507 ** (statically allocated) message in "errMsg".
1509 static highlightPattern
*readHighlightPatterns(char **inPtr
, int withBraces
,
1510 char **errMsg
, int *nPatterns
)
1512 highlightPattern
*pat
, *returnedList
, patternList
[MAX_PATTERNS
];
1514 /* skip over blank space */
1515 *inPtr
+= strspn(*inPtr
, " \t\n");
1517 /* look for initial brace */
1519 if (**inPtr
!= '{') {
1520 *errMsg
= "pattern list must begin with \"{\"";
1527 ** parse each pattern in the list
1531 *inPtr
+= strspn(*inPtr
, " \t\n");
1532 if (**inPtr
== '\0') {
1534 *errMsg
= "end of pattern list not found";
1538 } else if (**inPtr
== '}') {
1542 if (!readHighlightPattern(inPtr
, errMsg
, pat
++))
1544 if (pat
- patternList
> MAX_PATTERNS
) {
1545 *errMsg
= "max number of patterns exceeded\n";
1550 /* allocate a more appropriately sized list to return patterns */
1551 *nPatterns
= pat
- patternList
;
1552 returnedList
= (highlightPattern
*)XtMalloc(
1553 sizeof(highlightPattern
) * *nPatterns
);
1554 memcpy(returnedList
, patternList
, sizeof(highlightPattern
) * *nPatterns
);
1555 return returnedList
;
1558 static int readHighlightPattern(char **inPtr
, char **errMsg
,
1559 highlightPattern
*pattern
)
1561 /* read the name field */
1562 pattern
->name
= ReadSymbolicField(inPtr
);
1563 if (pattern
->name
== NULL
) {
1564 *errMsg
= "pattern name is required";
1567 if (!SkipDelimiter(inPtr
, errMsg
))
1570 /* read the start pattern */
1571 if (!ReadQuotedString(inPtr
, errMsg
, &pattern
->startRE
))
1573 if (!SkipDelimiter(inPtr
, errMsg
))
1576 /* read the end pattern */
1578 pattern
->endRE
= NULL
;
1579 else if (!ReadQuotedString(inPtr
, errMsg
, &pattern
->endRE
))
1581 if (!SkipDelimiter(inPtr
, errMsg
))
1584 /* read the error pattern */
1586 pattern
->errorRE
= NULL
;
1587 else if (!ReadQuotedString(inPtr
, errMsg
, &pattern
->errorRE
))
1589 if (!SkipDelimiter(inPtr
, errMsg
))
1592 /* read the style field */
1593 pattern
->style
= ReadSymbolicField(inPtr
);
1594 if (pattern
->style
== NULL
) {
1595 *errMsg
= "style field required in pattern";
1598 if (!SkipDelimiter(inPtr
, errMsg
))
1601 /* read the sub-pattern-of field */
1602 pattern
->subPatternOf
= ReadSymbolicField(inPtr
);
1603 if (!SkipDelimiter(inPtr
, errMsg
))
1606 /* read flags field */
1608 for (; **inPtr
!= '\n' && **inPtr
!= '}'; (*inPtr
)++) {
1610 pattern
->flags
|= DEFER_PARSING
;
1611 else if (**inPtr
== 'R')
1612 pattern
->flags
|= PARSE_SUBPATS_FROM_START
;
1613 else if (**inPtr
== 'C')
1614 pattern
->flags
|= COLOR_ONLY
;
1615 else if (**inPtr
!= ' ' && **inPtr
!= '\t') {
1616 *errMsg
= "unreadable flag field";
1624 ** Given a language mode name, determine if there is a default (built-in)
1625 ** pattern set available for that language mode, and if so, read it and
1626 ** return a new allocated copy of it. The returned pattern set should be
1627 ** freed by the caller with freePatternSet()
1629 static patternSet
*readDefaultPatternSet(const char *langModeName
)
1634 modeNameLen
= strlen(langModeName
);
1635 for (i
=0; i
<(int)XtNumber(DefaultPatternSets
); i
++) {
1636 if (!strncmp(langModeName
, DefaultPatternSets
[i
], modeNameLen
) &&
1637 DefaultPatternSets
[i
][modeNameLen
] == ':') {
1638 strPtr
= DefaultPatternSets
[i
];
1639 return readPatternSet(&strPtr
, False
);
1646 ** Return True if patSet exactly matches one of the default pattern sets
1648 static int isDefaultPatternSet(patternSet
*patSet
)
1650 patternSet
*defaultPatSet
;
1653 defaultPatSet
= readDefaultPatternSet(patSet
->languageMode
);
1654 if (defaultPatSet
== NULL
)
1656 retVal
= !patternSetsDiffer(patSet
, defaultPatSet
);
1657 freePatternSet(defaultPatSet
);
1662 ** Short-hand functions for formating and outputing errors for
1664 static patternSet
*highlightError(char *stringStart
, char *stoppedAt
,
1665 const char *message
)
1667 ParseError(NULL
, stringStart
, stoppedAt
, "highlight pattern", message
);
1672 static int styleError(const char *stringStart
, const char *stoppedAt
,
1673 const char *message
)
1675 ParseError(NULL
, stringStart
, stoppedAt
, "style specification", message
);
1680 ** Present a dialog for editing highlight style information
1682 void EditHighlightStyles(Widget parent
, const char *initialStyle
)
1684 #define HS_LIST_RIGHT 60
1685 #define HS_LEFT_MARGIN_POS 1
1686 #define HS_RIGHT_MARGIN_POS 99
1687 #define HS_H_MARGIN 10
1688 Widget form
, nameLbl
, topLbl
, colorLbl
, bgColorLbl
, fontLbl
;
1689 Widget fontBox
, sep1
, okBtn
, applyBtn
, dismissBtn
;
1694 /* if the dialog is already displayed, just pop it to the top and return */
1695 if (HSDialog
.shell
!= NULL
) {
1696 if (initialStyle
!= NULL
)
1697 setStyleByName(initialStyle
);
1698 RaiseShellWindow(HSDialog
.shell
);
1702 /* Copy the list of highlight style information to one that the user
1703 can freely edit (via the dialog and managed-list code) */
1704 HSDialog
.highlightStyleList
= (highlightStyleRec
**)XtMalloc(
1705 sizeof(highlightStyleRec
*) * MAX_HIGHLIGHT_STYLES
);
1706 for (i
=0; i
<NHighlightStyles
; i
++)
1707 HSDialog
.highlightStyleList
[i
] =
1708 copyHighlightStyleRec(HighlightStyles
[i
]);
1709 HSDialog
.nHighlightStyles
= NHighlightStyles
;
1711 /* Create a form widget in an application shell */
1713 XtSetArg(args
[ac
], XmNdeleteResponse
, XmDO_NOTHING
); ac
++;
1714 XtSetArg(args
[ac
], XmNiconName
, "Highlight Styles"); ac
++;
1715 XtSetArg(args
[ac
], XmNtitle
, "Highlight Styles"); ac
++;
1716 HSDialog
.shell
= CreateShellWithBestVis(APP_NAME
, APP_CLASS
,
1717 applicationShellWidgetClass
, TheDisplay
, args
, ac
);
1718 AddSmallIcon(HSDialog
.shell
);
1719 form
= XtVaCreateManagedWidget("editHighlightStyles", xmFormWidgetClass
,
1720 HSDialog
.shell
, XmNautoUnmanage
, False
,
1721 XmNresizePolicy
, XmRESIZE_NONE
, NULL
);
1722 XtAddCallback(form
, XmNdestroyCallback
, hsDestroyCB
, NULL
);
1723 AddMotifCloseCallback(HSDialog
.shell
, hsDismissCB
, NULL
);
1725 topLbl
= XtVaCreateManagedWidget("topLabel", xmLabelGadgetClass
, form
,
1726 XmNlabelString
, s1
=MKSTRING(
1727 "To modify the properties of an existing highlight style, select the name\n\
1728 from the list on the left. Select \"New\" to add a new style to the list."),
1730 XmNtopAttachment
, XmATTACH_POSITION
,
1732 XmNleftAttachment
, XmATTACH_POSITION
,
1733 XmNleftPosition
, HS_LEFT_MARGIN_POS
,
1734 XmNrightAttachment
, XmATTACH_POSITION
,
1735 XmNrightPosition
, HS_RIGHT_MARGIN_POS
, NULL
);
1738 nameLbl
= XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass
, form
,
1739 XmNlabelString
, s1
=XmStringCreateSimple("Name:"),
1741 XmNalignment
, XmALIGNMENT_BEGINNING
,
1742 XmNleftAttachment
, XmATTACH_POSITION
,
1743 XmNleftPosition
, HS_LIST_RIGHT
,
1744 XmNtopAttachment
, XmATTACH_WIDGET
,
1745 XmNtopOffset
, HS_H_MARGIN
,
1746 XmNtopWidget
, topLbl
, NULL
);
1749 HSDialog
.nameW
= XtVaCreateManagedWidget("name", xmTextWidgetClass
, form
,
1750 XmNleftAttachment
, XmATTACH_POSITION
,
1751 XmNleftPosition
, HS_LIST_RIGHT
,
1752 XmNtopAttachment
, XmATTACH_WIDGET
,
1753 XmNtopWidget
, nameLbl
,
1754 XmNrightAttachment
, XmATTACH_POSITION
,
1755 XmNrightPosition
, HS_RIGHT_MARGIN_POS
, NULL
);
1756 RemapDeleteKey(HSDialog
.nameW
);
1757 XtVaSetValues(nameLbl
, XmNuserData
, HSDialog
.nameW
, NULL
);
1759 colorLbl
= XtVaCreateManagedWidget("colorLbl", xmLabelGadgetClass
, form
,
1760 XmNlabelString
, s1
=XmStringCreateSimple("Foreground Color:"),
1762 XmNalignment
, XmALIGNMENT_BEGINNING
,
1763 XmNleftAttachment
, XmATTACH_POSITION
,
1764 XmNleftPosition
, HS_LIST_RIGHT
,
1765 XmNtopAttachment
, XmATTACH_WIDGET
,
1766 XmNtopOffset
, HS_H_MARGIN
,
1767 XmNtopWidget
, HSDialog
.nameW
, NULL
);
1770 HSDialog
.colorW
= XtVaCreateManagedWidget("color", xmTextWidgetClass
, form
,
1771 XmNleftAttachment
, XmATTACH_POSITION
,
1772 XmNleftPosition
, HS_LIST_RIGHT
,
1773 XmNtopAttachment
, XmATTACH_WIDGET
,
1774 XmNtopWidget
, colorLbl
,
1775 XmNrightAttachment
, XmATTACH_POSITION
,
1776 XmNrightPosition
, HS_RIGHT_MARGIN_POS
, NULL
);
1777 RemapDeleteKey(HSDialog
.colorW
);
1778 XtVaSetValues(colorLbl
, XmNuserData
, HSDialog
.colorW
, NULL
);
1780 bgColorLbl
= XtVaCreateManagedWidget("bgColorLbl", xmLabelGadgetClass
, form
,
1782 s1
=XmStringCreateSimple("Background Color (optional)"),
1784 XmNalignment
, XmALIGNMENT_BEGINNING
,
1785 XmNleftAttachment
, XmATTACH_POSITION
,
1786 XmNleftPosition
, HS_LIST_RIGHT
,
1787 XmNtopAttachment
, XmATTACH_WIDGET
,
1788 XmNtopOffset
, HS_H_MARGIN
,
1789 XmNtopWidget
, HSDialog
.colorW
, NULL
);
1792 HSDialog
.bgColorW
= XtVaCreateManagedWidget("bgColor",
1793 xmTextWidgetClass
, form
,
1794 XmNleftAttachment
, XmATTACH_POSITION
,
1795 XmNleftPosition
, HS_LIST_RIGHT
,
1796 XmNtopAttachment
, XmATTACH_WIDGET
,
1797 XmNtopWidget
, bgColorLbl
,
1798 XmNrightAttachment
, XmATTACH_POSITION
,
1799 XmNrightPosition
, HS_RIGHT_MARGIN_POS
, NULL
);
1800 RemapDeleteKey(HSDialog
.bgColorW
);
1801 XtVaSetValues(bgColorLbl
, XmNuserData
, HSDialog
.bgColorW
, NULL
);
1803 fontLbl
= XtVaCreateManagedWidget("fontLbl", xmLabelGadgetClass
, form
,
1804 XmNlabelString
, s1
=XmStringCreateSimple("Font:"),
1805 XmNalignment
, XmALIGNMENT_BEGINNING
,
1806 XmNleftAttachment
, XmATTACH_POSITION
,
1807 XmNleftPosition
, HS_LIST_RIGHT
,
1808 XmNtopAttachment
, XmATTACH_WIDGET
,
1809 XmNtopOffset
, HS_H_MARGIN
,
1810 XmNtopWidget
, HSDialog
.bgColorW
, NULL
);
1813 fontBox
= XtVaCreateManagedWidget("fontBox", xmRowColumnWidgetClass
, form
,
1814 XmNpacking
, XmPACK_COLUMN
,
1816 XmNradioBehavior
, True
,
1817 XmNleftAttachment
, XmATTACH_POSITION
,
1818 XmNleftPosition
, HS_LIST_RIGHT
,
1819 XmNtopAttachment
, XmATTACH_WIDGET
,
1820 XmNtopWidget
, fontLbl
, NULL
);
1821 HSDialog
.plainW
= XtVaCreateManagedWidget("plain",
1822 xmToggleButtonWidgetClass
, fontBox
,
1824 XmNlabelString
, s1
=XmStringCreateSimple("Plain"),
1825 XmNmnemonic
, 'P', NULL
);
1827 HSDialog
.boldW
= XtVaCreateManagedWidget("bold",
1828 xmToggleButtonWidgetClass
, fontBox
,
1829 XmNlabelString
, s1
=XmStringCreateSimple("Bold"),
1830 XmNmnemonic
, 'B', NULL
);
1832 HSDialog
.italicW
= XtVaCreateManagedWidget("italic",
1833 xmToggleButtonWidgetClass
, fontBox
,
1834 XmNlabelString
, s1
=XmStringCreateSimple("Italic"),
1835 XmNmnemonic
, 'I', NULL
);
1837 HSDialog
.boldItalicW
= XtVaCreateManagedWidget("boldItalic",
1838 xmToggleButtonWidgetClass
, fontBox
,
1839 XmNlabelString
, s1
=XmStringCreateSimple("Bold Italic"),
1840 XmNmnemonic
, 'o', NULL
);
1843 okBtn
= XtVaCreateManagedWidget("ok",xmPushButtonWidgetClass
,form
,
1844 XmNlabelString
, s1
=XmStringCreateSimple("OK"),
1845 XmNleftAttachment
, XmATTACH_POSITION
,
1846 XmNleftPosition
, 10,
1847 XmNrightAttachment
, XmATTACH_POSITION
,
1848 XmNrightPosition
, 30,
1849 XmNbottomAttachment
, XmATTACH_POSITION
,
1850 XmNbottomPosition
, 99, NULL
);
1851 XtAddCallback(okBtn
, XmNactivateCallback
, hsOkCB
, NULL
);
1854 applyBtn
= XtVaCreateManagedWidget("apply",xmPushButtonWidgetClass
,form
,
1855 XmNlabelString
, s1
=XmStringCreateSimple("Apply"),
1857 XmNleftAttachment
, XmATTACH_POSITION
,
1858 XmNleftPosition
, 40,
1859 XmNrightAttachment
, XmATTACH_POSITION
,
1860 XmNrightPosition
, 60,
1861 XmNbottomAttachment
, XmATTACH_POSITION
,
1862 XmNbottomPosition
, 99, NULL
);
1863 XtAddCallback(applyBtn
, XmNactivateCallback
, hsApplyCB
, NULL
);
1866 dismissBtn
= XtVaCreateManagedWidget("dismiss",xmPushButtonWidgetClass
,form
,
1867 XmNlabelString
, s1
=XmStringCreateSimple("Dismiss"),
1868 XmNleftAttachment
, XmATTACH_POSITION
,
1869 XmNleftPosition
, 70,
1870 XmNrightAttachment
, XmATTACH_POSITION
,
1871 XmNrightPosition
, 90,
1872 XmNbottomAttachment
, XmATTACH_POSITION
,
1873 XmNbottomPosition
, 99, NULL
);
1874 XtAddCallback(dismissBtn
, XmNactivateCallback
, hsDismissCB
, NULL
);
1877 sep1
= XtVaCreateManagedWidget("sep1", xmSeparatorGadgetClass
, form
,
1878 XmNleftAttachment
, XmATTACH_FORM
,
1879 XmNtopAttachment
, XmATTACH_WIDGET
,
1880 XmNtopWidget
, fontBox
,
1881 XmNtopOffset
, HS_H_MARGIN
,
1882 XmNrightAttachment
, XmATTACH_FORM
,
1883 XmNbottomAttachment
, XmATTACH_WIDGET
,
1884 XmNbottomWidget
, dismissBtn
, 0,
1885 XmNbottomOffset
, HS_H_MARGIN
, NULL
);
1888 XtSetArg(args
[ac
], XmNtopAttachment
, XmATTACH_WIDGET
); ac
++;
1889 XtSetArg(args
[ac
], XmNtopOffset
, HS_H_MARGIN
); ac
++;
1890 XtSetArg(args
[ac
], XmNtopWidget
, topLbl
); ac
++;
1891 XtSetArg(args
[ac
], XmNleftAttachment
, XmATTACH_POSITION
); ac
++;
1892 XtSetArg(args
[ac
], XmNleftPosition
, HS_LEFT_MARGIN_POS
); ac
++;
1893 XtSetArg(args
[ac
], XmNrightAttachment
, XmATTACH_POSITION
); ac
++;
1894 XtSetArg(args
[ac
], XmNrightPosition
, HS_LIST_RIGHT
-1); ac
++;
1895 XtSetArg(args
[ac
], XmNbottomAttachment
, XmATTACH_WIDGET
); ac
++;
1896 XtSetArg(args
[ac
], XmNbottomWidget
, sep1
); ac
++;
1897 XtSetArg(args
[ac
], XmNbottomOffset
, HS_H_MARGIN
); ac
++;
1898 HSDialog
.managedListW
= CreateManagedList(form
, "list", args
, ac
,
1899 (void **)HSDialog
.highlightStyleList
, &HSDialog
.nHighlightStyles
,
1900 MAX_HIGHLIGHT_STYLES
, 20, hsGetDisplayedCB
, NULL
, hsSetDisplayedCB
,
1901 NULL
, hsFreeItemCB
);
1902 XtVaSetValues(topLbl
, XmNuserData
, HSDialog
.managedListW
, NULL
);
1904 /* Set initial default button */
1905 XtVaSetValues(form
, XmNdefaultButton
, okBtn
, NULL
);
1906 XtVaSetValues(form
, XmNcancelButton
, dismissBtn
, NULL
);
1908 /* If there's a suggestion for an initial selection, make it */
1909 if (initialStyle
!= NULL
)
1910 setStyleByName(initialStyle
);
1912 /* Handle mnemonic selection of buttons and focus to dialog */
1913 AddDialogMnemonicHandler(form
, FALSE
);
1915 /* Realize all of the widgets in the new dialog */
1916 RealizeWithoutForcingPosition(HSDialog
.shell
);
1919 static void hsDestroyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
1923 for (i
=0; i
<HSDialog
.nHighlightStyles
; i
++)
1924 freeHighlightStyleRec(HSDialog
.highlightStyleList
[i
]);
1925 XtFree((char *)HSDialog
.highlightStyleList
);
1928 static void hsOkCB(Widget w
, XtPointer clientData
, XtPointer callData
)
1930 if (!updateHSList())
1933 /* pop down and destroy the dialog */
1934 XtDestroyWidget(HSDialog
.shell
);
1935 HSDialog
.shell
= NULL
;
1938 static void hsApplyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
1943 static void hsDismissCB(Widget w
, XtPointer clientData
, XtPointer callData
)
1945 /* pop down and destroy the dialog */
1946 XtDestroyWidget(HSDialog
.shell
);
1947 HSDialog
.shell
= NULL
;
1950 static void *hsGetDisplayedCB(void *oldItem
, int explicitRequest
, int *abort
,
1953 highlightStyleRec
*hs
;
1955 /* If the dialog is currently displaying the "new" entry and the
1956 fields are empty, that's just fine */
1957 if (oldItem
== NULL
&& hsDialogEmpty())
1960 /* If there are no problems reading the data, just return it */
1961 hs
= readHSDialogFields(True
);
1965 /* If there are problems, and the user didn't ask for the fields to be
1966 read, give more warning */
1967 if (!explicitRequest
) {
1968 if (DialogF(DF_WARN
, HSDialog
.shell
, 2,
1969 "Discard incomplete entry\nfor current highlight style?",
1972 return oldItem
== NULL
? NULL
:
1973 (void *)copyHighlightStyleRec((highlightStyleRec
*)oldItem
);
1977 /* Do readHSDialogFields again without "silent" mode to display warning */
1978 hs
= readHSDialogFields(False
);
1983 static void hsSetDisplayedCB(void *item
, void *cbArg
)
1985 highlightStyleRec
*hs
= (highlightStyleRec
*)item
;
1988 XmTextSetString(HSDialog
.nameW
, "");
1989 XmTextSetString(HSDialog
.colorW
, "");
1990 XmTextSetString(HSDialog
.bgColorW
, "");
1991 XmToggleButtonSetState(HSDialog
.plainW
, True
, False
);
1992 XmToggleButtonSetState(HSDialog
.boldW
, False
, False
);
1993 XmToggleButtonSetState(HSDialog
.italicW
, False
, False
);
1994 XmToggleButtonSetState(HSDialog
.boldItalicW
, False
, False
);
1996 XmTextSetString(HSDialog
.nameW
, hs
->name
);
1997 XmTextSetString(HSDialog
.colorW
, hs
->color
);
1998 XmTextSetString(HSDialog
.bgColorW
, hs
->bgColor
? hs
->bgColor
: "");
1999 XmToggleButtonSetState(HSDialog
.plainW
, hs
->font
==PLAIN_FONT
, False
);
2000 XmToggleButtonSetState(HSDialog
.boldW
, hs
->font
==BOLD_FONT
, False
);
2001 XmToggleButtonSetState(HSDialog
.italicW
, hs
->font
==ITALIC_FONT
, False
);
2002 XmToggleButtonSetState(HSDialog
.boldItalicW
, hs
->font
==BOLD_ITALIC_FONT
,
2007 static void hsFreeItemCB(void *item
)
2009 freeHighlightStyleRec((highlightStyleRec
*)item
);
2012 static highlightStyleRec
*readHSDialogFields(int silent
)
2014 highlightStyleRec
*hs
;
2015 Display
*display
= XtDisplay(HSDialog
.shell
);
2016 int screenNum
= XScreenNumberOfScreen(XtScreen(HSDialog
.shell
));
2019 /* Allocate a language mode structure to return */
2020 hs
= (highlightStyleRec
*)XtMalloc(sizeof(highlightStyleRec
));
2022 /* read the name field */
2023 hs
->name
= ReadSymbolicFieldTextWidget(HSDialog
.nameW
,
2024 "highlight style name", silent
);
2025 if (hs
->name
== NULL
) {
2029 if (*hs
->name
== '\0') {
2031 DialogF(DF_WARN
, HSDialog
.shell
, 1,
2032 "Please specify a name\nfor the highlight style", "Dismiss");
2033 XmProcessTraversal(HSDialog
.nameW
, XmTRAVERSE_CURRENT
);
2040 /* read the color field */
2041 hs
->color
= ReadSymbolicFieldTextWidget(HSDialog
.colorW
, "color", silent
);
2042 if (hs
->color
== NULL
) {
2047 if (*hs
->color
== '\0') {
2049 DialogF(DF_WARN
, HSDialog
.shell
, 1,
2050 "Please specify a color\nfor the highlight style",
2052 XmProcessTraversal(HSDialog
.colorW
, XmTRAVERSE_CURRENT
);
2060 /* Verify that the color is a valid X color spec */
2061 if (!XParseColor(display
, DefaultColormap(display
, screenNum
),
2064 DialogF(DF_WARN
, HSDialog
.shell
, 1,
2065 "Invalid X color specification: %s\n", "Dismiss", hs
->color
);
2066 XmProcessTraversal(HSDialog
.colorW
, XmTRAVERSE_CURRENT
);
2074 /* read the background color field - this may be empty */
2075 hs
->bgColor
= ReadSymbolicFieldTextWidget(HSDialog
.bgColorW
,
2077 if (hs
->bgColor
&& *hs
->bgColor
== '\0') {
2078 XtFree(hs
->bgColor
);
2082 /* Verify that the background color (if present) is a valid X color spec */
2084 !XParseColor(display
, DefaultColormap(display
, screenNum
),
2085 hs
->bgColor
, &rgb
)) {
2087 DialogF(DF_WARN
, HSDialog
.shell
, 1,
2088 "Invalid X background color specification: %s\n",
2089 "Dismiss", hs
->bgColor
);
2090 XmProcessTraversal(HSDialog
.bgColorW
, XmTRAVERSE_CURRENT
);
2094 XtFree(hs
->bgColor
);
2099 /* read the font buttons */
2100 if (XmToggleButtonGetState(HSDialog
.boldW
))
2101 hs
->font
= BOLD_FONT
;
2102 else if (XmToggleButtonGetState(HSDialog
.italicW
))
2103 hs
->font
= ITALIC_FONT
;
2104 else if (XmToggleButtonGetState(HSDialog
.boldItalicW
))
2105 hs
->font
= BOLD_ITALIC_FONT
;
2107 hs
->font
= PLAIN_FONT
;
2113 ** Copy a highlightStyleRec data structure, and all of the allocated memory
2116 static highlightStyleRec
*copyHighlightStyleRec(highlightStyleRec
*hs
)
2118 highlightStyleRec
*newHS
;
2120 newHS
= (highlightStyleRec
*)XtMalloc(sizeof(highlightStyleRec
));
2121 newHS
->name
= XtMalloc(strlen(hs
->name
)+1);
2122 strcpy(newHS
->name
, hs
->name
);
2123 if (hs
->color
== NULL
)
2124 newHS
->color
= NULL
;
2126 newHS
->color
= XtMalloc(strlen(hs
->color
)+1);
2127 strcpy(newHS
->color
, hs
->color
);
2129 if (hs
->bgColor
== NULL
)
2130 newHS
->bgColor
= NULL
;
2132 newHS
->bgColor
= XtMalloc(strlen(hs
->bgColor
)+1);
2133 strcpy(newHS
->bgColor
, hs
->bgColor
);
2135 newHS
->font
= hs
->font
;
2140 ** Free all of the allocated data in a highlightStyleRec, including the
2141 ** structure itself.
2143 static void freeHighlightStyleRec(highlightStyleRec
*hs
)
2146 if (hs
->color
!= NULL
)
2152 ** Select a particular style in the highlight styles dialog
2154 static void setStyleByName(const char *style
)
2158 for (i
=0; i
<HSDialog
.nHighlightStyles
; i
++) {
2159 if (!strcmp(HSDialog
.highlightStyleList
[i
]->name
, style
)) {
2160 SelectManagedListItem(HSDialog
.managedListW
, i
);
2167 ** Return True if the fields of the highlight styles dialog are consistent
2168 ** with a blank "New" style in the dialog.
2170 static int hsDialogEmpty(void)
2172 return TextWidgetIsBlank(HSDialog
.nameW
) &&
2173 TextWidgetIsBlank(HSDialog
.colorW
) &&
2174 XmToggleButtonGetState(HSDialog
.plainW
);
2178 ** Apply the changes made in the highlight styles dialog to the stored
2179 ** highlight style information in HighlightStyles
2181 static int updateHSList(void)
2186 /* Get the current contents of the dialog fields */
2187 if (!UpdateManagedList(HSDialog
.managedListW
, True
))
2190 /* Replace the old highlight styles list with the new one from the dialog */
2191 for (i
=0; i
<NHighlightStyles
; i
++)
2192 freeHighlightStyleRec(HighlightStyles
[i
]);
2193 for (i
=0; i
<HSDialog
.nHighlightStyles
; i
++)
2194 HighlightStyles
[i
] =
2195 copyHighlightStyleRec(HSDialog
.highlightStyleList
[i
]);
2196 NHighlightStyles
= HSDialog
.nHighlightStyles
;
2198 /* If a syntax highlighting dialog is up, update its menu */
2199 updateHighlightStyleMenu();
2201 /* Redisplay highlighted windows which use changed style(s) */
2202 for (window
=WindowList
; window
!=NULL
; window
=window
->next
)
2203 UpdateHighlightStyles(window
);
2205 /* Note that preferences have been changed */
2212 ** Present a dialog for editing highlight pattern information
2214 void EditHighlightPatterns(WindowInfo
*window
)
2217 #define LIST_RIGHT 41
2218 Widget form
, lmOptMenu
, patternsForm
, patternsFrame
, patternsLbl
;
2219 Widget lmForm
, contextFrame
, contextForm
, styleLbl
, styleBtn
;
2220 Widget okBtn
, applyBtn
, checkBtn
, deleteBtn
, dismissBtn
, helpBtn
;
2221 Widget restoreBtn
, nameLbl
, typeLbl
, typeBox
, lmBtn
, matchBox
;
2224 int i
, n
, nPatterns
;
2227 /* if the dialog is already displayed, just pop it to the top and return */
2228 if (HighlightDialog
.shell
!= NULL
) {
2229 RaiseShellWindow(HighlightDialog
.shell
);
2233 if (LanguageModeName(0) == NULL
) {
2234 DialogF(DF_WARN
, window
->shell
, 1, "No Language Modes available \
2235 for syntax highlighting\nAdd language modes under Preferenses->Language Modes",
2240 /* Decide on an initial language mode */
2241 HighlightDialog
.langModeName
= XtNewString(
2242 LanguageModeName(window
->languageMode
== PLAIN_LANGUAGE_MODE
? 0 :
2243 window
->languageMode
));
2245 /* Find the associated pattern set (patSet) to edit */
2246 patSet
= FindPatternSet(HighlightDialog
.langModeName
);
2248 /* Copy the list of patterns to one that the user can freely edit */
2249 HighlightDialog
.patterns
= (highlightPattern
**)XtMalloc(
2250 sizeof(highlightPattern
*) * MAX_PATTERNS
);
2251 nPatterns
= patSet
== NULL
? 0 : patSet
->nPatterns
;
2252 for (i
=0; i
<nPatterns
; i
++)
2253 HighlightDialog
.patterns
[i
] = copyPatternSrc(&patSet
->patterns
[i
],NULL
);
2254 HighlightDialog
.nPatterns
= nPatterns
;
2257 /* Create a form widget in an application shell */
2259 XtSetArg(args
[n
], XmNdeleteResponse
, XmDO_NOTHING
); n
++;
2260 XtSetArg(args
[n
], XmNiconName
, "Highlight Patterns"); n
++;
2261 XtSetArg(args
[n
], XmNtitle
, "Syntax Highlighting Patterns"); n
++;
2262 HighlightDialog
.shell
= CreateShellWithBestVis(APP_NAME
, APP_CLASS
,
2263 applicationShellWidgetClass
, TheDisplay
, args
, n
);
2264 AddSmallIcon(HighlightDialog
.shell
);
2265 form
= XtVaCreateManagedWidget("editHighlightPatterns", xmFormWidgetClass
,
2266 HighlightDialog
.shell
, XmNautoUnmanage
, False
,
2267 XmNresizePolicy
, XmRESIZE_NONE
, NULL
);
2268 XtAddCallback(form
, XmNdestroyCallback
, destroyCB
, NULL
);
2269 AddMotifCloseCallback(HighlightDialog
.shell
, dismissCB
, NULL
);
2271 lmForm
= XtVaCreateManagedWidget("lmForm", xmFormWidgetClass
,
2273 XmNleftAttachment
, XmATTACH_POSITION
,
2275 XmNtopAttachment
, XmATTACH_POSITION
,
2277 XmNrightAttachment
, XmATTACH_POSITION
,
2278 XmNrightPosition
, 99, NULL
);
2280 HighlightDialog
.lmPulldown
= CreateLanguageModeMenu(lmForm
, langModeCB
,
2283 XtSetArg(args
[n
], XmNspacing
, 0); n
++;
2284 XtSetArg(args
[n
], XmNmarginWidth
, 0); n
++;
2285 XtSetArg(args
[n
], XmNtopAttachment
, XmATTACH_FORM
); n
++;
2286 XtSetArg(args
[n
], XmNleftAttachment
, XmATTACH_POSITION
); n
++;
2287 XtSetArg(args
[n
], XmNleftPosition
, 50); n
++;
2288 XtSetArg(args
[n
], XmNsubMenuId
, HighlightDialog
.lmPulldown
); n
++;
2289 lmOptMenu
= XmCreateOptionMenu(lmForm
, "langModeOptMenu", args
, n
);
2290 XtManageChild(lmOptMenu
);
2291 HighlightDialog
.lmOptMenu
= lmOptMenu
;
2293 XtVaCreateManagedWidget("lmLbl", xmLabelGadgetClass
, lmForm
,
2294 XmNlabelString
, s1
=XmStringCreateSimple("Language Mode:"),
2296 XmNuserData
, XtParent(HighlightDialog
.lmOptMenu
),
2297 XmNalignment
, XmALIGNMENT_END
,
2298 XmNrightAttachment
, XmATTACH_POSITION
,
2299 XmNrightPosition
, 50,
2300 XmNtopAttachment
, XmATTACH_FORM
,
2301 XmNbottomAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2302 XmNbottomWidget
, lmOptMenu
, NULL
);
2305 lmBtn
= XtVaCreateManagedWidget("lmBtn", xmPushButtonWidgetClass
, lmForm
,
2306 XmNlabelString
, s1
=MKSTRING("Add / Modify\nLanguage Mode..."),
2308 XmNrightAttachment
, XmATTACH_FORM
,
2309 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
2310 XtAddCallback(lmBtn
, XmNactivateCallback
, lmDialogCB
, NULL
);
2313 okBtn
= XtVaCreateManagedWidget("ok", xmPushButtonWidgetClass
, form
,
2314 XmNlabelString
, s1
=XmStringCreateSimple("OK"),
2315 XmNleftAttachment
, XmATTACH_POSITION
,
2317 XmNrightAttachment
, XmATTACH_POSITION
,
2318 XmNrightPosition
, 13,
2319 XmNbottomAttachment
, XmATTACH_FORM
,
2320 XmNbottomOffset
, BORDER
, NULL
);
2321 XtAddCallback(okBtn
, XmNactivateCallback
, okCB
, NULL
);
2324 applyBtn
= XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass
, form
,
2325 XmNlabelString
, s1
=XmStringCreateSimple("Apply"),
2327 XmNleftAttachment
, XmATTACH_POSITION
,
2328 XmNleftPosition
, 13,
2329 XmNrightAttachment
, XmATTACH_POSITION
,
2330 XmNrightPosition
, 26,
2331 XmNbottomAttachment
, XmATTACH_FORM
,
2332 XmNbottomOffset
, BORDER
, NULL
);
2333 XtAddCallback(applyBtn
, XmNactivateCallback
, applyCB
, NULL
);
2336 checkBtn
= XtVaCreateManagedWidget("check", xmPushButtonWidgetClass
, form
,
2337 XmNlabelString
, s1
=XmStringCreateSimple("Check"),
2339 XmNleftAttachment
, XmATTACH_POSITION
,
2340 XmNleftPosition
, 26,
2341 XmNrightAttachment
, XmATTACH_POSITION
,
2342 XmNrightPosition
, 39,
2343 XmNbottomAttachment
, XmATTACH_FORM
,
2344 XmNbottomOffset
, BORDER
, NULL
);
2345 XtAddCallback(checkBtn
, XmNactivateCallback
, checkCB
, NULL
);
2348 deleteBtn
= XtVaCreateManagedWidget("delete", xmPushButtonWidgetClass
, form
,
2349 XmNlabelString
, s1
=XmStringCreateSimple("Delete"),
2351 XmNleftAttachment
, XmATTACH_POSITION
,
2352 XmNleftPosition
, 39,
2353 XmNrightAttachment
, XmATTACH_POSITION
,
2354 XmNrightPosition
, 52,
2355 XmNbottomAttachment
, XmATTACH_FORM
,
2356 XmNbottomOffset
, BORDER
, NULL
);
2357 XtAddCallback(deleteBtn
, XmNactivateCallback
, deleteCB
, NULL
);
2360 restoreBtn
= XtVaCreateManagedWidget("restore", xmPushButtonWidgetClass
, form
,
2361 XmNlabelString
, s1
=XmStringCreateSimple("Restore Defaults"),
2363 XmNleftAttachment
, XmATTACH_POSITION
,
2364 XmNleftPosition
, 52,
2365 XmNrightAttachment
, XmATTACH_POSITION
,
2366 XmNrightPosition
, 73,
2367 XmNbottomAttachment
, XmATTACH_FORM
,
2368 XmNbottomOffset
, BORDER
, NULL
);
2369 XtAddCallback(restoreBtn
, XmNactivateCallback
, restoreCB
, NULL
);
2372 dismissBtn
= XtVaCreateManagedWidget("dismiss", xmPushButtonWidgetClass
,
2374 XmNlabelString
, s1
=XmStringCreateSimple("Dismiss"),
2375 XmNleftAttachment
, XmATTACH_POSITION
,
2376 XmNleftPosition
, 73,
2377 XmNrightAttachment
, XmATTACH_POSITION
,
2378 XmNrightPosition
, 86,
2379 XmNbottomAttachment
, XmATTACH_FORM
,
2380 XmNbottomOffset
, BORDER
, NULL
);
2381 XtAddCallback(dismissBtn
, XmNactivateCallback
, dismissCB
, NULL
);
2384 helpBtn
= XtVaCreateManagedWidget("help", xmPushButtonWidgetClass
,
2386 XmNlabelString
, s1
=XmStringCreateSimple("Help"),
2388 XmNleftAttachment
, XmATTACH_POSITION
,
2389 XmNleftPosition
, 86,
2390 XmNrightAttachment
, XmATTACH_POSITION
,
2391 XmNrightPosition
, 99,
2392 XmNbottomAttachment
, XmATTACH_FORM
,
2393 XmNbottomOffset
, BORDER
, NULL
);
2394 XtAddCallback(helpBtn
, XmNactivateCallback
, helpCB
, NULL
);
2397 contextFrame
= XtVaCreateManagedWidget("contextFrame", xmFrameWidgetClass
,
2399 XmNleftAttachment
, XmATTACH_POSITION
,
2401 XmNrightAttachment
, XmATTACH_POSITION
,
2402 XmNrightPosition
, 99,
2403 XmNbottomAttachment
, XmATTACH_WIDGET
,
2404 XmNbottomWidget
, okBtn
,
2405 XmNbottomOffset
, BORDER
, NULL
);
2406 contextForm
= XtVaCreateManagedWidget("contextForm", xmFormWidgetClass
,
2407 contextFrame
, NULL
);
2408 XtVaCreateManagedWidget("contextLbl", xmLabelGadgetClass
, contextFrame
,
2409 XmNlabelString
, s1
=XmStringCreateSimple(
2410 "Context requirements for incremental re-parsing after changes"),
2411 XmNchildType
, XmFRAME_TITLE_CHILD
, NULL
);
2414 HighlightDialog
.lineContextW
= XtVaCreateManagedWidget("lineContext",
2415 xmTextWidgetClass
, contextForm
,
2418 XmNleftAttachment
, XmATTACH_POSITION
,
2419 XmNleftPosition
, 15,
2420 XmNrightAttachment
, XmATTACH_POSITION
,
2421 XmNrightPosition
, 25, NULL
);
2422 RemapDeleteKey(HighlightDialog
.lineContextW
);
2424 XtVaCreateManagedWidget("lineContLbl",
2425 xmLabelGadgetClass
, contextForm
,
2426 XmNlabelString
, s1
=XmStringCreateSimple("lines"),
2428 XmNuserData
, HighlightDialog
.lineContextW
,
2429 XmNalignment
, XmALIGNMENT_BEGINNING
,
2430 XmNleftAttachment
, XmATTACH_WIDGET
,
2431 XmNleftWidget
, HighlightDialog
.lineContextW
,
2432 XmNtopAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2433 XmNtopWidget
, HighlightDialog
.lineContextW
,
2434 XmNbottomAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2435 XmNbottomWidget
, HighlightDialog
.lineContextW
, NULL
);
2438 HighlightDialog
.charContextW
= XtVaCreateManagedWidget("charContext",
2439 xmTextWidgetClass
, contextForm
,
2442 XmNleftAttachment
, XmATTACH_POSITION
,
2443 XmNleftPosition
, 58,
2444 XmNrightAttachment
, XmATTACH_POSITION
,
2445 XmNrightPosition
, 68, NULL
);
2446 RemapDeleteKey(HighlightDialog
.lineContextW
);
2448 XtVaCreateManagedWidget("charContLbl",
2449 xmLabelGadgetClass
, contextForm
,
2450 XmNlabelString
, s1
=XmStringCreateSimple("characters"),
2452 XmNuserData
, HighlightDialog
.charContextW
,
2453 XmNalignment
, XmALIGNMENT_BEGINNING
,
2454 XmNleftAttachment
, XmATTACH_WIDGET
,
2455 XmNleftWidget
, HighlightDialog
.charContextW
,
2456 XmNtopAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2457 XmNtopWidget
, HighlightDialog
.charContextW
,
2458 XmNbottomAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2459 XmNbottomWidget
, HighlightDialog
.charContextW
, NULL
);
2462 patternsFrame
= XtVaCreateManagedWidget("patternsFrame", xmFrameWidgetClass
,
2464 XmNleftAttachment
, XmATTACH_POSITION
,
2466 XmNtopAttachment
, XmATTACH_WIDGET
,
2467 XmNtopWidget
, lmForm
,
2468 XmNrightAttachment
, XmATTACH_POSITION
,
2469 XmNrightPosition
, 99,
2470 XmNbottomAttachment
, XmATTACH_WIDGET
,
2471 XmNbottomWidget
, contextFrame
,
2472 XmNbottomOffset
, BORDER
, NULL
);
2473 patternsForm
= XtVaCreateManagedWidget("patternsForm", xmFormWidgetClass
,
2474 patternsFrame
, NULL
);
2475 patternsLbl
= XtVaCreateManagedWidget("patternsLbl", xmLabelGadgetClass
,
2477 XmNlabelString
, s1
=XmStringCreateSimple("Patterns"),
2480 XmNchildType
, XmFRAME_TITLE_CHILD
, NULL
);
2483 typeLbl
= XtVaCreateManagedWidget("typeLbl", xmLabelGadgetClass
,
2485 XmNlabelString
, s1
=XmStringCreateSimple("Pattern Type:"),
2487 XmNalignment
, XmALIGNMENT_BEGINNING
,
2488 XmNleftAttachment
, XmATTACH_POSITION
,
2489 XmNleftPosition
, LIST_RIGHT
,
2490 XmNtopAttachment
, XmATTACH_FORM
, NULL
);
2493 typeBox
= XtVaCreateManagedWidget("typeBox", xmRowColumnWidgetClass
,
2495 XmNpacking
, XmPACK_COLUMN
,
2496 XmNradioBehavior
, True
,
2497 XmNleftAttachment
, XmATTACH_POSITION
,
2498 XmNleftPosition
, LIST_RIGHT
,
2499 XmNtopAttachment
, XmATTACH_WIDGET
,
2500 XmNtopWidget
, typeLbl
, NULL
);
2501 HighlightDialog
.topLevelW
= XtVaCreateManagedWidget("top",
2502 xmToggleButtonWidgetClass
, typeBox
,
2505 XmNlabelString
, s1
=XmStringCreateSimple(
2506 "Pass-1 (applied to all text when loaded or modified)"),
2507 XmNmnemonic
, '1', NULL
);
2509 XtAddCallback(HighlightDialog
.topLevelW
, XmNvalueChangedCallback
,
2511 HighlightDialog
.deferredW
= XtVaCreateManagedWidget("deferred",
2512 xmToggleButtonWidgetClass
, typeBox
,
2514 XmNlabelString
, s1
=XmStringCreateSimple(
2515 "Pass-2 (parsing is deferred until text is exposed)"),
2516 XmNmnemonic
, '2', NULL
);
2518 XtAddCallback(HighlightDialog
.deferredW
, XmNvalueChangedCallback
,
2520 HighlightDialog
.subPatW
= XtVaCreateManagedWidget("subPat",
2521 xmToggleButtonWidgetClass
, typeBox
,
2523 XmNlabelString
, s1
=XmStringCreateSimple(
2524 "Sub-pattern (processed within start & end of parent)"),
2525 XmNmnemonic
, 'u', NULL
);
2527 XtAddCallback(HighlightDialog
.subPatW
, XmNvalueChangedCallback
,
2529 HighlightDialog
.colorPatW
= XtVaCreateManagedWidget("color",
2530 xmToggleButtonWidgetClass
, typeBox
,
2532 XmNlabelString
, s1
=XmStringCreateSimple(
2533 "Coloring for sub-expressions of parent pattern"),
2534 XmNmnemonic
, 'g', NULL
);
2536 XtAddCallback(HighlightDialog
.colorPatW
, XmNvalueChangedCallback
,
2539 HighlightDialog
.matchLbl
= XtVaCreateManagedWidget("matchLbl",
2540 xmLabelGadgetClass
, patternsForm
,
2541 XmNlabelString
, s1
=XmStringCreateSimple("Matching:"),
2543 XmNalignment
, XmALIGNMENT_BEGINNING
,
2544 XmNleftAttachment
, XmATTACH_POSITION
,
2545 XmNleftPosition
, LIST_RIGHT
,
2546 XmNtopAttachment
, XmATTACH_WIDGET
,
2547 XmNtopOffset
, BORDER
,
2548 XmNtopWidget
, typeBox
, NULL
);
2551 matchBox
= XtVaCreateManagedWidget("matchBox", xmRowColumnWidgetClass
,
2553 XmNpacking
, XmPACK_COLUMN
,
2554 XmNradioBehavior
, True
,
2555 XmNleftAttachment
, XmATTACH_POSITION
,
2556 XmNleftPosition
, LIST_RIGHT
,
2557 XmNtopAttachment
, XmATTACH_WIDGET
,
2558 XmNtopWidget
, HighlightDialog
.matchLbl
, NULL
);
2559 HighlightDialog
.simpleW
= XtVaCreateManagedWidget("simple",
2560 xmToggleButtonWidgetClass
, matchBox
,
2563 XmNlabelString
, s1
=XmStringCreateSimple(
2564 "Highlight text matching regular expression"),
2565 XmNmnemonic
, 'x', NULL
);
2567 XtAddCallback(HighlightDialog
.simpleW
, XmNvalueChangedCallback
,
2569 HighlightDialog
.rangeW
= XtVaCreateManagedWidget("range",
2570 xmToggleButtonWidgetClass
, matchBox
,
2572 XmNlabelString
, s1
=XmStringCreateSimple(
2573 "Highlight text between starting and ending REs"),
2574 XmNmnemonic
, 'b', NULL
);
2576 XtAddCallback(HighlightDialog
.rangeW
, XmNvalueChangedCallback
,
2579 nameLbl
= XtVaCreateManagedWidget("nameLbl", xmLabelGadgetClass
,
2581 XmNlabelString
, s1
=XmStringCreateSimple("Pattern Name"),
2584 XmNalignment
, XmALIGNMENT_BEGINNING
,
2585 XmNleftAttachment
, XmATTACH_POSITION
,
2586 XmNleftPosition
, LIST_RIGHT
,
2587 XmNtopAttachment
, XmATTACH_WIDGET
,
2588 XmNtopWidget
, matchBox
,
2589 XmNtopOffset
, BORDER
, NULL
);
2592 HighlightDialog
.nameW
= XtVaCreateManagedWidget("name", xmTextWidgetClass
,
2594 XmNleftAttachment
, XmATTACH_POSITION
,
2595 XmNleftPosition
, LIST_RIGHT
,
2596 XmNtopAttachment
, XmATTACH_WIDGET
,
2597 XmNtopWidget
, nameLbl
,
2598 XmNrightAttachment
, XmATTACH_POSITION
,
2599 XmNrightPosition
, (99 + LIST_RIGHT
)/2, NULL
);
2600 RemapDeleteKey(HighlightDialog
.nameW
);
2601 XtVaSetValues(nameLbl
, XmNuserData
, HighlightDialog
.nameW
, NULL
);
2603 HighlightDialog
.parentLbl
= XtVaCreateManagedWidget("parentLbl",
2604 xmLabelGadgetClass
, patternsForm
,
2605 XmNlabelString
, s1
=XmStringCreateSimple("Parent Pattern"),
2608 XmNalignment
, XmALIGNMENT_BEGINNING
,
2609 XmNleftAttachment
, XmATTACH_POSITION
,
2610 XmNleftPosition
, (99 + LIST_RIGHT
)/2 + 1,
2611 XmNtopAttachment
, XmATTACH_WIDGET
,
2612 XmNtopWidget
, matchBox
,
2613 XmNtopOffset
, BORDER
, NULL
);
2616 HighlightDialog
.parentW
= XtVaCreateManagedWidget("parent",
2617 xmTextWidgetClass
, patternsForm
,
2618 XmNleftAttachment
, XmATTACH_POSITION
,
2619 XmNleftPosition
, (99 + LIST_RIGHT
)/2 + 1,
2620 XmNtopAttachment
, XmATTACH_WIDGET
,
2621 XmNtopWidget
, HighlightDialog
.parentLbl
,
2622 XmNrightAttachment
, XmATTACH_POSITION
,
2623 XmNrightPosition
, 99, NULL
);
2624 RemapDeleteKey(HighlightDialog
.parentW
);
2625 XtVaSetValues(HighlightDialog
.parentLbl
, XmNuserData
,
2626 HighlightDialog
.parentW
, NULL
);
2628 HighlightDialog
.startLbl
= XtVaCreateManagedWidget("startLbl",
2629 xmLabelGadgetClass
, patternsForm
,
2630 XmNalignment
, XmALIGNMENT_BEGINNING
,
2632 XmNtopAttachment
, XmATTACH_WIDGET
,
2633 XmNtopWidget
, HighlightDialog
.parentW
,
2634 XmNtopOffset
, BORDER
,
2635 XmNleftAttachment
, XmATTACH_POSITION
,
2636 XmNleftPosition
, 1, NULL
);
2638 HighlightDialog
.errorW
= XtVaCreateManagedWidget("error",
2639 xmTextWidgetClass
, patternsForm
,
2640 XmNleftAttachment
, XmATTACH_POSITION
,
2642 XmNrightAttachment
, XmATTACH_POSITION
,
2643 XmNrightPosition
, 99,
2644 XmNbottomAttachment
, XmATTACH_POSITION
,
2645 XmNbottomPosition
, 99, NULL
);
2646 RemapDeleteKey(HighlightDialog
.errorW
);
2648 HighlightDialog
.errorLbl
= XtVaCreateManagedWidget("errorLbl",
2649 xmLabelGadgetClass
, patternsForm
,
2650 XmNlabelString
, s1
=XmStringCreateSimple(
2651 "Regular Expression Indicating Error in Match (Optional)"),
2653 XmNuserData
, HighlightDialog
.errorW
,
2654 XmNalignment
, XmALIGNMENT_BEGINNING
,
2655 XmNleftAttachment
, XmATTACH_POSITION
,
2657 XmNbottomAttachment
, XmATTACH_WIDGET
,
2658 XmNbottomWidget
, HighlightDialog
.errorW
, NULL
);
2661 HighlightDialog
.endW
= XtVaCreateManagedWidget("end",
2662 xmTextWidgetClass
, patternsForm
,
2663 XmNleftAttachment
, XmATTACH_POSITION
,
2665 XmNbottomAttachment
, XmATTACH_WIDGET
,
2666 XmNbottomWidget
, HighlightDialog
.errorLbl
,
2667 XmNbottomOffset
, BORDER
,
2668 XmNrightAttachment
, XmATTACH_POSITION
,
2669 XmNrightPosition
, 99, NULL
);
2670 RemapDeleteKey(HighlightDialog
.endW
);
2672 HighlightDialog
.endLbl
= XtVaCreateManagedWidget("endLbl",
2673 xmLabelGadgetClass
, patternsForm
,
2675 XmNuserData
, HighlightDialog
.endW
,
2676 XmNalignment
, XmALIGNMENT_BEGINNING
,
2677 XmNleftAttachment
, XmATTACH_POSITION
,
2679 XmNbottomAttachment
, XmATTACH_WIDGET
,
2680 XmNbottomWidget
, HighlightDialog
.endW
, NULL
);
2683 XtSetArg(args
[n
], XmNeditMode
, XmMULTI_LINE_EDIT
); n
++;
2684 XtSetArg(args
[n
], XmNscrollHorizontal
, False
); n
++;
2685 XtSetArg(args
[n
], XmNwordWrap
, True
); n
++;
2686 XtSetArg(args
[n
], XmNrows
, 3); n
++;
2687 XtSetArg(args
[n
], XmNbottomAttachment
, XmATTACH_WIDGET
); n
++;
2688 XtSetArg(args
[n
], XmNbottomWidget
, HighlightDialog
.endLbl
); n
++;
2689 XtSetArg(args
[n
], XmNbottomOffset
, BORDER
); n
++;
2690 XtSetArg(args
[n
], XmNtopAttachment
, XmATTACH_WIDGET
); n
++;
2691 XtSetArg(args
[n
], XmNtopWidget
, HighlightDialog
.startLbl
); n
++;
2692 XtSetArg(args
[n
], XmNleftAttachment
, XmATTACH_POSITION
); n
++;
2693 XtSetArg(args
[n
], XmNleftPosition
, 1); n
++;
2694 XtSetArg(args
[n
], XmNrightAttachment
, XmATTACH_POSITION
); n
++;
2695 XtSetArg(args
[n
], XmNrightPosition
, 99); n
++;
2696 HighlightDialog
.startW
= XmCreateScrolledText(patternsForm
, "start",args
,n
);
2697 XtManageChild(HighlightDialog
.startW
);
2698 MakeSingleLineTextW(HighlightDialog
.startW
);
2699 RemapDeleteKey(HighlightDialog
.startW
);
2700 XtVaSetValues(HighlightDialog
.startLbl
,
2701 XmNuserData
,HighlightDialog
.startW
, NULL
);
2703 styleBtn
= XtVaCreateManagedWidget("styleLbl", xmPushButtonWidgetClass
,
2705 XmNlabelString
, s1
=MKSTRING("Add / Modify\nStyle..."),
2707 XmNrightAttachment
, XmATTACH_POSITION
,
2708 XmNrightPosition
, LIST_RIGHT
-1,
2709 XmNbottomAttachment
, XmATTACH_OPPOSITE_WIDGET
,
2710 XmNbottomWidget
, HighlightDialog
.parentW
, NULL
);
2712 XtAddCallback(styleBtn
, XmNactivateCallback
, styleDialogCB
, NULL
);
2714 HighlightDialog
.stylePulldown
= createHighlightStylesMenu(patternsForm
);
2716 XtSetArg(args
[n
], XmNspacing
, 0); n
++;
2717 XtSetArg(args
[n
], XmNmarginWidth
, 0); n
++;
2718 XtSetArg(args
[n
], XmNbottomAttachment
, XmATTACH_OPPOSITE_WIDGET
); n
++;
2719 XtSetArg(args
[n
], XmNbottomWidget
, HighlightDialog
.parentW
); n
++;
2720 XtSetArg(args
[n
], XmNleftAttachment
, XmATTACH_POSITION
); n
++;
2721 XtSetArg(args
[n
], XmNleftPosition
, 1); n
++;
2722 XtSetArg(args
[n
], XmNrightAttachment
, XmATTACH_WIDGET
); n
++;
2723 XtSetArg(args
[n
], XmNrightWidget
, styleBtn
); n
++;
2724 XtSetArg(args
[n
], XmNsubMenuId
, HighlightDialog
.stylePulldown
); n
++;
2725 HighlightDialog
.styleOptMenu
= XmCreateOptionMenu(patternsForm
,
2726 "styleOptMenu", args
, n
);
2727 XtManageChild(HighlightDialog
.styleOptMenu
);
2729 styleLbl
= XtVaCreateManagedWidget("styleLbl", xmLabelGadgetClass
,
2731 XmNlabelString
, s1
=XmStringCreateSimple("Highlight Style"),
2733 XmNuserData
, XtParent(HighlightDialog
.styleOptMenu
),
2734 XmNalignment
, XmALIGNMENT_BEGINNING
,
2735 XmNleftAttachment
, XmATTACH_POSITION
,
2737 XmNbottomAttachment
, XmATTACH_WIDGET
,
2738 XmNbottomWidget
, HighlightDialog
.styleOptMenu
, NULL
);
2742 XtSetArg(args
[n
], XmNtopAttachment
, XmATTACH_FORM
); n
++;
2743 XtSetArg(args
[n
], XmNleftAttachment
, XmATTACH_POSITION
); n
++;
2744 XtSetArg(args
[n
], XmNleftPosition
, 1); n
++;
2745 XtSetArg(args
[n
], XmNrightAttachment
, XmATTACH_POSITION
); n
++;
2746 XtSetArg(args
[n
], XmNrightPosition
, LIST_RIGHT
-1); n
++;
2747 XtSetArg(args
[n
], XmNbottomAttachment
, XmATTACH_WIDGET
); n
++;
2748 XtSetArg(args
[n
], XmNbottomWidget
, styleLbl
); n
++;
2749 XtSetArg(args
[n
], XmNbottomOffset
, BORDER
); n
++;
2750 HighlightDialog
.managedListW
= CreateManagedList(patternsForm
, "list", args
,
2751 n
, (void **)HighlightDialog
.patterns
, &HighlightDialog
.nPatterns
,
2752 MAX_PATTERNS
, 18, getDisplayedCB
, NULL
, setDisplayedCB
,
2754 XtVaSetValues(patternsLbl
, XmNuserData
, HighlightDialog
.managedListW
, NULL
);
2756 /* Set initial default button */
2757 XtVaSetValues(form
, XmNdefaultButton
, okBtn
, NULL
);
2758 XtVaSetValues(form
, XmNcancelButton
, dismissBtn
, NULL
);
2760 /* Handle mnemonic selection of buttons and focus to dialog */
2761 AddDialogMnemonicHandler(form
, FALSE
);
2763 /* Fill in the dialog information for the selected language mode */
2764 SetIntText(HighlightDialog
.lineContextW
, patSet
==NULL
? 1 :
2765 patSet
->lineContext
);
2766 SetIntText(HighlightDialog
.charContextW
, patSet
==NULL
? 0 :
2767 patSet
->charContext
);
2768 SetLangModeMenu(HighlightDialog
.lmOptMenu
, HighlightDialog
.langModeName
);
2771 /* Realize all of the widgets in the new dialog */
2772 RealizeWithoutForcingPosition(HighlightDialog
.shell
);
2776 ** If a syntax highlighting dialog is up, ask to have the option menu for
2777 ** chosing highlight styles updated (via a call to createHighlightStylesMenu)
2779 static void updateHighlightStyleMenu(void)
2784 if (HighlightDialog
.shell
== NULL
)
2787 oldMenu
= HighlightDialog
.stylePulldown
;
2788 HighlightDialog
.stylePulldown
= createHighlightStylesMenu(
2789 XtParent(XtParent(oldMenu
)));
2790 XtVaSetValues(XmOptionButtonGadget(HighlightDialog
.styleOptMenu
),
2791 XmNsubMenuId
, HighlightDialog
.stylePulldown
, NULL
);
2792 patIndex
= ManagedListSelectedIndex(HighlightDialog
.managedListW
);
2794 setStyleMenu("Plain");
2796 setStyleMenu(HighlightDialog
.patterns
[patIndex
]->style
);
2798 XtDestroyWidget(oldMenu
);
2802 ** If a syntax highlighting dialog is up, ask to have the option menu for
2803 ** chosing language mode updated (via a call to CreateLanguageModeMenu)
2805 void UpdateLanguageModeMenu(void)
2809 if (HighlightDialog
.shell
== NULL
)
2812 oldMenu
= HighlightDialog
.lmPulldown
;
2813 HighlightDialog
.lmPulldown
= CreateLanguageModeMenu(
2814 XtParent(XtParent(oldMenu
)), langModeCB
, NULL
);
2815 XtVaSetValues(XmOptionButtonGadget(HighlightDialog
.lmOptMenu
),
2816 XmNsubMenuId
, HighlightDialog
.lmPulldown
, NULL
);
2817 SetLangModeMenu(HighlightDialog
.lmOptMenu
, HighlightDialog
.langModeName
);
2819 XtDestroyWidget(oldMenu
);
2822 static void destroyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2826 freeNonNull(HighlightDialog
.langModeName
);
2827 for (i
=0; i
<HighlightDialog
.nPatterns
; i
++)
2828 freePatternSrc(HighlightDialog
.patterns
[i
], True
);
2829 HighlightDialog
.shell
= NULL
;
2832 static void langModeCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2835 patternSet
*oldPatSet
, *newPatSet
;
2836 patternSet emptyPatSet
= {NULL
, 1, 0, 0, NULL
};
2839 /* Get the newly selected mode name. If it's the same, do nothing */
2840 XtVaGetValues(w
, XmNuserData
, &modeName
, NULL
);
2841 if (!strcmp(modeName
, HighlightDialog
.langModeName
))
2844 /* Look up the original version of the patterns being edited */
2845 oldPatSet
= FindPatternSet(HighlightDialog
.langModeName
);
2846 if (oldPatSet
== NULL
)
2847 oldPatSet
= &emptyPatSet
;
2849 /* Get the current information displayed by the dialog. If it's bad,
2850 give the user the chance to throw it out or go back and fix it. If
2851 it has changed, give the user the chance to apply discard or cancel. */
2852 newPatSet
= getDialogPatternSet();
2853 if (newPatSet
== NULL
) {
2854 if (DialogF(DF_WARN
, HighlightDialog
.shell
, 2,
2855 "Discard incomplete entry\nfor current language mode?",
2856 "Keep", "Discard") == 1) {
2857 SetLangModeMenu(HighlightDialog
.lmOptMenu
,
2858 HighlightDialog
.langModeName
);
2861 } else if (patternSetsDiffer(oldPatSet
, newPatSet
)) {
2862 resp
= DialogF(DF_WARN
, HighlightDialog
.shell
, 3,
2863 "Apply changes for language mode %s?", "Apply Changes",
2864 "Discard Changes", "Cancel", HighlightDialog
.langModeName
);
2866 SetLangModeMenu(HighlightDialog
.lmOptMenu
,
2867 HighlightDialog
.langModeName
);
2873 if (newPatSet
!= NULL
)
2874 freePatternSet(newPatSet
);
2876 /* Free the old dialog information */
2877 freeNonNull(HighlightDialog
.langModeName
);
2878 for (i
=0; i
<HighlightDialog
.nPatterns
; i
++)
2879 freePatternSrc(HighlightDialog
.patterns
[i
], True
);
2881 /* Fill the dialog with the new language mode information */
2882 HighlightDialog
.langModeName
= XtNewString(modeName
);
2883 newPatSet
= FindPatternSet(modeName
);
2884 if (newPatSet
== NULL
) {
2885 HighlightDialog
.nPatterns
= 0;
2886 SetIntText(HighlightDialog
.lineContextW
, 1);
2887 SetIntText(HighlightDialog
.charContextW
, 0);
2889 for (i
=0; i
<newPatSet
->nPatterns
; i
++)
2890 HighlightDialog
.patterns
[i
] =
2891 copyPatternSrc(&newPatSet
->patterns
[i
], NULL
);
2892 HighlightDialog
.nPatterns
= newPatSet
->nPatterns
;
2893 SetIntText(HighlightDialog
.lineContextW
, newPatSet
->lineContext
);
2894 SetIntText(HighlightDialog
.charContextW
, newPatSet
->charContext
);
2896 ChangeManagedListData(HighlightDialog
.managedListW
);
2899 static void lmDialogCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2901 EditLanguageModes(HighlightDialog
.shell
);
2904 static void styleDialogCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2906 Widget selectedItem
;
2909 XtVaGetValues(HighlightDialog
.styleOptMenu
, XmNmenuHistory
, &selectedItem
, NULL
);
2910 XtVaGetValues(selectedItem
, XmNuserData
, &style
, NULL
);
2911 EditHighlightStyles(HighlightDialog
.shell
, style
);
2914 static void okCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2916 /* change the patterns */
2917 if (!updatePatternSet())
2920 /* pop down and destroy the dialog */
2921 XtDestroyWidget(HighlightDialog
.shell
);
2924 static void applyCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2926 /* change the patterns */
2930 static void checkCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2932 if (checkHighlightDialogData())
2933 DialogF(DF_INF
, HighlightDialog
.shell
, 1,
2934 "Patterns compiled without error", "Dismiss");
2937 static void restoreCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2939 patternSet
*defaultPatSet
;
2942 defaultPatSet
= readDefaultPatternSet(HighlightDialog
.langModeName
);
2943 if (defaultPatSet
== NULL
) {
2944 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
2945 "There is no default pattern set\nfor language mode %s",
2946 "Dismiss", HighlightDialog
.langModeName
);
2950 if (DialogF(DF_WARN
, HighlightDialog
.shell
, 2,
2951 "Are you sure you want to discard\n\
2952 all changes to syntax highlighting\n\
2953 patterns for language mode %s?", "Discard", "Cancel",
2954 HighlightDialog
.langModeName
) == 2)
2957 /* if a stored version of the pattern set exists, replace it, if it
2958 doesn't, add a new one */
2959 for (psn
=0; psn
<NPatternSets
; psn
++)
2960 if (!strcmp(HighlightDialog
.langModeName
,
2961 PatternSets
[psn
]->languageMode
))
2963 if (psn
< NPatternSets
) {
2964 freePatternSet(PatternSets
[psn
]);
2965 PatternSets
[psn
] = defaultPatSet
;
2967 PatternSets
[NPatternSets
++] = defaultPatSet
;
2969 /* Free the old dialog information */
2970 for (i
=0; i
<HighlightDialog
.nPatterns
; i
++)
2971 freePatternSrc(HighlightDialog
.patterns
[i
], True
);
2973 /* Update the dialog */
2974 HighlightDialog
.nPatterns
= defaultPatSet
->nPatterns
;
2975 for (i
=0; i
<defaultPatSet
->nPatterns
; i
++)
2976 HighlightDialog
.patterns
[i
] =
2977 copyPatternSrc(&defaultPatSet
->patterns
[i
], NULL
);
2978 SetIntText(HighlightDialog
.lineContextW
, defaultPatSet
->lineContext
);
2979 SetIntText(HighlightDialog
.charContextW
, defaultPatSet
->charContext
);
2980 ChangeManagedListData(HighlightDialog
.managedListW
);
2983 static void deleteCB(Widget w
, XtPointer clientData
, XtPointer callData
)
2987 if (DialogF(DF_WARN
, HighlightDialog
.shell
, 2,
2988 "Are you sure you want to delete\n\
2989 syntax highlighting patterns for\n\
2990 language mode %s?", "Yes, Delete", "Cancel", HighlightDialog
.langModeName
) == 2)
2993 /* if a stored version of the pattern set exists, delete it from the list */
2994 for (psn
=0; psn
<NPatternSets
; psn
++)
2995 if (!strcmp(HighlightDialog
.langModeName
,
2996 PatternSets
[psn
]->languageMode
))
2998 if (psn
< NPatternSets
) {
2999 freePatternSet(PatternSets
[psn
]);
3000 memmove(&PatternSets
[psn
], &PatternSets
[psn
+1],
3001 (NPatternSets
-1 - psn
) * sizeof(patternSet
*));
3005 /* Free the old dialog information */
3006 for (i
=0; i
<HighlightDialog
.nPatterns
; i
++)
3007 freePatternSrc(HighlightDialog
.patterns
[i
], True
);
3009 /* Clear out the dialog */
3010 HighlightDialog
.nPatterns
= 0;
3011 SetIntText(HighlightDialog
.lineContextW
, 1);
3012 SetIntText(HighlightDialog
.charContextW
, 0);
3013 ChangeManagedListData(HighlightDialog
.managedListW
);
3016 static void dismissCB(Widget w
, XtPointer clientData
, XtPointer callData
)
3018 /* pop down and destroy the dialog */
3019 XtDestroyWidget(HighlightDialog
.shell
);
3022 static void helpCB(Widget w
, XtPointer clientData
, XtPointer callData
)
3024 Help(w
, HELP_PATTERNS
);
3027 static void patTypeCB(Widget w
, XtPointer clientData
, XtPointer callData
)
3032 static void matchTypeCB(Widget w
, XtPointer clientData
, XtPointer callData
)
3037 static void *getDisplayedCB(void *oldItem
, int explicitRequest
, int *abort
,
3040 highlightPattern
*pat
;
3042 /* If the dialog is currently displaying the "new" entry and the
3043 fields are empty, that's just fine */
3044 if (oldItem
== NULL
&& dialogEmpty())
3047 /* If there are no problems reading the data, just return it */
3048 pat
= readDialogFields(True
);
3052 /* If there are problems, and the user didn't ask for the fields to be
3053 read, give more warning */
3054 if (!explicitRequest
) {
3055 if (DialogF(DF_WARN
, HighlightDialog
.shell
, 2,
3056 "Discard incomplete entry\nfor current pattern?",
3057 "Keep", "Discard") == 2) {
3058 return oldItem
== NULL
? NULL
: (void *)copyPatternSrc(
3059 (highlightPattern
*)oldItem
, NULL
);
3063 /* Do readDialogFields again without "silent" mode to display warning */
3064 pat
= readDialogFields(False
);
3069 static void setDisplayedCB(void *item
, void *cbArg
)
3071 highlightPattern
*pat
= (highlightPattern
*)item
;
3072 int isSubpat
, isDeferred
, isColorOnly
, isRange
;
3075 XmTextSetString(HighlightDialog
.nameW
, "");
3076 XmTextSetString(HighlightDialog
.parentW
, "");
3077 XmTextSetString(HighlightDialog
.startW
, "");
3078 XmTextSetString(HighlightDialog
.endW
, "");
3079 XmTextSetString(HighlightDialog
.errorW
, "");
3080 XmToggleButtonSetState(HighlightDialog
.topLevelW
, True
, False
);
3081 XmToggleButtonSetState(HighlightDialog
.deferredW
, False
, False
);
3082 XmToggleButtonSetState(HighlightDialog
.subPatW
, False
, False
);
3083 XmToggleButtonSetState(HighlightDialog
.colorPatW
, False
, False
);
3084 XmToggleButtonSetState(HighlightDialog
.simpleW
, True
, False
);
3085 XmToggleButtonSetState(HighlightDialog
.rangeW
, False
, False
);
3086 setStyleMenu("Plain");
3088 isSubpat
= pat
->subPatternOf
!= NULL
;
3089 isDeferred
= pat
->flags
& DEFER_PARSING
;
3090 isColorOnly
= pat
->flags
& COLOR_ONLY
;
3091 isRange
= pat
->endRE
!= NULL
;
3092 XmTextSetString(HighlightDialog
.nameW
, pat
->name
);
3093 XmTextSetString(HighlightDialog
.parentW
, pat
->subPatternOf
);
3094 XmTextSetString(HighlightDialog
.startW
, pat
->startRE
);
3095 XmTextSetString(HighlightDialog
.endW
, pat
->endRE
);
3096 XmTextSetString(HighlightDialog
.errorW
, pat
->errorRE
);
3097 XmToggleButtonSetState(HighlightDialog
.topLevelW
,
3098 !isSubpat
&& !isDeferred
, False
);
3099 XmToggleButtonSetState(HighlightDialog
.deferredW
,
3100 !isSubpat
&& isDeferred
, False
);
3101 XmToggleButtonSetState(HighlightDialog
.subPatW
,
3102 isSubpat
&& !isColorOnly
, False
);
3103 XmToggleButtonSetState(HighlightDialog
.colorPatW
,
3104 isSubpat
&& isColorOnly
, False
);
3105 XmToggleButtonSetState(HighlightDialog
.simpleW
, !isRange
, False
);
3106 XmToggleButtonSetState(HighlightDialog
.rangeW
, isRange
, False
);
3107 setStyleMenu(pat
->style
);
3112 static void freeItemCB(void *item
)
3114 freePatternSrc((highlightPattern
*)item
, True
);
3118 ** Do a test compile of the patterns currently displayed in the highlight
3119 ** patterns dialog, and display warning dialogs if there are problems
3121 static int checkHighlightDialogData(void)
3126 /* Get the pattern information from the dialog */
3127 patSet
= getDialogPatternSet();
3131 /* Compile the patterns */
3132 result
= patSet
->nPatterns
== 0 ? True
: TestHighlightPatterns(patSet
);
3133 freePatternSet(patSet
);
3138 ** Update the text field labels and sensitivity of various fields, based on
3139 ** the settings of the Pattern Type and Matching radio buttons in the highlight
3142 static void updateLabels(void)
3144 char *startLbl
, *endLbl
;
3145 int endSense
, errSense
, matchSense
, parentSense
;
3148 if (XmToggleButtonGetState(HighlightDialog
.colorPatW
)) {
3149 startLbl
= "Sub-expressions to Highlight in Parent's Starting \
3150 Regular Expression (\\1, &, etc.)";
3151 endLbl
= "Sub-expressions to Highlight in Parent Pattern's Ending \
3152 Regular Expression";
3158 endLbl
= "Ending Regular Expression";
3160 parentSense
= XmToggleButtonGetState(HighlightDialog
.subPatW
);
3161 if (XmToggleButtonGetState(HighlightDialog
.simpleW
)) {
3162 startLbl
= "Regular Expression to Match";
3166 startLbl
= "Starting Regular Expression";
3172 XtSetSensitive(HighlightDialog
.parentLbl
, parentSense
);
3173 XtSetSensitive(HighlightDialog
.parentW
, parentSense
);
3174 XtSetSensitive(HighlightDialog
.endW
, endSense
);
3175 XtSetSensitive(HighlightDialog
.endLbl
, endSense
);
3176 XtSetSensitive(HighlightDialog
.errorW
, errSense
);
3177 XtSetSensitive(HighlightDialog
.errorLbl
, errSense
);
3178 XtSetSensitive(HighlightDialog
.errorLbl
, errSense
);
3179 XtSetSensitive(HighlightDialog
.simpleW
, matchSense
);
3180 XtSetSensitive(HighlightDialog
.rangeW
, matchSense
);
3181 XtSetSensitive(HighlightDialog
.matchLbl
, matchSense
);
3182 XtVaSetValues(HighlightDialog
.startLbl
, XmNlabelString
,
3183 s1
=XmStringCreateSimple(startLbl
), NULL
);
3185 XtVaSetValues(HighlightDialog
.endLbl
, XmNlabelString
,
3186 s1
=XmStringCreateSimple(endLbl
), NULL
);
3191 ** Set the styles menu in the currently displayed highlight dialog to show
3192 ** a particular style
3194 static void setStyleMenu(const char *styleName
)
3199 Widget selectedItem
;
3202 XtVaGetValues(HighlightDialog
.stylePulldown
, XmNchildren
, &items
,
3203 XmNnumChildren
, &nItems
, NULL
);
3206 selectedItem
= items
[0];
3207 for (i
=0; i
<(int)nItems
; i
++) {
3208 XtVaGetValues(items
[i
], XmNuserData
, &itemStyle
, NULL
);
3209 if (!strcmp(itemStyle
, styleName
)) {
3210 selectedItem
= items
[i
];
3214 XtVaSetValues(HighlightDialog
.styleOptMenu
, XmNmenuHistory
, selectedItem
, (char *)0);
3218 ** Read the pattern fields of the highlight dialog, and produce an allocated
3219 ** highlightPattern structure reflecting the contents, or pop up dialogs
3220 ** telling the user what's wrong (Passing "silent" as True, suppresses these
3221 ** dialogs). Returns NULL on error.
3223 static highlightPattern
*readDialogFields(int silent
)
3225 highlightPattern
*pat
;
3226 char *inPtr
, *outPtr
, *style
;
3227 Widget selectedItem
;
3230 /* Allocate a pattern source structure to return, zero out fields
3231 so that the whole pattern can be freed on error with freePatternSrc */
3232 pat
= (highlightPattern
*)XtMalloc(sizeof(highlightPattern
));
3234 pat
->errorRE
= NULL
;
3236 pat
->subPatternOf
= NULL
;
3238 /* read the type buttons */
3240 colorOnly
= XmToggleButtonGetState(HighlightDialog
.colorPatW
);
3241 if (XmToggleButtonGetState(HighlightDialog
.deferredW
))
3242 pat
->flags
|= DEFER_PARSING
;
3244 pat
->flags
= COLOR_ONLY
;
3246 /* read the name field */
3247 pat
->name
= ReadSymbolicFieldTextWidget(HighlightDialog
.nameW
,
3248 "highlight pattern name", silent
);
3249 if (pat
->name
== NULL
) {
3250 XtFree((char *)pat
);
3253 if (*pat
->name
== '\0') {
3255 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
3256 "Please specify a name\nfor the pattern", "Dismiss");
3257 XmProcessTraversal(HighlightDialog
.nameW
, XmTRAVERSE_CURRENT
);
3260 XtFree((char *)pat
);
3264 /* read the startRE field */
3265 pat
->startRE
= XmTextGetString(HighlightDialog
.startW
);
3266 if (*pat
->startRE
== '\0') {
3268 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
3269 "Please specify a regular\nexpression to match", "Dismiss");
3270 XmProcessTraversal(HighlightDialog
.startW
, XmTRAVERSE_CURRENT
);
3272 freePatternSrc(pat
, True
);
3276 /* Make sure coloring patterns contain only sub-expression references
3277 and put it in replacement regular-expression form */
3279 for (inPtr
=pat
->startRE
, outPtr
=pat
->startRE
; *inPtr
!='\0'; inPtr
++)
3280 if (*inPtr
!=' ' && *inPtr
!='\t')
3283 if (strspn(pat
->startRE
, "&\\123456789 \t") != strlen(pat
->startRE
) ||
3284 (*pat
->startRE
!= '\\' && *pat
->startRE
!= '&') ||
3285 strstr(pat
->startRE
, "\\\\") != NULL
) {
3287 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
3288 "The expression field in patterns which specify highlighting for\n\
3289 a parent, must contain only sub-expression references in regular\n\
3290 expression replacement form (&\\1\\2 etc.). See Help -> Regular\n\
3291 Expressions and Help -> Syntax Highlighting for more information", "Dismiss");
3292 XmProcessTraversal(HighlightDialog
.startW
, XmTRAVERSE_CURRENT
);
3294 freePatternSrc(pat
, True
);
3299 /* read the parent field */
3300 if (XmToggleButtonGetState(HighlightDialog
.subPatW
) || colorOnly
) {
3301 if (TextWidgetIsBlank(HighlightDialog
.parentW
)) {
3303 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
3304 "Please specify a parent pattern", "Dismiss");
3305 XmProcessTraversal(HighlightDialog
.parentW
, XmTRAVERSE_CURRENT
);
3307 freePatternSrc(pat
, True
);
3310 pat
->subPatternOf
= XmTextGetString(HighlightDialog
.parentW
);
3313 /* read the styles option menu */
3314 XtVaGetValues(HighlightDialog
.styleOptMenu
, XmNmenuHistory
, &selectedItem
, NULL
);
3315 XtVaGetValues(selectedItem
, XmNuserData
, &style
, NULL
);
3316 pat
->style
= XtMalloc(strlen(style
) + 1);
3317 strcpy(pat
->style
, style
);
3320 /* read the endRE field */
3321 if (colorOnly
|| XmToggleButtonGetState(HighlightDialog
.rangeW
)) {
3322 pat
->endRE
= XmTextGetString(HighlightDialog
.endW
);
3323 if (!colorOnly
&& *pat
->endRE
== '\0') {
3325 DialogF(DF_WARN
, HighlightDialog
.shell
, 1,
3326 "Please specify an ending\nregular expression", "Dismiss");
3327 XmProcessTraversal(HighlightDialog
.endW
, XmTRAVERSE_CURRENT
);
3329 freePatternSrc(pat
, True
);
3334 /* read the errorRE field */
3335 if (XmToggleButtonGetState(HighlightDialog
.rangeW
)) {
3336 pat
->errorRE
= XmTextGetString(HighlightDialog
.errorW
);
3337 if (*pat
->errorRE
== '\0') {
3338 XtFree(pat
->errorRE
);
3339 pat
->errorRE
= NULL
;
3346 ** Returns true if the pattern fields of the highlight dialog are set to
3347 ** the default ("New" pattern) state.
3349 static int dialogEmpty(void)
3351 return TextWidgetIsBlank(HighlightDialog
.nameW
) &&
3352 XmToggleButtonGetState(HighlightDialog
.topLevelW
) &&
3353 XmToggleButtonGetState(HighlightDialog
.simpleW
) &&
3354 TextWidgetIsBlank(HighlightDialog
.parentW
) &&
3355 TextWidgetIsBlank(HighlightDialog
.startW
) &&
3356 TextWidgetIsBlank(HighlightDialog
.endW
) &&
3357 TextWidgetIsBlank(HighlightDialog
.errorW
);
3361 ** Update the pattern set being edited in the Syntax Highlighting dialog
3362 ** with the information that the dialog is currently displaying, and
3363 ** apply changes to any window which is currently using the patterns.
3365 static int updatePatternSet(void)
3371 /* Make sure the patterns are valid and compile */
3372 if (!checkHighlightDialogData())
3375 /* Get the current data */
3376 patSet
= getDialogPatternSet();
3380 /* Find the pattern being modified */
3381 for (psn
=0; psn
<NPatternSets
; psn
++)
3382 if (!strcmp(HighlightDialog
.langModeName
,
3383 PatternSets
[psn
]->languageMode
))
3386 /* If it's a new pattern, add it at the end, otherwise free the
3387 existing pattern set and replace it */
3388 if (psn
== NPatternSets
) {
3389 PatternSets
[NPatternSets
++] = patSet
;
3391 freePatternSet(PatternSets
[psn
]);
3392 PatternSets
[psn
] = patSet
;
3395 /* Find windows that are currently using this pattern set and
3396 re-do the highlighting */
3397 for (window
=WindowList
; window
!=NULL
; window
=window
->next
) {
3398 if (window
->highlightSyntax
&&
3399 window
->languageMode
!= PLAIN_LANGUAGE_MODE
) {
3400 if (!strcmp(LanguageModeName(window
->languageMode
),
3401 patSet
->languageMode
)) {
3402 StopHighlighting(window
);
3403 StartHighlighting(window
, True
);
3408 /* Note that preferences have been changed */
3415 ** Get the current information that the user has entered in the syntax
3416 ** highlighting dialog. Return NULL if the data is currently invalid
3418 static patternSet
*getDialogPatternSet(void)
3420 int i
, lineContext
, charContext
;
3423 /* Get the current contents of the "patterns" dialog fields */
3424 if (!UpdateManagedList(HighlightDialog
.managedListW
, True
))
3427 /* Get the line and character context values */
3428 if (GetIntTextWarn(HighlightDialog
.lineContextW
, &lineContext
,
3429 "context lines", True
) != TEXT_READ_OK
)
3431 if (GetIntTextWarn(HighlightDialog
.charContextW
, &charContext
,
3432 "context lines", True
) != TEXT_READ_OK
)
3435 /* Allocate a new pattern set structure and copy the fields read from the
3436 dialog, including the modified pattern list into it */
3437 patSet
= (patternSet
*)XtMalloc(sizeof(patternSet
));
3438 patSet
->languageMode
= XtNewString(HighlightDialog
.langModeName
);
3439 patSet
->lineContext
= lineContext
;
3440 patSet
->charContext
= charContext
;
3441 patSet
->nPatterns
= HighlightDialog
.nPatterns
;
3442 patSet
->patterns
= (highlightPattern
*)XtMalloc(sizeof(highlightPattern
) *
3443 HighlightDialog
.nPatterns
);
3444 for (i
=0; i
<HighlightDialog
.nPatterns
; i
++)
3445 copyPatternSrc(HighlightDialog
.patterns
[i
], &patSet
->patterns
[i
]);
3450 ** Return True if "patSet1" and "patSet2" differ
3452 static int patternSetsDiffer(patternSet
*patSet1
, patternSet
*patSet2
)
3455 highlightPattern
*pat1
, *pat2
;
3457 if (patSet1
->lineContext
!= patSet2
->lineContext
)
3459 if (patSet1
->charContext
!= patSet2
->charContext
)
3461 if (patSet1
->nPatterns
!= patSet2
->nPatterns
)
3463 for (i
=0; i
<patSet2
->nPatterns
; i
++) {
3464 pat1
= &patSet1
->patterns
[i
];
3465 pat2
= &patSet2
->patterns
[i
];
3466 if (pat1
->flags
!= pat2
->flags
)
3468 if (AllocatedStringsDiffer(pat1
->name
, pat2
->name
))
3470 if (AllocatedStringsDiffer(pat1
->startRE
, pat2
->startRE
))
3472 if (AllocatedStringsDiffer(pat1
->endRE
, pat2
->endRE
))
3474 if (AllocatedStringsDiffer(pat1
->errorRE
, pat2
->errorRE
))
3476 if (AllocatedStringsDiffer(pat1
->style
, pat2
->style
))
3478 if (AllocatedStringsDiffer(pat1
->subPatternOf
, pat2
->subPatternOf
))
3485 ** Copy a highlight pattern data structure and all of the allocated data
3486 ** it contains. If "copyTo" is non-null, use that as the top-level structure,
3487 ** otherwise allocate a new highlightPattern structure and return it as the
3490 static highlightPattern
*copyPatternSrc(highlightPattern
*pat
,
3491 highlightPattern
*copyTo
)
3493 highlightPattern
*newPat
;
3496 newPat
= (highlightPattern
*)XtMalloc(sizeof(highlightPattern
));
3499 newPat
->name
= XtNewString(pat
->name
);
3500 newPat
->startRE
= XtNewString(pat
->startRE
);
3501 newPat
->endRE
= XtNewString(pat
->endRE
);
3502 newPat
->errorRE
= XtNewString(pat
->errorRE
);
3503 newPat
->style
= XtNewString(pat
->style
);
3504 newPat
->subPatternOf
= XtNewString(pat
->subPatternOf
);
3505 newPat
->flags
= pat
->flags
;
3509 static void freeNonNull(void *ptr
)
3512 XtFree((char *)ptr
);
3516 ** Free the allocated memory contained in a highlightPattern data structure
3517 ** If "freeStruct" is true, free the structure itself as well.
3519 static void freePatternSrc(highlightPattern
*pat
, int freeStruct
)
3522 freeNonNull(pat
->startRE
);
3523 freeNonNull(pat
->endRE
);
3524 freeNonNull(pat
->errorRE
);
3525 freeNonNull(pat
->style
);
3526 freeNonNull(pat
->subPatternOf
);
3528 XtFree((char *)pat
);
3532 ** Free the allocated memory contained in a patternSet data structure
3533 ** If "freeStruct" is true, free the structure itself as well.
3535 static void freePatternSet(patternSet
*p
)
3539 for (i
=0; i
<p
->nPatterns
; i
++)
3540 freePatternSrc(&p
->patterns
[i
], False
);
3541 XtFree(p
->languageMode
);
3542 XtFree((char *)p
->patterns
);
3548 ** Free the allocated memory contained in a patternSet data structure
3549 ** If "freeStruct" is true, free the structure itself as well.
3551 static int lookupNamedPattern(patternSet
*p
, char *patternName
)
3555 for (i
=0; i
<p
->nPatterns
; i
++)
3556 if (strcmp(p
->patterns
[i
].name
, patternName
))
3563 ** Find the index into the HighlightStyles array corresponding to "styleName".
3564 ** If styleName is not found, return -1.
3566 static int lookupNamedStyle(const char *styleName
)
3570 for (i
= 0; i
< NHighlightStyles
; i
++)
3572 if (!strcmp(styleName
, HighlightStyles
[i
]->name
))
3582 ** Returns a unique number of a given style name
3584 int IndexOfNamedStyle(const char *styleName
)
3586 return lookupNamedStyle(styleName
);
3590 ** Write the string representation of int "i" to a static area, and
3591 ** return a pointer to it.
3593 static char *intToStr(int i
)
3595 static char outBuf
[12];
3597 sprintf(outBuf
, "%d", i
);