mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-11-05 22:13:50 +01:00
Release 5.5.2 ( https://www.scintilla.org/scintilla552.zip ) Released 21 August 2024. Add SCI_SETCOPYSEPARATOR for separator between parts of a multiple selection when copied to the clipboard. Feature #1530. Add SCI_GETUNDOSEQUENCE to determine whether an undo sequence is active and its nesting depth. Add SCI_STYLESETSTRETCH to support condensed and expanded text styles. Add SCI_LINEINDENT and SCI_LINEDEDENT. Feature #1524. Fix bug on Cocoa where double-click stopped working when system had been running for a long time. On Cocoa implement more values of font weight and stretch. Release 5.4.0 ( https://www.scintilla.org/lexilla540.zip ) Released 21 August 2024. Inside Lexilla, LexerModule instances are now const. This will require changes to applications that modify Lexilla.cxx, which may be done to add custom lexers. Lexer added for TOML "toml". Bash: Handle backslash in heredoc delimiter. Issue #257. Progress: Fix lexing of nested comments. Pull request #258. Force lower-casing of case-insensitive keyword lists so keywords match in some lexers. Issue #259. Close #15564
74 lines
1.7 KiB
C++
74 lines
1.7 KiB
C++
// Scintilla source code edit control
|
|
/** @file CatalogueModules.h
|
|
** Lexer infrastructure.
|
|
** Contains a list of LexerModules which can be searched to find a module appropriate for a
|
|
** particular language.
|
|
**/
|
|
// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org>
|
|
// The License.txt file describes the conditions under which this software may be distributed.
|
|
|
|
#ifndef CATALOGUEMODULES_H
|
|
#define CATALOGUEMODULES_H
|
|
|
|
namespace Lexilla {
|
|
|
|
class CatalogueModules {
|
|
std::vector<const LexerModule *> lexerCatalogue;
|
|
public:
|
|
const LexerModule *Find(int language) const noexcept {
|
|
for (const LexerModule *lm : lexerCatalogue) {
|
|
if (lm->GetLanguage() == language) {
|
|
return lm;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
const LexerModule *Find(const char *languageName) const noexcept {
|
|
if (languageName) {
|
|
for (const LexerModule *lm : lexerCatalogue) {
|
|
if (lm->languageName && (0 == strcmp(lm->languageName, languageName))) {
|
|
return lm;
|
|
}
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
void AddLexerModule(const LexerModule *plm) {
|
|
lexerCatalogue.push_back(plm);
|
|
}
|
|
|
|
void AddLexerModules(std::initializer_list<const LexerModule *> modules) {
|
|
lexerCatalogue.insert(lexerCatalogue.end(), modules);
|
|
}
|
|
|
|
size_t Count() const noexcept {
|
|
return lexerCatalogue.size();
|
|
}
|
|
|
|
const char *Name(size_t index) const noexcept {
|
|
if (index < lexerCatalogue.size()) {
|
|
return lexerCatalogue[index]->languageName;
|
|
}
|
|
return "";
|
|
}
|
|
|
|
LexerFactoryFunction Factory(size_t index) const noexcept {
|
|
// Works for object lexers but not for function lexers
|
|
return lexerCatalogue[index]->fnFactory;
|
|
}
|
|
|
|
Scintilla::ILexer5 *Create(size_t index) const {
|
|
const LexerModule *plm = lexerCatalogue[index];
|
|
if (!plm) {
|
|
return nullptr;
|
|
}
|
|
return plm->Create();
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|