Compared files  

Left
C:\SDK\wxWidgets-2.6.2\contrib\src\stc\scintilla\src\LexCLW.cxx
Last modified2004-02-06 01:02:50.000 +0100
Size13.8 Kb (442 Lines)
EncodingLatin 1 - ANSI (CP1252) default
Right
C:\SDK\wxWidgets-2.6.3\contrib\src\stc\scintilla\src\LexCLW.cxx
Last modified2006-03-16 13:07:06.001 +0100
Size21.4 Kb (676 Lines)
EncodingLatin 1 - ANSI (CP1252) default


   Comparison Statistics  

Detailed Statistics

All Changes
 BlocksLines
Unchanged58378
Inserted1577
Deleted22
Ignored00
Changed40283



   Comparison Details  

1 1 // Scintilla source code edit control
2 2 /** @file LexClw.cxx
3 3  ** Lexer for Clarion.
  4  ** 2004/12/17 Updated Lexer
4 5  **/
5 // Copyright 2003 by Ron Schofield <ron@schofieldcomputer.com> 6 // Copyright 2003-2004 by Ron Schofield <ron@schofieldcomputer.com>
6 7 // The License.txt file describes the conditions under which this software may be distributed.
7 8  
8 9 #include <stdlib.h>
9 10 #include <string.h>
10 #include <ctype.h>  
11 11 #include <stdio.h>
12 12 #include <stdarg.h>
  13 #include <ctype.h>
13 14  
14 15 #include "Platform.h"
15 16  
4 skipped lines
20 21 #include "Scintilla.h"
21 22 #include "SciLexer.h"
22 23  
  24 // Is an end of line character
  25 inline bool IsEOL(const int ch) {
  26  
  27     return(ch == '\n');
  28 }
  29  
  30 // Convert character to uppercase
23 static char MakeUpperCase(char ch) { 31 static char CharacterUpper(char chChar) {
  32  
24     if (ch < 'a' || ch > 'z') 33     if (chChar < 'a' || chChar > 'z') {
25         return ch; 34         return(chChar);
  35     }
26     else 36     else {
27         return static_cast<char>(ch - 'a' + 'A'); 37         return(static_cast<char>(chChar - 'a' + 'A'));
  38     }
28 39 }
29 40  
  41 // Convert string to uppercase
30 static void MakeUpperCaseString(char *s) { 42 static void StringUpper(char *szString) {
  43  
31     while (*s) { 44     while (*szString) {
32         *s = MakeUpperCase(*s); 45         *szString = CharacterUpper(*szString);
33         s++; 46         szString++;
34 47     }
35 48 }
36 49  
37 50 // Is a label start character
38 51 inline bool IsALabelStart(const int iChar) {
  52  
39 53     return(isalpha(iChar) || iChar == '_');
40 54 }
41 55  
42 56 // Is a label character
43 57 inline bool IsALabelCharacter(const int iChar) {
  58  
44     return(isalnum(iChar) || iChar == '_' || iChar == ':'); 59     return(isalnum(iChar) || iChar == '_' || iChar == ':'); 
45 60 }
46 61  
47 // Is the character is a ! and the the next character is not a ! 62 // Is the character is a ! and the the next character is not a ! 
48 inline bool IsACommentStart(StyleContext &scDoc) { 63 inline bool IsACommentStart(const int iChar) {
  64  
49     return(scDoc.ch == '!' && scDoc.chNext != '!'); 65     return(iChar == '!');
50 66 }
51 67  
52 68 // Is the character a Clarion hex character (ABCDEF)
53 69 inline bool IsAHexCharacter(const int iChar, bool bCaseSensitive) {
  70  
54 71     // Case insensitive.
55 72     if (!bCaseSensitive) {
56 73         if (strchr("ABCDEFabcdef", iChar) != NULL) {
11 skipped lines
68 85  
69 86 // Is the character a Clarion base character (B=Binary, O=Octal, H=Hex)
70 87 inline bool IsANumericBaseCharacter(const int iChar, bool bCaseSensitive) {
  88  
71 89     // Case insensitive.
72 90     if (!bCaseSensitive) {
73 91         // If character is a numeric base character
13 skipped lines
87 105  
88 106 // Set the correct numeric constant state
89 107 inline bool SetNumericConstantState(StyleContext &scDoc) {
  108  
90 109     int iPoints = 0;// Point counter
91     char cNumericString[100]; // Numeric string buffer 110     char cNumericString[512]; // Numeric string buffer
92 111  
93 112     // Buffer the current numberic string
94 113     scDoc.GetCurrent(cNumericString, sizeof(cNumericString));
8 skipped lines
103 122         break;
104 123         default :
105 124         break;
106         } 125         } 
107 126     }
108 127     // If points found (can be more than one for improper formatted number
109 128     if (iPoints > 0) {
5 skipped lines
115 134     }
116 135 }
117 136  
  137 // Get the next word in uppercase from the current position (keyword lookahead)
  138 inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) {
  139  
  140     unsigned int iIndex = 0;// Buffer Index
  141  
22 skipped lines
  164         // Return success
  165         return(true);
  166     }
  167 }
  168  
118 169 // Clarion Language Colouring Procedure
119 static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) { 170 static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
  171  
  172     int iParenthesesLevel = 0;  // Parenthese Level
  173     int iColumn1Label = false;  // Label starts in Column 1
  174  
  175     WordList &wlClarionKeywords = *wlKeywords[0];   // Clarion Keywords
  176     WordList &wlCompilerDirectives = *wlKeywords[1];// Compiler Directives
  177     WordList &wlRuntimeExpressions = *wlKeywords[2];// Runtime Expressions
  178     WordList &wlBuiltInProcsFuncs = *wlKeywords[3];     // Builtin Procedures and Functions
  179     WordList &wlStructsDataTypes = *wlKeywords[4];  // Structures and Data Types
  180     WordList &wlAttributes = *wlKeywords[5];// Procedure Attributes
  181     WordList &wlStandardEquates = *wlKeywords[6];   // Standard Equates
  182     WordList &wlLabelReservedWords = *wlKeywords[7];// Clarion Reserved Keywords (Labels)
  183     WordList &wlProcLabelReservedWords = *wlKeywords[8];// Clarion Reserved Keywords (Procedure Labels)
120 184  
121     int iParenthesesLevel=0;// Parenthese Level 185     const char wlProcReservedKeywordList[] = 
  186     "PROCEDURE FUNCTION";
  187     WordList wlProcReservedKeywords;
  188     wlProcReservedKeywords.Set(wlProcReservedKeywordList);
122 189  
123     WordList &wlClarionKeywords = *wlKeywords[0];   // Clarion Keywords 190     const char wlCompilerKeywordList[] = 
124     WordList &wlCompilerDirectives = *wlKeywords[1];// Compiler Directives 191     "COMPILE OMIT";
125     WordList &wlBuiltInProcsFuncs = *wlKeywords[2];     // Builtin Procedures and Functions 192     WordList wlCompilerKeywords;
126     WordList &wlStructsDataTypes = *wlKeywords[3];  // Structures and Data Types 193     wlCompilerKeywords.Set(wlCompilerKeywordList);
127     WordList &wlAttributes = *wlKeywords[4];// Procedure Attributes 194  
128     WordList &wlStandardEquates = *wlKeywords[5];   // Standard Equates 195     const char wlLegacyStatementsList[] =
  196     "BOF EOF FUNCTION POINTER SHARE";
129     WordList &wlReservedWords = *wlKeywords[6];     // Clarion Reserved Keywords 197     WordList wlLegacyStatements;
  198     wlLegacyStatements.Set(wlLegacyStatementsList);
130 199  
131 200     StyleContext scDoc(uiStartPos, iLength, iInitStyle, accStyler);
132 201  
10 skipped lines
143 212         if (!IsALabelCharacter(scDoc.ch)) {
144 213         // If the character is a . (dot syntax)
145 214         if (scDoc.ch == '.') {
  215         // Turn off column 1 label flag as label now cannot be reserved work
  216         iColumn1Label = false;
146 217         // Uncolour the . (dot) to default state, move forward one character,
147 218         // and change back to the label state.
148 219         scDoc.SetState(SCE_CLW_DEFAULT);
149 220         scDoc.Forward();
150 221         scDoc.SetState(SCE_CLW_LABEL);
151 222         }
152         // Else terminate the label state 223         // Else check label
153 224         else {
154         char cLabel[100];   // Label buffer 225         char cLabel[512];   // Label buffer
155 226         // Buffer the current label string
156 227         scDoc.GetCurrent(cLabel,sizeof(cLabel));
157 228         // If case insensitive, convert string to UPPERCASE to match passed keywords.
158 229         if (!bCaseSensitive) {
159         MakeUpperCaseString(cLabel); 230         StringUpper(cLabel);
160 231         }
  232         // Else if UPPERCASE label string is in the Clarion compiler keyword list
  233         if (wlCompilerKeywords.InList(cLabel) && iColumn1Label){
  234         // change the label to error state
  235         scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
  236         }
161         // If label string is in the Clarion reserved keyword list 237         // Else if UPPERCASE label string is in the Clarion reserved keyword list
162         if (wlReservedWords.InList(cLabel)){ 238         else if (wlLabelReservedWords.InList(cLabel) && iColumn1Label){
163         // change to error state 239         // change the label to error state
164 240         scDoc.ChangeState(SCE_CLW_ERROR);
165 241         }
  242         // Else if UPPERCASE label string is 
  243         else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) {
  244         char cWord[512];// Word buffer
  245         // Get the next word from the current position
  246         if (GetNextWordUpper(accStyler,scDoc.currentPos,uiStartPos+iLength,cWord)) {
2 skipped lines
  249         // Change the label to error state
  250         scDoc.ChangeState(SCE_CLW_ERROR);
  251         }
  252         }
  253         }
166 254         // Else if label string is in the compiler directive keyword list
167 255         else if (wlCompilerDirectives.InList(cLabel)) {
168 256         // change the state to compiler directive state
8 skipped lines
177 265         else if (scDoc.state == SCE_CLW_KEYWORD) {
178 266         // If character is : (colon)
179 267         if (scDoc.ch == ':') {
180         char cEquate[100];  // Equate buffer 268         char cEquate[512];  // Equate buffer
181 269         // Move forward to include : (colon) in buffer
182 270         scDoc.Forward();
183 271         // Buffer the equate string
184 272         scDoc.GetCurrent(cEquate,sizeof(cEquate));
185 273         // If case insensitive, convert string to UPPERCASE to match passed keywords.
186 274         if (!bCaseSensitive) {
187         MakeUpperCaseString(cEquate); 275         StringUpper(cEquate);
188 276         }
189 277         // If statement string is in the equate list
190 278         if (wlStandardEquates.InList(cEquate)) {
3 skipped lines
194 282         }
195 283         // If the character is not a valid label character
196 284         else if (!IsALabelCharacter(scDoc.ch)) {
197         char cStatement[100];   // Statement buffer 285         char cStatement[512];   // Statement buffer
198 286         // Buffer the statement string
199 287         scDoc.GetCurrent(cStatement,sizeof(cStatement));
200 288         // If case insensitive, convert string to UPPERCASE to match passed keywords.
201 289         if (!bCaseSensitive) {
202         MakeUpperCaseString(cStatement); 290         StringUpper(cStatement);
203 291         }
204 292         // If statement string is in the Clarion keyword list