highlightdata.c
来自「nedit 是一款linux下的开发源码的功能强大的编辑器」· C语言 代码 · 共 700 行 · 第 1/5 页
C
700 行
static void deleteCB(Widget w, XtPointer clientData, XtPointer callData);static void dismissCB(Widget w, XtPointer clientData, XtPointer callData);static void helpCB(Widget w, XtPointer clientData, XtPointer callData);static void *getDisplayedCB(void *oldItem, int explicitRequest, int *abort, void *cbArg);static void setDisplayedCB(void *item, void *cbArg);static void setStyleMenu(const char *styleName);static highlightPattern *readDialogFields(int silent);static int dialogEmpty(void);static int updatePatternSet(void);static patternSet *getDialogPatternSet(void);static int patternSetsDiffer(patternSet *patSet1, patternSet *patSet2);static highlightPattern *copyPatternSrc(highlightPattern *pat, highlightPattern *copyTo);static void freeNonNull(void *ptr);static void freeItemCB(void *item);static void freePatternSrc(highlightPattern *pat, int freeStruct);static void freePatternSet(patternSet *p);/* list of available highlight styles */static int NHighlightStyles = 0;static highlightStyleRec *HighlightStyles[MAX_HIGHLIGHT_STYLES];/* Highlight styles dialog information */static struct { Widget shell; Widget nameW; Widget colorW; Widget bgColorW; Widget recogW; Widget plainW, boldW, italicW, boldItalicW; Widget managedListW; highlightStyleRec **highlightStyleList; int nHighlightStyles;} HSDialog = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0};/* Highlight dialog information */static struct { Widget shell; Widget lmOptMenu; Widget lmPulldown; Widget styleOptMenu; Widget stylePulldown; Widget nameW; Widget topLevelW; Widget deferredW; Widget subPatW; Widget colorPatW; Widget simpleW; Widget rangeW; Widget parentW; Widget startW; Widget endW; Widget errorW; Widget lineContextW; Widget charContextW; Widget managedListW; Widget parentLbl; Widget startLbl; Widget endLbl; Widget errorLbl; Widget matchLbl; char *langModeName; int nPatterns; highlightPattern **patterns;} HighlightDialog = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL };/* Pattern sources loaded from the .nedit file or set by the user */static int NPatternSets = 0;static patternSet *PatternSets[MAX_LANGUAGE_MODES];static char *DefaultPatternSets[] = { "Ada:1:0{\n\ Comments:\"--\":\"$\"::Comment::\n\ String Literals:\"\"\"\":\"\"\"\":\"\\n\":String::\n\ Character Literals:\"'(?:[^\\\\]|\\\\.)'\":::Character Const::\n\ Ada Attributes:\"(?i'size\\s+(use)>)|'\\l[\\l\\d]*(?:_[\\l\\d]+)*\":::Ada Attributes::\n\ Size Attribute:\"\\1\":\"\"::Keyword:Ada Attributes:C\n\ Based Numeric Literals:\"<(?:\\d+(?:_\\d+)*)#(?:[\\da-fA-F]+(?:_[\\da-fA-F]+)*)(?:\\.[\\da-fA-F]+(?:_[\\da-fA-F]+)*)?#(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?(?!\\Y)\":::Numeric Const::\n\ Numeric Literals:\"<(?:\\d+(?:_\\d+)*)(?:\\.\\d+(?:_\\d+)*)?(?iE[+\\-]?(?:\\d+(?:_\\d+)*))?>\":::Numeric Const::\n\ Pragma:\"(?n(?ipragma)\\s+\\l[\\l\\d]*(?:_\\l[\\l\\d]*)*\\s*\\([^)]*\\)\\s*;)\":::Preprocessor::\n\ 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\ Predefined Types:\"(?i(?=[bcdfilps]))<(?iboolean|character|count|duration|float|integer|long_float|long_integer|priority|short_float|short_integer|string)>\":::Storage Type::D\n\ Predefined Subtypes:\"(?i(?=[fnp]))<(?ifield|natural|number_base|positive|priority)>\":::Storage Type::D\n\ 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\ Dot All:\"\\.(?iall)>\":::Storage Type::\n\ Ada 95 Only:\"(?i(?=[aprtu]))<(?iabstract|tagged|all|protected|aliased|requeue|until)>\":::Keyword::\n\ Labels Parent:\"<(\\l[\\l\\d]*(?:_[\\l\\d]+)*)(?n\\s*:\\s*)(?ifor|while|loop|declare|begin)>\":::Keyword::D\n\ Labels subpattern:\"\\1\":\"\"::Label:Labels Parent:DC\n\ Endloop labels:\"<(?nend\\s+loop\\s+(\\l[\\l\\d]*(?:_[\\l\\d]+)*\\s*));\":::Keyword::\n\ Endloop labels subpattern:\"\\1\":\"\"::Label:Endloop labels:C\n\ Goto labels:\"\\<\\<\\l[\\l\\d]*(?:_[\\l\\d]+)*\\>\\>\":::Flag::\n\ Exit parent:\"((?iexit))\\s+(\\l\\w*)(?i\\s+when>)?\":::Keyword::\n\ Exit subpattern:\"\\2\":\"\"::Label:Exit parent:C\n\ Identifiers:\"<(?:\\l[\\l\\d]*(?:_[\\l\\d]+)*)>\":::Identifier::D}", "Awk:2:0{\n\ Comment:\"#\":\"$\"::Comment::\n\ Pattern:\"/(\\\\.|([[][]]?[^]]+[]])|[^/])+/\":::Preprocessor::\n\ Keyword:\"<(return|print|printf|if|else|while|for|in|do|break|continue|next|exit|close|system|getline)>\":::Keyword::D\n\ String:\"\"\"\":\"\"\"\":\"\\n\":String1::\n\ String escape:\"\\\\(.|\\n)\":::String1:String:\n\ Builtin functions:\"<(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gsub|index|length|match|split|sprintf|sub|substr)>\":::Keyword::D\n\ Gawk builtin functions:\"<(fflush|gensub|tolower|toupper|systime|strftime)>\":::Text Key1::D\n\ Builtin variables:\"<(ARGC|ARGV|FILENAME|FNR|FS|NF|NR|OFMT|OFS|ORS|RLENGTH|RS|RSTART|SUBSEP)>\":::Storage Type::D\n\ Gawk builtin variables:\"\"\"<(ARGIND|ERRNO|RT|IGNORECASE|FIELDWIDTHS)>\"\"\":::Storage Type::D\n\ Field:\"\\$[0-9a-zA-Z_]+|\\$[ \\t]*\\([^,;]*\\)\":::Storage Type::D\n\ BeginEnd:\"<(BEGIN|END)>\":::Preprocessor1::D\n\ 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\ String pattern:\"~[ \\t]*\"\"\":\"\"\"\":\"\\n\":Preprocessor::\n\ String pattern escape:\"\\\\(.|\\n)\":::Preprocessor:String pattern:\n\ newline escape:\"\\\\$\":::Preprocessor1::\n\ Function:\"function\":::Preprocessor1::D}", "C++:1:0{\n\ comment:\"/\\*\":\"\\*/\"::Comment::\n\ cplus comment:\"//\":\"$\"::Comment::\n\ string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\ preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\ string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\ preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\ preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\ preproc cplus comment:\"//\":\"$\"::Comment:preprocessor line:\n\ preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\ character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\ 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\ 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\ 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\ braces:\"[{}]\":::Keyword::D}", "C:1:0 {\n\ comment:\"/\\*\":\"\\*/\"::Comment::\n\ string:\"L?\"\"\":\"\"\"\":\"\\n\":String::\n\ preprocessor line:\"^\\s*#\\s*(?:include|define|if|ifn?def|line|error|else|endif|elif|undef|pragma)>\":\"$\"::Preprocessor::\n\ string escape chars:\"\\\\(?:.|\\n)\":::String1:string:\n\ preprocessor esc chars:\"\\\\(?:.|\\n)\":::Preprocessor1:preprocessor line:\n\ preprocessor comment:\"/\\*\":\"\\*/\"::Comment:preprocessor line:\n\ preprocessor keywords:\"<__(?:LINE|FILE|DATE|TIME|STDC)__>\":::Preprocessor::\n\ character constant:\"L?'\":\"'\":\"[^\\\\][^']\":Character Const::\n\ 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\ 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\
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?