mirror of
				https://github.com/notepad-plus-plus/notepad-plus-plus.git
				synced 2025-11-03 21:14:08 +01: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
		
			
				
	
	
		
			143 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			143 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
// Scintilla source code edit control
 | 
						|
/** @file DefaultLexer.cxx
 | 
						|
 ** A lexer base class that provides reasonable default behaviour.
 | 
						|
 **/
 | 
						|
// Copyright 2017 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 <string>
 | 
						|
#include <string_view>
 | 
						|
 | 
						|
#include "ILexer.h"
 | 
						|
#include "Scintilla.h"
 | 
						|
#include "SciLexer.h"
 | 
						|
 | 
						|
#include "PropSetSimple.h"
 | 
						|
#include "WordList.h"
 | 
						|
#include "LexAccessor.h"
 | 
						|
#include "Accessor.h"
 | 
						|
#include "LexerModule.h"
 | 
						|
#include "DefaultLexer.h"
 | 
						|
 | 
						|
using namespace Lexilla;
 | 
						|
 | 
						|
static const char styleSubable[] = { 0 };
 | 
						|
 | 
						|
DefaultLexer::DefaultLexer(const char *languageName_, int language_,
 | 
						|
	const LexicalClass *lexClasses_, size_t nClasses_) :
 | 
						|
	languageName(languageName_),
 | 
						|
	language(language_),
 | 
						|
	lexClasses(lexClasses_),
 | 
						|
	nClasses(nClasses_) {
 | 
						|
}
 | 
						|
 | 
						|
DefaultLexer::~DefaultLexer() {
 | 
						|
}
 | 
						|
 | 
						|
void SCI_METHOD DefaultLexer::Release() {
 | 
						|
	delete this;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::Version() const {
 | 
						|
	return Scintilla::lvRelease5;
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::PropertyNames() {
 | 
						|
	return "";
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::PropertyType(const char *) {
 | 
						|
	return SC_TYPE_BOOLEAN;
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::DescribeProperty(const char *) {
 | 
						|
	return "";
 | 
						|
}
 | 
						|
 | 
						|
Sci_Position SCI_METHOD DefaultLexer::PropertySet(const char *, const char *) {
 | 
						|
	return -1;
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::DescribeWordListSets() {
 | 
						|
	return "";
 | 
						|
}
 | 
						|
 | 
						|
Sci_Position SCI_METHOD DefaultLexer::WordListSet(int, const char *) {
 | 
						|
	return -1;
 | 
						|
}
 | 
						|
 | 
						|
void SCI_METHOD DefaultLexer::Fold(Sci_PositionU, Sci_Position, int, Scintilla::IDocument *) {
 | 
						|
}
 | 
						|
 | 
						|
void * SCI_METHOD DefaultLexer::PrivateCall(int, void *) {
 | 
						|
	return nullptr;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::LineEndTypesSupported() {
 | 
						|
	return SC_LINE_END_TYPE_DEFAULT;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::AllocateSubStyles(int, int) {
 | 
						|
	return -1;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::SubStylesStart(int) {
 | 
						|
	return -1;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::SubStylesLength(int) {
 | 
						|
	return 0;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::StyleFromSubStyle(int subStyle) {
 | 
						|
	return subStyle;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::PrimaryStyleFromStyle(int style) {
 | 
						|
	return style;
 | 
						|
}
 | 
						|
 | 
						|
void SCI_METHOD DefaultLexer::FreeSubStyles() {
 | 
						|
}
 | 
						|
 | 
						|
void SCI_METHOD DefaultLexer::SetIdentifiers(int, const char *) {
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::DistanceToSecondaryStyles() {
 | 
						|
	return 0;
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::GetSubStyleBases() {
 | 
						|
	return styleSubable;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::NamedStyles() {
 | 
						|
	return static_cast<int>(nClasses);
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::NameOfStyle(int style) {
 | 
						|
	return (style < NamedStyles()) ? lexClasses[style].name : "";
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::TagsOfStyle(int style) {
 | 
						|
	return (style < NamedStyles()) ? lexClasses[style].tags : "";
 | 
						|
}
 | 
						|
 | 
						|
const char * SCI_METHOD DefaultLexer::DescriptionOfStyle(int style) {
 | 
						|
	return (style < NamedStyles()) ? lexClasses[style].description : "";
 | 
						|
}
 | 
						|
 | 
						|
// ILexer5 methods
 | 
						|
const char * SCI_METHOD DefaultLexer::GetName() {
 | 
						|
	return languageName;
 | 
						|
}
 | 
						|
 | 
						|
int SCI_METHOD DefaultLexer::GetIdentifier() {
 | 
						|
	return language;
 | 
						|
}
 | 
						|
 |