FYI, I did this way back in 2010. :)

https://github.com/teotigraphix/as3-commons-jasblocks/blob/master/src/main/java/org/as3commons/asblocks/parser/antlr/asdoc/ASDoc.g

Mike

On Thu, Jul 9, 2015 at 12:17 PM, Michael Schmalle <teotigraphix...@gmail.com
> wrote:

>
>
> On Thu, Jul 9, 2015 at 12:01 PM, Frédéric THOMAS <webdoubl...@hotmail.com>
> wrote:
>
>> > You're not traversing anything, it just happens that the base class is
>> > abstract and defines callbacks for recursion. In your case you just
>> want a
>> > "processing" compiler pass.
>> >
>> > A plain old compiler pass wouldn't require visiting all nodes, just a
>> > process().
>> >
>> > Don't worry about it, the two you overrode are just stubs.
>>
>> Well, I got I did an override :-) I just was trying to understand the
>> base classes.
>>
>
>
> The base class why my design and for all the passes I did, I needed the
> callbacks. See NodeTraversal.travese() I think it is, that is what actually
> calls the callbacks and shouldTravese(), it's in the GCC API.
>
> You could have just implemented Callback with process() and created your
> won constructor if that makes it more clear, it wasn't neccessary to
> subclass but, it was there so, ya know. :)
>
>
>
>>
>> Anyway, thanks again Mike for your explanations !
>>
>> I will now go back on Falcon starting from the beginning trying to
>> understand the scan / parse phase, even if I understand approximatively how
>> theoretically it should work, it seems a huge thing to me in there, I see
>> JFlex, ANTLR, btw I thought it was possible to do the scan / parse with
>> ANTLR only, am I wrong ? if not why are we using JFlex too ?
>>
>
>
> JFlex is used to create the RawASDocTokenizer. So yes, if a grammar was
> created for asdoc parsing in antlr, we could get rid of JFlex dependency
> because I think that is the only place it's used.
>
> Mike
>
>
>
>>
>> I will try to experiment, even with ANTLR4.x
>>
>> Frédéric THOMAS
>>
>>
>> ----------------------------------------
>> > Date: Thu, 9 Jul 2015 11:25:09 -0400
>> > Subject: Re: [FalconJX] Collection Imports branch
>> > From: teotigraphix...@gmail.com
>> > To: dev@flex.apache.org
>> >
>> > You're not traversing anything, it just happens that the base class is
>> > abstract and defines callbacks for recursion. In your case you just
>> want a
>> > "processing" compiler pass.
>> >
>> > A plain old compiler pass wouldn't require visiting all nodes, just a
>> > process().
>> >
>> > Don't worry about it, the two you overrode are just stubs.
>> >
>> > Mike
>> >
>> > On Thu, Jul 9, 2015 at 11:13 AM, Frédéric THOMAS <
>> webdoubl...@hotmail.com>
>> > wrote:
>> >
>> >>> Other than that, merge/commit it man! thanks, looks good to me, we
>> will
>> >> see
>> >>> if anything else comes up.
>> >>
>> >> Thanks, done !
>> >>
>> >> But I'm still confuse with the pattern:
>> >>
>> >> I didn't get well this thing about pre / post order in the Callback
>> >> interface maybe I didn't get what it means, isn't supposed to be
>> recursive
>> >> descendant only, how does it work ?
>> >> I used process() which traverseRoots of both externs (the most out of
>> >> parent) and the given node, why 2 nodes have to be traversed in the
>> same
>> >> function ?
>> >>
>> >> Frédéric THOMAS
>> >>
>> >>
>> >> ----------------------------------------
>> >>> Date: Wed, 8 Jul 2015 16:46:34 -0400
>> >>> Subject: [FalconJX] Collection Imports branch
>> >>> From: teotigraphix...@gmail.com
>> >>> To: dev@flex.apache.org
>> >>>
>> >>> Hey Fred,
>> >>>
>> >>> Couple things;
>> >>>
>> >>> 1. CollectImportsPass
>> >>>
>> >>> Should probably be; (process() only gets called once)
>> >>>
>> >>> @Override
>> >>> public void process(Node externs, Node root)
>> >>> {
>> >>> for (ClassReference reference : model.getClasses())
>> >>> {
>> >>> collectClassImports(reference);
>> >>> }
>> >>>
>> >>> for (FunctionReference reference : model.getFunctions())
>> >>> {
>> >>> collectFunctionImports(reference);
>> >>> }
>> >>> }
>> >>>
>> >>> @Override
>> >>> public boolean shouldTraverse(final NodeTraversal nodeTraversal, final
>> >>> Node n, final Node parent)
>> >>> {
>> >>> return false;
>> >>> }
>> >>>
>> >>> @Override
>> >>> public void visit(final NodeTraversal t, final Node n, final Node
>> >>> parent)
>> >>> {
>> >>> }
>> >>>
>> >>>
>> >>> Other than that, merge/commit it man! thanks, looks good to me, we
>> will
>> >> see
>> >>> if anything else comes up.
>> >>>
>> >>> Mike
>> >>
>> >>
>>
>>
>
>

Reply via email to