⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lexothers.cxx

📁 robocup rcssserver 运行防真机器人足球比赛所用的服务器端
💻 CXX
📖 第 1 页 / 共 3 页
字号:
			lastNonSpace = i;		}		i++;	}	if (state == SCE_MAKE_IDENTIFIER) {		styler.ColourTo(endPos, SCE_MAKE_IDEOL);	// Error, variable reference not ended	} else {		styler.ColourTo(endPos, SCE_MAKE_DEFAULT);	}}static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {	char lineBuffer[1024];	styler.StartAt(startPos);	styler.StartSegment(startPos);	unsigned int linePos = 0;	unsigned int startLine = startPos;	for (unsigned int i = startPos; i < startPos + length; i++) {		lineBuffer[linePos++] = styler[i];		if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {			// End of line (or of line buffer) met, colourise it			lineBuffer[linePos] = '\0';			ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler);			linePos = 0;			startLine = i + 1;		}	}	if (linePos > 0) {	// Last line does not have ending characters		ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);	}}static bool strstart(const char *haystack, const char *needle) {	return strncmp(haystack, needle, strlen(needle)) == 0;}static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine) {	if (lineBuffer[0] == '>') {		// Command or return status		return SCE_ERR_CMD;	} else if (lineBuffer[0] == '<') {		// Diff removal, but not interested. Trapped to avoid hitting CTAG cases.		return SCE_ERR_DEFAULT;	} else if (lineBuffer[0] == '!') {		return SCE_ERR_DIFF_CHANGED;	} else if (lineBuffer[0] == '+') {		if (strstart(lineBuffer, "+++ ")) {			return SCE_ERR_DIFF_MESSAGE;		} else {			return SCE_ERR_DIFF_ADDITION;		}	} else if (lineBuffer[0] == '-') {		if (strstart(lineBuffer, "--- ")) {			return SCE_ERR_DIFF_MESSAGE;		} else {			return SCE_ERR_DIFF_DELETION;		}	} else if (strstart(lineBuffer, "cf90-")) {		// Absoft Pro Fortran 90/95 v8.2 error and/or warning message		return SCE_ERR_ABSF;	} else if (strstart(lineBuffer, "fortcom:")) {		// Intel Fortran Compiler v8.0 error/warning message		return SCE_ERR_IFORT;	} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {		return SCE_ERR_PYTHON;	} else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {		return SCE_ERR_PHP;	} else if ((strstart(lineBuffer, "Error ") ||	            strstart(lineBuffer, "Warning ")) &&	           strstr(lineBuffer, " at (") &&	           strstr(lineBuffer, ") : ") &&	           (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {		// Intel Fortran Compiler error/warning message		return SCE_ERR_IFC;	} else if (strstart(lineBuffer, "Error ")) {		// Borland error message		return SCE_ERR_BORLAND;	} else if (strstart(lineBuffer, "Warning ")) {		// Borland warning message		return SCE_ERR_BORLAND;	} else if (strstr(lineBuffer, "at line " ) &&	           (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) &&	           strstr(lineBuffer, "file ") &&	           (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {		// Lua 4 error message		return SCE_ERR_LUA;	} else if (strstr(lineBuffer, " at " ) &&	           (strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) &&	           strstr(lineBuffer, " line ") &&	           (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&	           (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) {		// perl error message		return SCE_ERR_PERL;	} else if ((memcmp(lineBuffer, "   at ", 6) == 0) &&	           strstr(lineBuffer, ":line ")) {		// A .NET traceback		return SCE_ERR_NET;	} else if (strstart(lineBuffer, "Line ") &&	           strstr(lineBuffer, ", file ")) {		// Essential Lahey Fortran error message		return SCE_ERR_ELF;	} else if (strstart(lineBuffer, "line ") &&	           strstr(lineBuffer, " column ")) {		// HTML tidy style: line 42 column 1		return SCE_ERR_TIDY;	} else if (strstart(lineBuffer, "\tat ") &&	           strstr(lineBuffer, "(") &&	           strstr(lineBuffer, ".java:")) {		// Java stack back trace		return SCE_ERR_JAVA_STACK;	} else {		// Look for one of the following formats:		// GCC: <filename>:<line>:<message>		// Microsoft: <filename>(<line>) :<message>		// Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal		// Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal		// Microsoft: <filename>(<line>,<column>)<message>		// CTags: \t<message>		// Lua 5 traceback: \t<filename>:<line>:<message>		bool initialTab = (lineBuffer[0] == '\t');		enum { stInitial,			stGccStart, stGccDigit, stGcc,			stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,			stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,			stUnrecognized		} state = stInitial;		for (unsigned int i = 0; i < lengthLine; i++) {			char ch = lineBuffer[i];			char chNext = ' ';			if ((i + 1) < lengthLine)				chNext = lineBuffer[i + 1];			if (state == stInitial) {				if (ch == ':') {					// May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)					if ((chNext != '\\') && (chNext != '/')) {						// This check is not completely accurate as may be on						// GTK+ with a file name that includes ':'.						state = stGccStart;					}				} else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {					// May be Microsoft					// Check against '0' often removes phone numbers					state = stMsStart;				} else if ((ch == '\t') && (!initialTab)) {					// May be CTags					state = stCtagsStart;				}			} else if (state == stGccStart) {	// <filename>:				state = Is1To9(ch) ? stGccDigit : stUnrecognized;			} else if (state == stGccDigit) {	// <filename>:<line>				if (ch == ':') {					state = stGcc;	// :9.*: is GCC					break;				} else if (!Is0To9(ch)) {					state = stUnrecognized;				}			} else if (state == stMsStart) {	// <filename>(				state = Is0To9(ch) ? stMsDigit : stUnrecognized;			} else if (state == stMsDigit) {	// <filename>(<line>				if (ch == ',') {					state = stMsDigitComma;				} else if (ch == ')') {					state = stMsBracket;				} else if ((ch != ' ') && !Is0To9(ch)) {					state = stUnrecognized;				}			} else if (state == stMsBracket) {	// <filename>(<line>)				if ((ch == ' ') && (chNext == ':')) {					state = stMsVc;				} else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {					// Possibly Delphi.. don't test against chNext as it's one of the strings below.					char word[512];					unsigned int j, chPos;					unsigned numstep;					chPos = 0;					if (ch == ' ')						numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.					else						numstep = 2; // otherwise add 2.					for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)						word[chPos++] = lineBuffer[j];					word[chPos] = 0;					if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||						!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||						!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {						state = stMsVc;					} else						state = stUnrecognized;				} else {					state = stUnrecognized;				}			} else if (state == stMsDigitComma) {	// <filename>(<line>,				if (ch == ')') {					state = stMsDotNet;					break;				} else if ((ch != ' ') && !Is0To9(ch)) {					state = stUnrecognized;				}			} else if (state == stCtagsStart) {				if ((lineBuffer[i - 1] == '\t') &&				        ((ch == '/' && lineBuffer[i + 1] == '^') || Is0To9(ch))) {					state = stCtags;					break;				} else if ((ch == '/') && (lineBuffer[i + 1] == '^')) {					state = stCtagsStartString;				}			} else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) {				state = stCtagsStringDollar;				break;			}		}		if (state == stGcc) {			return SCE_ERR_GCC;		} else if ((state == stMsVc) || (state == stMsDotNet)) {			return SCE_ERR_MS;		} else if ((state == stCtagsStringDollar) || (state == stCtags)) {			return SCE_ERR_CTAG;		} else {			return SCE_ERR_DEFAULT;		}	}}static void ColouriseErrorListLine(    char *lineBuffer,    unsigned int lengthLine,    unsigned int endPos,    Accessor &styler) {	styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine));}static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {	char lineBuffer[10000];	styler.StartAt(startPos);	styler.StartSegment(startPos);	unsigned int linePos = 0;	for (unsigned int i = startPos; i < startPos + length; i++) {		lineBuffer[linePos++] = styler[i];		if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {			// End of line (or of line buffer) met, colourise it			lineBuffer[linePos] = '\0';			ColouriseErrorListLine(lineBuffer, linePos, i, styler);			linePos = 0;		}	}	if (linePos > 0) {	// Last line does not have ending characters		ColouriseErrorListLine(lineBuffer, linePos, startPos + length - 1, styler);	}}static int isSpecial(char s) {	return (s == '\\') || (s == ',') || (s == ';') || (s == '\'') || (s == ' ') ||	       (s == '\"') || (s == '`') || (s == '^') || (s == '~');}static int isTag(int start, Accessor &styler) {	char s[6];	unsigned int i = 0, e = 1;	while (i < 5 && e) {		s[i] = styler[start + i];		i++;		e = styler[start + i] != '{';	}	s[i] = '\0';	return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);}static void ColouriseLatexDoc(unsigned int startPos, int length, int initStyle,                              WordList *[], Accessor &styler) {	styler.StartAt(startPos);	int state = initStyle;	char chNext = styler[startPos];	styler.StartSegment(startPos);	int lengthDoc = startPos + length;	for (int i = startPos; i < lengthDoc; i++) {		char ch = chNext;		chNext = styler.SafeGetCharAt(i + 1);		if (styler.IsLeadByte(ch)) {			chNext = styler.SafeGetCharAt(i + 2);			i++;			continue;		}		switch (state) {		case SCE_L_DEFAULT :			switch (ch) {			case '\\' :				styler.ColourTo(i - 1, state);				if (isSpecial(styler[i + 1])) {					styler.ColourTo(i + 1, SCE_L_COMMAND);					i++;					chNext = styler.SafeGetCharAt(i + 1);				} else {					if (isTag(i + 1, styler))						state = SCE_L_TAG;					else						state = SCE_L_COMMAND;				}				break;			case '$' :				styler.ColourTo(i - 1, state);				state = SCE_L_MATH;				if (chNext == '$') {					i++;					chNext = styler.SafeGetCharAt(i + 1);				}				break;			case '%' :				styler.ColourTo(i - 1, state);				state = SCE_L_COMMENT;				break;			}			break;		case SCE_L_COMMAND :			if (chNext == '[' || chNext == '{' || chNext == '}' ||			        chNext == ' ' || chNext == '\r' || chNext == '\n') {				styler.ColourTo(i, state);				state = SCE_L_DEFAULT;				i++;				chNext = styler.SafeGetCharAt(i + 1);			}			break;		case SCE_L_TAG :			if (ch == '}') {				styler.ColourTo(i, state);				state = SCE_L_DEFAULT;			}			break;		case SCE_L_MATH :			if (ch == '$') {				if (chNext == '$') {					i++;					chNext = styler.SafeGetCharAt(i + 1);				}				styler.ColourTo(i, state);				state = SCE_L_DEFAULT;			}			break;		case SCE_L_COMMENT :			if (ch == '\r' || ch == '\n') {				styler.ColourTo(i - 1, state);				state = SCE_L_DEFAULT;			}		}	}	styler.ColourTo(lengthDoc-1, state);}static const char * const batchWordListDesc[] = {	"Internal Commands",	"External Commands",	0};static const char * const emptyWordListDesc[] = {	0};static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[],                            Accessor &styler) {	// Null language means all style bytes are 0 so just mark the end - no need to fill in.	if (length > 0) {		styler.StartAt(startPos + length - 1);		styler.StartSegment(startPos + length - 1);		styler.ColourTo(startPos + length - 1, 0);	}}LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc);LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -