On 12/21/2011 08:03 PM, Andrea Crotti wrote: > I just had the following (maybe stupid) idea. > > One of the great things about python is that it exposes the parsing > completely > in the standard library, with the module tokenize. > > Now would not it be possible to write a simple tokenizer that takes a python > file and returns a nice structured format of the same, that python-mode > can interpret to colorize/manage the code? > > For example > > import sys > def fun(a): > .. > > might become (very roughly) > <builtin>import</builtin> <name>name</name> > <builtin>def</builtin> <name>fun</name><op>(</op><parameter>a</parameter>... > > This would make it work automatically with every possible python version, > and remove the necessity of rewriting the parser in elisp. > Does it make any sense? > > If yes I can write a blueprint maybe, and actually I could implement > something myself, > at least on the python side I have some experience in the area.
One possible drawback now that I tought a bit better is that this thing should run in background continuosly, because I would actually edit the file and expect that everything gets correctly interpreted. But if maybe we can limit to some areas then it might not be so bad.. And also Pymacs might help in this case, but I'm not sure we should rely on Pymacs even for the parsing. Mm there would be great advantages but is probably not so easy.. _______________________________________________ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode