diff options
| -rw-r--r-- | include/ILexer.h | 4 | ||||
| -rw-r--r-- | include/Scintilla.h | 4 | ||||
| -rw-r--r-- | include/Scintilla.iface | 15 | ||||
| -rw-r--r-- | lexers/LexCPP.cxx | 12 | ||||
| -rw-r--r-- | lexlib/DefaultLexer.cxx | 16 | ||||
| -rw-r--r-- | lexlib/DefaultLexer.h | 4 | ||||
| -rw-r--r-- | lexlib/LexerBase.cxx | 16 | ||||
| -rw-r--r-- | lexlib/LexerBase.h | 4 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 49 | 
9 files changed, 124 insertions, 0 deletions
| diff --git a/include/ILexer.h b/include/ILexer.h index 7f92e2b79..0e03dbdb0 100644 --- a/include/ILexer.h +++ b/include/ILexer.h @@ -75,6 +75,10 @@ public:  	virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;  	virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;  	virtual const char * SCI_METHOD GetSubStyleBases() = 0; +	virtual int SCI_METHOD NamedStyles() = 0; +	virtual const char * SCI_METHOD NameOfStyle(int style) = 0; +	virtual const char * SCI_METHOD TagsOfStyle(int style) = 0; +	virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0;  };  class ILoader { diff --git a/include/Scintilla.h b/include/Scintilla.h index 1a0108270..37bcf146f 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -1008,6 +1008,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCI_SETIDENTIFIERS 4024  #define SCI_DISTANCETOSECONDARYSTYLES 4025  #define SCI_GETSUBSTYLEBASES 4026 +#define SCI_GETNAMEDSTYLES 4029 +#define SCI_NAMEOFSTYLE 4030 +#define SCI_TAGSOFSTYLE 4031 +#define SCI_DESCRIPTIONOFSTYLE 4032  #define SC_MOD_INSERTTEXT 0x1  #define SC_MOD_DELETETEXT 0x2  #define SC_MOD_CHANGESTYLE 0x4 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 8406fa6fc..60c6b993b 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2702,6 +2702,21 @@ get int DistanceToSecondaryStyles=4025(,)  # Result is NUL-terminated.  get int GetSubStyleBases=4026(, stringresult styles) +# Retrieve the number of named styles for the lexer. +get int GetNamedStyles=4029(,) + +# Retrieve the name of a style. +# Result is NUL-terminated. +fun int NameOfStyle=4030(int style, stringresult names) + +# Retrieve a ' ' separated list of style tags like "literal quoted string". +# Result is NUL-terminated. +fun int TagsOfStyle=4031(int style, stringresult names) + +# Retrieve a description of a style. +# Result is NUL-terminated. +fun int DescriptionOfStyle=4032(int style, stringresult names) +  # Notifications  # Type of modification and the action which caused the modification.  # These are defined as a bit mask to make it easy to specify which notifications are wanted. diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 5d75aa171..39e21fff3 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -545,6 +545,18 @@ public:  	const char * SCI_METHOD GetSubStyleBases() override {  		return styleSubable;  	} +	int SCI_METHOD NamedStyles() { +		return 0; +	} +	const char * SCI_METHOD NameOfStyle(int) { +		return ""; +	} +	const char * SCI_METHOD TagsOfStyle(int) { +		return ""; +	} +	const char * SCI_METHOD DescriptionOfStyle(int) { +		return ""; +	}  	static ILexer4 *LexerFactoryCPP() {  		return new LexerCPP(true); diff --git a/lexlib/DefaultLexer.cxx b/lexlib/DefaultLexer.cxx index 69310f33c..19221cc53 100644 --- a/lexlib/DefaultLexer.cxx +++ b/lexlib/DefaultLexer.cxx @@ -108,3 +108,19 @@ int SCI_METHOD DefaultLexer::DistanceToSecondaryStyles() {  const char * SCI_METHOD DefaultLexer::GetSubStyleBases() {  	return styleSubable;  } + +int SCI_METHOD DefaultLexer::NamedStyles() { +	return 0; +} + +const char * SCI_METHOD DefaultLexer::NameOfStyle(int) { +	return ""; +} + +const char * SCI_METHOD DefaultLexer::TagsOfStyle(int) { +	return ""; +} + +const char * SCI_METHOD DefaultLexer::DescriptionOfStyle(int) { +	return ""; +} diff --git a/lexlib/DefaultLexer.h b/lexlib/DefaultLexer.h index be287546b..372294e1a 100644 --- a/lexlib/DefaultLexer.h +++ b/lexlib/DefaultLexer.h @@ -40,6 +40,10 @@ public:  	void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override;  	int SCI_METHOD DistanceToSecondaryStyles() override;  	const char * SCI_METHOD GetSubStyleBases() override; +	int SCI_METHOD NamedStyles() override; +	const char * SCI_METHOD NameOfStyle(int style) override; +	const char * SCI_METHOD TagsOfStyle(int style) override; +	const char * SCI_METHOD DescriptionOfStyle(int style) override;  };  #ifdef SCI_NAMESPACE diff --git a/lexlib/LexerBase.cxx b/lexlib/LexerBase.cxx index 232b110c4..fdf8878a2 100644 --- a/lexlib/LexerBase.cxx +++ b/lexlib/LexerBase.cxx @@ -127,3 +127,19 @@ int SCI_METHOD LexerBase::DistanceToSecondaryStyles() {  const char * SCI_METHOD LexerBase::GetSubStyleBases() {  	return styleSubable;  } + +int SCI_METHOD LexerBase::NamedStyles() { +	return 0; +} + +const char * SCI_METHOD LexerBase::NameOfStyle(int) { +	return ""; +} + +const char * SCI_METHOD LexerBase::TagsOfStyle(int) { +	return ""; +} + +const char * SCI_METHOD LexerBase::DescriptionOfStyle(int) { +	return ""; +} diff --git a/lexlib/LexerBase.h b/lexlib/LexerBase.h index f0378916f..66e7560e1 100644 --- a/lexlib/LexerBase.h +++ b/lexlib/LexerBase.h @@ -42,6 +42,10 @@ public:  	void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override;  	int SCI_METHOD DistanceToSecondaryStyles() override;  	const char * SCI_METHOD GetSubStyleBases() override; +	int SCI_METHOD NamedStyles() override; +	const char * SCI_METHOD NameOfStyle(int style) override; +	const char * SCI_METHOD TagsOfStyle(int style) override; +	const char * SCI_METHOD DescriptionOfStyle(int style) override;  };  #ifdef SCI_NAMESPACE diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 204ff9f8e..d65659ae8 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -582,6 +582,10 @@ public:  	void SetIdentifiers(int style, const char *identifiers);  	int DistanceToSecondaryStyles();  	const char *GetSubStyleBases(); +	int NamedStyles(); +	const char *NameOfStyle(int style); +	const char *TagsOfStyle(int style); +	const char *DescriptionOfStyle(int style);  };  #ifdef SCI_NAMESPACE @@ -790,6 +794,38 @@ const char *LexState::GetSubStyleBases() {  	return "";  } +int LexState::NamedStyles() { +	if (instance) { +		return instance->NamedStyles(); +	} else { +		return -1; +	} +} + +const char *LexState::NameOfStyle(int style) { +	if (instance) { +		return instance->NameOfStyle(style); +	} else { +		return 0; +	} +} + +const char *LexState::TagsOfStyle(int style) { +	if (instance) { +		return instance->TagsOfStyle(style); +	} else { +		return 0; +	} +} + +const char *LexState::DescriptionOfStyle(int style) { +	if (instance) { +		return instance->DescriptionOfStyle(style); +	} else { +		return 0; +	} +} +  #endif  void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { @@ -1101,6 +1137,19 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  	case SCI_GETSUBSTYLEBASES:  		return StringResult(lParam, DocumentLexState()->GetSubStyleBases()); + +	case SCI_GETNAMEDSTYLES: +		return DocumentLexState()->NamedStyles(); + +	case SCI_NAMEOFSTYLE: +		return StringResult(lParam, DocumentLexState()->NameOfStyle(wParam)); + +	case SCI_TAGSOFSTYLE: +		return StringResult(lParam, DocumentLexState()->TagsOfStyle(wParam)); + +	case SCI_DESCRIPTIONOFSTYLE: +		return StringResult(lParam, DocumentLexState()->DescriptionOfStyle(wParam)); +  #endif  	default: | 
