src/eric7/QScintilla/Lexers/LexerXML.py

Tue, 08 Nov 2022 11:14:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 08 Nov 2022 11:14:44 +0100
branch
eric7
changeset 9484
d2eb8f0a5bf0
parent 9473
3f23dbf37dbe
child 9653
e67609152c5e
permissions
-rw-r--r--

Changed the way editor lexers are instantiated.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
3 # Copyright (c) 2008 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a XML lexer with some additional methods.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
10 import contextlib
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
11
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
12 from PyQt6.Qsci import QsciLexerXML
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14 from eric7 import Preferences
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
15
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 from .Lexer import Lexer
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
18
3462
6d6e7334a787 Fixed an issue with ALL lexers inheriting in the wrong order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
19 class LexerXML(Lexer, QsciLexerXML):
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
20 """
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Subclass to implement some additional lexer dependant methods.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
23
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 def __init__(self, parent=None):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
27
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @param parent parent widget of this lexer
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
3462
6d6e7334a787 Fixed an issue with ALL lexers inheriting in the wrong order.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
30 QsciLexerXML.__init__(self, parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 Lexer.__init__(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
32
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
33 self.streamCommentString = {"start": "<!-- ", "end": " -->"}
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
34
6874
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
35 self.keywordSetDescriptions = [
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
36 self.tr(""),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
37 self.tr(""),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
38 self.tr(""),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
39 self.tr(""),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
40 self.tr(""),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
41 self.tr("SGML and DTD keywords"),
5a3a39442711 Lexers: extended the keyword set handling by introducing a keyword set description and some set adjustments (harmonized with SciTE).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6645
diff changeset
42 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
43
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 def initProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 Public slot to initialize the properties.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.setFoldPreprocessor(Preferences.getEditor("HtmlFoldPreprocessor"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49 self.setCaseSensitiveTags(Preferences.getEditor("HtmlCaseSensitiveTags"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
8243
cc717c2ae956 Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
51 with contextlib.suppress(AttributeError):
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52 self.setFoldScriptComments(Preferences.getEditor("HtmlFoldScriptComments"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53 self.setFoldScriptHeredocs(Preferences.getEditor("HtmlFoldScriptHeredocs"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.setScriptsStyled(Preferences.getEditor("XMLStyleScripts"))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def isCommentStyle(self, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 Public method to check, if a style is a comment style.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
60 @param style style to check (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 @return flag indicating a comment style (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 return style in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 QsciLexerXML.HTMLComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 QsciLexerXML.ASPXCComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 QsciLexerXML.SGMLComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67 QsciLexerXML.SGMLParameterComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68 QsciLexerXML.JavaScriptComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
69 QsciLexerXML.JavaScriptCommentDoc,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
70 QsciLexerXML.JavaScriptCommentLine,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71 QsciLexerXML.ASPJavaScriptComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72 QsciLexerXML.ASPJavaScriptCommentDoc,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 QsciLexerXML.ASPJavaScriptCommentLine,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 QsciLexerXML.VBScriptComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75 QsciLexerXML.ASPVBScriptComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 QsciLexerXML.PythonComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77 QsciLexerXML.ASPPythonComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78 QsciLexerXML.PHPComment,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79 ]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 def isStringStyle(self, style):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Public method to check, if a style is a string style.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
85 @param style style to check (integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @return flag indicating a string style (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 return style in [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 QsciLexerXML.HTMLDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90 QsciLexerXML.HTMLSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91 QsciLexerXML.SGMLDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 QsciLexerXML.SGMLSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 QsciLexerXML.JavaScriptDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 QsciLexerXML.JavaScriptSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 QsciLexerXML.JavaScriptUnclosedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 QsciLexerXML.ASPJavaScriptDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 QsciLexerXML.ASPJavaScriptSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 QsciLexerXML.ASPJavaScriptUnclosedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 QsciLexerXML.VBScriptString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 QsciLexerXML.VBScriptUnclosedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 QsciLexerXML.ASPVBScriptString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 QsciLexerXML.ASPVBScriptUnclosedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 QsciLexerXML.PythonDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 QsciLexerXML.PythonSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 QsciLexerXML.PythonTripleDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106 QsciLexerXML.PythonTripleSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107 QsciLexerXML.ASPPythonDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108 QsciLexerXML.ASPPythonSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 QsciLexerXML.ASPPythonTripleDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 QsciLexerXML.ASPPythonTripleSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
111 QsciLexerXML.PHPDoubleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
112 QsciLexerXML.PHPSingleQuotedString,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
113 ]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
114
130
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
115 def defaultKeywords(self, kwSet):
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
116 """
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
117 Public method to get the default keywords.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
118
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
119 @param kwSet number of the keyword set (integer)
167
7508e44f4853 Fixed an issue with a missing method in LexerPygments.py and corrected some source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 130
diff changeset
120 @return string giving the keywords (string) or None
130
fcce4cc20d95 Added capability to change the keywords of a syntax highlighter.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 13
diff changeset
121 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
122 return QsciLexerXML.keywords(self, kwSet)
9484
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
123
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
124
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
125 def createLexer(variant="", parent=None):
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
126 """
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
127 Function to instantiate a lexer object.
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
128
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
129 @param variant name of the language variant
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
130 @type str
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
131 @param parent parent widget of this lexer
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
132 @type QObject
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
133 @return instantiated lexer object
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
134 @rtype LexerXML
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
135 """
d2eb8f0a5bf0 Changed the way editor lexers are instantiated.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
136 return LexerXML(parent=parent)

eric ide

mercurial