Trace mode for lexer development

Issue #347 resolved
created an issue

What do you think about a new option that enabled a super-verbose mode to pygmentize so you can see what is being matched and where the slowdowns are?

I have a patch at which I personally use, but I'm thinking that it should at least take a trace-filename (in case I want to send to another tty).

Comments (7)

  1. gbrandl
    +    while opts.pop('-v', None) is not None:
    +        pygments.lexer.VERBOSITY = 3

    This was probably meant to be `VERBOSITY += 1`...

    What I'm not happy about is the lots of extra tests and time calls in the RegexLexer. Benchmarks showing that they're not doing any harm to lexing speed would be nice. (A first optimization would be to make VERBOSITY a local in that function.)

    Otherwise, it would perhaps be possible to always set VERBOSITY before importing, and doing conditional method definitions in RegexLexer.

  2. Log in to comment