aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexPython.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2017-07-17 14:37:48 +1000
committerNeil <nyamatongwe@gmail.com>2017-07-17 14:37:48 +1000
commitdb6528b463841e9ea05fb9dad1559d263b1f6a34 (patch)
tree0131d0de33a0ecabadf7d81ebe3d3a50551642e8 /lexers/LexPython.cxx
parentff97c84526a6105c8371cc75333053640b4b4ccb (diff)
downloadscintilla-mirror-db6528b463841e9ea05fb9dad1559d263b1f6a34.tar.gz
Backport: Implement style metadata for some languages.
Add some helper methods to SubStyles for finding style metadata of substyles. Backport of changeset 6349:f350a2543488.
Diffstat (limited to 'lexers/LexPython.cxx')
-rw-r--r--lexers/LexPython.cxx25
1 files changed, 25 insertions, 0 deletions
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<OptionsPython> {
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<int, std::vector<SingleFStringExpState> > ftripleStateAtEol;
public:
explicit LexerPython() :
+ DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)),
subStyles(styleSubable, 0x80, 0x40, 0) {
}
virtual ~LexerPython() {