Tuesday, February 07, 2006

Checking how to do code-formatting

I was giving a quick look on how could the code-formatter be better, and having researched a little on how would it do the 'pretty-print' I found some references:

Dealing with comments:

Approach 1 (using special token):
- https://javacc.dev.java.net
/servlets/ReadMsg?list=users&msgNo=227

Approach 2 (not using special token and actually putting comments in the parsing.
- http://cvs.sourceforge.net/viewcvs.py/jrefactory
/JRefactory/javacc/java1_5.jjt?rev=1.18&view=markup

Currently, I generate an asdl structure that would also need to be extended to be supported later, but I guess I'll have to work on this myself, as I could not find any reference about comments in asdl... anyone has any suggestions?

And a little 'offtopic' but also for javaCC:

Error recovery: http://www.cise.ufl.edu/help/software/JavaCC/errorrecovery.html
Getting special tokens: https://javacc.dev.java.net/doc/tokenmanager.html

Cheers,

Fabio

2 comments:

  1. Is there a way to code format the entire project in pydev?

    ReplyDelete
  2. Yes, right click the project > pydev > source format python files.

    ReplyDelete