From dev-return-66048-archive-asf-public=cust-asf.ponee.io@flex.apache.org Thu May 9 05:15:35 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id DADC8180630 for ; Thu, 9 May 2019 07:15:34 +0200 (CEST) Received: (qmail 57296 invoked by uid 500); 9 May 2019 05:15:33 -0000 Mailing-List: contact dev-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list dev@flex.apache.org Received: (qmail 57271 invoked by uid 99); 9 May 2019 05:15:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 May 2019 05:15:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id F344BC647A for ; Thu, 9 May 2019 05:15:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.049 X-Spam-Level: X-Spam-Status: No, score=0.049 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id u5T0YmpoXRie for ; Thu, 9 May 2019 05:15:27 +0000 (UTC) Received: from sonic315-8.consmr.mail.gq1.yahoo.com (sonic315-8.consmr.mail.gq1.yahoo.com [98.137.65.32]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 9C8C66125A for ; Thu, 9 May 2019 05:15:26 +0000 (UTC) X-YMail-OSG: H9QPW0gVM1lGn0df7Ou4PP3xahDTL_i.dOmU.Zb2jYHjwvNEDxMe1fraEW_2ciY mf2i_pdsj1S_It3VX_DnfM5ZNCZwoW3eY0IqSIz1TyqmDBki6sqnjuEGtFUlTrbSbZlYgDkLQXaP op5arCRFR1vOc2CF2nOW3InxBFFTehXMBgO3OlK3W3TU89pINgfwAFyubof8dcqAvjIkpqbMBsNt Uy.Le_Jx0SvTHVJ3bC258kvjRG7fC9uxtHsWAXPhr0jS3FchqLpI.sjpBoHX7s47N6PqlsPeAg_G rv5G0Bx04G7aJmxccf3IVaoKD4c1tU4KqKPMpaJ1xZ69sdaFkfTIlJgtzG5fbBr4rcjshSMVqaks SZY8STtSIA1C6Em4UEcaezPm.OPVFL_DAV2j2RObijz.3tSSFwRq698eYnotSJlVvcZ1z9t3r3Jm X8_9BQGSQDKgXq2YEQ6Wj0lXFKTFn.PlWK4wxIapuSx14MnON68sFeKCV1pgo_6J8ZxFdlSWo.tR zejMHH54emwWC19NvucRgVYWHBgIK0lCOSG3AYZd2G5t9NKS0yb48Kt2YJaKMFvUunM5Xb7Y2tf6 Wz.PALCgLC.86ET4sV2V5fR6h8ZbrdTdD3ZzMFyKmXSZPMlfsORsi50IjPCWmkzE5hobcWUY62Bm vzJPnBOJ.umvLPJWrTJXPE.NpBux340UpSapQjUlRcbyxnBAhhAbW5CEwRwkiwM65K9uAKpiW5Sd lmbS58.qT28hjYXrbhFLINwNvrURFAE_X4lO5_3LPsRXCedv_WdN8Bm9._.mvKUE5qhYZ_YajtyX cz5W8TBObypt2g4kC9DQuRWY4vsgEHvf7C_mzFrNPRsv_YXpmS2tDI3vge8a.xhKSwupk_S23Zl4 y7k0n9gMl4OUgjy_QoUBlzPgZ_zpZMzy6utBnOiKS0lDZPawt10..4AaRnItLpBwrswUv.JUle52 GD4K7St7rJx.BHaSFJpaq4aBl42s.nmE2_lx9f59sW23k.FPVaXdR0ts0fstcQ7_dmgOD1uJKXhq bHZg7xqlJbwAsOdntGc8IBPjO9.ZxTBfc6weQIIwbJY0jWakh1kKUZfXHd5e.nfn.4.Q5Nkxn4WX UFZf50MD7ix8Jbm5LGREAtstczGg.mpkED7bmiJlv3g7GTdt7EA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Thu, 9 May 2019 05:15:19 +0000 Received: from 75-172-68-204.tukw.qwest.net (EHLO [192.168.9.16]) ([75.172.68.204]) by smtp432.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 8f0c5a0b88f2f5137cc083d4540f7a2d for ; Thu, 09 May 2019 05:15:17 +0000 (UTC) To: dev@flex.apache.org From: Lance Johnson Subject: Using ForStatementNode for AST analysis of for each statements Message-ID: <6f3bb7da-031e-4bd5-6616-a62d1e0a9134@yahoo.com> Date: Wed, 8 May 2019 22:15:18 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Greetings. 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.