| 1 | // Scintilla source code edit control |
|---|---|
| 2 | /** @file StyleContext.cxx |
| 3 | ** Lexer infrastructure. |
| 4 | **/ |
| 5 | // Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> |
| 6 | // This file is in the public domain. |
| 7 | |
| 8 | #include <cstdlib> |
| 9 | #include <cassert> |
| 10 | |
| 11 | #include <string> |
| 12 | #include <string_view> |
| 13 | |
| 14 | #include "ILexer.h" |
| 15 | |
| 16 | #include "LexAccessor.h" |
| 17 | #include "Accessor.h" |
| 18 | #include "StyleContext.h" |
| 19 | #include "CharacterSet.h" |
| 20 | |
| 21 | using namespace Lexilla; |
| 22 | |
| 23 | bool StyleContext::MatchIgnoreCase(const char *s) { |
| 24 | if (MakeLowerCase(ch) != static_cast<unsigned char>(*s)) |
| 25 | return false; |
| 26 | s++; |
| 27 | if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s)) |
| 28 | return false; |
| 29 | s++; |
| 30 | for (int n = 2; *s; n++) { |
| 31 | if (*s != |
| 32 | MakeLowerCase(styler.SafeGetCharAt(currentPos + n, 0))) |
| 33 | return false; |
| 34 | s++; |
| 35 | } |
| 36 | return true; |
| 37 | } |
| 38 | |
| 39 | void StyleContext::GetCurrent(char *s, Sci_PositionU len) { |
| 40 | styler.GetRange(styler.GetStartSegment(), currentPos, s, len); |
| 41 | } |
| 42 | |
| 43 | void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { |
| 44 | styler.GetRangeLowered(styler.GetStartSegment(), currentPos, s, len); |
| 45 | } |
| 46 |