Hello Pygments developers,

The IPython project is in the process of refactoring their code base
to make GUI IPython frontends possible. I'm writing a prototype Qt
frontend (as well as a Qt source code editor to accompany it), and I
am using Pygments to perform syntax highlighting.

Pygments is a great tool but has been difficult to adapt to this use
case.The primary issue has been that Pygments cannot process text line
by line, which is required by Qt's syntax highlighting system. In
order to save the lexer state between lines, which is crucial for
handling things like multi-line strings, we have had to monkey-patch
RegexLexer's get_tokens_unprocessed method to save the state stack and
then restore it after every call. Obviously, this state of affairs is
not desirable.

Additionally, lexers that rely on regular expressions matching across
lines do not work even with the above patch, of course. For example,
multi-line comments in C code do not work and have necessitated
additional monkey-patching to use stateful pattern matching. (This has
the unfortunate side effect of making nested comments look like valid
C.)

I realize these issues probably constitute a lot of work for what is
currently uncommon use case. I would appreciate any help and would be
happy to submit patches if necessary.

Thanks for your time,

Evan

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to