X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0c3140ca4494195cfe3fee8a21dd0834437993a6..1dcf666dc7872fca0366db62c4740d96beb7b074:/src/stc/scintilla/lexlib/StyleContext.cxx diff --git a/src/stc/scintilla/lexlib/StyleContext.cxx b/src/stc/scintilla/lexlib/StyleContext.cxx new file mode 100644 index 0000000000..cf59fdd24e --- /dev/null +++ b/src/stc/scintilla/lexlib/StyleContext.cxx @@ -0,0 +1,56 @@ +// Scintilla source code edit control +/** @file StyleContext.cxx + ** Lexer infrastructure. + **/ +// Copyright 1998-2004 by Neil Hodgson +// This file is in the public domain. + +#include +#include +#include +#include +#include + +#include "ILexer.h" + +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static void getRange(unsigned int start, + unsigned int end, + LexAccessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = styler[start + i]; + i++; + } + s[i] = '\0'; +} + +void StyleContext::GetCurrent(char *s, unsigned int len) { + getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); +} + +static void getRangeLowered(unsigned int start, + unsigned int end, + LexAccessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast(tolower(styler[start + i])); + i++; + } + s[i] = '\0'; +} + +void StyleContext::GetCurrentLowered(char *s, unsigned int len) { + getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); +}