Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\LexCPP.cxx
Last modified2005-03-21 12:17:54.000 +0100
Size12.2 Kb (406 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\LexCPP.cxx
Last modified2006-03-16 13:07:06.001 +0100
Size13.8 Kb (463 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged31267
Inserted6105
Deleted310
Ignored00
Changed21220



   Comparison Details  

1U1U// Scintilla source code edit control
2U2U/** @file LexCPP.cxx
3C ** Lexer for C++, C, Java, and Javascript. 3C ** Lexer for C++, C, Java, and JavaScript.
4U4U **/
5C// Copyright 1998-2002 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>
14 skipped lines
23U23U#define KEYWORD_BOXHEADER 1
24U24U#define KEYWORD_FOLDCONTRACTED 2
25U25U 
26Cstatic bool IsOKBeforeRE(const int ch) { 26Cstatic bool IsOKBeforeRE(int ch) {
27U27U    return (ch == '(') || (ch == '=') || (ch == ',');
28U28U}
29U29U 
30Cstatic inline bool IsAWordChar(const int ch) { 30Cstatic inline bool IsAWordChar(int ch) {
31U31U    return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
32U32U}
33U33U 
34Cstatic inline bool IsAWordStart(consint ch) { 34Cstatic inline bool IsAWordStart(int ch) {
35C    return (ch < 0x80) && (isalnum(ch) || ch == '_'); 35C    return (ch < 0x80) && (isalpha(ch) || ch == '_');
36U36U}
37U37U 
38Cstatic inline bool IsADoxygenChar(const int ch) { 38Cstatic inline bool IsADoxygenChar(int ch) {
39C    return (islower(ch) || ch == '$' || ch == '@' || 39C    return (ch < 0x80 && islower(ch)) || ch == '$' || ch == '@' ||
40C            ch == '\\' || ch == '&' || ch == '<' || 40C        ch == '\\' || ch == '&' || ch == '<' ||
41C            ch == '>' || ch == '#' || ch == '{' || 41C        ch == '>' || ch == '#' || ch == '{' ||
42C            ch == '}' || ch == '[' || ch == ']'); 42C        ch == '}' || ch == '[' || ch == ']';
43U43U}
44U44U 
45Cstatic inlinbool IsStateComment(const int state) { 45Cstatic bool IsSpaceEquiv(int state) {
46C    return ((state == SCE_C_COMMENT) || 46C    return (state <= SCE_C_COMMENTDOC) ||
47C            (state == SCE_C_COMMENTLINE) ||  
48C            (state == SCE_C_COMMENTDOC) ||  
49C            (state == SCE_C_COMMENTDOCKEYWORD) || 47C        // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
50C            (state == SCE_C_COMMENTDOCKEYWORDERROR)); 48C        (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
51C}  
52C   
53Cstatic inline bool IsStateString(const int state) {  
54C    return ((state == SCE_C_STRING|| (state == SCE_C_VERBATIM)); 49C        (state == SCE_C_COMMENTDOCKEYWORDERROR);
55U50U}
56U51U 
57U52Ustatic void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
6 skipped lines
64U59U 
65U60U    bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
66U61U 
67R    // Do not leak onto next line  
68R    if (initStyle == SCE_C_STRINGEOL)  
69R        initStyle = SCE_C_DEFAULT;  
70R   
71U62U    int chPrevNonWhite = ' ';
72U63U    int visibleChars = 0;
73U64U    bool lastWordWasUUID = false;
  65A    int styleBeforeDCKeyword = SCE_C_DEFAULT;
  66A    bool continuationLine = false;
  67A 
  68A    if (initStyle == SCE_C_PREPROCESSOR) {
  69A        // Set continuationLine if last character of previous line is '\'
18 skipped lines
  88A        ;
  89A        if (styler.StyleAt(back) == SCE_C_OPERATOR) {
  90A        chPrevNonWhite = styler.SafeGetCharAt(back);
  91A        }
  92A    }
74U93U 
75U94U    StyleContext sc(startPos, length, initStyle, styler);
76U95U 
77U96U    for (; sc.More(); sc.Forward()) {
78U97U 
  98C        if (sc.atLineStart) {
79C        if (sc.atLineStart && (sc.state == SCE_C_STRING)) { 99C        if (sc.state == SCE_C_STRING) {
80C        // Prevent SCE_C_STRINGEOL from leaking back to previous line 100C        // Prevent SCE_C_STRINGEOL from leaking back to previous line which 
  101C        // ends with a line continuation by locking in the state upto this position.
81C        sc.SetState(SCE_C_STRING); 102C        sc.SetState(SCE_C_STRING);
  103C        }
  104C        // Reset states to begining of colourise so no surprises
  105C        // if different sets of lines lexed.
  106C        visibleChars = 0;
  107C        lastWordWasUUID = false;
82U108U        }
83U109U 
84U110U        // Handle line continuation generically.
3 skipped lines
88U114U        if (sc.ch == '\r' && sc.chNext == '\n') {
89U115U        sc.Forward();
90U116U        }
  117A        continuationLine = true;
91U118U        continue;
92U119U        }
93U120U        }
94U121U 
95U122U        // Determine if the current state should terminate.
96C        if (sc.state == SCE_C_OPERATOR) { 123C        switch (sc.state) {
97C        sc.SetState(SCE_C_DEFAULT);  
98C        } else if (sc.state == SCE_C_NUMBER) {  
99C        if (!IsAWordChar(sc.ch)) {  
100C        sc.SetState(SCE_C_DEFAULT); 124C        case SCE_C_OPERATOR:
101C        }  
102C        } else if (sc.state == SCE_C_IDENTIFIER) {  
103C        if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {  
104C        char s[100];  
105C        if (caseSensitive) {  
106C        sc.GetCurrent(s, sizeof(s));  
107C        } else {  
108C        sc.GetCurrentLowered(s, sizeof(s));  
109C        }  
110C        if (keywords.InList(s)) {  
111C        lastWordWasUUID = strcmp(s, "uuid") == 0;  
112C        sc.ChangeState(SCE_C_WORD);  
113C        } else if (keywords2.InList(s)) {  
114C        sc.ChangeState(SCE_C_WORD2);  
115C        } else if (keywords4.InList(s)) {  
116C        sc.ChangeState(SCE_C_GLOBALCLASS);  
117C        }  
118U125U        sc.SetState(SCE_C_DEFAULT);
119C        } 126C        break;
120C        } else if (sc.state == SCE_C_PREPROCESSOR) { 127C        case SCE_C_NUMBER:
121C        if (stylingWithinPreprocessor) { 128C        // We accept almost anything because of hex. and number suffixes
122C        if (IsASpace(sc.ch)) { 129C        if (!IsAWordChar(sc.ch)) {
123U130U        sc.SetState(SCE_C_DEFAULT);
124U131U        }
125C        } else { 132C        break;
  133C        case SCE_C_IDENTIFIER:
126C        if ((sc.ch == '\r') || (sc.ch == '\n') || (sc.Match('/', '*')) || (sc.Match('/', '/')){ 134C        if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
  135C        char s[1000];
  136C        if (caseSensitive) {
  137C        sc.GetCurrent(s, sizeof(s));
  138C        } else {
  139C        sc.GetCurrentLowered(s, sizeof(s));
  140C        }
  141C        if (keywords.InList(s)) {
  142C        lastWordWasUUID = strcmp(s, "uuid") == 0;
  143C        sc.ChangeState(SCE_C_WORD);
  144C        } else if (keywords2.InList(s)) {
  145C        sc.ChangeState(SCE_C_WORD2);
  146C        } else if (keywords4.InList(s)) {
  147C        sc.ChangeState(SCE_C_GLOBALCLASS);
  148C        }
127U149U        sc.SetState(SCE_C_DEFAULT);
128U150U        }
129C        } 151C        break;
130C        } else if (sc.state == SCE_C_COMMENT) {  
131C        if (sc.Match('*', '/')) {  
132C        sc.Forward();  
133C        sc.ForwardSetState(SCE_C_DEFAULT);  
134C        }  
135C        } else if (sc.state == SCE_C_COMMENTDOC) { 152C        case SCE_C_PREPROCESSOR:
136C        if (sc.Match('*', '/')) {  
137C        sc.Forward();  
138C        sc.ForwardSetState(SCE_C_DEFAULT);  
139C        } else if (sc.ch == '@' || sc.ch == '\\') { 153C        if (sc.atLineStart && !continuationLine) {
140C        sc.SetState(SCE_C_COMMENTDOCKEYWORD);  
141C        }  
142C        } else if (sc.state == SCE_C_COMMENTLINE || sc.state == SCE_C_COMMENTLINEDOC) {  
143C        if (sc.ch == '\r' || sc.ch == '\n') {  
144C        sc.SetState(SCE_C_DEFAULT); 154C        sc.SetState(SCE_C_DEFAULT);
145C        visibleChars = 0;  
146C        }  
147C        } else if (sc.state == SCE_C_COMMENTDOCKEYWORD) { 155C        } else if (stylingWithinPreprocessor) {
148C        if (sc.Match('*', '/')) { 156C        if (IsASpace(sc.ch)) {
149C        sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);  
150C        sc.Forward();  
151C        sc.ForwardSetState(SCE_C_DEFAULT); 157C        sc.SetState(SCE_C_DEFAULT);
152C        } else if (!IsADoxygenChar(sc.ch)) { 158C        }
153C        char s[100];  
154C        if (caseSensitive) {  
155C        sc.GetCurrent(s, sizeof(s));  
156U159U        } else {
157C        sc.GetCurrentLowered(s, sizeof(s));  
158C        }  
159C        if (!isspace(sc.ch) || !keywords3.InList(s + 1)) { 160C        if (sc.Match('/', '*') || sc.Match('/', '/')) {
160C        sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); 161C        sc.SetState(SCE_C_DEFAULT);
  162C        }
161U163U        }
162C        sc.SetState(SCE_C_COMMENTDOC); 164C        break;
163C        }  
164C        } else if (sc.state == SCE_C_STRING) { 165C        case SCE_C_COMMENT:
165C        if (sc.ch == '\\') {  
166C        if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { 166C        if (sc.Match('*', '/')) {
167U167U        sc.Forward();
  168A        sc.ForwardSetState(SCE_C_DEFAULT);
168U169U        }
169C        } else if (sc.ch == '\"') { 170C        break;
170C        sc.ForwardSetState(SCE_C_DEFAULT);  
171C        } else if (sc.atLineEnd) {  
172C        sc.ChangeState(SCE_C_STRINGEOL);  
173C        sc.ForwardSetState(SCE_C_DEFAULT);  
174C        visibleChars = 0;  
175C        }  
176C        } else if (sc.state == SCE_C_CHARACTER) {  
177C        if (sc.atLineEnd) {  
178C        sc.ChangeState(SCE_C_STRINGEOL);  
179C        sc.ForwardSetState(SCE_C_DEFAULT); 171C        case SCE_C_COMMENTDOC:
180C        visibleChars = 0;  
181C        } else if (sc.ch == '\\') { 172C        if (sc.Match('*', '/')) {
182C        if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {  
183U173U        sc.Forward();
  174A        sc.ForwardSetState(SCE_C_DEFAULT);
  175A        } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
  176A        // Verify that we have the conditions to mark a comment-doc-keyword
  177A        if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
  178A        styleBeforeDCKeyword = SCE_C_COMMENTDOC;
  179A        sc.SetState(SCE_C_COMMENTDOCKEYWORD);
  180A        }
184U181U        }
185C        } else if (sc.ch == '\'') { 182C        break;
186C        sc.ForwardSetState(SCE_C_DEFAULT);  
187C        }  
188C        } else if (sc.state == SCE_C_REGEX) { 183C        case SCE_C_COMMENTLINE:
189C        if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == '/'{ 184C        if (sc.atLineStart) {
190C        sc.ForwardSetState(SCE_C_DEFAULT); 185C        sc.SetState(SCE_C_DEFAULT);
191C        } else if (sc.ch == '\\') {  
192C        // Gobble up the quoted character  
193C        if (sc.chNext == '\\' || sc.chNext == '/') {  
194C        sc.Forward();  
195U186U        }
196C        } 187C        break;
  188C        case SCE_C_COMMENTLINEDOC:
  189C        if (sc.atLineStart) {
  190C        sc.SetState(SCE_C_DEFAULT);
197C        } else if (sc.state == SCE_C_VERBATIM) { 191C        } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
  192C        // Verify that we have the conditions to mark a comment-doc-keyword
198C        if (sc.ch == '\"') { 193C        if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
  194C        styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC;
  195C        sc.SetState(SCE_C_COMMENTDOCKEYWORD);
  196C        }
  197C        }
  198C        break;
  199C        case SCE_C_COMMENTDOCKEYWORD:
199C        if (sc.chNext == '\"') { 200C        if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) {
  201C        sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
200U202U        sc.Forward();
201R        } else {  
202U203U        sc.ForwardSetState(SCE_C_DEFAULT);
  204A        } else if (!IsADoxygenChar(sc.ch)) {
  205A        char s[100];
  206A        if (caseSensitive) {
  207A        sc.GetCurrent(s, sizeof(s));
  208A        } else {
57 skipped lines
  266A        }
  267A        break;
  268A        case SCE_C_UUID:
  269A        if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
  270A        sc.SetState(SCE_C_DEFAULT);
203U271U        }
204R        }  
205R        } else if (sc.state == SCE_C_UUID) {  
206R        if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {  
207R        sc.SetState(SCE_C_DEFAULT);  
208R        }  
209U272U        }
210U273U 
211U274U        // Determine if a new state should be entered.
29 skipped lines
241U304U        else
242U305U        sc.SetState(SCE_C_COMMENTLINE);
243U306U        } else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
244C        sc.SetState(SCE_C_REGEX); 307C        sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
245U308U        } else if (sc.ch == '\"') {
246U309U        sc.SetState(SCE_C_STRING);
247U310U        } else if (sc.ch == '\'') {
5 skipped lines
253U316U        do {
254U317U        sc.Forward();
255U318U        } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
256C        if (sc.ch == '\r' || sc.ch == '\n') { 319C        if (sc.atLineEnd) {
257U320U        sc.SetState(SCE_C_DEFAULT);
258U321U        }
259U322U        } else if (isoperator(static_cast<char>(sc.ch))) {
1 skipped line
261U324U        }
262U325U        }
263U326U 
264C        if (sc.atLineEnd) {  
265C        // Reset states to begining of colourise so no surprises  
266C        // if different sets of lines lexed.  
267C        chPrevNonWhite = ' ';  
268C        visibleChars = 0;  
269C        lastWordWasUUID = false;  
270C        }  
271C        if (!IsASpace(sc.ch)) { 327C        if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
272U328U        chPrevNonWhite = sc.ch;
273U329U        visibleChars++;
274U330U        }
  331A        continuationLine = false;
275U332U    }
276U333U    sc.Complete();
277U334U}
278U335U 
279U336Ustatic bool IsStreamCommentStyle(int style) {
280U337U    return style == SCE_C_COMMENT ||
281C           style == SCE_C_COMMENTDOC || 338C        style == SCE_C_COMMENTDOC ||
282C           style == SCE_C_COMMENTDOCKEYWORD || 339C        style == SCE_C_COMMENTDOCKEYWORD ||
283C           style == SCE_C_COMMENTDOCKEYWORDERROR; 340C        style == SCE_C_COMMENTDOCKEYWORDERROR;
284U341U}
285U342U 
286U343U// Store both the current line's fold level and the next lines in the
120 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:36.001 +0200.
© 2005-2006 Ellié Computing http://www.elliecomputing.com. All rights reserved.