From: Peter G. <pe...@ar...> - 2007-04-24 07:40:48
|
On Mon, 23 Apr 2007 at 21:38:15 +0200, Jan-Wijbrand Kolman wrote: > It's been a while since I was able to improve J's Python mode. I have > two small patches. The sourceforge patch tracker is driving me nuts, so > I hope it is OK to post'em here. Yes, of course! > The first is a very trivial patch to add the new "with" keyword that is > introduced with the Python-2.5 release. For more information on the what > and how of the "with" statement, see: > > http://www.python.org/doc/2.5/whatsnew/pep-343.html > > The second patch adds (in a somewhat naive manner probably) support for > highlighting Python code in so called "doctests". Doctests are a way of > writing (unit)tests *inside* the documentation strings of Python > modules, classes, methods, and functions. > > For more information on the how and what of doctests, see: > > http://docs.python.org/lib/module-doctest.html > > In short, python code inside docstrings that start with ">>>" (or "...", > depending on context) is executed by a doctest-aware testrunner. This > patch will apply syntax coloring to these code snippets. > > I was suprised to see I got the doctest support added so easily, and I'm > not even 100% sure why it works... I *think* it works because J uses, > somehow, a two stage aproach to parsing the buffer in order to apply > syntax coloring: first on a buffer level and then on a single line level. That's correct. > Hopefully these patches are of any use. I've committed them to CVS. Thanks very much! -Peter |