From db6528b463841e9ea05fb9dad1559d263b1f6a34 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 17 Jul 2017 14:37:48 +1000 Subject: Backport: Implement style metadata for some languages. Add some helper methods to SubStyles for finding style metadata of substyles. Backport of changeset 6349:f350a2543488. --- lexers/LexPython.cxx | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lexers/LexPython.cxx') diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx index 50c3baa8c..567c44d05 100644 --- a/lexers/LexPython.cxx +++ b/lexers/LexPython.cxx @@ -309,6 +309,30 @@ struct OptionSetPython : public OptionSet { const char styleSubable[] = { SCE_P_IDENTIFIER, 0 }; +LexicalClass lexicalClasses[] = { + // Lexer Python SCLEX_PYTHON SCE_P_: + 0, "SCE_P_DEFAULT", "default", "White space", + 1, "SCE_P_COMMENTLINE", "comment line", "Comment", + 2, "SCE_P_NUMBER", "literal numeric", "Number", + 3, "SCE_P_STRING", "literal string", "String", + 4, "SCE_P_CHARACTER", "literal string", "Single quoted string", + 5, "SCE_P_WORD", "keyword", "Keyword", + 6, "SCE_P_TRIPLE", "literal string", "Triple quotes", + 7, "SCE_P_TRIPLEDOUBLE", "literal string", "Triple double quotes", + 8, "SCE_P_CLASSNAME", "identifier", "Class name definition", + 9, "SCE_P_DEFNAME", "identifier", "Function or method name definition", + 10, "SCE_P_OPERATOR", "operator", "Operators", + 11, "SCE_P_IDENTIFIER", "identifier", "Identifiers", + 12, "SCE_P_COMMENTBLOCK", "comment", "Comment-blocks", + 13, "SCE_P_STRINGEOL", "error literal string", "End of line where string is not closed", + 14, "SCE_P_WORD2", "identifier", "Highlighted identifiers", + 15, "SCE_P_DECORATOR", "preprocessor", "Decorators", + 16, "SCE_P_FSTRING", "literal string interpolated", "F-String", + 17, "SCE_P_FCHARACTER", "literal string interpolated", "Single quoted f-string", + 18, "SCE_P_FTRIPLE", "literal string interpolated", "Triple quoted f-string", + 19, "SCE_P_FTRIPLEDOUBLE", "literal string interpolated", "Triple double quoted f-string", +}; + } class LexerPython : public DefaultLexer { @@ -321,6 +345,7 @@ class LexerPython : public DefaultLexer { std::map > ftripleStateAtEol; public: explicit LexerPython() : + DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)), subStyles(styleSubable, 0x80, 0x40, 0) { } virtual ~LexerPython() { -- cgit v1.2.3