flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com.INVALID>
Subject Re: Using ForStatementNode for AST analysis of for each statements
Date Fri, 10 May 2019 04:03:27 GMT

I do not know the Flex MXMLC compiler very well at all, and I'm not sure anyone else does
either at this point.

The next generation compiler (was known as Falcon) might be worth a try.  A few more of us
do know this compiler better, and you might find that its AST has what you need.   The Apache
Royale project has the latest version of the Falcon compiler so inquire on dev@royale.apache.org
if you interested.


´╗┐On 5/8/19, 10:15 PM, "Lance Johnson" <friedfrogs888@yahoo.com.INVALID> wrote:

    This email will probably contain some dumb questions buried in a jumble 
    of context, but I'm potentially looking at patching Flex to fix this 
    problem and would like to exhaust all /other/ possibilities before I do 
    so.  The project I am working on has already snowballed into an 
    avalanche, so additional complexity is something I would like to avoid.
    I'm involved in a rather complicated modding project, where, due to 
    licensing restrictions, we are patching commercially-licensed but 
    undistributable code[1] by using the usual diff method, and then using 
    Flex's generated AST to find particular sequences of statements in 
    parsed code. We then patch them appropriately, and then emit the patched 
    ActionScript using a custom Evaluator. The evaluator in question is 
    based on PrettyPrinter, but is ending up being quite more exhaustive in 
    order to present compilable code. We use this tool to collect 
    information and patch repetitive statements that can be parsed with 
    tools like regular expressions, but need thousands of lines of 
    supporting code to properly keep track of context and syntax.
    The problem I'm running into is that I'm having to run the Parser with 
    `Context.scriptAssistParsing` turned on, as I need the AST with as few 
    mutations as possible, and without loading includes or imports. 
    Unfortunately, this has resulted into running into a problem with 
    ForStatementNodes in this mode.
    It appears that, while `for each` statements are parsed, there is no 
    indication applied in NodeFactory to the ForStatementNode to indicate 
    that the Node is a `for each` loop /in scriptAssistParsing mode/. In 
    addition, if I were to turn scriptAssistParsing off, there would be 
    significant mutations applied.  In NodeFactory.java, it appears like 
    there were plans made to introduce a boolean (is_each?) to mark this, 
    but it never materialized.
    Is there another way to determine this information, or will I need to 
    patch Flex itself to expose it?  If this is something that should be 
    added to the upstream project, what would be the most agreeable means to 
    implement it?  Right now, I simply plan on adding a public boolean 
    is_each to ForStatementNode, and updating NodeFactory accordingly.
    Thanks in advance,
    Lance Johnson
    1: The owners of the code in question have released it on GitHub, but 
    the license terms forbid distribution of modified code or binaries, so 
    we distribute our mod as patches, instead.  There's also talk of more 
    permissive licensing in the future. Maybe.

View raw message