src/eric7/QScintilla/Lexers/LexerContainer.py

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
14 14
15 class LexerContainer(Lexer, QsciLexer): 15 class LexerContainer(Lexer, QsciLexer):
16 """ 16 """
17 Subclass as a base for the implementation of custom lexers. 17 Subclass as a base for the implementation of custom lexers.
18 """ 18 """
19
19 def __init__(self, parent=None): 20 def __init__(self, parent=None):
20 """ 21 """
21 Constructor 22 Constructor
22 23
23 @param parent parent widget of this lexer 24 @param parent parent widget of this lexer
24 """ 25 """
25 QsciLexer.__init__(self, parent) 26 QsciLexer.__init__(self, parent)
26 Lexer.__init__(self) 27 Lexer.__init__(self)
27 28
28 self.editor = parent 29 self.editor = parent
29 30
30 def language(self): 31 def language(self):
31 """ 32 """
32 Public method returning the language of the lexer. 33 Public method returning the language of the lexer.
33 34
34 @return language of the lexer (string) 35 @return language of the lexer (string)
35 """ 36 """
36 return "Container" 37 return "Container"
37 38
38 def lexer(self): 39 def lexer(self):
39 """ 40 """
40 Public method returning the type of the lexer. 41 Public method returning the type of the lexer.
41 42
42 @return type of the lexer (string) 43 @return type of the lexer (string)
43 """ 44 """
44 if hasattr(self, 'lexerId'): 45 if hasattr(self, "lexerId"):
45 return None 46 return None
46 else: 47 else:
47 return "container" 48 return "container"
48 49
49 def description(self, style): 50 def description(self, style):
50 """ 51 """
51 Public method returning the descriptions of the styles supported 52 Public method returning the descriptions of the styles supported
52 by the lexer. 53 by the lexer.
53 54
54 <b>Note</b>: This methods needs to be overridden by the lexer class. 55 <b>Note</b>: This methods needs to be overridden by the lexer class.
55 56
56 @param style style number (integer) 57 @param style style number (integer)
57 @return description for the given style (string) 58 @return description for the given style (string)
58 """ 59 """
59 return "" 60 return ""
60 61
61 def styleText(self, start, end): 62 def styleText(self, start, end):
62 """ 63 """
63 Public method to perform the styling. 64 Public method to perform the styling.
64 65
65 @param start position of first character to be styled (integer) 66 @param start position of first character to be styled (integer)
66 @param end position of last character to be styled (integer) 67 @param end position of last character to be styled (integer)
67 """ 68 """
68 self.editor.startStyling(start, 0x1f) 69 self.editor.startStyling(start, 0x1F)
69 self.editor.setStyling(end - start + 1, 0) 70 self.editor.setStyling(end - start + 1, 0)
70 71
71 def keywords(self, kwSet): 72 def keywords(self, kwSet):
72 """ 73 """
73 Public method to get the keywords. 74 Public method to get the keywords.
74 75
75 @param kwSet number of the keyword set (integer) 76 @param kwSet number of the keyword set (integer)
76 @return string giving the keywords (string) or None 77 @return string giving the keywords (string) or None
77 """ 78 """
78 return Lexer.keywords(self, kwSet) 79 return Lexer.keywords(self, kwSet)

eric ide

mercurial