diff options
author | blackbird <devnull@localhost> | 2006-12-19 22:27:32 +0100 |
---|---|---|
committer | blackbird <devnull@localhost> | 2006-12-19 22:27:32 +0100 |
commit | 00717a73526159ac08d2c5f3a5bde7a4550fb36f (patch) | |
tree | b0864395fa8226d3a7c9e8e06c2dd9a86632796e /pygments/lexer.py | |
parent | e20c50a69c13e6a9505a05cdc50dba5f0e28f9d5 (diff) | |
download | pygments-00717a73526159ac08d2c5f3a5bde7a4550fb36f.tar.gz |
[svn] php lexer finetuning
Diffstat (limited to 'pygments/lexer.py')
-rw-r--r-- | pygments/lexer.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pygments/lexer.py b/pygments/lexer.py index fa236d28..092870ce 100644 --- a/pygments/lexer.py +++ b/pygments/lexer.py @@ -275,8 +275,16 @@ def using(_other, **kwargs): """ if _other is this: def callback(lexer, match, ctx=None): + # if keyword arguments are given the callback + # function has to create a new lexer instance + if kwargs: + # XXX: cache that somehow + kwargs.update(lexer.options) + lx = lexer.__class__(**kwargs) + else: + lx = lexer s = match.start() - for i, t, v in lexer.get_tokens_unprocessed(match.group()): + for i, t, v in lx.get_tokens_unprocessed(match.group()): yield i + s, t, v if ctx: ctx.pos = match.end() |