8
8
** Updated by Rod Falck, Aug 2006 Converted to COBOL
9
9
**/
10
10
11
- #include < stdlib.h>
12
- #include < string.h>
13
- #include < stdio.h>
14
- #include < stdarg.h>
15
- #include < assert.h>
16
- #include < ctype.h>
11
+ #include < cstdlib>
12
+ #include < cassert>
13
+ #include < cstring>
14
+ #include < cctype>
15
+ #include < cstdio>
17
16
18
17
#include < string>
19
18
#include < string_view>
@@ -38,23 +37,25 @@ using namespace Lexilla;
38
37
#define IN_FLAGS 0xF
39
38
#define NOT_HEADER 0x10
40
39
41
- inline bool isCOBOLoperator (char ch)
40
+ namespace {
41
+
42
+ bool isCOBOLoperator (char ch)
42
43
{
43
44
return isoperator (ch);
44
45
}
45
46
46
- inline bool isCOBOLwordchar (char ch)
47
+ bool isCOBOLwordchar (char ch)
47
48
{
48
49
return IsASCII (ch) && (isalnum (ch) || ch == ' -' );
49
50
50
51
}
51
52
52
- inline bool isCOBOLwordstart (char ch)
53
+ bool isCOBOLwordstart (char ch)
53
54
{
54
55
return IsASCII (ch) && isalnum (ch);
55
56
}
56
57
57
- static int CountBits (int nBits)
58
+ int CountBits (int nBits)
58
59
{
59
60
int count = 0 ;
60
61
for (int i = 0 ; i < 32 ; ++i)
@@ -65,7 +66,7 @@ static int CountBits(int nBits)
65
66
return count;
66
67
}
67
68
68
- static void getRange (Sci_PositionU start,
69
+ void getRange (Sci_PositionU start,
69
70
Sci_PositionU end,
70
71
Accessor &styler,
71
72
char *s,
@@ -78,12 +79,12 @@ static void getRange(Sci_PositionU start,
78
79
s[i] = ' \0 ' ;
79
80
}
80
81
81
- static void ColourTo (Accessor &styler, Sci_PositionU end, unsigned int attr) {
82
+ void ColourTo (Accessor &styler, Sci_PositionU end, unsigned int attr) {
82
83
styler.ColourTo (end, attr);
83
84
}
84
85
85
86
86
- static int classifyWordCOBOL (Sci_PositionU start, Sci_PositionU end, /* WordList &keywords*/ WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
87
+ int classifyWordCOBOL (Sci_PositionU start, Sci_PositionU end, /* WordList &keywords*/ WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
87
88
int ret = 0 ;
88
89
89
90
char s[100 ];
@@ -143,7 +144,7 @@ static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList
143
144
return ret;
144
145
}
145
146
146
- static void ColouriseCOBOLDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
147
+ void ColouriseCOBOLDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
147
148
Accessor &styler) {
148
149
149
150
styler.StartAt (startPos);
@@ -315,7 +316,7 @@ static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int i
315
316
ColourTo (styler, lengthDoc - 1 , state);
316
317
}
317
318
318
- static void FoldCOBOLDoc (Sci_PositionU startPos, Sci_Position length, int , WordList *[],
319
+ void FoldCOBOLDoc (Sci_PositionU startPos, Sci_Position length, int , WordList *[],
319
320
Accessor &styler) {
320
321
bool foldCompact = styler.GetPropertyInt (" fold.compact" , 1 ) != 0 ;
321
322
Sci_PositionU endPos = startPos + length;
@@ -377,11 +378,13 @@ static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordL
377
378
styler.SetLevel (lineCurrent, levelPrev | flagsNext);
378
379
}
379
380
380
- static const char * const COBOLWordListDesc[] = {
381
+ const char * const COBOLWordListDesc[] = {
381
382
" A Keywords" ,
382
383
" B Keywords" ,
383
384
" Extended Keywords" ,
384
- 0
385
+ nullptr
385
386
};
386
387
388
+ }
389
+
387
390
extern const LexerModule lmCOBOL (SCLEX_COBOL, ColouriseCOBOLDoc, " COBOL" , FoldCOBOLDoc, COBOLWordListDesc);
0 commit comments