mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-08-25 11:48:23 +02:00
Update with https://www.scintilla.org/scintilla521.zip https://www.scintilla.org/lexilla515.zip - fix setting to bring Scintilla::PositionCR from ScintillaStructures.h inline with Sci_Position.h Sci_PositionCR - add workaround to enable lexer for searchResult commented out SCI_SETILEXER call on searchResult to get one result which is correctly handled by the lexer, added comment about the current problem with property @MarkingsStruct which seems to disappear after call to SCI_SETILEXER or CreateLexer - corrected usage of ObjC lexer - removed unnecessary filter stuff - use own sections for scintilla and lexilla build targets and allow parallel builds - as libscilex is no longer existing, changed to libscintilla - adapt makefiles and cmake - use VS2019 - started simple changes for createlexer adaptations, nullpointercheck missing on return of lexer name from deprecated LexerNameFromID -> undefined behaviour - movement from id -> lexer name, mostly done via LexerNameFromID + switching off corresponding compiler warning - changed to SCI_SETILEXER from SCI_SETLEXER, SCI_SETLEXERLANGUAGE needs to be corrected, see Scintilla5Migration.html - just commented out: SCI_LOADLEXERLIBRARY Fix #10504, close #11419
77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
// Scintilla source code edit control
|
|
/** @file StyleContext.cxx
|
|
** Lexer infrastructure.
|
|
**/
|
|
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
|
|
// This file is in the public domain.
|
|
|
|
#include <cstdlib>
|
|
#include <cassert>
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
#include "ILexer.h"
|
|
|
|
#include "LexAccessor.h"
|
|
#include "Accessor.h"
|
|
#include "StyleContext.h"
|
|
#include "CharacterSet.h"
|
|
|
|
using namespace Lexilla;
|
|
|
|
bool StyleContext::MatchIgnoreCase(const char *s) {
|
|
if (MakeLowerCase(ch) != static_cast<unsigned char>(*s))
|
|
return false;
|
|
s++;
|
|
if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s))
|
|
return false;
|
|
s++;
|
|
for (int n = 2; *s; n++) {
|
|
if (*s !=
|
|
MakeLowerCase(styler.SafeGetCharAt(currentPos + n, 0)))
|
|
return false;
|
|
s++;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool StyleContext::MatchIgnoreCase2(const char *s) {
|
|
if (MakeLowerCase(ch) != MakeLowerCase(static_cast<unsigned char>(*s)))
|
|
return false;
|
|
s++;
|
|
if (!*s)
|
|
return true;
|
|
if (MakeLowerCase(chNext) != MakeLowerCase(static_cast<unsigned char>(*s)))
|
|
return false;
|
|
s++;
|
|
for (int n = 2; *s; n++) {
|
|
if (MakeLowerCase(static_cast<unsigned char>(*s)) !=
|
|
MakeLowerCase(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n))))
|
|
return false;
|
|
s++;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
static void getRange(Sci_PositionU start,
|
|
Sci_PositionU end,
|
|
LexAccessor &styler,
|
|
char *s,
|
|
Sci_PositionU len) {
|
|
Sci_PositionU i = 0;
|
|
while ((i < end - start + 1) && (i < len-1)) {
|
|
s[i] = styler[start + i];
|
|
i++;
|
|
}
|
|
s[i] = '\0';
|
|
}
|
|
|
|
void StyleContext::GetCurrent(char *s, Sci_PositionU len) {
|
|
styler.GetRange(styler.GetStartSegment(), currentPos, s, len);
|
|
}
|
|
|
|
void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) {
|
|
styler.GetRangeLowered(styler.GetStartSegment(), currentPos, s, len);
|
|
}
|