|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.QScintilla.Lexers.LexerPygments</title> |
|
6 <style> |
|
7 b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' |
|
8 </style> |
|
9 </head> |
|
10 <body><a NAME="top" ID="top"></a> |
|
11 <h1>eric5.QScintilla.Lexers.LexerPygments</h1> |
|
12 <p> |
|
13 Module implementing a custom lexer using pygments. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 <table> |
|
17 <tr><td>PYGMENTS_ERROR</td></tr><tr><td>PYGMENTS_INSERTED</td></tr><tr><td>TOKEN_MAP</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#LexerPygments">LexerPygments</a></td> |
|
23 <td>Class implementing a custom lexer using pygments.</td> |
|
24 </tr> |
|
25 </table> |
|
26 <h3>Functions</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <hr /><hr /> |
|
31 <a NAME="LexerPygments" ID="LexerPygments"></a> |
|
32 <h2>LexerPygments</h2> |
|
33 <p> |
|
34 |
|
35 </p><p> |
|
36 Class implementing a custom lexer using pygments. |
|
37 </p> |
|
38 <h3>Derived from</h3> |
|
39 LexerContainer |
|
40 <h3>Class Attributes</h3> |
|
41 <table> |
|
42 <tr><td>None</td></tr> |
|
43 </table> |
|
44 <h3>Methods</h3> |
|
45 <table> |
|
46 <tr> |
|
47 <td><a href="#LexerPygments.__init__">LexerPygments</a></td> |
|
48 <td>Constructor</td> |
|
49 </tr><tr> |
|
50 <td><a href="#LexerPygments.__guessLexer">__guessLexer</a></td> |
|
51 <td>Private method to guess a pygments lexer.</td> |
|
52 </tr><tr> |
|
53 <td><a href="#LexerPygments.canStyle">canStyle</a></td> |
|
54 <td>Public method to check, if the lexer is able to style the text.</td> |
|
55 </tr><tr> |
|
56 <td><a href="#LexerPygments.defaultColor">defaultColor</a></td> |
|
57 <td>Public method to get the default foreground color for a style.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#LexerPygments.defaultFont">defaultFont</a></td> |
|
60 <td>Public method to get the default font for a style.</td> |
|
61 </tr><tr> |
|
62 <td><a href="#LexerPygments.defaultPaper">defaultPaper</a></td> |
|
63 <td>Public method to get the default background color for a style.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#LexerPygments.description">description</a></td> |
|
66 <td>Public method returning the descriptions of the styles supported by the lexer.</td> |
|
67 </tr><tr> |
|
68 <td><a href="#LexerPygments.isCommentStyle">isCommentStyle</a></td> |
|
69 <td>Public method to check, if a style is a comment style.</td> |
|
70 </tr><tr> |
|
71 <td><a href="#LexerPygments.isStringStyle">isStringStyle</a></td> |
|
72 <td>Public method to check, if a style is a string style.</td> |
|
73 </tr><tr> |
|
74 <td><a href="#LexerPygments.language">language</a></td> |
|
75 <td>Public method returning the language of the lexer.</td> |
|
76 </tr><tr> |
|
77 <td><a href="#LexerPygments.name">name</a></td> |
|
78 <td>Public method to get the name of the pygments lexer.</td> |
|
79 </tr><tr> |
|
80 <td><a href="#LexerPygments.styleBitsNeeded">styleBitsNeeded</a></td> |
|
81 <td>Public method to get the number of style bits needed by the lexer.</td> |
|
82 </tr><tr> |
|
83 <td><a href="#LexerPygments.styleText">styleText</a></td> |
|
84 <td>Public method to perform the styling.</td> |
|
85 </tr> |
|
86 </table> |
|
87 <a NAME="LexerPygments.__init__" ID="LexerPygments.__init__"></a> |
|
88 <h4>LexerPygments (Constructor)</h4> |
|
89 <b>LexerPygments</b>(<i>parent = None, name = ""</i>) |
|
90 <p> |
|
91 Constructor |
|
92 </p><dl> |
|
93 <dt><i>parent</i></dt> |
|
94 <dd> |
|
95 parent widget of this lexer |
|
96 </dd><dt><i>name=</i></dt> |
|
97 <dd> |
|
98 name of the pygments lexer to use (string) |
|
99 </dd> |
|
100 </dl><a NAME="LexerPygments.__guessLexer" ID="LexerPygments.__guessLexer"></a> |
|
101 <h4>LexerPygments.__guessLexer</h4> |
|
102 <b>__guessLexer</b>(<i>text</i>) |
|
103 <p> |
|
104 Private method to guess a pygments lexer. |
|
105 </p><dl> |
|
106 <dt><i>text</i></dt> |
|
107 <dd> |
|
108 text to base guessing on (string) |
|
109 </dd> |
|
110 </dl><dl> |
|
111 <dt>Returns:</dt> |
|
112 <dd> |
|
113 reference to the guessed lexer (pygments.lexer) |
|
114 </dd> |
|
115 </dl><a NAME="LexerPygments.canStyle" ID="LexerPygments.canStyle"></a> |
|
116 <h4>LexerPygments.canStyle</h4> |
|
117 <b>canStyle</b>(<i></i>) |
|
118 <p> |
|
119 Public method to check, if the lexer is able to style the text. |
|
120 </p><dl> |
|
121 <dt>Returns:</dt> |
|
122 <dd> |
|
123 flag indicating the lexer capability (boolean) |
|
124 </dd> |
|
125 </dl><a NAME="LexerPygments.defaultColor" ID="LexerPygments.defaultColor"></a> |
|
126 <h4>LexerPygments.defaultColor</h4> |
|
127 <b>defaultColor</b>(<i>style</i>) |
|
128 <p> |
|
129 Public method to get the default foreground color for a style. |
|
130 </p><dl> |
|
131 <dt><i>style</i></dt> |
|
132 <dd> |
|
133 style number (integer) |
|
134 </dd> |
|
135 </dl><dl> |
|
136 <dt>Returns:</dt> |
|
137 <dd> |
|
138 foreground color (QColor) |
|
139 </dd> |
|
140 </dl><a NAME="LexerPygments.defaultFont" ID="LexerPygments.defaultFont"></a> |
|
141 <h4>LexerPygments.defaultFont</h4> |
|
142 <b>defaultFont</b>(<i>style</i>) |
|
143 <p> |
|
144 Public method to get the default font for a style. |
|
145 </p><dl> |
|
146 <dt><i>style</i></dt> |
|
147 <dd> |
|
148 style number (integer) |
|
149 </dd> |
|
150 </dl><dl> |
|
151 <dt>Returns:</dt> |
|
152 <dd> |
|
153 font (QFont) |
|
154 </dd> |
|
155 </dl><a NAME="LexerPygments.defaultPaper" ID="LexerPygments.defaultPaper"></a> |
|
156 <h4>LexerPygments.defaultPaper</h4> |
|
157 <b>defaultPaper</b>(<i>style</i>) |
|
158 <p> |
|
159 Public method to get the default background color for a style. |
|
160 </p><dl> |
|
161 <dt><i>style</i></dt> |
|
162 <dd> |
|
163 style number (integer) |
|
164 </dd> |
|
165 </dl><dl> |
|
166 <dt>Returns:</dt> |
|
167 <dd> |
|
168 background color (QColor) |
|
169 </dd> |
|
170 </dl><a NAME="LexerPygments.description" ID="LexerPygments.description"></a> |
|
171 <h4>LexerPygments.description</h4> |
|
172 <b>description</b>(<i>style</i>) |
|
173 <p> |
|
174 Public method returning the descriptions of the styles supported |
|
175 by the lexer. |
|
176 </p><dl> |
|
177 <dt><i>style</i></dt> |
|
178 <dd> |
|
179 style number (integer) |
|
180 </dd> |
|
181 </dl><dl> |
|
182 <dt>Returns:</dt> |
|
183 <dd> |
|
184 description for the style (string) |
|
185 </dd> |
|
186 </dl><a NAME="LexerPygments.isCommentStyle" ID="LexerPygments.isCommentStyle"></a> |
|
187 <h4>LexerPygments.isCommentStyle</h4> |
|
188 <b>isCommentStyle</b>(<i>style</i>) |
|
189 <p> |
|
190 Public method to check, if a style is a comment style. |
|
191 </p><dl> |
|
192 <dt>Returns:</dt> |
|
193 <dd> |
|
194 flag indicating a comment style (boolean) |
|
195 </dd> |
|
196 </dl><a NAME="LexerPygments.isStringStyle" ID="LexerPygments.isStringStyle"></a> |
|
197 <h4>LexerPygments.isStringStyle</h4> |
|
198 <b>isStringStyle</b>(<i>style</i>) |
|
199 <p> |
|
200 Public method to check, if a style is a string style. |
|
201 </p><dl> |
|
202 <dt>Returns:</dt> |
|
203 <dd> |
|
204 flag indicating a string style (boolean) |
|
205 </dd> |
|
206 </dl><a NAME="LexerPygments.language" ID="LexerPygments.language"></a> |
|
207 <h4>LexerPygments.language</h4> |
|
208 <b>language</b>(<i></i>) |
|
209 <p> |
|
210 Public method returning the language of the lexer. |
|
211 </p><dl> |
|
212 <dt>Returns:</dt> |
|
213 <dd> |
|
214 language of the lexer (string) |
|
215 </dd> |
|
216 </dl><a NAME="LexerPygments.name" ID="LexerPygments.name"></a> |
|
217 <h4>LexerPygments.name</h4> |
|
218 <b>name</b>(<i></i>) |
|
219 <p> |
|
220 Public method to get the name of the pygments lexer. |
|
221 </p><dl> |
|
222 <dt>Returns:</dt> |
|
223 <dd> |
|
224 name of the pygments lexer (string) |
|
225 </dd> |
|
226 </dl><a NAME="LexerPygments.styleBitsNeeded" ID="LexerPygments.styleBitsNeeded"></a> |
|
227 <h4>LexerPygments.styleBitsNeeded</h4> |
|
228 <b>styleBitsNeeded</b>(<i></i>) |
|
229 <p> |
|
230 Public method to get the number of style bits needed by the lexer. |
|
231 </p><dl> |
|
232 <dt>Returns:</dt> |
|
233 <dd> |
|
234 number of style bits needed (integer) |
|
235 </dd> |
|
236 </dl><a NAME="LexerPygments.styleText" ID="LexerPygments.styleText"></a> |
|
237 <h4>LexerPygments.styleText</h4> |
|
238 <b>styleText</b>(<i>start, end</i>) |
|
239 <p> |
|
240 Public method to perform the styling. |
|
241 </p><dl> |
|
242 <dt><i>start</i></dt> |
|
243 <dd> |
|
244 position of first character to be styled (integer) |
|
245 </dd><dt><i>end</i></dt> |
|
246 <dd> |
|
247 position of last character to be styled (integer) |
|
248 </dd> |
|
249 </dl> |
|
250 <div align="right"><a href="#top">Up</a></div> |
|
251 <hr /> |
|
252 </body></html> |