diff options
Diffstat (limited to 'doc/docs/lexerdevelopment.rst')
-rw-r--r-- | doc/docs/lexerdevelopment.rst | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/docs/lexerdevelopment.rst b/doc/docs/lexerdevelopment.rst index 08069889..2c868440 100644 --- a/doc/docs/lexerdevelopment.rst +++ b/doc/docs/lexerdevelopment.rst @@ -145,7 +145,7 @@ Regex Flags You can either define regex flags locally in the regex (``r'(?x)foo bar'``) or globally by adding a `flags` attribute to your lexer class. If no attribute is -defined, it defaults to `re.MULTILINE`. For more informations about regular +defined, it defaults to `re.MULTILINE`. For more information about regular expression flags see the page about `regular expressions`_ in the Python documentation. @@ -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 |