Compared files  

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


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged22267
Inserted218
Deleted11
Ignored00
Changed18130



   Comparison Details  

11 skipped lines
12U12U#include <ctype.h>
13U13U#include <stdarg.h>
14U14U#include <stdio.h>
15R#include <fcntl.h>  
16U15U 
17U16U#include "Platform.h"
18U17U 
4 skipped lines
23U22U#include "Scintilla.h"
24U23U#include "SciLexer.h"
25U24U 
  25C// Extended to accept accented characters
26Cstatic inline bool IsAWordChar(const int ch) { 26Cstatic inline bool IsAWordChar(int ch) {
  27C    return ch >= 0x80 ||
27C    return (ch < 0x80) &(isalnum(ch) || ch == '_' || ch == '.'); 28C           (isalnum(ch) || ch == '.' || ch == '_');
28U29U}
29U30U 
30Cstatic inline bool IsAWordStart(consint ch) { 31Cstatic inline bool IsAWordStart(int ch) {
  32C    return ch >= 0x80 ||
31C    return (ch < 0x80) && (isalnum(ch) || ch == '_'); 33C           (isalpha(ch) || ch == '_');
32U34U}
33U35U 
34Cstatic inline bool IsANumberChar(const int ch) { 36Cstatic inline bool IsANumberChar(int ch) {
35U37U    // Not exactly following number definition (several dots are seen as OK, etc.)
36U38U    // but probably enough in most cases.
37U39U    return (ch < 0x80) &&
17 skipped lines
55U57U    return false;
56U58U}
57U59U 
  60A// Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ],
  61A// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
  62A// The maximum number of '=' characters allowed is 254.
  63Astatic int LongDelimCheck(StyleContext &sc) {
  64A    int sep = 1;
2 skipped lines
  67A    if (sc.GetRelative(sep) == sc.ch)
  68A        return sep;
  69A    return 0;
  70A}
  71A 
58U72Ustatic void ColouriseLuaDoc(
59U73U    unsigned int startPos,
60U74U    int length,
11 skipped lines
72U86U    WordList &keywords8 = *keywordlists[7];
73U87U 
74U88U    int currentLine = styler.GetLine(startPos);
75C    // Initialize the literal string [[ ... ]] nesting level, if we are inside such a string. 89C    // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
76C    int literalStringLevel = 0; 90C    // if we are inside such a string. Block comment was introduced in Lua 5.0,
77C    if (initStyle == SCE_LUA_LITERALSTRING) {  
78C        literalStringLevel = styler.GetLineState(currentLine - 1);  
79C    }  
80C    // Initialize the block comment --[[ ... ]nesting level, if we are inside such a comment 91C    // blocks with separators [=[ ... ]=] in Lua 5.1.
  92C    int nestLevel = 0;
81C    int blockCommentLevel = 0; 93C    int sepCount = 0;
82C    if (initStyle == SCE_LUA_COMMENT) { 94C    if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT) {
83C        blockCommentLevel = styler.GetLineState(currentLine - 1); 95C        int lineState = styler.GetLineState(currentLine - 1);
  96C        nestLevel = lineState >> 8;
  97C        sepCount = lineState & 0xFF;
84U98U    }
85U99U 
86U100U    // Do not leak onto next line
87C    if (initStyle == SCE_LUA_STRINGEOL) { 101C    if (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == SCE_LUA_PREPROCESSOR) {
88U102U        initStyle = SCE_LUA_DEFAULT;
89U103U    }
90U104U 
8 skipped lines
99U113U        currentLine = styler.GetLine(sc.currentPos);
100U114U        switch (sc.state) {
101U115U        case SCE_LUA_LITERALSTRING:
102C        // Inside a literal string, we set the line state  
103C        styler.SetLineState(currentLine, literalStringLevel);  
104C        break;  
105C        case SCE_LUA_COMMENT:   // Block comment 116C        case SCE_LUA_COMMENT:
106C        // Inside a block comment, we set the line state 117C        // Inside a literal string oblock comment, we set the line state
107C        styler.SetLineState(currentLine, blockCommentLevel); 118C        styler.SetLineState(currentLine, (nestLevel << 8) | sepCount);
108U119U        break;
109U120U        default:
110U121U        // Reset the line state
51 skipped lines
162U173U        }
163U174U        sc.SetState(SCE_LUA_DEFAULT);
164U175U        }
165C        } else if (sc.state == SCE_LUA_COMMENTLINE ) { 176C        } else if (sc.state == SCE_LUA_COMMENTLINE || sc.state == SCE_LUA_PREPROCESSOR) {
166U177U        if (sc.atLineEnd) {
167C        sc.SetState(SCE_LUA_DEFAULT);  
168C        }  
169C        } else if (sc.state == SCE_LUA_PREPROCESSOR ) {  
170C        if (sc.atLineEnd) {  
171C        sc.SetState(SCE_LUA_DEFAULT); 178C        sc.ForwardSetState(SCE_LUA_DEFAULT);
172U179U        }
173U180U        } else if (sc.state == SCE_LUA_STRING) {
174U181U        if (sc.ch == '\\') {
17 skipped lines
192U199U        sc.ChangeState(SCE_LUA_STRINGEOL);
193U200U        sc.ForwardSetState(SCE_LUA_DEFAULT);
194U201U        }
195C        } else if (sc.state == SCE_LUA_LITERALSTRING) { 202C        } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) {
196C        if (sc.Match('[', '[')) {  
197C        literalStringLevel++;  
198C        sc.Forward();  
199C        sc.SetState(SCE_LUA_LITERALSTRING);  
200C        } else if (sc.Match(']', ']') && literalStringLevel > 0) { 203C        if (sc.ch == '[') {
201C        literalStringLevel--;  
202C        sc.Forward(); 204C        int sep = LongDelimCheck(sc);
203C        if (literalStringLevel == 0) { 205C        if (sep == 1 && sepCount == 1) {    // [[-only allowed to nest
  206C        nestLevel++;
204C        sc.ForwardSetState(SCE_LUA_DEFAULT); 207C        sc.Forward();
205U208U        }
206C        }  
207C        } else if (sc.state == SCE_LUA_COMMENT) { // Lua 5.0's block comment 209C        } else if (sc.ch == ']') {
  210C        int sep = LongDelimCheck(sc);
208C        if (sc.Match('[', '[')) { 211C        if (sep == 1 && sepCount == 1) {    // un-nest with ]]-only
209C        blockCommentLevel++; 212C        nestLevel--;
210C        sc.Forward(); 213C        sc.Forward();
211C        } else if (sc.Match(']', ']') && blockCommentLevel > 0) { 214C        if (nestLevel == 0) {
212C        blockCommentLevel--;  
213C        sc.Forward(); 215C        sc.ForwardSetState(SCE_LUA_DEFAULT);
  216C        }
214C        if (blockCommentLevel == 0) { 217C        } else if (sep > 1 && sep == sepCount) {   // ]=]-style delim
  218C        sc.Forward(sep);
215U219U        sc.ForwardSetState(SCE_LUA_DEFAULT);
216U220U        }
217U221U        }
5 skipped lines
223U227U        sc.SetState(SCE_LUA_NUMBER);
224U228U        } else if (IsAWordStart(sc.ch)) {
225U229U        sc.SetState(SCE_LUA_IDENTIFIER);
226C        } else if (sc.Match('\"')) { 230C        } else if (sc.ch == '\"') {
227U231U        sc.SetState(SCE_LUA_STRING);
228C        } else if (sc.Match('\'')) { 232C        } else if (sc.ch == '\'') {
229U233U        sc.SetState(SCE_LUA_CHARACTER);
230C        } else if (sc.Match('[', '[')) { 234C        } else if (sc.ch == '[') {
231C        literalStringLevel = 1; 235C        sepCount = LongDelimCheck(sc);
  236C        if (sepCount == 0) {
232C        sc.SetState(SCE_LUA_LITERALSTRING); 237C        sc.SetState(SCE_LUA_OPERATOR);
233C        sc.Forward();  
234C        } else if (sc.Match("--[[")) {  // Lua 5.0's block comment 238C        } else {
235C        blockCommentLevel = 1; 239C        nestLevel = 1;
236C        sc.SetState(SCE_LUA_COMMENT); 240C        sc.SetState(SCE_LUA_LITERALSTRING);
237C        sc.Forward(3); 241C        sc.Forward(sepCount);
  242C        }
238U243U        } else if (sc.Match('-', '-')) {
239U244U        sc.SetState(SCE_LUA_COMMENTLINE);
  245C        if (sc.Match("--[")) {
  246C        sc.Forward(2);
  247C        sepCount = LongDelimCheck(sc);
  248C        if (sepCount > 0) {
  249C        nestLevel = 1;
  250C        sc.ChangeState(SCE_LUA_COMMENT);
240C        sc.Forward(); 251C        sc.Forward(sepCount);
  252C        }
  253C        } else {
  254C        sc.Forward();
  255C        }
241U256U        } else if (sc.atLineStart && sc.Match('$')) {
242U257U        sc.SetState(SCE_LUA_PREPROCESSOR);  // Obsolete since Lua 4.0, but still in old code
243U258U        } else if (IsLuaOperator(static_cast<char>(sc.ch))) {
23 skipped lines
267U282U        styleNext = styler.StyleAt(i + 1);
268U283U        bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
269U284U        if (style == SCE_LUA_WORD) {
270C        if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') { 285C        if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
271U286U        for (unsigned int j = 0; j < 8; j++) {
272U287U        if (!iswordchar(styler[i + j])) {
273U288U        break;
2 skipped lines
276U291U        s[j + 1] = '\0';
277U292U        }
278U293U 
279C        if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) { 294C        if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) {
280U295U        levelCurrent++;
281U296U        }
282C        if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) { 297C        if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0) || (strcmp(s, "until") == 0){
283U298U        levelCurrent--;
284U299U        }
285U300U        }
3 skipped lines
289U304U        } else if (ch == '}' || ch == ')') {
290U305U        levelCurrent--;
291U306U        }
  307A        } else if (style == SCE_LUA_LITERALSTRING || style == SCE_LUA_COMMENT) {
  308A        if (ch == '[') {
  309A        levelCurrent++;
  310A        } else if (ch == ']') {
  311A        levelCurrent--;
  312A        }
292U313U        }
293U314U 
294U315U        if (atEOL) {
26 skipped lines
321U342U    "Basic functions",
322U343U    "String, (table) & math functions",
323U344U    "(coroutines), I/O & system facilities",
324C    "XXX", 345C    "user1",
  346C    "user2",
  347C    "user3",
325C    "XXX", 348C    "user4",
326U349U    0
327U350U};
328U351U 
2 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:38.001 +0200.
© 2005-2006 Ellié Computing http://www.elliecomputing.com. All rights reserved.