Update of /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30133/extsrc/w32fScintilla/src Modified Files: AutoComplete.cxx AutoComplete.h CallTip.cxx CallTip.h CellBuffer.cxx Document.cxx Document.h DocumentAccessor.cxx DocumentAccessor.h Editor.cxx Editor.h KeyWords.cxx LexAU3.cxx LexAVE.cxx LexBash.cxx LexCLW.cxx LexCPP.cxx LexCSS.cxx LexEiffel.cxx LexFortran.cxx LexGen.py LexHTML.cxx LexLisp.cxx LexLua.cxx LexMSSQL.cxx LexNsis.cxx LexOthers.cxx LexPOV.cxx LexPS.cxx LexPerl.cxx LexPython.cxx LexRuby.cxx LexSQL.cxx LexTeX.cxx LexVB.cxx LineMarker.cxx PropSet.cxx RESearch.h ScintillaBase.cxx ScintillaBase.h StyleContext.h XPM.cxx Log Message: w32fScintilla.dll updated to use the latest Version 1.66 of the scintilla control. Index: CallTip.h =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/CallTip.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CallTip.h 22 Dec 2004 20:25:56 -0000 1.1 --- CallTip.h 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 16,21 **** char *val; Font font; ! int xUp; ! int xDown; int lineHeight; int offsetMain; --- 16,21 ---- char *val; Font font; ! PRectangle rectUp; ! PRectangle rectDown; int lineHeight; int offsetMain; Index: Document.h =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/Document.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Document.h 22 Dec 2004 20:25:57 -0000 1.1 --- Document.h 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 135,138 **** --- 135,139 ---- // Gateways to modifying document + void ModifiedAt(int pos); bool DeleteChars(int pos, int len); bool InsertStyledString(int position, char *s, int insertLength); *************** *** 229,232 **** --- 230,234 ---- int WordPartRight(int pos); int ExtendStyleRange(int pos, int delta, bool singleLine = false); + bool IsWhiteLine(int line); int ParaUp(int pos); int ParaDown(int pos); *************** *** 234,242 **** private: charClassification WordCharClass(unsigned char ch); bool IsWordStartAt(int pos); bool IsWordEndAt(int pos); bool IsWordAt(int start, int end); - void ModifiedAt(int pos); void NotifyModifyAttempt(); --- 236,245 ---- private: + void CheckReadOnly(); + charClassification WordCharClass(unsigned char ch); bool IsWordStartAt(int pos); bool IsWordEndAt(int pos); bool IsWordAt(int start, int end); void NotifyModifyAttempt(); *************** *** 262,266 **** DocModification(int modificationType_, int position_=0, int length_=0, ! int linesAdded_=0, const char *text_=0) : modificationType(modificationType_), position(position_), --- 265,269 ---- DocModification(int modificationType_, int position_=0, int length_=0, ! int linesAdded_=0, const char *text_=0, int line_=0) : modificationType(modificationType_), position(position_), *************** *** 268,276 **** linesAdded(linesAdded_), text(text_), ! line(0), foldLevelNow(0), foldLevelPrev(0) {} ! DocModification(int modificationType_, const Action &act, int linesAdded_=0) : modificationType(modificationType_), position(act.position / 2), --- 271,279 ---- linesAdded(linesAdded_), text(text_), ! line(line_), foldLevelNow(0), foldLevelPrev(0) {} ! DocModification(int modificationType_, const Action &act, int linesAdded_=0) : modificationType(modificationType_), position(act.position / 2), Index: LexAVE.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/LexAVE.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LexAVE.cxx 22 Dec 2004 20:25:57 -0000 1.1 --- LexAVE.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 13,17 **** #include <stdarg.h> #include <stdio.h> - #include <fcntl.h> #include "Platform.h" --- 13,16 ---- *************** *** 184,188 **** levelCurrent++; } ! if ((strcmp(s, "end") == 0)) { levelCurrent--; } --- 183,189 ---- levelCurrent++; } ! if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) { ! // Normally "elseif" and "then" will be on the same line and will cancel ! // each other out. // As implemented, this does not support fold.at.else. levelCurrent--; } Index: LexHTML.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/LexHTML.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LexHTML.cxx 22 Dec 2004 20:25:58 -0000 1.1 --- LexHTML.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 36,46 **** } ! static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { ! char s[30 + 1]; ! unsigned int i = 0; ! for (; i < end - start + 1 && i < 30; i++) { ! s[i] = static_cast<char>(tolower(styler[start + i])); } s[i] = '\0'; //Platform::DebugPrintf("Scripting indicator [%s]\n", s); if (strstr(s, "src")) // External script --- 36,57 ---- } ! static inline int MakeLowerCase(int ch) { ! if (ch < 'A' || ch > 'Z') ! return ch; ! else ! return ch - 'A' + 'a'; ! } ! ! static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) { ! size_t i = 0; ! for (; (i < end - start + 1) && (i < len-1); i++) { ! s[i] = static_cast<char>(MakeLowerCase(styler[start + i])); } s[i] = '\0'; + } + + static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { + char s[100]; + GetTextSegment(styler, start, end, s, sizeof(s)); //Platform::DebugPrintf("Scripting indicator [%s]\n", s); if (strstr(s, "src")) // External script *************** *** 64,73 **** static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) { int iResult = 0; ! char s[30 + 1]; ! unsigned int i = 0; ! for (; i < end - start + 1 && i < 30; i++) { ! s[i] = static_cast<char>(tolower(styler[start + i])); ! } ! s[i] = '\0'; if (0 == strncmp(s, "php", 3)) { iResult = 3; --- 75,80 ---- static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) { int iResult = 0; ! char s[100]; ! GetTextSegment(styler, start, end, s, sizeof(s)); if (0 == strncmp(s, "php", 3)) { iResult = 3; *************** *** 184,193 **** chAttr = SCE_H_NUMBER; } else { ! char s[30 + 1]; ! unsigned int i = 0; ! for (; i < end - start + 1 && i < 30; i++) { ! s[i] = static_cast<char>(tolower(styler[start + i])); ! } ! s[i] = '\0'; if (keywords.InList(s)) chAttr = SCE_H_ATTRIBUTE; --- 191,196 ---- chAttr = SCE_H_NUMBER; } else { ! char s[100]; ! GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) chAttr = SCE_H_ATTRIBUTE; *************** *** 208,212 **** char ch = styler[cPos]; if ((ch != '<') && (ch != '/')) { ! s[i++] = caseSensitive ? ch : static_cast<char>(tolower(ch)); } } --- 211,215 ---- char ch = styler[cPos]; if ((ch != '<') && (ch != '/')) { ! s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch)); } } *************** *** 271,280 **** chAttr = SCE_HB_NUMBER; else { ! char s[30 + 1]; ! unsigned int i = 0; ! for (; i < end - start + 1 && i < 30; i++) { ! s[i] = static_cast<char>(tolower(styler[start + i])); ! } ! s[i] = '\0'; if (keywords.InList(s)) { chAttr = SCE_HB_WORD; --- 274,279 ---- chAttr = SCE_HB_NUMBER; else { ! char s[100]; ! GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) { chAttr = SCE_HB_WORD; *************** *** 319,328 **** chAttr = SCE_HPHP_NUMBER; else { ! char s[100 + 1]; ! unsigned int i = 0; ! for (; i < end - start + 1 && i < 100; i++) { ! s[i] = static_cast<char>(tolower(styler[start + i])); ! } ! s[i] = '\0'; if (keywords.InList(s)) chAttr = SCE_HPHP_WORD; --- 318,323 ---- chAttr = SCE_HPHP_NUMBER; else { ! char s[100]; ! GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) chAttr = SCE_HPHP_WORD; *************** *** 407,410 **** --- 402,410 ---- } + static bool IsScriptCommentState(const int state) { + return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT || + state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE; + } + static bool isLineEnd(char ch) { return ch == '\r' || ch == '\n'; *************** *** 425,428 **** --- 425,430 ---- static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler) { int j; + while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) + i++; phpStringDelimiter[0] = '\n'; for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) { *************** *** 606,612 **** case SCE_HJ_COMMENT: case SCE_HJ_COMMENTDOC: ! // SCE_HJ_COMMENTLINE removed as this is a common thing done to hide ! // the end of script marker from some JS interpreters. ! //case SCE_HJ_COMMENTLINE: case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: --- 608,613 ---- case SCE_HJ_COMMENT: case SCE_HJ_COMMENTDOC: ! //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide ! // the end of script marker from some JS interpreters. case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: *************** *** 618,621 **** --- 619,635 ---- break; default : + // check if the closing tag is a script tag + if (state == SCE_HJ_COMMENTLINE) { + char tag[7]; // room for the <script> tag + char chr; // current char + int j=0; + chr = styler.SafeGetCharAt(i+2); + while (j < 6 && !isspacechar(chr)) { + tag[j++] = static_cast<char>(MakeLowerCase(chr)); + chr = styler.SafeGetCharAt(i+2+j); + } + tag[j] = '\0'; + if (strcmp(tag, "script") != 0) break; + } // closing tag of the script (it's a closing HTML tag anyway) styler.ColourTo(i - 1, StateToPrint); *************** *** 637,641 **** (state != SCE_HPHP_COMMENT) && (ch == '<') && ! (chNext == '?')) { scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP); if (scriptLanguage != eScriptPHP && isStringState(state)) continue; --- 651,656 ---- (state != SCE_HPHP_COMMENT) && (ch == '<') && ! (chNext == '?') && ! !IsScriptCommentState(state) ) { scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP); if (scriptLanguage != eScriptPHP && isStringState(state)) continue; *************** *** 666,670 **** // handle the start of ASP pre-processor = Non-HTML ! else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) { styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; --- 681,685 ---- // handle the start of ASP pre-processor = Non-HTML ! else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; *************** *** 707,719 **** // handle the start of SGML language (DTD) else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) && ! (chPrev == '<') && ! (ch == '!') && ! (StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint))) { beforePreProc = state; styler.ColourTo(i - 2, StateToPrint); if ((chNext == '-') && (chNext2 == '-')) { state = SCE_H_COMMENT; // wait for a pending command ! } ! else if (isWordCdata(i + 1, i + 7, styler)) { state = SCE_H_CDATA; } else { --- 722,737 ---- // handle the start of SGML language (DTD) else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) && ! (chPrev == '<') && ! (ch == '!') && ! (StateToPrint != SCE_H_CDATA) && ! (!IsCommentState(StateToPrint)) && ! (!IsScriptCommentState(StateToPrint)) ) { beforePreProc = state; styler.ColourTo(i - 2, StateToPrint); if ((chNext == '-') && (chNext2 == '-')) { state = SCE_H_COMMENT; // wait for a pending command ! styler.ColourTo(i + 2, SCE_H_COMMENT); ! i += 2; // follow styling after the -- ! } else if (isWordCdata(i + 1, i + 7, styler)) { state = SCE_H_CDATA; } else { *************** *** 1497,1501 **** break; case SCE_HPHP_NUMBER: ! if (!IsADigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && (ch != '-' || (chPrev != 'e' && chPrev != 'E'))) { styler.ColourTo(i - 1, SCE_HPHP_NUMBER); if (isoperator(ch)) --- 1515,1522 ---- break; case SCE_HPHP_NUMBER: ! // recognize bases 8,10 or 16 integers OR floating-point numbers ! if (!IsADigit(ch) ! && strchr(".xXabcdefABCDEF", ch) == NULL ! && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) { styler.ColourTo(i - 1, SCE_HPHP_NUMBER); if (isoperator(ch)) *************** *** 1947,1950 **** --- 1968,1977 ---- } + static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + if(startPos == 0) initStyle = SCE_HPHP_DEFAULT; + ColouriseHyperTextDoc(startPos,length,initStyle,keywordlists,styler); + } + static const char * const htmlWordListDesc[] = { "HTML elements and attributes", *************** *** 1957,1962 **** --- 1984,2001 ---- }; + static const char * const phpscriptWordListDesc[] = { + "", //Unused + "", //Unused + "", //Unused + "", //Unused + "PHP keywords", + "", //Unused + 0, + }; + LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc); LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc); + // SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead. LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc); LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc); + LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc); Index: LexLua.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/LexLua.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LexLua.cxx 22 Dec 2004 20:25:58 -0000 1.1 --- LexLua.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 13,17 **** #include <stdarg.h> #include <stdio.h> - #include <fcntl.h> #include "Platform.h" --- 13,16 ---- *************** *** 24,36 **** #include "SciLexer.h" ! static inline bool IsAWordChar(const int ch) { ! return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } ! static inline bool IsAWordStart(const int ch) { ! return (ch < 0x80) && (isalnum(ch) || ch == '_'); } ! static inline bool IsANumberChar(const int ch) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. --- 23,38 ---- #include "SciLexer.h" ! // Extended to accept accented characters ! static inline bool IsAWordChar(int ch) { ! return ch >= 0x80 || ! (isalnum(ch) || ch == '.' || ch == '_'); } ! static inline bool IsAWordStart(int ch) { ! return ch >= 0x80 || ! (isalpha(ch) || ch == '_'); } ! static inline bool IsANumberChar(int ch) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. *************** *** 85,89 **** // Do not leak onto next line ! if (initStyle == SCE_LUA_STRINGEOL) { initStyle = SCE_LUA_DEFAULT; } --- 87,91 ---- // Do not leak onto next line ! if (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == SCE_LUA_PREPROCESSOR) { initStyle = SCE_LUA_DEFAULT; } *************** *** 163,173 **** sc.SetState(SCE_LUA_DEFAULT); } ! } else if (sc.state == SCE_LUA_COMMENTLINE ) { if (sc.atLineEnd) { ! sc.SetState(SCE_LUA_DEFAULT); } ! } else if (sc.state == SCE_LUA_PREPROCESSOR ) { if (sc.atLineEnd) { ! sc.SetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_STRING) { --- 165,175 ---- sc.SetState(SCE_LUA_DEFAULT); } ! } else if (sc.state == SCE_LUA_COMMENTLINE) { if (sc.atLineEnd) { ! sc.ForwardSetState(SCE_LUA_DEFAULT); } ! } else if (sc.state == SCE_LUA_PREPROCESSOR) { if (sc.atLineEnd) { ! sc.ForwardSetState(SCE_LUA_DEFAULT); } } else if (sc.state == SCE_LUA_STRING) { *************** *** 268,272 **** bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LUA_WORD) { ! if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') { for (unsigned int j = 0; j < 8; j++) { if (!iswordchar(styler[i + j])) { --- 270,274 ---- bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LUA_WORD) { ! if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { for (unsigned int j = 0; j < 8; j++) { if (!iswordchar(styler[i + j])) { *************** *** 277,284 **** } ! if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) { levelCurrent++; } ! if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) { levelCurrent--; } --- 279,286 ---- } ! if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) { levelCurrent++; } ! if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0) || (strcmp(s, "until") == 0)) { levelCurrent--; } *************** *** 290,293 **** --- 292,301 ---- levelCurrent--; } + } else if (style == SCE_LUA_LITERALSTRING || style == SCE_LUA_COMMENT) { + if (ch == '[') { + levelCurrent++; + } else if (ch == ']') { + levelCurrent--; + } } *************** *** 322,327 **** "String, (table) & math functions", "(coroutines), I/O & system facilities", ! "XXX", ! "XXX", 0 }; --- 330,337 ---- "String, (table) & math functions", "(coroutines), I/O & system facilities", ! "user1", ! "user2", ! "user3", ! "user4", 0 }; Index: ScintillaBase.h =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/ScintillaBase.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ScintillaBase.h 22 Dec 2004 20:25:58 -0000 1.1 --- ScintillaBase.h 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 38,42 **** int listType; ///< 0 is an autocomplete list ! SString userListSelected; ///< Receives listbox selected string #ifdef SCI_LEXER --- 38,45 ---- int listType; ///< 0 is an autocomplete list ! SString listSelected; ///< Receives listbox selected string ! int maxListWidth; /// Maximum width of list, in average character widths ! ! bool performingStyle; ///< Prevent reentrance #ifdef SCI_LEXER Index: KeyWords.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/KeyWords.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** KeyWords.cxx 22 Dec 2004 20:25:57 -0000 1.1 --- KeyWords.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 130,199 **** //++Autogenerated -- run src/LexGen.py to regenerate //**\(\tLINK_LEXER(\*);\n\) - - /* We use the Forth and Null lexer's only (dbu) - LINK_LEXER(lmAda); - LINK_LEXER(lmAPDL); - LINK_LEXER(lmAsm); - LINK_LEXER(lmAns1); - LINK_LEXER(lmAU3); - LINK_LEXER(lmAVE); - LINK_LEXER(lmBaan); - LINK_LEXER(lmBash); - LINK_LEXER(lmBullant); - LINK_LEXER(lmClw); - LINK_LEXER(lmClwNoCase); - LINK_LEXER(lmConf); - LINK_LEXER(lmCPP); - LINK_LEXER(lmCPPNoCase); - LINK_LEXER(lmTCL); - LINK_LEXER(lmNncrontab); - LINK_LEXER(lmCss); - LINK_LEXER(lmEiffel); - LINK_LEXER(lmEiffelkw); - LINK_LEXER(lmErlang); - LINK_LEXER(lmESCRIPT); - LINK_LEXER(lmForth); - LINK_LEXER(lmFortran); - LINK_LEXER(lmF77); - LINK_LEXER(lmGui4Cli); - LINK_LEXER(lmHTML); - LINK_LEXER(lmXML); - LINK_LEXER(lmASP); - LINK_LEXER(lmPHP); - LINK_LEXER(lmKix); - LINK_LEXER(lmLISP); - LINK_LEXER(lmLout); - LINK_LEXER(lmLua); - LINK_LEXER(lmMatlab); - LINK_LEXER(lmOctave); - LINK_LEXER(lmMETAPOST); - LINK_LEXER(lmMMIXAL); - LINK_LEXER(lmLot); - LINK_LEXER(lmMSSQL); - LINK_LEXER(lmNsis); - LINK_LEXER(lmBatch); - LINK_LEXER(lmDiff); - LINK_LEXER(lmProps); - LINK_LEXER(lmMake); - LINK_LEXER(lmErrorList); - LINK_LEXER(lmLatex); - LINK_LEXER(lmNull); - LINK_LEXER(lmPascal); - LINK_LEXER(lmPB); - LINK_LEXER(lmPerl); - LINK_LEXER(lmPOV); - LINK_LEXER(lmPS); - LINK_LEXER(lmPython); - LINK_LEXER(lmRuby); - LINK_LEXER(lmScriptol); - LINK_LEXER(lmSpecman); - LINK_LEXER(lmSQL); - LINK_LEXER(lmTeX); - LINK_LEXER(lmVB); - LINK_LEXER(lmVBScript); - LINK_LEXER(lmVerilog); - LINK_LEXER(lmVHDL); - LINK_LEXER(lmYAML); - */ LINK_LEXER(lmForth); LINK_LEXER(lmNull); --- 130,133 ---- Index: RESearch.h =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/RESearch.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RESearch.h 22 Dec 2004 20:25:58 -0000 1.1 --- RESearch.h 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 21,24 **** --- 21,26 ---- public: virtual char CharAt(int index)=0; + virtual ~CharacterIndexer() { + } }; Index: CellBuffer.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/CellBuffer.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CellBuffer.cxx 22 Dec 2004 20:25:56 -0000 1.1 --- CellBuffer.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 255,265 **** } if (levels) { ! // Level information merges back onto previous line ! int posAbove = pos - 1; ! if (posAbove < 0) ! posAbove = 0; ! for (int j = posAbove; j < lines; j++) { levels[j] = levels[j + 1]; } } lines--; --- 255,266 ---- } if (levels) { ! // Move up following lines but merge header flag from this line ! // to line before to avoid a temporary disappearence causing expansion. ! int firstHeader = levels[pos] & SC_FOLDLEVELHEADERFLAG; ! for (int j = pos; j < lines; j++) { levels[j] = levels[j + 1]; } + if (pos > 0) + levels[pos-1] |= firstHeader; } lines--; *************** *** 1029,1033 **** bool CellBuffer::CanUndo() { ! return (!readOnly) && (uh.CanUndo()); } --- 1030,1034 ---- bool CellBuffer::CanUndo() { ! return uh.CanUndo(); } *************** *** 1057,1061 **** bool CellBuffer::CanRedo() { ! return (!readOnly) && (uh.CanRedo()); } --- 1058,1062 ---- bool CellBuffer::CanRedo() { ! return uh.CanRedo(); } Index: LexMSSQL.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/LexMSSQL.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LexMSSQL.cxx 22 Dec 2004 20:25:58 -0000 1.1 --- LexMSSQL.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 3,7 **** ** Lexer for MSSQL. **/ ! // Copyright 1998-2002 by Filip Yaghob <fy...@eg...> --- 3,7 ---- ** Lexer for MSSQL. **/ ! // By Filip Yaghob <fy...@gm...> *************** *** 28,49 **** #define KW_MSSQL_OPERATORS 6 - //~ val SCE_MSSQL_DEFAULT=0 - //~ val SCE_MSSQL_COMMENT=1 - //~ val SCE_MSSQL_LINE_COMMENT=2 - //~ val SCE_MSSQL_NUMBER=3 - //~ val SCE_MSSQL_STRING=4 - //~ val SCE_MSSQL_OPERATOR=5 - //~ val SCE_MSSQL_IDENTIFIER=6 - //~ val SCE_MSSQL_VARIABLE=7 - //~ val SCE_MSSQL_COLUMN_NAME=8 - //~ val SCE_MSSQL_STATEMENT=9 - //~ val SCE_MSSQL_DATATYPE=10 - //~ val SCE_MSSQL_SYSTABLE=11 - //~ val SCE_MSSQL_GLOBAL_VARIABLE=12 - //~ val SCE_MSSQL_FUNCTION=13 - //~ val SCE_MSSQL_STORED_PROCEDURE=14 - //~ val SCE_MSSQL_DEFAULT_PREF_DATATYPE 15 - //~ val SCE_MSSQL_COLUMN_NAME_2 16 - static bool isMSSQLOperator(char ch) { if (isascii(ch) && isalnum(ch)) --- 28,31 ---- *************** *** 134,153 **** int lineCurrent = styler.GetLine(startPos); int spaceFlags = 0; - /* - WordList &kwStatements = *keywordlists[KW_MSSQL_STATEMENTS]; - WordList &kwDataTypes = *keywordlists[KW_MSSQL_DATA_TYPES]; - WordList &kwSystemTables = *keywordlists[KW_MSSQL_SYSTEM_TABLES]; - WordList &kwGlobalVariables = *keywordlists[KW_MSSQL_GLOBAL_VARIABLES]; - WordList &kwFunctions = *keywordlists[KW_MSSQL_FUNCTIONS]; - char s[100]; - int iixx = 0; - s[0] = 's'; s[1] = 'e'; s[2] = 'l'; s[3] = 'e'; s[4] = 'c'; s[5] = 't'; s[6] = 0; - if (kwStatements.InList(s)) - iixx = 1; - s[0] = 's'; s[1] = 'e'; s[2] = 'r'; s[3] = 'v'; s[4] = 'e'; s[5] = 'r'; s[6] = 'n'; s[7] = 'a'; s[8] = 'm'; s[9] = 'e'; s[10] = 0; - if (kwGlobalVariables.InList(s)) - iixx += 2; - */ int state = initStyle; int prevState = initStyle; --- 116,120 ---- *************** *** 316,319 **** --- 283,349 ---- } + static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT); + char s[10]; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int style = styler.StyleAt(i); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + // Comment folding + if (foldComment) { + if (!inComment && (style == SCE_MSSQL_COMMENT)) + levelCurrent++; + else if (inComment && (style != SCE_MSSQL_COMMENT)) + levelCurrent--; + inComment = (style == SCE_MSSQL_COMMENT); + } + if (style == SCE_MSSQL_STATEMENT) { + // Folding between begin and end + if (ch == 'b' || ch == 'e') { + for (unsigned int j = 0; j < 5; j++) { + if (!iswordchar(styler[i + j])) { + break; + } + s[j] = styler[i + j]; + s[j + 1] = '\0'; + } + if (strcmp(s, "begin") == 0) { + levelCurrent++; + } + if (strcmp(s, "end") == 0) { + levelCurrent--; + } + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + if (!isspacechar(ch)) + visibleChars++; + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); + } + static const char * const sqlWordListDesc[] = { "Statements", *************** *** 327,329 **** }; ! LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", 0, sqlWordListDesc); --- 357,359 ---- }; ! LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", FoldMSSQLDoc, sqlWordListDesc); Index: LexOthers.cxx =================================================================== RCS file: /cvsroot/win32forth/win32forth-extsrc/extsrc/w32fScintilla/src/LexOthers.cxx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LexOthers.cxx 22 Dec 2004 20:25:58 -0000 1.1 --- LexOthers.cxx 3 Sep 2005 10:13:13 -0000 1.2 *************** *** 31,35 **** static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ! ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } --- 31,47 ---- static inline bool AtEOL(Accessor &styler, unsigned int i) { return (styler[i] == '\n') || ! ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); ! } ! ! // Tests for BATCH Operators ! static bool IsBOperator(char ch) { ! return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || ! (ch == '|') || (ch == '?') || (ch == '*'); ! } ! ! // Tests for BATCH Separators ! static bool IsBSeparator(char ch) { ! return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') || ! (ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')'); } *************** *** 42,134 **** Accessor &styler) { ! unsigned int i = 0; ! unsigned int state = SCE_BAT_DEFAULT; ! while ((i < lengthLine) && isspacechar(lineBuffer[i])) { // Skip initial spaces ! i++; ! } ! if (lineBuffer[i] == '@') { // Hide command (ECHO OFF) ! styler.ColourTo(startLine + i, SCE_BAT_HIDE); ! i++; ! while ((i < lengthLine) && isspacechar(lineBuffer[i])) { // Skip next spaces ! i++; ! } } ! if (lineBuffer[i] == ':') { ! // Label ! if (lineBuffer[i + 1] == ':') { ! // :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm styler.ColourTo(endPos, SCE_BAT_COMMENT); ! } else { // Real label styler.ColourTo(endPos, SCE_BAT_LABEL); } ! } else { ! // Check if initial word is a keyword ! char wordBuffer[21]; ! unsigned int wbl = 0, offset = i; ! // Copy word in buffer ! for (; offset < lengthLine && wbl < 20 && !isspacechar(lineBuffer[offset]); wbl++, offset++) { wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); } wordBuffer[wbl] = '\0'; ! // Check if it is a comment if (CompareCaseInsensitive(wordBuffer, "rem") == 0) { styler.ColourTo(endPos, SCE_BAT_COMMENT); ! return ; } ! // Check if it is in the list ! if (keywords.InList(wordBuffer)) { ! styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); // Regular keyword ! } else { ! // Search end of word (can be a long path) ! while (offset < lengthLine && ! !isspacechar(lineBuffer[offset])) { ! offset++; } - styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); // External command / program } ! // Remainder of the line: colourise the variables. ! ! while (offset < lengthLine) { ! if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') { ! styler.ColourTo(startLine + offset - 1, state); ! if (Is0To9(lineBuffer[offset + 1])) { ! styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER); ! offset += 2; ! } else if (lineBuffer[offset + 1] == '%' && ! !isspacechar(lineBuffer[offset + 2])) { ! // Should be safe, as there is CRLF at the end of the line... ! styler.ColourTo(startLine + offset + 2, SCE_BAT_IDENTIFIER); ! offset += 3; } else { ! state = SCE_BAT_IDENTIFIER; } - } else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') { - styler.ColourTo(startLine + offset, state); - state = SCE_BAT_DEFAULT; - } else if (state == SCE_BAT_DEFAULT && - (lineBuffer[offset] == '*' || - lineBuffer[offset] == '?' || - lineBuffer[offset] == '=' || - lineBuffer[offset] == '<' || - lineBuffer[offset] == '>' || - lineBuffer[offset] == '|')) { - styler.ColourTo(startLine + offset - 1, state); - styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR); } offset++; } - // if (endPos > startLine + offset - 1) { - styler.ColourTo(endPos, SCE_BAT_DEFAULT); // Remainder of line, currently not lexed - // } } ! } - // ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL - // IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number) - // FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X - // ToDo: %n (parameters), %EnvironmentVariable% colourising - // ToDo: Colourise = > >> < | " static void ColouriseBatchDoc( --- 54,442 ---- Accessor &styler) { ! unsigned int offset = 0; // Line Buffer Offset ! unsigned int enVarEnd; // Environment Variable End point ! unsigned int cmdLoc; // External Command / Program Location ! char wordBuffer[81]; // Word Buffer - large to catch long paths ! unsigned int wbl; // Word Buffer Length ! unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length ! bool forFound = false; // No Local Variable without FOR statement ! // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords ! // Toggling Regular Keyword Checking off improves readability ! // Other Regular Keywords and External Commands / Programs might also benefit from toggling ! // Need a more robust algorithm to properly toggle Regular Keyword Checking ! bool continueProcessing = true; // Used to toggle Regular Keyword Checking ! // Special Keywords are those that allow certain characters without whitespace after the command ! // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path= ! // Special Keyword Buffer used to determine if the first n characters is a Keyword ! char sKeywordBuffer[10]; // Special Keyword Buffer ! bool sKeywordFound; // Exit Special Keyword for-loop if found ! // Skip initial spaces ! while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { ! offset++; } ! // Colorize Default Text ! styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); ! // Set External Command / Program Location ! cmdLoc = offset; ! ! // Check for Fake Label (Comment) or Real Label - return if found ! if (lineBuffer[offset] == ':') { ! if (lineBuffer[offset + 1] == ':') { ! // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm styler.ColourTo(endPos, SCE_BAT_COMMENT); ! } else { ! // Colorize Real Label styler.ColourTo(endPos, SCE_BAT_LABEL); } ! return; ! // Check for Drive Change (Drive Change is internal command) - return if found ! } else if ((isalpha(lineBuffer[offset])) && ! (lineBuffer[offset + 1] == ':') && ! ((isspacechar(lineBuffer[offset + 2])) || ! (((lineBuffer[offset + 2] == '\\')) && ! (isspacechar(lineBuffer[offset + 3]))))) { ! // Colorize Regular Keyword ! styler.ColourTo(endPos, SCE_BAT_WORD); ! return; ! } ! ! // Check for Hide Command (@ECHO OFF/ON) ! if (lineBuffer[offset] == '@') { ! styler.ColourTo(startLine + offset, SCE_BAT_HIDE); ! offset++; ! // Check for Argument (%n) or Environment Variable (%x...%) ! } else if (lineBuffer[offset] == '%') { ! enVarEnd = offset + 1; ! // Search end of word for second % (can be a long path) ! while ((enVarEnd < lengthLine) && ! (!isspacechar(lineBuffer[enVarEnd])) && ! (lineBuffer[enVarEnd] != '%') && ! (!IsBOperator(lineBuffer[enVarEnd])) && ! (!IsBSeparator(lineBuffer[enVarEnd]))) { ! enVarEnd++; ! } ! // Check for Argument (%n) ! if ((Is0To9(lineBuffer[offset + 1])) && ! (lineBuffer[enVarEnd] != '%')) { ! // Colorize Argument ! styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER); ! offset += 2; ! // Check for External Command / Program ! if (!isspacechar(lineBuffer[offset])) { ! cmdLoc = offset; ! } ! // Check for Environment Variable (%x...%) ! } else if ((lineBuffer[offset + 1] != '%') && ! (lineBuffer[enVarEnd] == '%')) { ! offset = enVarEnd; ! // Colorize Environment Variable ! styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER); ! offset++; ! // Check for External Command / Program ! if (!isspacechar(lineBuffer[offset])) { ! cmdLoc = offset; ! } ! } ! } ! // Skip next spaces ! while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { ! offset++; ! } ! ! // Read remainder of line word-at-a-time or remainder-of-word-at-a-time ! while (offset < lengthLine) { ! if (offset > startLine) { ! // Colorize Default Text ! styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); ! } ! // Copy word from Line Buffer into Word Buffer ! wbl = 0; ! for (; offset < lengthLine && wbl < 80 && !isspacechar(lineBuffer[offset]); wbl++, offset++) { wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); } wordBuffer[wbl] = '\0'; ! wbo = 0; ! ! // Check for Comment - return if found if (CompareCaseInsensitive(wordBuffer, "rem") == 0) { styler.ColourTo(endPos, SCE_BAT_COMMENT); ! return; } ! // Check for Separator ! if (IsBSeparator(wordBuffer[0])) { ! // Check for External Command / Program ! if ((cmdLoc == offset - wbl) && ! ((wordBuffer[0] == ':') || ! (wordBuffer[0] == '\\') || ! (wordBuffer[0] == '.'))) { ! // Reset Offset to re-process remainder of word ! offset -= (wbl - 1); ! // Colorize External Command / Program ! styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); ! // Reset External Command / Program Location ! cmdLoc = offset; ! } else { ! // Reset Offset to re-process remainder of word ! offset -= (wbl - 1); ! // Colorize Default Text ! styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); ! } ! // Check for Regular Keyword in list ! } else if ((keywords.InList(wordBuffer)) && ! (continueProcessing)) { ! // Local Variables do not exist if no FOR statement ! if (CompareCaseInsensitive(wordBuffer, "for") == 0) { ! forFound = true; ! } ! // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking ! if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || ! (CompareCaseInsensitive(wordBuffer, "goto") == 0) || ! (CompareCaseInsensitive(wordBuffer, "prompt") == 0) || ! (CompareCaseInsensitive(wordBuffer, "set") == 0)) { ! continueProcessing = false; ! } ! // Identify External Command / Program Location for ERRORLEVEL, and EXIST ! if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) || ! (CompareCaseInsensitive(wordBuffer, "exist") == 0)) { ! // Reset External Command / Program Location ! cmdLoc = offset; ! // Skip next spaces ! while ((cmdLoc < lengthLine) && ! (isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! // Skip comparison ! while ((cmdLoc < lengthLine) && ! (!isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! // Skip next spaces ! while ((cmdLoc < lengthLine) && ! (isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH ! } else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) || ! (CompareCaseInsensitive(wordBuffer, "do") == 0) || ! (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) || ! (CompareCaseInsensitive(wordBuffer, "lh") == 0)) { ! // Reset External Command / Program Location ! cmdLoc = offset; ! // Skip next spaces ! while ((cmdLoc < lengthLine) && ! (isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! } ! // Colorize Regular keyword ! styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); ! // No need to Reset Offset ! // Check for Special Keyword in list, External Command / Program, or Default Text ! } else if ((wordBuffer[0] != '%') && ! (!IsBOperator(wordBuffer[0])) && ! (continueProcessing)) { ! // Check for Special Keyword ! // Affected Commands are in Length range 2-6 ! // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected ! sKeywordFound = false; ! for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { ! wbo = 0; ! // Copy Keyword Length from Word Buffer into Special Keyword Buffer ! for (; wbo < keywordLength; wbo++) { ! sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]); ! } ! sKeywordBuffer[wbo] = '\0'; ! // Check for Special Keyword in list ! if ((keywords.InList(sKeywordBuffer)) && ! ((IsBOperator(wordBuffer[wbo])) || ! (IsBSeparator(wordBuffer[wbo])))) { ! sKeywordFound = true; ! // ECHO requires no further Regular Keyword Checking ! if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) { ! continueProcessing = false; ! } ! // Colorize Special Keyword as Regular Keyword ! styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD); ! // Reset Offset to re-process remainder of word ! offset -= (wbl - wbo); } } ! // Check for External Command / Program or Default Text ! if (!sKeywordFound) { ! wbo = 0; ! // Check for External Command / Program ! if (cmdLoc == offset - wbl) { ! // Read up to %, Operator or Separator ! while ((wbo < wbl) && ! (wordBuffer[wbo] != '%') && ! (!IsBOperator(wordBuffer[wbo])) && ! (!IsBSeparator(wordBuffer[wbo]))) { ! wbo++; ! } ! // Reset External Command / Program Location ! cmdLoc = offset - (wbl - wbo); ! // Reset Offset to re-process remainder of word ! offset -= (wbl - wbo); ! // CHOICE requires no further Regular Keyword Checking ! if (CompareCaseInsensitive(wordBuffer, "choice") == 0) { ! continueProcessing = false; ! } ! // Check for START (and its switches) - What follows is External Command \ Program ! if (CompareCaseInsensitive(wordBuffer, "start") == 0) { ! // Reset External Command / Program Location ! cmdLoc = offset; ! // Skip next spaces ! while ((cmdLoc < lengthLine) && ! (isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! // Reset External Command / Program Location if command switch detected ! if (lineBuffer[cmdLoc] == '/') { ! // Skip command switch ! while ((cmdLoc < lengthLine) && ! (!isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! // Skip next spaces ! while ((cmdLoc < lengthLine) && ! (isspacechar(lineBuffer[cmdLoc]))) { ! cmdLoc++; ! } ! } ! } ! // Colorize External command / program ! styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); ! // No need to Reset Offset ! // Check for Default Text } else { ! // Read up to %, Operator or Separator ! while ((wbo < wbl) && ! (wordBuffer[wbo] != '%') && ! (!IsBOperator(wordBuffer[wbo])) && ! (!IsBSeparator(wordBuffer[wbo]))) { ! wbo++; ! } ! // Colorize Default Text ! styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); ! // Reset Offset to re-process remainder of word ! offset -= (wbl - wbo); } } + // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a) + } else if (wordBuffer[0] == '%') { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + wbo++; + // Search to end of word for second % (can be a long path) + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Check for Argument (%n) + if ((Is0To9(wordBuffer[1])) && + (wordBuffer[wbo] != '%')) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 2); + } + // Colorize Argument + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Environment Variable (%x...%) + } else if ((wordBuffer[1] != '%') && + (wordBuffer[wbo] == '%')) { + wbo++; + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - wbo); + } + // Colorize Environment Variable + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + // Check for Local Variable (%%a) + } else if ((forFound) && + (wordBuffer[1] == '%') && + (wordBuffer[2] != '%') && + (!IsBOperator(wordBuffer[2])) && + (!IsBSeparator(wordBuffer[2]))) { + // Check for External Command / Program + if (cmdLoc == offset - wbl) { + cmdLoc = offset - (wbl - 3); + } + // Colorize Local Variable + styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER); + // Reset Offset to re-process remainder of word + offset -= (wbl - 3); + } + // Check for Operator + } else if (IsBOperator(wordBuffer[0])) { + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); + // Check for Comparison Operator + if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) { + // Identify External Command / Program Location for IF + cmdLoc = offset; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Comparison Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 2); + // Check for Pipe Operator + } else if (wordBuffer[0] == '|') { + // Reset External Command / Program Location + cmdLoc = offset - wbl + 1; + // Skip next spaces + while ((cmdLoc < lengthLine) && + (isspacechar(lineBuffer[cmdLoc]))) { + cmdLoc++; + } + // Colorize Pipe Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + // Check for Other Operator + } else { + // Check for > Operator + if (wordBuffer[0] == '>') { + // Turn Keyword and External Command / Program checking back on + continueProcessing = true; + } + // Colorize Other Operator + styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); + // Reset Offset to re-process remainder of word + offset -= (wbl - 1); + } + // Check for Default Text + } else { + // Read up to %, Operator or Separator + while ((wbo < wbl) && + (wordBuffer[wbo] != '%') && + (!IsBOperator(wordBuffer[wbo])) && + (!IsBSeparator(wordBuffer[wbo]))) { + wbo++; + } + // Colorize Default Text + styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); + // Reset Offset to re-process remainder of word + offset -= (wbl - wbo); + } + // Skip next spaces - nothing happens if Offset was Reset + while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } } ! // Colorize Default Text for remainder of line - currently not lexed ! styler.ColourTo(endPos, SCE_BAT_DEFAULT); } static void ColouriseBatchDoc( *************** *** 241,245 **** if (prevLevel & SC_FOLDLEVELHEADERFLAG) nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; ! int lineType = styler.StyleAt(curLineStart); if (lineType == SCE_DIFF_COMMAND) --- 549,553 ---- if (prevLevel & SC_FOLDLEVELHEADERFLAG) nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; ! int lineType = styler.StyleAt(curLineStart); if (lineType == SCE_DIFF_COMMAND) *************** *** 249,253 **** } else if (lineType == SCE_DIFF_POSITION) nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG; ! if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); --- 557,561 ---- } else if (lineType == SCE_DIFF_POSITION) nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG; ! if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); *************** *** 255,259 **** styler.SetLevel(curLine, nextLevel); prevLevel = nextLevel; ! curLineStart = styler.LineStart(++curLine); } while (static_cast<int>(startPos) + length > curLineStart); --- 563,567 ---- styler.SetLevel(curLine, nextLevel); prevLevel = nextLevel; ! curLineStart = styler.LineStart(++curLine); } while (static_cast<int>(startPos) + length > curLineStart); *************** *** 373,377 **** lineCurrent++; visibleChars = 0; ! headerPoint=false; } if (!isspacechar(ch)) --- 681,685 ---- lineCurrent++; visibleChars = 0; ! headerPoint = false; } if (!isspacechar(ch)) *************** *** 476,527 **** } ! static bool strstart(char *haystack, char *needle) { return strncmp(haystack, needle, strlen(needle)) == 0; } ! static void ColouriseErrorListLine( ! char *lineBuffer, ! unsigned int lengthLine, ! // unsigned int startLine, ! unsigned int endPos, ! Accessor &styler) { ! const int unRecognized = 99; if (lineBuffer[0] == '>') { // Command or return status ! styler.ColourTo(endPos, SCE_ERR_CMD); } else if (lineBuffer[0] == '<') { // Diff removal, but not interested. Trapped to avoid hitting CTAG cases. ! styler.ColourTo(endPos, SCE_ERR_DEFAULT); } else if (lineBuffer[0] == '!') { ! styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED); } else if (lineBuffer[0] == '+') { ! styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION); ! } else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') { ! styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE); } else if (lineBuffer[0] == '-') { ! styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION); } else if (strstart(lineBuffer, "cf90-")) { // Absoft Pro Fortran 90/95 v8.2 error and/or warning message ! styler.ColourTo(endPos, SCE_ERR_ABSF); } else if (strstart(lineBuffer, "fortcom:")) { // Intel Fortran Compiler v8.0 error/warning message ! styler.ColourTo(endPos, SCE_ERR_IFORT); } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { ! styler.ColourTo(endPos, SCE_ERR_PYTHON); } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) { ! styler.ColourTo(endPos, 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 ! styler.ColourTo(endPos, SCE_ERR_IFC); } else if (strstart(lineBuffer, "Error ")) { // Borland error message ! styler.ColourTo(endPos, SCE_ERR_BORLAND); } else if (strstart(lineBuffer, "Warning ")) { // Borland warning message ! styler.ColourTo(endPos, SCE_ERR_BORLAND); } else if (strstr(lineBuffer, "at line " ) && (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) && --- 784,835 ---- } ! 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)) && *************** *** 529,571 **** (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { // Lua 4 error message ! styler.ColourTo(endPos, 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 ! styler.ColourTo(endPos, SCE_ERR_PERL); } else if ((memcmp(lineBuffer, " at ", 6) == 0) && ! strstr(lineBuffer, ":line ")) { // A .NET traceback ! styler.ColourTo(endPos, SCE_ERR_NET); } else if (strstart(lineBuffer, "Line ") && ! strstr(lineBuffer, ", file ")) { // Essential Lahey Fortran error message ! styler.ColourTo(endPos, SCE_ERR_ELF); } else if (strstart(lineBuffer, "line ") && ! strstr(lineBuffer, " column ")) { // HTML tidy style: line 42 column 1 ! styler.ColourTo(endPos, SCE_ERR_TIDY); } else if (strstart(lineBuffer, "\tat ") && ! strstr(lineBuffer, "(") && ! strstr(lineBuffer, ".java:")) { // Java stack back trace ! styler.ColourTo(endPos, SCE_ERR_JAVA_STACK); } else { ! // Look for GCC <filename>:<line>:message ! // Look for Microsoft <filename>(line) :message ! // Look for Microsoft <filename>(line,pos)message ! // Look for CTags \tmessage ! // Look for Lua 5 traceback \t<filename>:<line>:message bool initialTab = (lineBuffer[0] == '\t'); ! int state = 0; for (unsigned int i = 0; i < lengthLine; i++) { char ch = lineBuffer[i]; char chNext = ' '; ! if ((i+1) < lengthLine) ! chNext = lineBuffer[i+1]; ! if (state == 0) { if (ch == ':') { // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix) --- 837,887 ---- (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) *************** *** 573,645 **** // This check is not completely accurate as may be on // GTK+ with a file name that includes ':'. ! state = 1; } } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) { // May be Microsoft // Check against '0' often removes phone numbers ! state = 10; } else if ((ch == '\t') && (!initialTab)) { // May be CTags ! state = 20; } ! } else if (state == 1) { ! state = Is1To9(ch) ? 2 : unRecognized; ! } else if (state == 2) { if (ch == ':') { ! state = 3; // :9.*: is GCC break; } else if (!Is0To9(ch)) { ! state = unRecognized; } ! } else if (state == 10) { ! state = Is0To9(ch) ? 11 : unRecognized; ! } else if (state == 11) { if (ch == ',') { ! state = 14; } else if (ch == ')') { ! state = 12; } else if ((ch != ' ') && !Is0To9(ch)) { ! state = unRecognized; } ! } else if (state == 12) { if ((ch == ' ') && (chNext == ':')) { ! state = 13; } else { ! state = unRecognized; } ! } else if (state == 14) { if (ch == ')') { ! state = 15; break; } else if ((ch != ' ') && !Is0To9(ch)) { ! state = unRecognized; } ! } else if (state == 20) { ! if ((lineBuffer[i-1] == '\t') && ! ((ch == '/' && lineBuffer[i+1] == '^') || Is0To9(ch))) { ! state = 24; break; ! } else if ((ch == '/') && (lineBuffer[i+1] == '^')) { ! state = 21; } ! } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) { ! state = 22; break; } } ! if (state == 3) { ! styler.ColourTo(endPos, SCE_ERR_GCC); ! } else if ((state == 13) || (state == 14) || (state == 15)) { ! styler.ColourTo(endPos, SCE_ERR_MS); ! } else if ((state == 22) || (state == 24)) { ! styler.ColourTo(endPos, SCE_ERR_CTAG); } else { ! styler.ColourTo(endPos, SCE_ERR_DEFAULT); } } } static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { ! char lineBuffer[1024]; styler.StartAt(startPos); styler.StartSegment(startPos); --- 889,988 ---- // This check i... [truncated message content] |