+ upd: to Scintilla v.5.0.0

This commit is contained in:
Rainer Kottenhoff 2021-03-11 17:26:46 +01:00
parent edc7c2843c
commit 1f62ea8e42
21 changed files with 102 additions and 667 deletions

View File

@ -1,6 +1,6 @@
License for Scintilla and SciTE
License for Lexilla, Scintilla, and SciTE
Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
Copyright 1998-2021 by Neil Hodgson <neilh@scintilla.org>
All Rights Reserved

View File

@ -433,7 +433,6 @@
<ClInclude Include="src\Editor.h" />
<ClInclude Include="src\EditView.h" />
<ClInclude Include="src\ElapsedPeriod.h" />
<ClInclude Include="src\ExternalLexer.h" />
<ClInclude Include="src\FontQuality.h" />
<ClInclude Include="src\Indicator.h" />
<ClInclude Include="src\IntegerRectangle.h" />

View File

@ -239,9 +239,6 @@
<ClInclude Include="src\EditView.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="src\ExternalLexer.h">
<Filter>src</Filter>
</ClInclude>
<ClInclude Include="src\FontQuality.h">
<Filter>src</Filter>
</ClInclude>

View File

@ -129,28 +129,29 @@ typedef void *IdlerID;
/**
* A geometric point class.
* Point is similar to the Win32 POINT and GTK GdkPoint types.
* Point is similar to the Win32 POINT and GTK+ GdkPoint types.
*/
class Point {
public:
XYPOSITION x;
XYPOSITION y;
constexpr explicit Point(XYPOSITION x_ = 0, XYPOSITION y_ = 0) noexcept : x(x_), y(y_) {}
constexpr explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) noexcept : x(x_), y(y_) {
}
static constexpr Point FromInts(int x_, int y_) noexcept {
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
}
bool operator!=(Point other) const noexcept {
constexpr bool operator!=(Point other) const noexcept {
return (x != other.x) || (y != other.y);
}
Point operator+(Point other) const noexcept {
constexpr Point operator+(Point other) const noexcept {
return Point(x + other.x, y + other.y);
}
Point operator-(Point other) const noexcept {
constexpr Point operator-(Point other) const noexcept {
return Point(x - other.x, y - other.y);
}
@ -169,8 +170,9 @@ public:
XYPOSITION right;
XYPOSITION bottom;
constexpr explicit PRectangle(XYPOSITION left_ = 0, XYPOSITION top_ = 0, XYPOSITION right_ = 0, XYPOSITION bottom_ = 0) noexcept :
left(left_), top(top_), right(right_), bottom(bottom_) {}
constexpr explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) noexcept :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
static constexpr PRectangle FromInts(int left_, int top_, int right_, int bottom_) noexcept {
return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_),
@ -179,24 +181,24 @@ public:
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
bool operator==(const PRectangle &rc) const noexcept {
constexpr bool operator==(const PRectangle &rc) const noexcept {
return (rc.left == left) && (rc.right == right) &&
(rc.top == top) && (rc.bottom == bottom);
}
bool Contains(Point pt) const noexcept {
constexpr bool Contains(Point pt) const noexcept {
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
}
bool ContainsWholePixel(Point pt) const noexcept {
constexpr bool ContainsWholePixel(Point pt) const noexcept {
// Does the rectangle contain all of the pixel to left/below the point
return (pt.x >= left) && ((pt.x + 1) <= right) &&
(pt.y >= top) && ((pt.y + 1) <= bottom);
return (pt.x >= left) && ((pt.x+1) <= right) &&
(pt.y >= top) && ((pt.y+1) <= bottom);
}
bool Contains(PRectangle rc) const noexcept {
constexpr bool Contains(PRectangle rc) const noexcept {
return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom);
}
bool Intersects(PRectangle other) const noexcept {
constexpr bool Intersects(PRectangle other) const noexcept {
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
@ -232,20 +234,22 @@ public:
/**
* Holds an RGB colour with 8 bits for each component.
*/
constexpr float componentMaximum = 255.0F;
constexpr const float componentMaximum = 255.0f;
class ColourDesired {
unsigned int co;
int co;
public:
constexpr explicit ColourDesired(unsigned int co_ = 0) noexcept : co(co_) {}
constexpr explicit ColourDesired(int co_=0) noexcept : co(co_) {
}
ColourDesired(unsigned int red, unsigned int green, unsigned int blue) noexcept :
co(red | (green << 8) | (blue << 16)) {}
constexpr ColourDesired(unsigned int red, unsigned int green, unsigned int blue) noexcept :
co(red | (green << 8) | (blue << 16)) {
}
constexpr bool operator==(const ColourDesired &other) const noexcept {
return co == other.co;
}
constexpr unsigned int AsInteger() const noexcept {
constexpr int AsInteger() const noexcept {
return co;
}
@ -277,15 +281,20 @@ public:
*/
class ColourAlpha : public ColourDesired {
public:
constexpr explicit ColourAlpha(unsigned int co_ = 0) noexcept : ColourDesired(co_) {}
constexpr explicit ColourAlpha(int co_ = 0) noexcept : ColourDesired(co_) {
}
ColourAlpha(unsigned int red, unsigned int green, unsigned int blue) noexcept :
ColourDesired(red | (green << 8) | (blue << 16)) {}
ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha) noexcept :
ColourDesired(red | (green << 8) | (blue << 16) | (alpha << 24)) {}
constexpr ColourAlpha(unsigned int red, unsigned int green, unsigned int blue) noexcept :
ColourDesired(red | (green << 8) | (blue << 16)) {
}
ColourAlpha(ColourDesired cd, unsigned int alpha) noexcept :
ColourDesired(cd.AsInteger() | (alpha << 24)) {}
constexpr ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha) noexcept :
ColourDesired(red | (green << 8) | (blue << 16) | (alpha << 24)) {
}
constexpr ColourAlpha(ColourDesired cd, unsigned int alpha) noexcept :
ColourDesired(cd.AsInteger() | (alpha << 24)) {
}
constexpr ColourDesired GetColour() const noexcept {
return ColourDesired(AsInteger() & 0xffffff);
@ -299,7 +308,7 @@ public:
return GetAlpha() / componentMaximum;
}
ColourAlpha MixedWith(ColourAlpha other) const noexcept {
constexpr ColourAlpha MixedWith(ColourAlpha other) const noexcept {
const unsigned int red = (GetRed() + other.GetRed()) / 2;
const unsigned int green = (GetGreen() + other.GetGreen()) / 2;
const unsigned int blue = (GetBlue() + other.GetBlue()) / 2;
@ -316,7 +325,8 @@ public:
float position;
ColourAlpha colour;
ColourStop(float position_, ColourAlpha colour_) noexcept :
position(position_), colour(colour_) {}
position(position_), colour(colour_) {
}
};
/**

View File

@ -24,7 +24,6 @@ typedef size_t Sci_PositionU;
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
typedef long Sci_PositionCR;
#ifdef _WIN32
#define SCI_METHOD __stdcall
#else

View File

@ -1658,7 +1658,6 @@ fun void LinesSplit=2289(int pixelWidth,)
# Set one of the colours used as a chequerboard pattern in the fold margin
fun void SetFoldMarginColour=2290(bool useSetting, colour back)
# Set the other colour used as a chequerboard pattern in the fold margin
fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore)
@ -3133,7 +3132,6 @@ val SC_CHARACTERSOURCE_TENTATIVE_INPUT=1
# IME (either inline or windowed mode) full composited string.
val SC_CHARACTERSOURCE_IME_RESULT=2
# Events
evt void StyleNeeded=2000(int position)

View File

@ -9,15 +9,6 @@ import Face
from FileGenerator import UpdateFile, Generate, Regenerate, UpdateLineInFile, lineEnd
def printLexHFile(f):
out = []
for name in f.order:
v = f.features[name]
if v["FeatureType"] in ["val"]:
if "SCE_" in name or "SCLEX_" in name:
out.append("#define " + name + " " + v["Value"])
return out
def printHFile(f):
out = []
previousCategory = ""
@ -36,8 +27,7 @@ def printHFile(f):
featureDefineName = "SCN_" + name.upper()
out.append("#define " + featureDefineName + " " + v["Value"])
elif v["FeatureType"] in ["val"]:
if not ("SCE_" in name or "SCLEX_" in name):
out.append("#define " + name + " " + v["Value"])
out.append("#define " + name + " " + v["Value"])
if anyProvisional:
out.append("#endif")
return out
@ -46,7 +36,6 @@ def RegenerateAll(root, showMaxID):
f = Face.Face()
f.ReadFromFile(root / "include/Scintilla.iface")
Regenerate(root / "include/Scintilla.h", "/* ", printHFile(f))
Regenerate(root / "include/SciLexer.h", "/* ", printLexHFile(f))
if showMaxID:
valueSet = set(int(x) for x in f.values if int(x) < 3000)
maximumID = max(valueSet)

View File

@ -1,23 +1,9 @@
#!/usr/bin/env python3
# Script to check that headers are in a consistent order
# Canonical header order is defined in scripts/HeaderOrder.txt
# Canonical header order is defined in a file, normally scripts/HeaderOrder.txt
# Requires Python 3.6 or later
import pathlib
patterns = [
"include/*.h",
"src/*.cxx",
"lexlib/*.cxx",
"lexers/*.cxx",
"win32/*.cxx",
"gtk/*.cxx",
"cocoa/*.mm",
"cocoa/*.h",
"test/unit/*.cxx",
"lexilla/src/*.cxx",
"lexilla/test/*.cxx",
]
import pathlib, sys
def IsHeader(x):
return x.strip().startswith("#") and \
@ -28,32 +14,41 @@ def HeaderFromIncludeLine(s):
#\s*#\s*(include|import)\s+\S+\s*
return s.strip()[1:].strip()[7:].strip()
def ExtractHeaders(filename):
with filename.open(encoding="cp437") as infile:
def ExtractHeaders(file):
with file.open(encoding="cp437") as infile:
return [HeaderFromIncludeLine(l) for l in infile if IsHeader(l)]
def ExcludeName(name):
# LexCaml adds system headers in #if to be an external lexer
# moc_ files are generated by Qt and follow its rules
return "LexCaml" in name or "moc_" in name
def ExtractWithPrefix(file, prefix):
with file.open(encoding="cp437") as infile:
return [l.strip()[len(prefix):] for l in infile if l.startswith(prefix)]
def ExcludeName(name, excludes):
return any(exclude in name for exclude in excludes)
def SortLike(incs, order):
return sorted(incs, key = lambda i: order.index(i))
def CheckFiles(root):
# Find all the lexer source code files
basePrefix = "//base:"
sourcePrefix = "//source:"
excludePrefix = "//exclude:"
def CheckFiles(headerOrderTxt):
headerOrderFile = pathlib.Path(headerOrderTxt).resolve()
bases = ExtractWithPrefix(headerOrderFile, basePrefix)
base = bases[0] if len(bases) > 0 else ".."
orderDirectory = headerOrderFile.parent
root = (orderDirectory / base).resolve()
# Find all the source code files
patterns = ExtractWithPrefix(headerOrderFile, sourcePrefix)
excludes = ExtractWithPrefix(headerOrderFile, excludePrefix)
filePaths = []
for p in patterns:
filePaths += root.glob(p)
# The Qt platform code interleaves system and Scintilla headers
#~ filePaths += root.glob("qt/ScintillaEditBase/*.cpp")
#~ filePaths += root.glob("qt/ScintillaEdit/*.cpp")
#~ print(filePaths)
scriptDirectory = root / "scripts"
headerOrderFile = scriptDirectory / "HeaderOrder.txt"
headerOrder = ExtractHeaders(headerOrderFile)
originalOrder = headerOrder[:]
orderedPaths = [p for p in sorted(filePaths) if not ExcludeName(str(p))]
orderedPaths = [p for p in sorted(filePaths) if not ExcludeName(str(p), excludes)]
allIncs = set()
for f in orderedPaths:
print(" File ", f.relative_to(root))
@ -105,7 +100,7 @@ def CheckFiles(root):
if headerOrder != originalOrder:
newIncludes = set(headerOrder) - set(originalOrder)
headerOrderNew = scriptDirectory / "NewOrder.txt"
headerOrderNew = orderDirectory / "NewOrder.txt"
print(f"{headerOrderFile}:1: changed to {headerOrderNew}")
print(f" Added {', '.join(newIncludes)}.")
with headerOrderNew.open("w") as headerOut:
@ -117,4 +112,7 @@ def CheckFiles(root):
print("In HeaderOrder.txt but not used")
print("\n".join(unused))
CheckFiles(pathlib.Path(__file__).resolve().parent.parent)
if len(sys.argv) > 1:
CheckFiles(sys.argv[1])
else:
CheckFiles("HeaderOrder.txt")

View File

@ -2,15 +2,26 @@
// All platform headers should be included before Scintilla headers
// and each of these groups are then divided into directory groups.
// Base of the repository relative to this file
//base:..
// File patterns to check:
//source:include/*.h
//source:src/*.cxx
//source:lexlib/*.cxx
//source:lexers/*.cxx
//source:win32/*.cxx
//source:gtk/*.cxx
//source:cocoa/*.mm
//source:cocoa/*.h
//source:test/unit/*.cxx
//source:lexilla/src/*.cxx
//source:lexilla/test/*.cxx
// C standard library
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
// C++ wrappers of C standard library
#include <cstddef>
@ -18,7 +29,6 @@
#include <cstdint>
#include <cassert>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdarg>
#include <ctime>
@ -28,12 +38,10 @@
// C++ standard library
#include <stdexcept>
#include <new>
#include <utility>
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include <set>
#include <forward_list>
#include <algorithm>
#include <iterator>
@ -44,9 +52,7 @@
#include <regex>
#include <iostream>
#include <sstream>
#include <fstream>
#include <mutex>
#include <filesystem>
// POSIX
#include <dlfcn.h>
@ -91,30 +97,11 @@
#include "Scintilla.h"
#include "ScintillaWidget.h"
#include "SciLexer.h"
// lexlib
#include "StringCopy.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h"
#include "CatalogueModules.h"
#include "OptionSet.h"
#include "SparseState.h"
#include "SubStyles.h"
#include "DefaultLexer.h"
#include "LexerBase.h"
#include "LexerSimple.h"
#include "LexerNoExceptions.h"
// src
#include "Catalogue.h"
#include "Position.h"
#include "IntegerRectangle.h"
#include "UniqueString.h"
@ -152,12 +139,6 @@
#include "AutoComplete.h"
#include "ScintillaBase.h"
#include "ExternalLexer.h"
#include "Lexilla.h"
#include "TestDocument.h"
#include "LexillaAccess.h"
// Platform-specific headers
// win32

View File

@ -54,11 +54,6 @@ def UpdateVersionNumbers(sci, root):
cocoa = root / "cocoa"
UpdateLineInPlistFile(cocoa / "ScintillaFramework/Info.plist",
"CFBundleVersion", sci.versionDotted)
UpdateLineInPlistFile(cocoa / "ScintillaFramework/Info.plist",
"CFBundleShortVersionString", sci.versionDotted)
UpdateLineInPlistFile(cocoa / "Scintilla" / "Info.plist",
"CFBundleShortVersionString", sci.versionDotted)
ReplaceREInFile(cocoa / "Scintilla"/ "Scintilla.xcodeproj" / "project.pbxproj",
@ -72,61 +67,6 @@ def uid24():
def ciLexerKey(a):
return a.split()[2].lower()
"""
11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */; };
11F35FDA12AEFAF100F0236D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../lexers/LexA68k.cxx; sourceTree = SOURCE_ROOT; };
11F35FDA12AEFAF100F0236D /* LexA68k.cxx */,
11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */,
"""
def RegenerateXcodeProject(path, lexers, lexerReferences):
# Build 4 blocks for insertion:
# Each markers contains a unique section start, an optional wait string, and a section end
markersPBXBuildFile = ["Begin PBXBuildFile section", "", "End PBXBuildFile section"]
sectionPBXBuildFile = []
markersPBXFileReference = ["Begin PBXFileReference section", "", "End PBXFileReference section"]
sectionPBXFileReference = []
markersLexers = ["/* Lexers */ =", "children", ");"]
sectionLexers = []
markersPBXSourcesBuildPhase = ["Begin PBXSourcesBuildPhase section", "files", ");"]
sectionPBXSourcesBuildPhase = []
for lexer in lexers:
if lexer not in lexerReferences:
uid1 = uid24()
uid2 = uid24()
print("Lexer", lexer, "is not in Xcode project. Use IDs", uid1, uid2)
lexerReferences[lexer] = [uid1, uid2]
linePBXBuildFile = "\t\t{} /* {}.cxx in Sources */ = {{isa = PBXBuildFile; fileRef = {} /* {}.cxx */; }};".format(uid1, lexer, uid2, lexer)
linePBXFileReference = "\t\t{} /* {}.cxx */ = {{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = {}.cxx; path = ../../lexers/{}.cxx; sourceTree = SOURCE_ROOT; }};".format(uid2, lexer, lexer, lexer)
lineLexers = "\t\t\t\t{} /* {}.cxx */,".format(uid2, lexer)
linePBXSourcesBuildPhase = "\t\t\t\t{} /* {}.cxx in Sources */,".format(uid1, lexer)
sectionPBXBuildFile.append(linePBXBuildFile)
sectionPBXFileReference.append(linePBXFileReference)
sectionLexers.append(lineLexers)
sectionPBXSourcesBuildPhase.append(linePBXSourcesBuildPhase)
lines = ReadFileAsList(path)
sli = FindSectionInList(lines, markersPBXBuildFile)
lines[sli.stop:sli.stop] = sectionPBXBuildFile
sli = FindSectionInList(lines, markersPBXFileReference)
lines[sli.stop:sli.stop] = sectionPBXFileReference
sli = FindSectionInList(lines, markersLexers)
# This section is shown in the project outline so sort it to make it easier to navigate.
allLexers = sorted(lines[sli.start:sli.stop] + sectionLexers, key=ciLexerKey)
lines[sli] = allLexers
sli = FindSectionInList(lines, markersPBXSourcesBuildPhase)
lines[sli.stop:sli.stop] = sectionPBXSourcesBuildPhase
UpdateFileFromLines(path, lines, "\n")
def RegenerateAll(rootDirectory):
root = pathlib.Path(rootDirectory)
@ -135,7 +75,6 @@ def RegenerateAll(rootDirectory):
sci = ScintillaData.ScintillaData(scintillaBase)
Regenerate(scintillaBase / "src/Catalogue.cxx", "//", sci.lexerModules)
Regenerate(scintillaBase / "win32/scintilla.mak", "#", sci.lexFiles)
startDir = os.getcwd()
@ -145,9 +84,6 @@ def RegenerateAll(rootDirectory):
gtk.DepGen.Generate()
os.chdir(startDir)
RegenerateXcodeProject(root / "cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj",
sci.lexFiles, sci.lexersXcode)
UpdateVersionNumbers(sci, root)
HFacer.RegenerateAll(root, False)

View File

@ -233,8 +233,6 @@ class ScintillaData:
self.lexerProperties = list(lexerProperties)
SortListInsensitive(self.lexerProperties)
self.lexersXcode = FindLexersInXcode(scintillaRoot /
"cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj")
self.credits = FindCredits(scintillaRoot / "doc" / "ScintillaHistory.html")
def printWrapped(text):
@ -247,8 +245,6 @@ if __name__=="__main__":
sci.dateModified, sci.yearModified, sci.mdyModified, sci.dmyModified, sci.myModified))
printWrapped(str(len(sci.lexFiles)) + " lexer files: " + ", ".join(sci.lexFiles))
printWrapped(str(len(sci.lexerModules)) + " lexer modules: " + ", ".join(sci.lexerModules))
#~ printWrapped(str(len(sci.lexersXcode)) + " Xcode lexer references: " + ", ".join(
#~ [lex+":"+uids[0]+","+uids[1] for lex, uids in sci.lexersXcode.items()]))
print("Lexer name to ID:")
lexNames = sorted(sci.sclexFromName.keys())
for lexName in lexNames:

View File

@ -1,207 +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.
#ifdef SCI_LEXER
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
// EXTERNAL LEXERS
LINK_LEXER(lmAHKL);
LINK_LEXER(lmCSV);
LINK_LEXER(lmDart);
LINK_LEXER(lmKotlin);
LINK_LEXER(lmTOML);
#endif // SCI_EMPTYCATALOGUE
return 1;
}
#endif // SCI_LEXER

View File

@ -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

View File

@ -816,7 +816,7 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m
if (subLine == ll->lines - 1)
posRet = ll->numCharsBeforeEOL + posLineStart;
else
posRet = ll->LineStart(subLine + 1) + posLineStart - 1;
posRet = model.pdoc->MovePositionOutsideChar(ll->LineStart(subLine + 1) + posLineStart - 1, -1, false);
}
}
}

View File

@ -1,220 +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;
using GetLexerCountFn = int (EXT_LEXER_DECL *)();
using GetLexerNameFn = void (EXT_LEXER_DECL *)(unsigned int Index, char *name, int buflength);
using GetLexerFactoryFunction = LexerFactoryFunction(EXT_LEXER_DECL *)(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() = default;
//------------------------------------------
//
// 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() = default;
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);
}
}

View File

@ -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

View File

@ -75,7 +75,7 @@ inline bool UTF8IsNEL(const unsigned char *us) noexcept {
return (us[0] == 0xc2) && (us[1] == 0x85);
}
// Is the sequence of 3 char a UTF-8 line end? Only the last two char are tested for a NEL.
// Is the sequence of 3 char a UTF-8 line end? Only the last two char are tested for a NEL.
constexpr bool UTF8IsMultibyteLineEnd(unsigned char ch0, unsigned char ch1, unsigned char ch2) noexcept {
return
((ch0 == 0xe2) && (ch1 == 0x80) && ((ch2 == 0xa8) || (ch2 == 0xa9))) ||

View File

@ -1 +1 @@
446
500

View File

@ -13,8 +13,8 @@ from scripts import Dependencies
topComment = "# Created by DepGen.py. To recreate, run DepGen.py.\n"
def Generate():
sources = ["../src/*.cxx", "../lexlib/*.cxx", "../lexers/*.cxx"]
includes = ["../include", "../src", "../lexlib"]
sources = ["../src/*.cxx"]
includes = ["../include", "../src"]
# Create the dependencies file for g++
deps = Dependencies.FindDependencies(["../win32/*.cxx"] + sources, ["../win32"] + includes, ".o", "../win32/")

View File

@ -22,7 +22,7 @@ interface IRadical;
interface IHanja;
interface IStrokes;
enum HANJA_TYPE { HANJA_UNKNOWN = 0, HANJA_K0 = 1, HANJA_K1 = 2, HANJA_OTHER = 3 };
typedef enum { HANJA_UNKNOWN = 0, HANJA_K0 = 1, HANJA_K1 = 2, HANJA_OTHER = 3 } HANJA_TYPE;
interface IHanjaDic : IUnknown {
STDMETHOD(OpenMainDic)();
@ -104,10 +104,10 @@ int GetHangulOfHanja(wchar_t *inout) noexcept {
int changed = 0;
HanjaDic dict;
if (dict.HJdictAvailable()) {
const size_t len = lstrlenW(inout);
wchar_t conv[UTF8MaxBytes] = { 0 };
const size_t len = wcslen(inout);
wchar_t conv[UTF8MaxBytes] = {0};
BSTR bstrHangul = SysAllocString(conv);
for (size_t i = 0; i < len; i++) {
for (size_t i=0; i<len; i++) {
if (dict.IsHanja(static_cast<int>(inout[i]))) { // Pass hanja only!
conv[0] = inout[i];
BSTR bstrHanja = SysAllocString(conv);

View File

@ -1,13 +1,13 @@
// Resource file for Scintilla
// encoding: UTF-8
#pragma code_page(65001) // UTF-8
// Copyright 1998-2020 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2021 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <windows.h>
#define VERSION_SCINTILLA "4.4.6"
#define VERSION_WORDS 4, 4, 6, 0
#define VERSION_SCINTILLA "5.0.0"
#define VERSION_WORDS 5, 0, 0, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS