Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\LexOthers.cxx
Last modified2005-03-21 12:17:54.000 +0100
Size25.2 Kb (788 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\LexOthers.cxx
Last modified2006-03-16 13:07:08.000 +0100
Size37.6 Kb (1131 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged74632
Inserted266
Deleted39
Ignored00
Changed68580



   Comparison Details  

29 skipped lines
30U30U 
31U31Ustatic inline bool AtEOL(Accessor &styler, unsigned int i) {
32U32U    return (styler[i] == '\n') ||
33C        ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); 33C           ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
  34C}
  35C 
  36C// Tests for BATCH Operators
  37Cstatic bool IsBOperator(char ch) {
  38C    return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') ||
  39C        (ch == '|') || (ch == '?') || (ch == '*');
  40C}
  41C 
  42C// Tests for BATCH Separators
  43Cstatic bool IsBSeparator(char ch) {
  44C    return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
  45C        (ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
34U46U}
35U47U 
36U48Ustatic void ColouriseBatchLine(
4 skipped lines
41U53U    WordList &keywords,
42U54U    Accessor &styler) {
43U55U 
44C    unsigned int i = 0; 56C    unsigned int offset = 0;// Line Buffer Offset
  57C    unsigned int enVarEnd;  // Environment Variable End point
  58C    unsigned int cmdLoc;// External Command / Program Location
  59C    char wordBuffer[81];// Word Buffer - large to catch long paths
  60C    unsigned int wbl;   // Word Buffer Length
45C    unsigned int state = SCE_BAT_DEFAULT; 61C    unsigned int wbo;   // Word Buffer Offset - also Special Keyword Buffer Length
  62C    bool forFound = false;  // No Local Variable without FOR statement
  63C    // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
  64C    //   Toggling Regular Keyword Checking off improves readability
  65C    // Other Regular Keywords and External Commands / Programs might also benefit from toggling
  66C    //   Need a more robust algorithm to properly toggle Regular Keyword Checking
  67C    bool continueProcessing = true;   // Used to toggle Regular Keyword Checking
  68C    // Special Keywords are those that allow certain characters without whitespace after the command
  69C    // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path=
  70C    // Special Keyword Buffer used to determine if the first n characters is a Keyword
  71C    char sKeywordBuffer[10];// Special Keyword Buffer
  72C    bool sKeywordFound;     // Exit Special Keyword for-loop if found
46U73U 
47C    while ((i < lengthLine) && isspacechar(lineBuffer[i])) {// Skip initial spaces 74C    // Skip initial spaces
48C        i++;  
49C    }  
50C    if (lineBuffer[i] == '@') {   // Hide command (ECHO OFF)  
51C        styler.ColourTo(startLine + i, SCE_BAT_HIDE);  
52C        i++;  
53C        while ((i < lengthLine) && isspacechar(lineBuffer[i])) {// Skip next spaces 75C    while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
54C        i++; 76C        offset++;
55C        }  
56U77U    }
  78C    // Colorize Default Text
  79C    styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
  80C    // Set External Command / Program Location
  81C    cmdLoc = offset;
  82C 
  83C    // Check for Fake Label (Comment) or Real Label - return if found
57C    if (lineBuffer[i] == ':') { 84C    if (lineBuffer[offset] == ':') {
58C        // Label  
59C        if (lineBuffer[i + 1] == ':') { 85C        if (lineBuffer[offset + 1] == ':') {
60C        // :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm 86C        // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
61U87U        styler.ColourTo(endPos, SCE_BAT_COMMENT);
62C        } else {// Real label 88C        } else {
  89C        // Colorize Real Label
63U90U        styler.ColourTo(endPos, SCE_BAT_LABEL);
64U91U        }
  92C        return;
  93C    // Check for Drive Change (Drive Change is internal command) - return if found
65C    } else { 94C    } else if ((isalpha(lineBuffer[offset])) &&
  95C        (lineBuffer[offset + 1] == ':') &&
  96C        ((isspacechar(lineBuffer[offset + 2])) ||
  97C        (((lineBuffer[offset + 2] == '\\')) &&
  98C        (isspacechar(lineBuffer[offset + 3]))))) {
  99C        // Colorize Regular Keyword
  100C        styler.ColourTo(endPos, SCE_BAT_WORD);
  101C        return;
  102C    }
  103C 
66C        // Check if initial word is a keyword 104C    // Check for Hide Command (@ECHO OFF/ON)
67C        char wordBuffer[21]; 105C    if (lineBuffer[offset] == '@') {
68C        unsigned int wbl = 0, offset = i; 106C        styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
69C        // Copy word in buffer 107C        offset++;
  108C    // Check for Argument (%n) or Environment Variable (%x...%)
  109C    } else if (lineBuffer[offset] == '%') {
  110C        enVarEnd = offset + 1;
  111C        // Search end of word for second % (can be a long path)
  112C        while ((enVarEnd < lengthLine) &&
  113C        (!isspacechar(lineBuffer[enVarEnd])) &&
  114C        (lineBuffer[enVarEnd] != '%') &&
  115C        (!IsBOperator(lineBuffer[enVarEnd])) &&
  116C        (!IsBSeparator(lineBuffer[enVarEnd]))) {
  117C        enVarEnd++;
27 skipped lines
  145C    }
  146C 
  147C    // Read remainder of line word-at-a-time or remainder-of-word-at-a-time
  148C    while (offset < lengthLine) {
  149C        if (offset > startLine) {
  150C        // Colorize Default Text
  151C        styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
  152C        }
  153C        // Copy word from Line Buffer into Word Buffer
  154C        wbl = 0;
70C        for (; offset < lengthLine && wbl < 20 && 155C        for (; offset < lengthLine && wbl < 80 &&
71U156U                !isspacechar(lineBuffer[offset]); wbl++, offset++) {
72U157U        wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
73U158U        }
74U159U        wordBuffer[wbl] = '\0';
  160C        wbo = 0;
  161C 
75C        // Check if it is a comment 162C        // Check for Comment - return if found
76U163U        if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
77U164U        styler.ColourTo(endPos, SCE_BAT_COMMENT);
78C        return ; 165C        return;
79U166U        }
80C        // Check if it is in the list 167C        // Check for Separator
  168C        if (IsBSeparator(wordBuffer[0])) {
  169C        // Check for External Command / Program
  170C        if ((cmdLoc == offset - wbl) &&
  171C        ((wordBuffer[0] == ':') ||
  172C        (wordBuffer[0] == '\\') ||
81C        if (keywords.InList(wordBuffer)) { 173C        (wordBuffer[0] == '.'))) {
  174C        // Reset Offset to re-process remainder of word
  175C        offset -= (wbl - 1);
  176C        // Colorize External Command / Program
82C        styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);  // Regular keyword 177C        styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
  178C        // Reset External Command / Program Location
  179C        cmdLoc = offset;
83C        } else { 180C        } else {
84C        // Search end of word (can be a long path) 181C        // Reset Offset to re-process remainder of word
  182C        offset -= (wbl - 1);
  183C        // Colorize Default Text
  184C        styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
  185C        }
  186C        // Check for Regular Keyword in list
85C        while (offset < lengthLine && 187C        } else if ((keywords.InList(wordBuffer)) &&
  188C        (continueProcessing)) {
  189C        // Local Variables do not exist if no FOR statement
86C                !isspacechar(lineBuffer[offset])) { 190C        if (CompareCaseInsensitive(wordBuffer, "for") == 0{
  191C        forFound = true;
  192C        }
  193C        // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
  194C        if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
  195C        (CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
  196C        (CompareCaseInsensitive(wordBuffer, "prompt") == 0) ||
  197C        (CompareCaseInsensitive(wordBuffer, "set") == 0)) {
  198C        continueProcessing = false;
  199C        }
  200C        // Identify External Command / Program Location for ERRORLEVEL, and EXIST
52 skipped lines
  253C        ((IsBOperator(wordBuffer[wbo])) ||
  254C        (IsBSeparator(wordBuffer[wbo])))) {
  255C        sKeywordFound = true;
  256C        // ECHO requires no further Regular Keyword Checking
  257C        if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) {
  258C        continueProcessing = false;
  259C        }
  260C        // Colorize Special Keyword as Regular Keyword
  261C        styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD);
  262C        // Reset Offset to re-process remainder of word
87C        offset++; 263C        offset -= (wbl - wbo);
88U264U        }
89R        styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); // External command / program  
90U265U        }
91C        // Remainder of the line: colourise the variables. 266C        // Check for External Command / Program or Default Text
92C  267C        if (!sKeywordFound) {
  268C        wbo = 0;
  269C        // Check for External Command / Program
93C        while (offset lengthLine{ 270C        if (cmdLoc == offset - wbl{
  271C        // Read up to %, Operator or Separator
  272C        while ((wbo < wbl) &&
94C        if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') { 273C        (wordBuffer[wbo] != '%') &&
  274C        (!IsBOperator(wordBuffer[wbo])) &&
  275C        (!IsBSeparator(wordBuffer[wbo]))) {
  276C        wbo++;
  277C        }
  278C        // Reset External Command / Program Location
95C        styler.ColourTo(startLine + offset - 1, state); 279C        cmdLoc = offset (wbl - wbo);
  280C        // Reset Offset to re-process remainder of word
  281C        offset -= (wbl - wbo);
  282C        // CHOICE requires no further Regular Keyword Checking
96C        if (Is0To9(lineBuffer[offset + 1])) { 283C        if (CompareCaseInsensitive(wordBuffer, "choice") == 0) {
97C        styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER); 284C        continueProcessing = false;
98C        offset += 2; 285C        }
  286C        // Check for START (and its switches) - What follows is External Command \ Program
  287C        if (CompareCaseInsensitive(wordBuffer, "start") == 0) {
  288C        // Reset External Command / Program Location
  289C        cmdLoc = offset;
  290C        // Skip next spaces
  291C        while ((cmdLoc < lengthLine) &&
99C        } else if (lineBuffer[offset + 1] == '%' && 292C        (isspacechar(lineBuffer[cmdLoc]))) {
  293C        cmdLoc++;
  294C        }
  295C        // Reset External Command / Program Location if command switch detected
  296C        if (lineBuffer[cmdLoc] == '/') {
  297C        // Skip command switch
  298C        while ((cmdLoc < lengthLine) &&
100C                   !isspacechar(lineBuffer[offset + 2])) { 299C        (!isspacechar(lineBuffer[cmdLoc]))) {
101C        // Should be safe, as there is CRLF at the end of the line... 300C        cmdLoc++;
  301C        }
  302C        // Skip next spaces
  303C        while ((cmdLoc < lengthLine) &&
  304C        (isspacechar(lineBuffer[cmdLoc]))) {
  305C        cmdLoc++;
  306C        }
  307C        }
  308C        }
  309C        // Colorize External command / program
102C        styler.ColourTo(startLine + offset + 2SCE_BAT_IDENTIFIER); 310C        styler.ColourTo(startLine + offset - 1SCE_BAT_COMMAND);
103C        offset += 3; 311C        // No need to Reset Offset
  312C        // Check for Default Text
104U313U        } else {
  314C        // Read up to %, Operator or Separator
  315C        while ((wbo < wbl) &&
  316C        (wordBuffer[wbo] != '%') &&
  317C        (!IsBOperator(wordBuffer[wbo])) &&
  318C        (!IsBSeparator(wordBuffer[wbo]))) {
  319C        wbo++;
  320C        }
  321C        // Colorize Default Text
  322C        styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
  323C        // Reset Offset to re-process remainder of word
25 skipped lines
  349C        offset -= (wbl - 2);
  350C        // Check for Environment Variable (%x...%)
  351C        } else if ((wordBuffer[1] != '%') &&
  352C        (wordBuffer[wbo] == '%')) {
  353C        wbo++;
  354C        // Check for External Command / Program
  355C        if (cmdLoc == offset - wbl) {
  356C        cmdLoc = offset - (wbl - wbo);
  357C        }
  358C        // Colorize Environment Variable
105C        state = SCE_BAT_IDENTIFIER; 359C        styler.ColourTo(startLine + offset - 1 - (wbl - wbo)SCE_BAT_IDENTIFIER);
  360C        // Reset Offset to re-process remainder of word
  361C        offset -= (wbl - wbo);
  362C        // Check for Local Variable (%%a)
  363C        } else if ((forFound) &&
  364C        (wordBuffer[1] == '%') &&
  365C        (wordBuffer[2] != '%') &&
  366C        (!IsBOperator(wordBuffer[2])) &&
  367C        (!IsBSeparator(wordBuffer[2]))) {
  368C        // Check for External Command / Program
  369C        if (cmdLoc == offset - wbl) {
  370C        cmdLoc = offset - (wbl - 3);
106U371U        }
107C        } else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') { 372C        // Colorize Local Variable
108C        styler.ColourTo(startLine + offset, state); 373C        styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER);
109C        state = SCE_BAT_DEFAULT; 374C        // Reset Offset to re-process remainder of word
110C        } else if (state == SCE_BAT_DEFAULT &&  
111C                   (lineBuffer[offset] == '*' ||  
112C                    lineBuffer[offset] == '?' ||  
113C                    lineBuffer[offset] == '=' ||  
114C                    lineBuffer[offset] == '<' ||  
115C                    lineBuffer[offset] == '>' ||  
116C                    lineBuffer[offset] == '|')) {  
117C        styler.ColourTo(startLine + offset - 1, state); 375C        offset -= (wbl - 3);
118C        styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR);  
119U376U        }
  377A        // Check for Operator
  378A        } else if (IsBOperator(wordBuffer[0])) {
  379A        // Colorize Default Text
  380A        styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
  381A        // Check for Comparison Operator
48 skipped lines
  430A        // Reset Offset to re-process remainder of word
  431A        offset -= (wbl - wbo);
  432A        }
  433A        // Skip next spaces - nothing happens if Offset was Reset
  434A        while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
120U435U        offset++;
121U436U        }
122R        //  if (endPos > startLine + offset - 1) {  
123R        styler.ColourTo(endPos, SCE_BAT_DEFAULT);   // Remainder of line, currently not lexed  
124R        //  }  
125U437U    }
126C  438C    // Colorize Default Text for remainder of line - currently not lexed
  439C    styler.ColourTo(endPos, SCE_BAT_DEFAULT);
127U440U}
128R// ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL  
129R// IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number)  
130R// FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X  
131R// ToDo: %n (parameters), %EnvironmentVariable% colourising  
132R// ToDo: Colourise = > >> < | "  
133U441U 
134U442Ustatic void ColouriseBatchDoc(
135U443U    unsigned int startPos,
104 skipped lines
240U548U        int nextLevel = prevLevel;
241U549U        if (prevLevel & SC_FOLDLEVELHEADERFLAG)
242U550U        nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
243C          551C 
244U552U        int lineType = styler.StyleAt(curLineStart);
245U553U        if (lineType == SCE_DIFF_COMMAND)
246U554U        nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG;
1 skipped line
248U556U        nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
249U557U        } else if (lineType == SCE_DIFF_POSITION)
250U558U        nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG;
251C          559C 
252U560U        if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel))
253U561U        styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG);
254U562U 
255U563U        styler.SetLevel(curLine, nextLevel);
256U564U        prevLevel = nextLevel;
257C          565C 
258U566U        curLineStart = styler.LineStart(++curLine);
259U567U    } while (static_cast<int>(startPos) + length > curLineStart);
260U568U}
111 skipped lines
372U680U 
373U681U        lineCurrent++;
374U682U        visibleChars = 0;
375C        headerPoint=false; 683C        headerPoint = false;
376U684U        }
377U685U        if (!isspacechar(ch))
378U686U        visibleChars++;
96 skipped lines
475U783U    }
476U784U}
477U785U 
478Cstatic bool strstart(char *haystack, char *needle) { 786Cstatic bool strstart(const char *haystack, const char *needle) {
479U787U    return strncmp(haystack, needle, strlen(needle)) == 0;
480U788U}
481U789U 
482Cstatic void ColouriseErrorListLine(  
483C    char *lineBuffer,  
484C    unsigned int lengthLine,  
485C    //  unsigned int startLine,  
486C    unsigned int endPos, 790Cstatic int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine) {
487C    Accessor &styler) {  
488C    const int unRecognized = 99;  
489U791U    if (lineBuffer[0] == '>') {
490U792U        // Command or return status
491C        styler.ColourTo(endPos, SCE_ERR_CMD); 793C        return SCE_ERR_CMD;
492U794U    } else if (lineBuffer[0] == '<') {
493U795U        // Diff removal, but not interested. Trapped to avoid hitting CTAG cases.
494C        styler.ColourTo(endPos, SCE_ERR_DEFAULT); 796C        return SCE_ERR_DEFAULT;
495U797U    } else if (lineBuffer[0] == '!') {
496C        styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED); 798C        return SCE_ERR_DIFF_CHANGED;
497U799U    } else if (lineBuffer[0] == '+') {
  800C        if (strstart(lineBuffer, "+++ ")) {
498C        styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION); 801C        return SCE_ERR_DIFF_MESSAGE;
499C    } else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') { 802C        } else {
500C        styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE); 803C        return SCE_ERR_DIFF_ADDITION;
  804C        }
501U805U    } else if (lineBuffer[0] == '-') {
  806C        if (strstart(lineBuffer, "--- ")) {
  807C        return SCE_ERR_DIFF_MESSAGE;
  808C        } else {
502C        styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION); 809C        return SCE_ERR_DIFF_DELETION;
  810C        }
503U811U    } else if (strstart(lineBuffer, "cf90-")) {
504U812U        // Absoft Pro Fortran 90/95 v8.2 error and/or warning message
505C        styler.ColourTo(endPos, SCE_ERR_ABSF); 813C        return SCE_ERR_ABSF;
506U814U    } else if (strstart(lineBuffer, "fortcom:")) {
507U815U        // Intel Fortran Compiler v8.0 error/warning message
508C        styler.ColourTo(endPos, SCE_ERR_IFORT); 816C        return SCE_ERR_IFORT;
509U817U    } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
510C        styler.ColourTo(endPos, SCE_ERR_PYTHON); 818C        return SCE_ERR_PYTHON;
511U819U    } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
512C        styler.ColourTo(endPos, SCE_ERR_PHP); 820C        return SCE_ERR_PHP;
513U821U    } else if ((strstart(lineBuffer, "Error ") ||
514C        strstart(lineBuffer, "Warning ")) && 822C                strstart(lineBuffer, "Warning ")) &&
515C        strstr(lineBuffer, " at (") && 823C               strstr(lineBuffer, " at (") &&
516C        strstr(lineBuffer, ") : ") && 824C               strstr(lineBuffer, ") : ") &&
517C        (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) { 825C               (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
518U826U        // Intel Fortran Compiler error/warning message
519C        styler.ColourTo(endPos, SCE_ERR_IFC); 827C        return SCE_ERR_IFC;
520U828U    } else if (strstart(lineBuffer, "Error ")) {
521U829U        // Borland error message
522C        styler.ColourTo(endPos, SCE_ERR_BORLAND); 830C        return SCE_ERR_BORLAND;
523U831U    } else if (strstart(lineBuffer, "Warning ")) {
524U832U        // Borland warning message
525C        styler.ColourTo(endPos, SCE_ERR_BORLAND); 833C        return SCE_ERR_BORLAND;
526U834U    } else if (strstr(lineBuffer, "at line " ) &&
527U835U               (strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) &&
528U836U               strstr(lineBuffer, "file ") &&
529U837U               (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {
530U838U        // Lua 4 error message
531C        styler.ColourTo(endPos, SCE_ERR_LUA); 839C        return SCE_ERR_LUA;
532U840U    } else if (strstr(lineBuffer, " at " ) &&
533U841U               (strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) &&
534U842U               strstr(lineBuffer, " line ") &&
535U843U               (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
536C           (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) { 844C               (strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) {
537U845U        // perl error message
538C        styler.ColourTo(endPos, SCE_ERR_PERL); 846C        return SCE_ERR_PERL;
539U847U    } else if ((memcmp(lineBuffer, "   at ", 6) == 0) &&
540C        strstr(lineBuffer, ":line ")) { 848C               strstr(lineBuffer, ":line ")) {
541U849U        // A .NET traceback
542C        styler.ColourTo(endPos, SCE_ERR_NET); 850C        return SCE_ERR_NET;
543U851U    } else if (strstart(lineBuffer, "Line ") &&
544C        strstr(lineBuffer, ", file ")) { 852C               strstr(lineBuffer, ", file ")) {
545U853U        // Essential Lahey Fortran error message
546C        styler.ColourTo(endPos, SCE_ERR_ELF); 854C        return SCE_ERR_ELF;
547U855U    } else if (strstart(lineBuffer, "line ") &&
548C               strstr(lineBuffer, " column ")) { 856C               strstr(lineBuffer, " column ")) {
549U857U        // HTML tidy style: line 42 column 1
550C        styler.ColourTo(endPos, SCE_ERR_TIDY); 858C        return SCE_ERR_TIDY;
551U859U    } else if (strstart(lineBuffer, "\tat ") &&
552C        strstr(lineBuffer, "(") && 860C               strstr(lineBuffer, "(") &&
553C        strstr(lineBuffer, ".java:")) { 861C               strstr(lineBuffer, ".java:")) {
554U862U        // Java stack back trace
555C        styler.ColourTo(endPos, SCE_ERR_JAVA_STACK); 863C        return SCE_ERR_JAVA_STACK;
556U864U    } else {
  865C        // Look for one of the following formats:
557C        // Look for GCC <filename>:<line>:message 866C        // GCC: <filename>:<line>:<message>
558C        // Look for Microsoft <filename>(line) :message 867C        // Microsoft: <filename>(<line>) :<message>
  868C        // Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal
  869C        // Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal
559C        // Look for Microsoft <filename>(line,pos)message 870C        // Microsoft: <filename>(<line>,<column>)<message>
560C        // Look for CTags \tmessage 871C        // CTags: \t<message>
561C        // Look for Lua 5 traceback \t<filename>:<line>:message 872C        // Lua 5 traceback: \t<filename>:<line>:<message>
562U873U        bool initialTab = (lineBuffer[0] == '\t');
  874C        enum { stInitial
  875C        stGccStart, stGccDigit, stGcc,
  876C        stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
  877C        stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,
  878C        stUnrecognized
563C        int state = 0; 879C        } state = stInitial;
564U880U        for (unsigned int i = 0; i < lengthLine; i++) {
565U881U        char ch = lineBuffer[i];
566U882U        char chNext = ' ';
567C        if ((i+1) < lengthLine) 883C        if ((i + 1) < lengthLine)
568C        chNext = lineBuffer[i+1]; 884C        chNext = lineBuffer[i + 1];
569C        if (state == 0{ 885C        if (state == stInitial) {
570U886U        if (ch == ':') {
571U887U        // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
572U888U        if ((chNext != '\\') && (chNext != '/')) {
573U889U        // This check is not completely accurate as may be on
574U890U        // GTK+ with a file name that includes ':'.
575C        state = 1; 891C        state = stGccStart;
576U892U        }
577U893U        } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
578U894U        // May be Microsoft
579U895U        // Check against '0' often removes phone numbers
580C        state = 10; 896C        state = stMsStart;
581U897U        } else if ((ch == '\t') && (!initialTab)) {
582U898U        // May be CTags
583C        state = 20; 899C        state = stCtagsStart;
584U900U        }
585C        } else if (state == 1) { 901C        } else if (state == stGccStart) { // <filename>:
586C        state = Is1To9(ch) ? 2 : unRecognized; 902C        state = Is1To9(ch) ? stGccDigit : stUnrecognized;
587C        } else if (state == 2) { 903C        } else if (state == stGccDigit) { // <filename>:<line>
588U904U        if (ch == ':') {
589C        state = 3;  // :9.*: is GCC 905C        state = stGcc;  // :9.*: is GCC
590U906U        break;
591U907U        } else if (!Is0To9(ch)) {
592C        state = unRecognized; 908C        state = stUnrecognized;
593U909U        }
594C        } else if (state == 10) { 910C        } else if (state == stMsStart) {// <filename>(
595C        state = Is0To9(ch) ? 11 : unRecognized; 911C        state = Is0To9(ch) ? stMsDigit : stUnrecognized;
596C        } else if (state == 11) { 912C        } else if (state == stMsDigit) {// <filename>(<line>
597U913U        if (ch == ',') {
598C        state = 14; 914C        state = stMsDigitComma;
599U915U        } else if (ch == ')') {
600C        state = 12; 916C        state = stMsBracket;
601U917U        } else if ((ch != ' ') && !Is0To9(ch)) {
602C        state = unRecognized; 918C        state = stUnrecognized;
603U919U        }
604C        } else if (state == 12) { 920C        } else if (state == stMsBracket) {  // <filename>(<line>)
605U921U        if ((ch == ' ') && (chNext == ':')) {
606C        state = 13; 922C        state = stMsVc;
  923C        } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
  924C        // Possibly Delphi.. don't test against chNext as it's one of the strings below.
  925C        char word[512];
  926C        unsigned int j, chPos;
  927C        unsigned numstep;
  928C        chPos = 0;
  929C        if (ch == ' ')
  930C        numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
  931C        else
  932C        numstep = 2; // otherwise add 2.
  933C        for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
  934C        word[chPos++] = lineBuffer[j];
  935C        word[chPos] = 0;
  936C        if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") |
  937C        !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") || 
  938C        !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
  939C        state = stMsVc;
  940C        } else
  941C        state = stUnrecognized;
607U942U        } else {
608C        state = unRecognized; 943C        state = stUnrecognized;
609U944U        }
610C        } else if (state == 14) { 945C        } else if (state == stMsDigitComma) { // <filename>(<line>,
611U946U        if (ch == ')') {
612C        state = 15; 947C        state = stMsDotNet;
613U948U        break;
614U949U        } else if ((ch != ' ') && !Is0To9(ch)) {
615C        state = unRecognized; 950C        state = stUnrecognized;
616U951U        }
617C        } else if (state == 20) { 952C        } else if (state == stCtagsStart) {
618C        if ((lineBuffer[i-1] == '\t') && 953C        if ((lineBuffer[i - 1] == '\t') &&
619C        ((ch == '/' && lineBuffer[i+1] == '^') || Is0To9(ch))) { 954C                ((ch == '/' && lineBuffer[i + 1] == '^') || Is0To9(ch))) {
620C        state = 24; 955C        state = stCtags;
621U956U        break;
622C        } else if ((ch == '/') && (lineBuffer[i+1] == '^')) { 957C        } else if ((ch == '/') && (lineBuffer[i 1] == '^')) {
623C        state = 21; 958C        state = stCtagsStartString;
624U959U        }
625C        } else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) { 960C        } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) {
626C        state = 22; 961C        state = stCtagsStringDollar;
627U962U        break;
628U963U        }
629U964U        }
630C        if (state == 3{ 965C        if (state == stGcc) {
631C        styler.ColourTo(endPos, SCE_ERR_GCC); 966C        return SCE_ERR_GCC;
632C        } else if ((state == 13) || (state == 14) || (state == 15)) { 967C        } else if ((state == stMsVc) || (state =stMsDotNet)) {
633C        styler.ColourTo(endPos, SCE_ERR_MS); 968C        return SCE_ERR_MS;
634C        } else if ((state == 22) || (state == 24)) { 969C        } else if ((state == stCtagsStringDollar) || (state == stCtags)) {
635C        styler.ColourTo(endPos, SCE_ERR_CTAG); 970C        return SCE_ERR_CTAG;
636U971U        } else {
637C        styler.ColourTo(endPos, SCE_ERR_DEFAULT); 972C        return SCE_ERR_DEFAULT;
638U973U        }
639U974U    }
640U975U}
641U976U 
  977Astatic void ColouriseErrorListLine(
  978A    char *lineBuffer,
  979A    unsigned int lengthLine,
  980A    unsigned int endPos,
  981A    Accessor &styler) {
  982A    styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine));
  983A}
  984A 
642U985Ustatic void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
643C    char lineBuffer[1024]; 986C    char lineBuffer[10000];
644U987U    styler.StartAt(startPos);
645U988U    styler.StartSegment(startPos);
646U989U    unsigned int linePos = 0;
142 skipped lines

   Text comparison Options  

Match character case: yes.
Match line endings: no.
Match spaces

At start of lines: yes,
In middle of lines: yes,
At end of lines: yes.
Blank lines as empty lines: no.
Activate comparison algorithm
At word level: yes,
At character level: no.


   Legend  

UExample of unchanged line
CExample of modified line
AExample of added line
RExample of removed line
IExample of ignored line
Modified text
Added text
Removed text

This report has been generated by Ellié Computing Merge on 2006-09-07 16:23:40.001 +0200.
© 2005-2006 Ellié Computing http://www.elliecomputing.com. All rights reserved.