diff options
| author | Georg Brandl <georg@python.org> | 2015-10-12 08:45:22 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2015-10-12 08:45:22 +0200 |
| commit | 5e541828a60a6fda3a2165b4c3282a28980b87f1 (patch) | |
| tree | 466633b396021a8e222adf830061c1d8fa9fd105 /doc/docs | |
| parent | 7b77c0676c6d0a26e2cccbff2b1e1d503073bd92 (diff) | |
| download | pygments-git-5e541828a60a6fda3a2165b4c3282a28980b87f1.tar.gz | |
Small problem with overriding get_tokens_unprocessed in the docs (thanks M. Harnisch).
Diffstat (limited to 'doc/docs')
| -rw-r--r-- | doc/docs/lexerdevelopment.rst | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst index 08069889..81e4d3fe 100644 --- a/doc/docs/lexerdevelopment.rst +++ b/doc/docs/lexerdevelopment.rst @@ -345,15 +345,14 @@ There are a few more things you can do with states: `PythonLexer`'s string literal processing. - If you want your lexer to start lexing in a different state you can modify the - stack by overloading the `get_tokens_unprocessed()` method:: + stack by overriding the `get_tokens_unprocessed()` method:: from pygments.lexer import RegexLexer class ExampleLexer(RegexLexer): tokens = {...} - def get_tokens_unprocessed(self, text): - stack = ['root', 'otherstate'] + def get_tokens_unprocessed(self, text, stack=('root', 'otherstate')): for item in RegexLexer.get_tokens_unprocessed(text, stack): yield item |
