Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\LexHTML.cxx
Last modified2005-03-21 12:17:54.000 +0100
Size58.3 Kb (1963 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\LexHTML.cxx
Last modified2006-03-16 13:07:08.000 +0100
Size60.6 Kb (2026 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged301908
Inserted1057
Deleted12
Ignored00
Changed18114



   Comparison Details  

1 skipped line
2U2U/** @file LexHTML.cxx
3U3U ** Lexer for HTML.
4U4U **/
5C// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> 5C// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
6U6U// The License.txt file describes the conditions under which this software may be distributed.
7U7U 
8U8U#include <stdlib.h>
26 skipped lines
35U35U    return (ch < 0x80) && (isalnum(ch) || ch == '_');
36U36U}
37U37U 
  38Cstatic inline int MakeLowerCase(int ch) {
  39C    if (ch < 'A' || ch > 'Z')
  40C        return ch;
  41C    else
  42C        return ch - 'A' + 'a';
  43C}
  44C 
38Cstatic script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { 45Cstatic void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
39C    char s[30 + 1];  
40C    unsigned int i = 0; 46C    size_t i = 0;
41C    for (; i < end - start + 1 && i < 30; i++) { 47C    for (; (i < end - start + 1) && (i < len-1); i++) {
42C        s[i] = static_cast<char>(tolower(styler[start + i])); 48C        s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
43U49U    }
44U50U    s[i] = '\0';
  51A}
  52A 
  53Astatic script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
  54A    char s[100];
  55A    GetTextSegment(styler, start, end, s, sizeof(s));
45U56U    //Platform::DebugPrintf("Scripting indicator [%s]\n", s);
46U57U    if (strstr(s, "src")) // External script
47U58U        return eScriptNone;
15 skipped lines
63U74U 
64U75Ustatic int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
65U76U    int iResult = 0;
66C    char s[30 + 1]; 77C    char s[100];
67C    unsigned int i = 0;  
68C    for (; i < end - start + 1 && i < 30; i++) { 78C    GetTextSegment(styler, start, end, s, sizeof(s));
69C        s[i] = static_cast<char>(tolower(styler[start + i]));  
70C    }  
71C    s[i] = '\0';  
72U79U    if (0 == strncmp(s, "php", 3)) {
73U80U        iResult = 3;
74U81U    }
108 skipped lines
183U190U    if (wordIsNumber) {
184U191U        chAttr = SCE_H_NUMBER;
185U192U    } else {
186C        char s[30 + 1]; 193C        char s[100];
187C        unsigned int i = 0;  
188C        for (; i < end - start + 1 && i < 30; i++) { 194C        GetTextSegment(styler, start, end, s, sizeof(s));
189C        s[i] = static_cast<char>(tolower(styler[start + i]));  
190C        }  
191C        s[i] = '\0';  
192U195U        if (keywords.InList(s))
193U196U        chAttr = SCE_H_ATTRIBUTE;
194U197U    }
12 skipped lines
207U210U    for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
208U211U        char ch = styler[cPos];
209U212U        if ((ch != '<') && (ch != '/')) {
210C        s[i++] = caseSensitive ? ch : static_cast<char>(tolower(ch)); 213C        s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
211U214U        }
212U215U    }
213U216U 
56 skipped lines
270U273U    if (wordIsNumber)
271U274U        chAttr = SCE_HB_NUMBER;
272U275U    else {
273C        char s[30 + 1]; 276C        char s[100];
274C        unsigned int i = 0;  
275C        for (; i < end - start + 1 && i < 30; i++) { 277C        GetTextSegment(styler, start, end, s, sizeof(s));
276C        s[i] = static_cast<char>(tolower(styler[start + i]));  
277C        }  
278C        s[i] = '\0';  
279U278U        if (keywords.InList(s)) {
280U279U        chAttr = SCE_HB_WORD;
281U280U        if (strcmp(s, "rem") == 0)
36 skipped lines
318U317U    if (wordIsNumber)
319U318U        chAttr = SCE_HPHP_NUMBER;
320U319U    else {
321C        char s[100 + 1]; 320C        char s[100];
322C        unsigned int i = 0;  
323C        for (; i < end - start + 1 && i < 100; i++) { 321C        GetTextSegment(styler, start, end, s, sizeof(s));
324C        s[i] = static_cast<char>(tolower(styler[start + i]));  
325C        }  
326C        s[i] = '\0';  
327U322U        if (keywords.InList(s))
328U323U        chAttr = SCE_HPHP_WORD;
329U324U    }
76 skipped lines
406U401U    return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
407U402U}
408U403U 
  404Astatic bool IsScriptCommentState(const int state) {
  405A    return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT ||
  406A           state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE;
  407A}
  408A 
409U409Ustatic bool isLineEnd(char ch) {
410U410U    return ch == '\r' || ch == '\n';
411U411U}
12 skipped lines
424U424U 
425U425Ustatic int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler) {
426U426U    int j;
  427A    while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
  428A        i++;
427U429U    phpStringDelimiter[0] = '\n';
428U430U    for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) {
429U431U        if (j - i < phpStringDelimiterSize - 2)
71 skipped lines
501U503U    char chPrev = ' ';
502U504U    char ch = ' ';
503U505U    char chPrevNonWhite = ' ';
  506A    // look back to set chPrevNonWhite properly for better regex colouring
  507A    if (scriptLanguage == eScriptJS && startPos > 0) {
  508A        int back = startPos;
  509A        int style = 0;
  510A        while (--back) {
5 skipped lines
  516A        if (style == SCE_HJ_SYMBOLS) {
  517A        chPrevNonWhite = styler.SafeGetCharAt(back);
  518A        }
  519A    }
  520A 
504U521U    styler.StartSegment(startPos);
505U522U    const int lengthDoc = startPos + length;
506U523U    for (int i = startPos; i < lengthDoc; i++) {
507U524U        const char chPrev2 = chPrev;
508U525U        chPrev = ch;
509C        if (ch != ' ' && ch != '\t') 526C        if (!isspacechar(ch) && state != SCE_HJ_COMMENT &&
  527C        state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC)
510U528U        chPrevNonWhite = ch;
511U529U        ch = styler[i];
512U530U        char chNext = styler.SafeGetCharAt(i + 1);
92 skipped lines
605U623U        case SCE_H_SINGLESTRING:
606U624U        case SCE_HJ_COMMENT:
607U625U        case SCE_HJ_COMMENTDOC:
608C        // SCE_HJ_COMMENTLINE removed as this is a common thing done to hide 626C        //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide
609C        // the end of script marker from some JS interpreters. 627C        // the end of script marker from some JS interpreters.
610C        //case SCE_HJ_COMMENTLINE:  
611U628U        case SCE_HJ_DOUBLESTRING:
612U629U        case SCE_HJ_SINGLESTRING:
613U630U        case SCE_HJ_REGEX:
3 skipped lines
617U634U        case SCE_HP_TRIPLEDOUBLE:
618U635U        break;
619U636U        default :
  637A        // check if the closing tag is a script tag
  638A        if (state == SCE_HJ_COMMENTLINE) {
  639A        char tag[7]; // room for the <script> tag
  640A        char chr; // current char
  641A        int j=0;
3 skipped lines
  645A        chr = styler.SafeGetCharAt(i+2+j);
  646A        }
  647A        tag[j] = '\0';
  648A        if (strcmp(tag, "script") != 0) break;
  649A        }
620U650U        // closing tag of the script (it's a closing HTML tag anyway)
621U651U        styler.ColourTo(i - 1, StateToPrint);
622U652U        state = SCE_H_TAGUNKNOWN;
13 skipped lines
636U666U                 !isPHPStringState(state) &&
637U667U                 (state != SCE_HPHP_COMMENT) &&
638U668U                 (ch == '<') &&
639C                 (chNext == '?')) { 669C                 (chNext == '?') &&
  670C         !IsScriptCommentState(state) {
640U671U        scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
641U672U        if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
642U673U        styler.ColourTo(i - 1, StateToPrint);
10 skipped lines
653U684U        inScriptType = eNonHtmlScriptPreProc;
654U685U        else
655U686U        inScriptType = eNonHtmlPreProc;
656C        // fold whole script 687C        // Fold whole script, but not if the XML first tag (all XML-like tags in this case)
657C        if (foldHTMLPreprocessor){ 688C        if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) {
658U689U        levelCurrent++;
659R        if (scriptLanguage == eScriptXML)  
660R        levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)  
661U690U        }
662U691U        // should be better
663U692U        ch = styler.SafeGetCharAt(i);
1 skipped line
665U694U        }
666U695U 
667U696U        // handle the start of ASP pre-processor = Non-HTML
668C        else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) { 697C        else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) {
669U698U        styler.ColourTo(i - 1, StateToPrint);
670U699U        beforePreProc = state;
671U700U        if (inScriptType == eNonHtmlScript)
34 skipped lines
706U735U        /////////////////////////////////////
707U736U        // handle the start of SGML language (DTD)
708U737U        else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) &&
709C                 (chPrev == '<') && 738C         (chPrev == '<') &&
710C                 (ch == '!') && 739C         (ch == '!') &&
711C                 (StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint))) { 740C         (StateToPrint != SCE_H_CDATA) &&
  741C         (!IsCommentState(StateToPrint)) &&
  742C         (!IsScriptCommentState(StateToPrint)) ) {
712U743U        beforePreProc = state;
713U744U        styler.ColourTo(i - 2, StateToPrint);
714U745U        if ((chNext == '-') && (chNext2 == '-')) {
715U746U        state = SCE_H_COMMENT; // wait for a pending command
716C        } 747C        styler.ColourTo(i + 2, SCE_H_COMMENT);
  748C        i += 2; // follow styling after the --
717C        else if (isWordCdata(i + 1, i + 7, styler)) { 749C        } else if (isWordCdata(i + 1, i + 7, styler)) {
718U750U        state = SCE_H_CDATA;
719U751U        } else {
720U752U        styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default
12 skipped lines
733U765U                      || (inScriptType == eNonHtmlScriptPreProc)) && (
734U766U                         ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
735U767U                         ((scriptLanguage != eScriptNone) && !isStringState(state) &&
736C                          (ch == '%')) 768C                          ((ch == '%') || (ch == '?')))
737U769U                     ) && (chNext == '>')) ||
738U770U                 ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
739U771U        if (state == SCE_H_ASPAT) {
38 skipped lines
778U810U        inScriptType = eNonHtmlScript;
779U811U        else
780U812U        inScriptType = eHtml;
781C        scriptLanguage = eScriptNone;  
782C        // unfold all scripting languages 813C        // Unfold all scripting languages, except for XML tag
783C        if (foldHTMLPreprocessor) 814C        if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) {
784U815U        levelCurrent--;
  816A        }
  817A        scriptLanguage = eScriptNone;
785U818U        continue;
786U819U        }
787U820U        /////////////////////////////////////
431 skipped lines
1219U1252U        if (ch == '/' && chPrev == '*') {
1220U1253U        styler.ColourTo(i, StateToPrint);
1221U1254U        state = SCE_HJ_DEFAULT;
  1255A        ch = ' ';
1222U1256U        }
1223U1257U        break;
1224U1258U        case SCE_HJ_COMMENTLINE:
1225U1259U        if (ch == '\r' || ch == '\n') {
1226U1260U        styler.ColourTo(i - 1, statePrintForState(SCE_HJ_COMMENTLINE, inScriptType));
1227U1261U        state = SCE_HJ_DEFAULT;
  1262A        ch = ' ';
1228U1263U        }
1229U1264U        break;
1230U1265U        case SCE_HJ_DOUBLESTRING:
41 skipped lines
1272U1307U        break;
1273U1308U        case SCE_HJ_REGEX:
1274U1309U        if (ch == '\r' || ch == '\n' || ch == '/') {
  1310A        if (ch == '/') {
  1311A        while (isascii(chNext) && islower(chNext)) {   // gobble regex flags
  1312A        i++;
  1313A        ch = chNext;
  1314A        chNext = styler.SafeGetCharAt(i + 1);
  1315A        }
  1316A        }
1275U1317U        styler.ColourTo(i, StateToPrint);
1276U1318U        state = SCE_HJ_DEFAULT;
1277U1319U        } else if (ch == '\\') {
218 skipped lines
1496U1538U        }
1497U1539U        break;
1498U1540U        case SCE_HPHP_NUMBER:
  1541C        // recognize bases 8,10 or 16 integers OR floating-point numbers
  1542C        if (!IsADigit(ch)
  1543C        && strchr(".xXabcdefABCDEF", ch) == NULL
1499C        if (!IsADigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && (ch != '-' || (chPrev != 'e' && chPrev != 'E'))) { 1544C        && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) {
1500U1545U        styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
1501U1546U        if (isoperator(ch))
1502U1547U        state = SCE_HPHP_OPERATOR;
443 skipped lines
1946U1991U    sc.Complete();
1947U1992U}
1948U1993U 
  1994Astatic void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
  1995A                                               Accessor &styler) {
  1996A    if(startPos == 0) initStyle = SCE_HPHP_DEFAULT;
  1997A        ColouriseHyperTextDoc(startPos,length,initStyle,keywordlists,styler);
  1998A}
  1999A 
1949U2000Ustatic const char * const htmlWordListDesc[] = {
1950U2001U    "HTML elements and attributes",
1951U2002U    "JavaScript keywords",
4 skipped lines
1956U2007U    0,
1957U2008U};
1958U2009U 
  2010Cstatic const char * const phpscriptWordListDesc[] = {
  2011C    "", //Unused
  2012C    "", //Unused
  2013C    "", //Unused
  2014C    "", //Unused
  2015C    "PHP keywords",
  2016C    "", //Unused
  2017C    0,
  2018C};
  2019C 
1959CLexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc); 2020CLexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc, 7);
1960CLexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc); 2021CLexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc, 7);
  2022C// SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
1961CLexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc); 2023CLexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 7);
1962CLexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc); 2024CLexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 7);
  2025CLexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 7);
1963U2026U 

   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:37.001 +0200.
© 2005-2006 Ellié Computing http://www.elliecomputing.com. All rights reserved.