<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> <<a href="mailto:metaas-dev-request@lists.badgers-in-foil.co.uk">metaas-dev-request@lists.badgers-in-foil.co.uk</a>>:</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> <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> <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 'help' to<br>
<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> <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 "Re: Contents of metaas-dev digest..."<br><br><br>Today's Topics:<br><br> 1. Re: method.addStmt("super.executeNextCommand()") (David Holroyd)<br>
2. Re: Sorting methods by name output parameters (David Holroyd)<br> 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 <<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>><br>Subject: Re: [metaas-dev] method.addStmt("super.executeNextCommand()")<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: <<a href="mailto:20080507215824.GA4514@badgers-in-foil.co.uk">20080507215824.GA4514@badgers-in-foil.co.uk</a>><br>
Content-Type: text/plain; charset=us-ascii<br><br>On Tue, May 06, 2008 at 08:44:42PM +0800, Yuliang-Yang wrote:<br>> when I use method.addStmt("super.executeNextCommand()");<br>> the compiler complains,,<br>
> this method is override method of the super class.<br>> Exception in thread "main" uk.co.badgersinfoil.metaas.SyntaxException:<br>> Unexpected token DOT in "super.executeNextCommand()" at line 1<br>
<br>Unfortunatly, this is due to incompleteness of the AS3 parser built into<br>metaas. Several people have reported this problem so I'll try to tackle<br>this first when I get back on to metaas stuff.<br><br>Sorry about that!<br>
<br><br>> and I also haven't find define a method with modifier "override",maybe this<br>> is cause by not modifiy with "override";<br><br>I don't think that the message related to 'override' is coming from<br>
metaas. Something to do with your application?</blockquote>
<div> </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's executeNextCommand I just use ASMethod method = clazz.newMethod("executeNextCommand",,,somemodify),</div>
<div>and then use method.addStmt("super.executeNextCommand()"); 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 <<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>><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: <<a href="mailto:20080507221657.GB4514@badgers-in-foil.co.uk">20080507221657.GB4514@badgers-in-foil.co.uk</a>><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>> I'm currently working on a code generator for my own needs. Metaas is<br>> a great help so far. But in order to navigate through my classes a lil<br>
> easier i have this habit to write my methods in alphabetical order. I<br>> thought of sorting the code regarding my needs with metaas, but the<br>> list regarding the methods is read only. Do i have to sort the classes<br>
> by hand?<br><br>Well, I'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'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. That would<br>
really be a lot of effort though.<br><br><br>> Also i'd like to know if some sort of output parameters are planned to<br>> be implemented in the nearer future (whitespaces between operands and<br>> 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't yet have a simple way to get at that<br>info from within the ASTStatementlList instance. 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..? 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 <<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</a>><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: <<a href="mailto:20080507222547.GC4514@badgers-in-foil.co.uk">20080507222547.GC4514@badgers-in-foil.co.uk</a>><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>> I'm trying to build an Actionscript 3 to haxe <a href="http://haxe.org">http://haxe.org</a> translator,<br>
> and I've been taking a closer look at metaas to see if I could reuse the AS3<br>> and island grammars as the basis for it. I thought I might as well try to<br>> build something robust with ANTLR than hand code a translator, but I've into<br>
> a couple snags with building the project.<br>><br>> I was hoping maybe David Holroyd or someone would give me some pointers on<br>> how to alter the grammar into a tree grammar for rewriting as I'm still<br>
> learning how to use ANTLR.<br>><br>> Just as a side note, I setup Netbeans with a Maven plugin to build the<br>> metaas project but ran into some dependency issues with the maven-archiver,<br>> plexus-archiver and plexus-components. I stopped trying to resolve them at<br>
> that point because I wanted to focus on the task of the tree grammar.<br><br>I'm afraid I have no experience of Netbeans/Maven integration, so I<br>can't really help out there. Were you able to get things to work with<br>
the plain-old Maven command line interface?<br><br><br>> I've been reading through the docs and examples, but I don't know I would<br>> translate the certain parser rewrites into a tree grammar rule. For<br>
> example:<br>><br>> classDefinition[LinkedListTree annos, LinkedListTree mods]<br>> : CLASS ident<br>> classExtendsClause<br>> implementsClause<br>> typeBlock<br>> -> ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>
> implementsClause typeBlock)<br>> ;<br>><br>> In The Definitive Guide to ANTLR, Terrence Parr says to copy the rules over<br>> like so:<br>><br>> classDefinition[LinkedListTree annos, LinkedListTree mods]<br>
> : ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>> implementsClause typeBlock)<br>> ;<br><br>Note that you would not need to pass the [annos,mods] arguments to this<br>rule in the tree parser. The main parser will already have inserted<br>
these into the resulting tree.<br><br><br>> But what would I do about the {$annos} and {$mods} elements in the rule? I<br>> figure the parameter clause should be removed, but what should I use to<br>> 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. 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'll see that $annos and $mods are the subtrees produced by the rules<br>
'annotations' and 'modifiers' respectively.<br><br>Therefore, you could write the rule in the tree parser like...<br><br><br>classDefinition<br> : ^(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,