<br><br>
<div><span class="gmail_quote">2008/5/8, <a href="mailto:metaas-dev-request@lists.badgers-in-foil.co.uk">metaas-dev-request@lists.badgers-in-foil.co.uk</a> &lt;<a href="mailto:metaas-dev-request@lists.badgers-in-foil.co.uk">metaas-dev-request@lists.badgers-in-foil.co.uk</a>&gt;:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Send metaas-dev mailing list submissions to<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br>
<br>To subscribe or unsubscribe via the World Wide Web, visit<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev">http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev</a><br>or, via email, send a message with subject or body &#39;help&#39; to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:metaas-dev-request@lists.badgers-in-foil.co.uk">metaas-dev-request@lists.badgers-in-foil.co.uk</a><br><br>You can reach the person managing the list at<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:metaas-dev-owner@lists.badgers-in-foil.co.uk">metaas-dev-owner@lists.badgers-in-foil.co.uk</a><br>
<br>When replying, please edit your Subject line so it is more specific<br>than &quot;Re: Contents of metaas-dev digest...&quot;<br><br><br>Today&#39;s Topics:<br><br>&nbsp;&nbsp;1. Re: method.addStmt(&quot;super.executeNextCommand()&quot;) (David Holroyd)<br>
&nbsp;&nbsp;2. Re: Sorting methods by name output parameters (David Holroyd)<br>&nbsp;&nbsp;3. Re: Reusing the ANTLR grammar (David Holroyd)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>
Date: Wed, 7 May 2008 21:58:25 +0000<br>From: David Holroyd &lt;<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>&gt;<br>Subject: Re: [metaas-dev] method.addStmt(&quot;super.executeNextCommand()&quot;)<br>
To: <a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br>Message-ID: &lt;<a href="mailto:20080507215824.GA4514@badgers-in-foil.co.uk">20080507215824.GA4514@badgers-in-foil.co.uk</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br><br>On Tue, May 06, 2008 at 08:44:42PM +0800, Yuliang-Yang wrote:<br>&gt; when I use method.addStmt(&quot;super.executeNextCommand()&quot;);<br>&gt; the compiler complains,,<br>
&gt; this method is override method of the super class.<br>&gt; Exception in thread &quot;main&quot; uk.co.badgersinfoil.metaas.SyntaxException:<br>&gt; Unexpected token DOT in &quot;super.executeNextCommand()&quot; at line 1<br>
<br>Unfortunatly, this is due to incompleteness of the AS3 parser built into<br>metaas.&nbsp;&nbsp;Several people have reported this problem so I&#39;ll try to tackle<br>this first when I get back on to metaas stuff.<br><br>Sorry about that!<br>
<br><br>&gt; and I also haven&#39;t find define a method with modifier &quot;override&quot;,maybe this<br>&gt; is cause by not modifiy with &quot;override&quot;;<br><br>I don&#39;t think that the message related to &#39;override&#39; is coming from<br>
metaas.&nbsp;&nbsp;Something to do with your application?</blockquote>
<div>&nbsp;</div>
<div>My usecase is that i want generate a subclass of A,which is B, and class A have a method executeNextCommand,</div>
<div>when I generate B&#39;s executeNextCommand I just use ASMethod method&nbsp;= clazz.newMethod(&quot;executeNextCommand&quot;,,,somemodify),</div>
<div>and then use method.addStmt(&quot;super.executeNextCommand()&quot;);&nbsp; so the parser complain :(</div><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">ta,<br>dave<br><br>--<br><a href="http://david.holroyd.me.uk/">http://david.holroyd.me.uk/</a><br><br><br>
<br>------------------------------<br><br>Message: 2<br>Date: Wed, 7 May 2008 22:16:58 +0000<br>From: David Holroyd &lt;<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>&gt;<br>Subject: Re: [metaas-dev] Sorting methods by name output parameters<br>
To: <a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br>Message-ID: &lt;<a href="mailto:20080507221657.GB4514@badgers-in-foil.co.uk">20080507221657.GB4514@badgers-in-foil.co.uk</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br><br>Hi there!<br><br>On Tue, May 06, 2008 at 09:17:23AM +0200, Florian Salihovic wrote:<br>&gt; I&#39;m currently working on a code generator for my own needs. Metaas is<br>&gt; a great help so far. But in order to navigate through my classes a lil<br>
&gt; easier i have this habit to write my methods in alphabetical order. I<br>&gt; thought of sorting the code regarding my needs with metaas, but the<br>&gt; list regarding the methods is read only. Do i have to sort the classes<br>
&gt; by hand?<br><br>Well, I&#39;m sorry to say that in-place modification of the contents of<br>code blocks is not supported yet :(<br><br>The underlying Abstract Syntax Tree data structure could allow this kind<br>of change with a bit of work, but the public API doesn&#39;t have the<br>
features yet.<br><br>I accept patches! ;)<br><br>The only way of really doing this currently might be to walk the entire<br>contents of the ASCompilationUnit, creating a duplicate of everything,<br>but adding the duplicate methods in alphabetical order.&nbsp;&nbsp;That would<br>
really be a lot of effort though.<br><br><br>&gt; Also i&#39;d like to know if some sort of output parameters are planned to<br>&gt; be implemented in the nearer future (whitespaces between operands and<br>&gt; operators, additional linebreaks between methods...).<br>
<br>I have had some thoughts, and getting the configuration data to the<br>places that need it seems to be the main challenge.<br><br>i.e. it should be possible to tweak the settings in the<br>ActionScriptFactory and then an ASBlock.newIf(...) should just do the<br>
right thing -- however, I don&#39;t yet have a simple way to get at that<br>info from within the ASTStatementlList instance.&nbsp;&nbsp;Maybe one could walk<br>up the AST to the root node, and have the instance object there hold a<br>
reference to the factory..?&nbsp;&nbsp;Well, there are other bugs to fix first I<br>think.<br><br>It is on my TODO list though!<br><br><br>ta,<br>dave<br><br>--<br><a href="http://david.holroyd.me.uk/">http://david.holroyd.me.uk/</a><br>
<br><br><br>------------------------------<br><br>Message: 3<br>Date: Wed, 7 May 2008 22:25:48 +0000<br>From: David Holroyd &lt;<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>&gt;<br>Subject: Re: [metaas-dev] Reusing the ANTLR grammar<br>
To: <a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br>Message-ID: &lt;<a href="mailto:20080507222547.GC4514@badgers-in-foil.co.uk">20080507222547.GC4514@badgers-in-foil.co.uk</a>&gt;<br>
Content-Type: text/plain; charset=us-ascii<br><br>Hello,<br><br>On Mon, Apr 28, 2008 at 02:28:50PM -0700, Don-Duong Quach wrote:<br>&gt; I&#39;m trying to build an Actionscript 3 to haxe <a href="http://haxe.org">http://haxe.org</a> translator,<br>
&gt; and I&#39;ve been taking a closer look at metaas to see if I could reuse the AS3<br>&gt; and island grammars as the basis for it.&nbsp;&nbsp;I thought I might as well try to<br>&gt; build something robust with ANTLR than hand code a translator, but I&#39;ve into<br>
&gt; a couple snags with building the project.<br>&gt;<br>&gt; I was hoping maybe David Holroyd or someone would give me some pointers on<br>&gt; how to alter the grammar into a tree grammar for rewriting as I&#39;m still<br>
&gt; learning how to use ANTLR.<br>&gt;<br>&gt; Just as a side note, I setup Netbeans with a Maven plugin to build the<br>&gt; metaas project but ran into some dependency issues with the maven-archiver,<br>&gt; plexus-archiver and plexus-components.&nbsp;&nbsp;I stopped trying to resolve them at<br>
&gt; that point because I wanted to focus on the task of the tree grammar.<br><br>I&#39;m afraid I have no experience of Netbeans/Maven integration, so I<br>can&#39;t really help out there.&nbsp;&nbsp;Were you able to get things to work with<br>
the plain-old Maven command line interface?<br><br><br>&gt; I&#39;ve been reading through the docs and examples, but I don&#39;t know I would<br>&gt; translate the certain parser rewrites into a tree grammar rule.&nbsp;&nbsp;For<br>
&gt; example:<br>&gt;<br>&gt; classDefinition[LinkedListTree annos, LinkedListTree mods]<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;CLASS ident<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; classExtendsClause<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; implementsClause<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typeBlock<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -&gt; ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>
&gt; implementsClause typeBlock)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ;<br>&gt;<br>&gt; In The Definitive Guide to ANTLR, Terrence Parr says to copy the rules over<br>&gt; like so:<br>&gt;<br>&gt; classDefinition[LinkedListTree annos, LinkedListTree mods]<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>&gt; implementsClause typeBlock)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ;<br><br>Note that you would not need to pass the [annos,mods] arguments to this<br>rule in the tree parser.&nbsp;&nbsp;The main parser will already have inserted<br>
these into the resulting tree.<br><br><br>&gt; But what would I do about the {$annos} and {$mods} elements in the rule?&nbsp;&nbsp;I<br>&gt; figure the parameter clause should be removed, but what should I use to<br>&gt; reference the annos and mods elements in the AST?<br>
<br>You need to consider what structure the tree parser will actually<br>observe.<br><br>In the above example, {$annos} and {$mods} are references (passed as<br>arguments to the rule) to some subtrees.&nbsp;&nbsp;In your tree parser, you would<br>
need to address the concrete tree structure that will be produced that<br>these points.<br><br>If you look at the rules that may invoke the classDefinition rule,<br>you&#39;ll see that $annos and $mods are the subtrees produced by the rules<br>
&#39;annotations&#39; and &#39;modifiers&#39; respectively.<br><br>Therefore, you could write the rule in the tree parser like...<br><br><br>classDefinition<br>&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp;&nbsp;^(CLASS_DEF annotations modifiers ident classExtendsClause implementsClause typeBlock)<br>
<br><br>does that make sense?<br><br><br>ta,<br>dave<br><br>--<br><a href="http://david.holroyd.me.uk/">http://david.holroyd.me.uk/</a><br><br><br><br>------------------------------<br><br>_______________________________________________<br>
metaas-dev mailing list<br><a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br><a href="http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev">http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev</a><br>
<br><br>End of metaas-dev Digest, Vol 17, Issue 3<br>*****************************************<br></blockquote></div><br><br clear="all"><br>-- <br>best regards,