<div dir="ltr"><div>Hi guys,<br><br></div><div>I also have done some work in this area [1]. <br>Well, I didnt get into reactoring yet...<br></div><div>Anyway, I thought you might be interested.<br></div><div><br></div><div>My approach was to convert python code to XML (and back to python)<br><div>This allow any generic XML tool to be used to manipulate the XML-code,<br></div><div>and then convert back to python without the need to create specific tools.<br></div><br>The implementation uses python's AST tree and the tokenize module<br>to retrieve information that is thrown away by the AST.<br></div><div>This way I didnt need to implement my own python parser.<br></div><div>It ended up being much more work than I expected but I still believe thats better<br>than maitaining another parser.<br></div><div><br></div><div>[1] <a href="http://pythonhosted.org/pyRegurgitator/#py2xml-experimental">http://pythonhosted.org/pyRegurgitator/#py2xml-experimental</a><br><br><a href="https://github.com/schettino72/pyRegurgitator">https://github.com/schettino72/pyRegurgitator</a><br><br></div><div>cheers,<br></div><div>   Eduardo<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 17, 2014 at 5:01 PM, Sylvain Thénault <span dir="ltr"><<a href="mailto:sylvain.thenault@logilab.fr" target="_blank">sylvain.thenault@logilab.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 15 novembre 16:49, Dave Halter wrote:<br>
> Hi Laurent<br>
<br>
Hi Laurent, David,<br>
<span class=""><br>
> Great to see somebody finally tackling refactoring.<br>
<br>
</span>indeed!<br>
<span class=""><br>
> I'm answering, because I think we're working on the same issue. But we have<br>
> finished two different parts: You have finished a refactoring<br>
> implementation and I have finished the static analysis part. I'm the author<br>
> of Jedi. <a href="https://github.com/davidhalter/jedi/" target="_blank">https://github.com/davidhalter/jedi/</a><br>
<br>
</span>Could I ask what do you mean by static analysis in the context of a completion<br>
library?<br>
<span class=""><br>
> I'm currently working on the integration of the lib2to3 parser into Jedi.<br>
> This would make refactoring really easy (I'm about 50% done with the<br>
> parser). It's also well tested and offers a few other advantages.<br>
><br>
> In a perfect world, we could now combine our projects :-) I will look in<br>
> detail at Red Baron on Monday.<br>
<br>
</span>David, we've been talking about this during the latest EuroPython, and I've<br>
talked with Laurent yesterday at the Capitole du Libre in Toulouse: IMO we could<br>
start by extracting from lib2to3 "the" parser that could be used by every tools<br>
like ours (refactoring, completion, static analysis...). It would be:<br>
* loss-less (comments, indents...)<br>
* accurate (eg from/to line numbers)<br>
* fast<br>
* version agnostic within a reasonable frame (eg 2.7 -> 3.4?)<br>
<br>
I guess almost every one on this list would be interested in such a parser, even<br>
if most would have to do a second pass on the generated tree to get more<br>
"business oriented" tree for their own project. Whatever, we (pylint guys) would<br>
be greatly interested.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)<br>
Formations Python, Debian, Méth. Agiles: <a href="http://www.logilab.fr/formations" target="_blank">http://www.logilab.fr/formations</a><br>
Développement logiciel sur mesure:       <a href="http://www.logilab.fr/services" target="_blank">http://www.logilab.fr/services</a><br>
CubicWeb, the semantic web framework:    <a href="http://www.cubicweb.org" target="_blank">http://www.cubicweb.org</a><br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
code-quality mailing list<br>
<a href="mailto:code-quality@python.org">code-quality@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/code-quality" target="_blank">https://mail.python.org/mailman/listinfo/code-quality</a><br>
</div></div></blockquote></div><br></div>