1 // Scintilla source code edit control
2 /** @file StyleContext.cxx
3 ** Lexer infrastructure.
5 // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
6 // This file is in the public domain.
14 #include "LexAccessor.h"
16 #include "StyleContext.h"
17 #include "CharacterSet.h"
19 using namespace Scintilla
;
21 bool StyleContext::MatchIgnoreCase(const char *s
) {
22 if (MakeLowerCase(ch
) != static_cast<unsigned char>(*s
))
25 if (MakeLowerCase(chNext
) != static_cast<unsigned char>(*s
))
28 for (int n
= 2; *s
; n
++) {
29 if (static_cast<unsigned char>(*s
) !=
30 MakeLowerCase(static_cast<unsigned char>(styler
.SafeGetCharAt(currentPos
+ n
, 0))))
37 static void getRange(Sci_PositionU start
,
43 while ((i
< end
- start
+ 1) && (i
< len
-1)) {
44 s
[i
] = styler
[start
+ i
];
50 void StyleContext::GetCurrent(char *s
, Sci_PositionU len
) {
51 getRange(styler
.GetStartSegment(), currentPos
- 1, styler
, s
, len
);
54 static void getRangeLowered(Sci_PositionU start
,
60 while ((i
< end
- start
+ 1) && (i
< len
-1)) {
61 s
[i
] = static_cast<char>(tolower(styler
[start
+ i
]));
67 void StyleContext::GetCurrentLowered(char *s
, Sci_PositionU len
) {
68 getRangeLowered(styler
.GetStartSegment(), currentPos
- 1, styler
, s
, len
);