<div dir="ltr">Do you have a suggestion for an alternate Groovy parser to use if we cannot use groovy eclipse?<div><br></div><div style>Also, even if we do, this should not  (unless the Eclipse JDT does some *really bad* things), be a problem because it will be loaded in an isolated classloader.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, May 13, 2013 at 12:55 PM, Max Rydahl Andersen <span dir="ltr">&lt;<a href="mailto:manderse@redhat.com" target="_blank">manderse@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Just a warning about using groovy eclipse plugin - it historically have had a dependency<br>
on a patched Eclipse JDT meaning it&#39;s not installable on just any eclipse version.<br>
<br>
I would hope if you just need a groovy parser that you don&#39;t have a depenency on Eclipse JDT for that<br>
- but if you do then that might become tricky (might also be osgi dependencies to deal with, but<br>
that is another concern ;)<br>
<br>
If the dependency will be included into eclipse as a forge loaded lib we might avoid it all - but<br>
since forge itself also have a dependency on JDT it is something to keep an eye on for possible<br>
version mismatches.<br>
<span class="HOEnZb"><font color="#888888"><br>
/max<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Sun, May 12, 2013 at 06:00:20PM +0200, Adam Wyłuda wrote:<br>
&gt;Hi Lincoln!<br>
&gt;Thank you for your response, it&#39;s nice to hear that my proposal is rated<br>
&gt;positively.<br>
&gt;<br>
&gt;I first thought that creating our own Groovy parser which works directly on<br>
&gt;Groovy AST would be a good idea because that would give us more<br>
&gt;possibilities than existing solutions, but you are right - there is a risk<br>
&gt;that it might take more time than planned (although basic support could be<br>
&gt;provided which could be sufficient to work on Gradle project files).<br>
&gt;<br>
&gt;I have found this paper which gave me some insights on problems related to<br>
&gt;Groovy script parsing and modification:<br>
&gt;<a href="http://groovy.ifs.hsr.ch/groovy-refactoring.pdf" target="_blank">http://groovy.ifs.hsr.ch/groovy-refactoring.pdf</a><br>
&gt;<br>
&gt;It seems that the biggest issue is how to rewrite code without changing its<br>
&gt;formatting and how to keep comments in code. Groovy AST doesn&#39;t contain<br>
&gt;comment nodes so if we want to use pure Groovy AST to parse it, we need to<br>
&gt;include all whitespace and comments in our model, what is possible because<br>
&gt;Groovy AST nodes include position in source information, so we could just<br>
&gt;substring our source between statements, but it&#39;s hard because we need to<br>
&gt;check thoroughly every expression as comments can appear between any nodes,<br>
&gt;like this:<br>
&gt;x = y + /* comment */ z<br>
&gt;<br>
&gt;So as you said, it&#39;s better to use existing solution so we won&#39;t reinvent<br>
&gt;the wheel. I think that Groovy Eclipse plugin is the best candidate because<br>
&gt;it&#39;s API is similar to JDT plugin used in JavaParser (actually Groovy<br>
&gt;plugin uses JDT and it even seems to be a part of JDT), so it will be more<br>
&gt;convenient for other developers with JavaParser experience to maintain it.<br>
&gt;The are also alternatives like NetBeans or IntelliJ IDEA plugin, but I<br>
&gt;think Eclipse plugin is sufficient enough to work effectively with Groovy<br>
&gt;sources.<br>
&gt;<br>
&gt;Like you suggested I updated my proposal to give myself some time to<br>
&gt;understand Groovy Eclipse plugin API and start working on Gradle project<br>
&gt;support earlier.<br>
&gt;<br>
&gt;2013/5/7 Lincoln Baxter, III &lt;<a href="mailto:lincolnbaxter@gmail.com">lincolnbaxter@gmail.com</a>&gt;<br>
&gt;<br>
&gt;&gt; Hey Adam,<br>
&gt;&gt;<br>
&gt;&gt; Thank you so much for your proposal! We have reviewed your submission and<br>
&gt;&gt; so far all the mentors have given it a high rating :)<br>
&gt;&gt;<br>
&gt;&gt; I took a look at your prototype groovy-manager project, which looks very<br>
&gt;&gt; interesting. You are doing source parsing for groovy, which is pretty<br>
&gt;&gt; challenging.<br>
&gt;&gt;<br>
&gt;&gt; While writing a parser from scratch can be a thrilling challenge, I have<br>
&gt;&gt; to say that it can be quite a burden! We started writing our own<br>
&gt;&gt; Java-parser for Forge, but quickly came to find that even parsing a<br>
&gt;&gt; type-safe language is incredibly difficult.<br>
&gt;&gt;<br>
&gt;&gt; We ended up using the Eclipse JDT as a base implementation for our<br>
&gt;&gt; JavaParser.<br>
&gt;&gt;<br>
&gt;&gt; Have you looked for any Groovy parsers that may already exist today? This<br>
&gt;&gt; would give you a quick boost when working on this project. It may be the<br>
&gt;&gt; case that the parser would require some usability improvements to make<br>
&gt;&gt; integration with Forge simpler, and simpler for plugin devs, but I think it<br>
&gt;&gt; is safe to say that a search for existing parsers is warranted.<br>
&gt;&gt;<br>
&gt;&gt; If a suitable parser can be found, I would suggest that we revise your<br>
&gt;&gt; proposal to allow for several weeks to become familiar with that parser,<br>
&gt;&gt; and then allocate the rest of the time to actually working with it to<br>
&gt;&gt; implement the gradle support.<br>
&gt;&gt;<br>
&gt;&gt; I&#39;d suggest starting here, with the Groovy Eclipse Plugin - they almost<br>
&gt;&gt; certainly already support groovy syntax:<br>
&gt;&gt; <a href="http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-KeyFeatures" target="_blank">http://groovy.codehaus.org/Eclipse+Plugin#EclipsePlugin-KeyFeatures</a><br>
&gt;&gt;<br>
&gt;&gt; The problem with writing your own parser is that you have to maintain it<br>
&gt;&gt; :) Better to delegate.<br>
&gt;&gt;<br>
&gt;&gt; ~Lincoln<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Sun, May 5, 2013 at 5:05 PM, Adam Wyłuda &lt;<a href="mailto:adamwyl92@gmail.com">adamwyl92@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Hello JBoss community,<br>
&gt;&gt;&gt; This year I want to participate in an OS project and GSoC gives me great<br>
&gt;&gt;&gt; opportunity to do so.<br>
&gt;&gt;&gt; Here is my idea as GSoC 2013 proposal:<br>
&gt;&gt;&gt; <a href="http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/adamw/1" target="_blank">http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/adamw/1</a><br>
&gt;&gt;&gt; I&#39;d be very happy to hear your opinions (I hope it&#39;s not too late).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; forge-dev mailing list<br>
&gt;&gt;&gt; <a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Lincoln Baxter, III<br>
&gt;&gt; <a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>
&gt;&gt; &quot;Simpler is better.&quot;<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; forge-dev mailing list<br>
&gt;&gt; <a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
&gt;&gt;<br>
<br>
&gt;_______________________________________________<br>
&gt;forge-dev mailing list<br>
&gt;<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
&gt;<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a><br>
<br>
_______________________________________________<br>
forge-dev mailing list<br>
<a href="mailto:forge-dev@lists.jboss.org">forge-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/forge-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/forge-dev</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Lincoln Baxter, III<br>
<a href="http://ocpsoft.org" target="_blank">http://ocpsoft.org</a><br>&quot;Simpler is better.&quot;
</div>