Show More
@@ -12,6 +12,11 b" def get_tokens_unprocessed(self, text, stack=('root',)):" | |||||
12 | """ Split ``text`` into (tokentype, text) pairs. |
|
12 | """ Split ``text`` into (tokentype, text) pairs. | |
13 |
|
13 | |||
14 | Monkeypatched to store the final stack on the object itself. |
|
14 | Monkeypatched to store the final stack on the object itself. | |
|
15 | ||||
|
16 | The `text` parameter this gets passed is only the current line, so to | |||
|
17 | highlight things like multiline strings correctly, we need to retrieve | |||
|
18 | the state from the previous line (this is done in PygmentsHighlighter, | |||
|
19 | below), and use it to continue processing the current line. | |||
15 | """ |
|
20 | """ | |
16 | pos = 0 |
|
21 | pos = 0 | |
17 | tokendefs = self._tokens |
|
22 | tokendefs = self._tokens | |
@@ -24,6 +29,7 b" def get_tokens_unprocessed(self, text, stack=('root',)):" | |||||
24 | for rexmatch, action, new_state in statetokens: |
|
29 | for rexmatch, action, new_state in statetokens: | |
25 | m = rexmatch(text, pos) |
|
30 | m = rexmatch(text, pos) | |
26 | if m: |
|
31 | if m: | |
|
32 | if action is not None: | |||
27 | if type(action) is _TokenType: |
|
33 | if type(action) is _TokenType: | |
28 | yield pos, action, m.group() |
|
34 | yield pos, action, m.group() | |
29 | else: |
|
35 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now