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
2 2 /** @file LexHTML.cxx
3 3  ** Lexer for HTML.
4 4  **/
5 // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> 5 // Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
6 6 // The License.txt file describes the conditions under which this software may be distributed.
7 7  
8 8 #include <stdlib.h>
26 skipped lines
35 35     return (ch < 0x80) && (isalnum(ch) || ch == '_');
36 36 }
37 37  
  38 static inline int MakeLowerCase(int ch) {
  39     if (ch < 'A' || ch > 'Z')
  40         return ch;
  41     else
  42         return ch - 'A' + 'a';
  43 }
  44  
38 static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) { 45 static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
39     char s[30 + 1];  
40     unsigned int i = 0; 46     size_t i = 0;
41     for (; i < end - start + 1 && i < 30; i++) { 47     for (; (i < end - start + 1) && (i < len-1); i++) {
42         s[i] = static_cast<char>(tolower(styler[start + i])); 48         s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
43 49     }
44 50     s[i] = '\0';
  51 }
  52  
  53 static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
  54     char s[100];
  55     GetTextSegment(styler, start, end, s, sizeof(s));
45 56     //Platform::DebugPrintf("Scripting indicator [%s]\n", s);
46 57     if (strstr(s, "src")) // External script
47 58         return eScriptNone;
15 skipped lines
63 74  
64 75 static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
65 76     int iResult = 0;
66     char s[30 + 1]; 77     char s[100];
67     unsigned int i = 0;  
68     for (; i < end - start + 1 && i < 30; i++) { 78     GetTextSegment(styler, start, end, s, sizeof(s));
69         s[i] = static_cast<char>(tolower(styler[start + i]));  
70     }  
71     s[i] = '\0';  
72 79     if (0 == strncmp(s, "php", 3)) {
73 80         iResult = 3;
74 81     }
108 skipped lines
183 190     if (wordIsNumber) {
184 191         chAttr = SCE_H_NUMBER;
185 192     } else {
186         char s[30 + 1]; 193         char s[100];
187         unsigned int i = 0;  
188         for (; i < end - start + 1 && i < 30; i++) { 194         GetTextSegment(styler, start, end, s, sizeof(s));
189         s[i] = static_cast<char>(tolower(styler[start + i]));  
190         }  
191         s[i] = '\0';  
192 195         if (keywords.InList(s))
193 196         chAttr = SCE_H_ATTRIBUTE;
194 197     }
12 skipped lines
207 210     for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
208 211         char ch = styler[cPos];
209 212         if ((ch != '<') && (ch != '/')) {
210         s[i++] = caseSensitive ? ch : static_cast<char>(tolower(ch)); 213         s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
211 214         }
212 215     }
213 216  
56 skipped lines
270 273     if (wordIsNumber)
271 274         chAttr = SCE_HB_NUMBER;
272 275     else {
273         char s[30 + 1]; 276         char s[100];
274         unsigned int i = 0;  
275         for (; i < end - start + 1 && i < 30; i++) { 277         GetTextSegment(styler, start, end, s, sizeof(s));
276         s[i] = static_cast<char>(tolower(styler[start + i]));  
277         }  
278         s[i] = '\0';  
279 278         if (keywords.InList(s)) {
280 279         chAttr = SCE_HB_WORD;
281 280         if (strcmp(s, "rem") == 0)
36 skipped lines
318 317     if (wordIsNumber)
319 318         chAttr = SCE_HPHP_NUMBER;
320 319     else {
321         char s[100 + 1]; 320         char s[100];
322         unsigned int i = 0;  
323         for (; i < end - start + 1 && i < 100; i++) { 321         GetTextSegment(styler, start, end, s, sizeof(s));
324         s[i] = static_cast<char>(tolower(styler[start + i]));  
325         }  
326         s[i] = '\0';  
327 322         if (keywords.InList(s))
328 323         chAttr = SCE_HPHP_WORD;
329 324     }
76 skipped lines
406 401     return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
407 402 }
408 403  
  404 static bool IsScriptCommentState(const int state) {
  405     return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT ||
  406            state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE;
  407 }
  408  
409 409 static bool isLineEnd(char ch) {
410 410     return ch == '\r' || ch == '\n';
411 411 }
12 skipped lines
424 424  
425 425 static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler) {
426 426     int j;
  427     while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
  428         i++;
427 429     phpStringDelimiter[0] = '\n';
428 430     for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) {
429 431         if (j - i < phpStringDelimiterSize - 2)
71 skipped lines
501 503     char chPrev = ' ';
502 504     char ch = ' ';
503 505     char chPrevNonWhite = ' ';
  506     // look back to set chPrevNonWhite properly for better regex colouring
  507     if (scriptLanguage == eScriptJS && startPos > 0) {
  508         int back = startPos;
  509         int style = 0;
  510         while (--back) {
5 skipped lines
  516         if (style == SCE_HJ_SYMBOLS) {
  517         chPrevNonWhite = styler.SafeGetCharAt(back);
  518         }
  519     }
  520  
504 521     styler.StartSegment(startPos);
505 522     const int lengthDoc = startPos + length;
506 523     for (int i = startPos; i < lengthDoc; i++) {
507 524         const char chPrev2 = chPrev;
508 525         chPrev = ch;
509         if (ch != ' ' && ch != '\t') 526         if (!isspacechar(ch) && state != SCE_HJ_COMMENT &&
  527         state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC)
510 528         chPrevNonWhite = ch;
511 529         ch = styler[i];
512 530         char chNext = styler.SafeGetCharAt(i + 1);
92 skipped lines
605 623         case SCE_H_SINGLESTRING:
606 624         case SCE_HJ_COMMENT:
607 625         case SCE_HJ_COMMENTDOC:
608         // SCE_HJ_COMMENTLINE removed as this is a common thing done to hide 626         //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide
609         // the end of script marker from some JS interpreters. 627         // the end of script marker from some JS interpreters.
610         //case SCE_HJ_COMMENTLINE:  
611 628         case SCE_HJ_DOUBLESTRING:
612 629         case SCE_HJ_SINGLESTRING:
613 630         case SCE_HJ_REGEX:
3 skipped lines
617 634         case SCE_HP_TRIPLEDOUBLE:
618 635         break;
619 636         default :
  637         // check if the closing tag is a script tag
  638         if (state == SCE_HJ_COMMENTLINE) {
  639         char tag[7]; // room for the <script> tag
  640         char chr; // current char
  641         int j=0;
3 skipped lines
  645         chr = styler.SafeGetCharAt(i+2+j);
  646         }
  647         tag[j] = '\0';
  648         if (strcmp(tag, "script") != 0) break;
  649         }
620 650         // closing tag of the script (it's a closing HTML tag anyway)
621 651         styler.ColourTo(i - 1, StateToPrint);
622 652         state = SCE_H_TAGUNKNOWN;
13 skipped lines
636 666                  !isPHPStringState(state) &&
637 667                  (state != SCE_HPHP_COMMENT) &&
638 668                  (ch == '<') &&
639                  (chNext == '?')) { 669                  (chNext == '?') &&
  670          !IsScriptCommentState(state) ) {
640 671         scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
641 672         if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
642 673         styler.ColourTo(i - 1, StateToPrint);
10 skipped lines
653 684         inScriptType = eNonHtmlScriptPreProc;
654 685         else
655 686         inScriptType = eNonHtmlPreProc;
656         // fold whole script 687         // Fold whole script, but not if the XML first tag (all XML-like tags in this case)
657         if (foldHTMLPreprocessor){ 688         if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) {
658