aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Catalogue.cxx197
-rw-r--r--src/Catalogue.h24
-rw-r--r--src/ExternalLexer.cxx222
-rw-r--r--src/ExternalLexer.h17
4 files changed, 0 insertions, 460 deletions
diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx
deleted file mode 100644
index 7f2415e0b..000000000
--- a/src/Catalogue.cxx
+++ /dev/null
@@ -1,197 +0,0 @@
-// Scintilla source code edit control
-/** @file Catalogue.cxx
- ** Lexer infrastructure.
- ** Contains a list of LexerModules which can be searched to find a module appropriate for a
- ** particular language.
- **/
-// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <cstdlib>
-#include <cassert>
-#include <cstring>
-
-#include <stdexcept>
-#include <vector>
-
-#include "ILexer.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-
-#include "LexerModule.h"
-#include "CatalogueModules.h"
-#include "Catalogue.h"
-
-using namespace Scintilla;
-
-namespace {
-
-CatalogueModules catalogueDefault;
-
-}
-
-const LexerModule *Catalogue::Find(int language) {
- return catalogueDefault.Find(language);
-}
-
-const LexerModule *Catalogue::Find(const char *languageName) noexcept {
- return catalogueDefault.Find(languageName);
-}
-
-void Catalogue::AddLexerModule(LexerModule *plm) {
- catalogueDefault.AddLexerModule(plm);
-}
-
-// To add or remove a lexer, add or remove its file and run LexGen.py.
-
-// Force a reference to all of the Scintilla lexers so that the linker will
-// not remove the code of the lexers.
-int Scintilla_LinkLexers() {
-
- static int initialised = 0;
- if (initialised)
- return 0;
- initialised = 1;
-
-#if !defined(SCI_EMPTYCATALOGUE)
-
-// Shorten the code that declares a lexer and ensures it is linked in by calling a method.
-#define LINK_LEXER(lexer) extern LexerModule lexer; catalogueDefault.AddLexerModule(&lexer);
-
-//++Autogenerated -- run scripts/LexGen.py to regenerate
-//**\(\tLINK_LEXER(\*);\n\)
- LINK_LEXER(lmA68k);
- LINK_LEXER(lmAbaqus);
- LINK_LEXER(lmAda);
- LINK_LEXER(lmAPDL);
- LINK_LEXER(lmAs);
- LINK_LEXER(lmAsm);
- LINK_LEXER(lmAsn1);
- LINK_LEXER(lmASY);
- LINK_LEXER(lmAU3);
- LINK_LEXER(lmAVE);
- LINK_LEXER(lmAVS);
- LINK_LEXER(lmBaan);
- LINK_LEXER(lmBash);
- LINK_LEXER(lmBatch);
- LINK_LEXER(lmBibTeX);
- LINK_LEXER(lmBlitzBasic);
- LINK_LEXER(lmBullant);
- LINK_LEXER(lmCaml);
- LINK_LEXER(lmCIL);
- LINK_LEXER(lmClw);
- LINK_LEXER(lmClwNoCase);
- LINK_LEXER(lmCmake);
- LINK_LEXER(lmCOBOL);
- LINK_LEXER(lmCoffeeScript);
- LINK_LEXER(lmConf);
- LINK_LEXER(lmCPP);
- LINK_LEXER(lmCPPNoCase);
- LINK_LEXER(lmCsound);
- LINK_LEXER(lmCss);
- LINK_LEXER(lmD);
- LINK_LEXER(lmDataflex);
- LINK_LEXER(lmDiff);
- LINK_LEXER(lmDMAP);
- LINK_LEXER(lmDMIS);
- LINK_LEXER(lmECL);
- LINK_LEXER(lmEDIFACT);
- LINK_LEXER(lmEiffel);
- LINK_LEXER(lmEiffelkw);
- LINK_LEXER(lmErlang);
- LINK_LEXER(lmErrorList);
- LINK_LEXER(lmESCRIPT);
- LINK_LEXER(lmF77);
- LINK_LEXER(lmFlagShip);
- LINK_LEXER(lmForth);
- LINK_LEXER(lmFortran);
- LINK_LEXER(lmFreeBasic);
- LINK_LEXER(lmGAP);
- LINK_LEXER(lmGui4Cli);
- LINK_LEXER(lmHaskell);
- LINK_LEXER(lmHollywood);
- LINK_LEXER(lmHTML);
- LINK_LEXER(lmIHex);
- LINK_LEXER(lmIndent);
- LINK_LEXER(lmInno);
- LINK_LEXER(lmJSON);
- LINK_LEXER(lmKix);
- LINK_LEXER(lmKVIrc);
- LINK_LEXER(lmLatex);
- LINK_LEXER(lmLISP);
- LINK_LEXER(lmLiterateHaskell);
- LINK_LEXER(lmLot);
- LINK_LEXER(lmLout);
- LINK_LEXER(lmLua);
- LINK_LEXER(lmMagikSF);
- LINK_LEXER(lmMake);
- LINK_LEXER(lmMarkdown);
- LINK_LEXER(lmMatlab);
- LINK_LEXER(lmMaxima);
- LINK_LEXER(lmMETAPOST);
- LINK_LEXER(lmMMIXAL);
- LINK_LEXER(lmModula);
- LINK_LEXER(lmMSSQL);
- LINK_LEXER(lmMySQL);
- LINK_LEXER(lmNim);
- LINK_LEXER(lmNimrod);
- LINK_LEXER(lmNncrontab);
- LINK_LEXER(lmNsis);
- LINK_LEXER(lmNull);
- LINK_LEXER(lmOctave);
- LINK_LEXER(lmOpal);
- LINK_LEXER(lmOScript);
- LINK_LEXER(lmPascal);
- LINK_LEXER(lmPB);
- LINK_LEXER(lmPerl);
- LINK_LEXER(lmPHPSCRIPT);
- LINK_LEXER(lmPLM);
- LINK_LEXER(lmPO);
- LINK_LEXER(lmPOV);
- LINK_LEXER(lmPowerPro);
- LINK_LEXER(lmPowerShell);
- LINK_LEXER(lmProgress);
- LINK_LEXER(lmProps);
- LINK_LEXER(lmPS);
- LINK_LEXER(lmPureBasic);
- LINK_LEXER(lmPython);
- LINK_LEXER(lmR);
- LINK_LEXER(lmRaku);
- LINK_LEXER(lmREBOL);
- LINK_LEXER(lmRegistry);
- LINK_LEXER(lmRuby);
- LINK_LEXER(lmRust);
- LINK_LEXER(lmSAS);
- LINK_LEXER(lmScriptol);
- LINK_LEXER(lmSmalltalk);
- LINK_LEXER(lmSML);
- LINK_LEXER(lmSorc);
- LINK_LEXER(lmSpecman);
- LINK_LEXER(lmSpice);
- LINK_LEXER(lmSQL);
- LINK_LEXER(lmSrec);
- LINK_LEXER(lmStata);
- LINK_LEXER(lmSTTXT);
- LINK_LEXER(lmTACL);
- LINK_LEXER(lmTADS3);
- LINK_LEXER(lmTAL);
- LINK_LEXER(lmTCL);
- LINK_LEXER(lmTCMD);
- LINK_LEXER(lmTEHex);
- LINK_LEXER(lmTeX);
- LINK_LEXER(lmTxt2tags);
- LINK_LEXER(lmVB);
- LINK_LEXER(lmVBScript);
- LINK_LEXER(lmVerilog);
- LINK_LEXER(lmVHDL);
- LINK_LEXER(lmVisualProlog);
- LINK_LEXER(lmX12);
- LINK_LEXER(lmXML);
- LINK_LEXER(lmYAML);
-
-//--Autogenerated -- end of automatically generated section
-
-#endif
-
- return 1;
-}
diff --git a/src/Catalogue.h b/src/Catalogue.h
deleted file mode 100644
index 05a1f1d29..000000000
--- a/src/Catalogue.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Scintilla source code edit control
-/** @file Catalogue.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 CATALOGUE_H
-#define CATALOGUE_H
-
-namespace Scintilla {
-
-class Catalogue {
-public:
- static const LexerModule *Find(int language);
- static const LexerModule *Find(const char *languageName) noexcept;
- static void AddLexerModule(LexerModule *plm);
-};
-
-}
-
-#endif
diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx
deleted file mode 100644
index 1609b676e..000000000
--- a/src/ExternalLexer.cxx
+++ /dev/null
@@ -1,222 +0,0 @@
-// Scintilla source code edit control
-/** @file ExternalLexer.cxx
- ** Support external lexers in DLLs or shared libraries.
- **/
-// Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson.
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#include <cstdlib>
-#include <cassert>
-#include <cstring>
-
-#include <stdexcept>
-#include <string>
-#include <string_view>
-#include <vector>
-#include <memory>
-
-#include "Platform.h"
-
-#include "ILexer.h"
-#include "Scintilla.h"
-#include "SciLexer.h"
-
-#include "LexerModule.h"
-#include "Catalogue.h"
-#include "ExternalLexer.h"
-
-using namespace Scintilla;
-
-#if PLAT_WIN
-#define EXT_LEXER_DECL __stdcall
-#else
-#define EXT_LEXER_DECL
-#endif
-
-namespace {
-
-int nextLanguage = SCLEX_AUTOMATIC + 1;
-
-typedef int (EXT_LEXER_DECL *GetLexerCountFn)();
-typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
-typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index);
-
-/// Generic function to convert from a void* to a function pointer.
-/// This avoids undefined and conditionally defined behaviour.
-template<typename T>
-T FunctionPointer(void *function) noexcept {
- static_assert(sizeof(T) == sizeof(function));
- T fp;
- memcpy(&fp, &function, sizeof(T));
- return fp;
-}
-
-/// Sub-class of LexerModule to use an external lexer.
-class ExternalLexerModule : public LexerModule {
-protected:
- GetLexerFactoryFunction fneFactory;
- std::string name;
-public:
- ExternalLexerModule(int language_, LexerFunction fnLexer_,
- const char *languageName_=nullptr, LexerFunction fnFolder_=nullptr) :
- LexerModule(language_, fnLexer_, nullptr, fnFolder_),
- fneFactory(nullptr), name(languageName_){
- languageName = name.c_str();
- }
- void SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept;
-};
-
-/// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules.
-class LexerLibrary {
- std::unique_ptr<DynamicLibrary> lib;
- std::vector<std::unique_ptr<ExternalLexerModule>> modules;
-public:
- explicit LexerLibrary(const char *moduleName_);
- ~LexerLibrary();
-
- std::string moduleName;
-};
-
-/// LexerManager manages external lexers, contains LexerLibrarys.
-class LexerManager {
-public:
- ~LexerManager();
-
- static LexerManager *GetInstance();
- static void DeleteInstance() noexcept;
-
- void Load(const char *path);
- void Clear() noexcept;
-
-private:
- LexerManager();
- static std::unique_ptr<LexerManager> theInstance;
- std::vector<std::unique_ptr<LexerLibrary>> libraries;
-};
-
-class LMMinder {
-public:
- ~LMMinder();
-};
-
-std::unique_ptr<LexerManager> LexerManager::theInstance;
-
-//------------------------------------------
-//
-// ExternalLexerModule
-//
-//------------------------------------------
-
-void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept {
- fneFactory = fFactory;
- fnFactory = fFactory(index);
-}
-
-//------------------------------------------
-//
-// LexerLibrary
-//
-//------------------------------------------
-
-LexerLibrary::LexerLibrary(const char *moduleName_) {
- // Load the DLL
- lib.reset(DynamicLibrary::Load(moduleName_));
- if (lib->IsValid()) {
- moduleName = moduleName_;
- GetLexerCountFn GetLexerCount = FunctionPointer<GetLexerCountFn>(lib->FindFunction("GetLexerCount"));
-
- if (GetLexerCount) {
- // Find functions in the DLL
- GetLexerNameFn GetLexerName = FunctionPointer<GetLexerNameFn>(lib->FindFunction("GetLexerName"));
- GetLexerFactoryFunction fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory"));
-
- if (!GetLexerName || !fnFactory) {
- return;
- }
-
- const int nl = GetLexerCount();
-
- for (int i = 0; i < nl; i++) {
- // Assign a buffer for the lexer name.
- char lexname[100] = "";
- GetLexerName(i, lexname, sizeof(lexname));
- ExternalLexerModule *lex = new ExternalLexerModule(nextLanguage, nullptr, lexname, nullptr);
- nextLanguage++;
-
- // This is storing a second reference to lex in the Catalogue as well as in modules.
- // TODO: Should use std::shared_ptr or similar to ensure allocation safety.
- Catalogue::AddLexerModule(lex);
-
- // Remember ExternalLexerModule so we don't leak it
- modules.push_back(std::unique_ptr<ExternalLexerModule>(lex));
-
- // The external lexer needs to know how to call into its DLL to
- // do its lexing and folding, we tell it here.
- lex->SetExternal(fnFactory, i);
- }
- }
- }
-}
-
-LexerLibrary::~LexerLibrary() {
-}
-
-//------------------------------------------
-//
-// LexerManager
-//
-//------------------------------------------
-
-/// Return the single LexerManager instance...
-LexerManager *LexerManager::GetInstance() {
- if (!theInstance)
- theInstance.reset(new LexerManager);
- return theInstance.get();
-}
-
-/// Delete any LexerManager instance...
-void LexerManager::DeleteInstance() noexcept {
- theInstance.reset();
-}
-
-/// protected constructor - this is a singleton...
-LexerManager::LexerManager() {
-}
-
-LexerManager::~LexerManager() {
- Clear();
-}
-
-void LexerManager::Load(const char *path) {
- for (const std::unique_ptr<LexerLibrary> &ll : libraries) {
- if (ll->moduleName == path)
- return;
- }
- libraries.push_back(std::make_unique<LexerLibrary>(path));
-}
-
-void LexerManager::Clear() noexcept {
- libraries.clear();
-}
-
-//------------------------------------------
-//
-// LMMinder -- trigger to clean up at exit.
-//
-//------------------------------------------
-
-LMMinder::~LMMinder() {
- LexerManager::DeleteInstance();
-}
-
-LMMinder minder;
-
-}
-
-namespace Scintilla {
-
-void ExternalLexerLoad(const char *path) {
- LexerManager::GetInstance()->Load(path);
-}
-
-}
diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h
deleted file mode 100644
index d0a615e31..000000000
--- a/src/ExternalLexer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Scintilla source code edit control
-/** @file ExternalLexer.h
- ** Support external lexers in DLLs or shared libraries.
- **/
-// Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson.
-// The License.txt file describes the conditions under which this software may be distributed.
-
-#ifndef EXTERNALLEXER_H
-#define EXTERNALLEXER_H
-
-namespace Scintilla {
-
-void ExternalLexerLoad(const char *path);
-
-}
-
-#endif