Actually -DdumpASTInput/Output dump the AST using SimpleNode->dump(),
not with the unparser.
Kind of a raw view of the tree. This is helpful, especially when
working out issues in the unparser.
But yes, LPP-5754 should be easy nonetheless.
On Apr 16, 2008, at 9:45 AM, P T Withington wrote:
Approved.
Comment: Isn't -DdumpASTOutput really the same as -S/--script.
Couldn't you solve http://jira.openlaszlo.org/jira/browse/LPP-5754
for nearly free now?
On 2008-04-15, at 20:33 EDT, Donald Anderson wrote:
Change 20080415-dda-G by [EMAIL PROTECTED] on 2008-04-15 19:43:52 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: Line number tracking and options for debugging compiler
for development
New Features: New compilation options for lzc:
-DtrackLines
-DdumpASTInput=filename
-DdumpASTOutput=filename
Bugs Fixed: LPP-5784: Need option to track input line numbers to
output code
AKA nexb bugs
#285 LZX: Relocate sourcelocator assigned donalda enhancement 1 -
ASAP LZX: OpenLaszlo core (mostly fixed, see below))
#262 LZX: Wrong sourcelocator for <script> tags assigned donalda
defect 2 - Must Be LZX: OpenLaszlo core (mostly fixed)
#290 LZX: sourcelocator line numbers messed up assigned donalda
defect 1 - ASAP LZX: OpenLaszlo core (mostly fixed)
Technical Reviewer: ptw (pending)
QA Reviewer: promanik (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
There are two parts to this change.
First - When 'trackLines' is set to 'true' in the compiler
options, some extra /* -*- file: #XXX -*- */
entries will be emitted into the output script. This will happen
at most(**) statements,
but will not happen when the line number can be otherwise deduced
by counting
from the previous /* -*- file: #XXX -*- */ seen. Tracklines can
be set in lzc via:
lzc -DtrackLines --runtime=dthml file.lzx
or can be set in the Compiler.Options object. It only has an
effect when script output is
produced (dhtml or swf9).
The /* -*- file: #XXX -*- */ is an abbreviated format, we aren't
showing the line or column number.
(**) The flaw is that not all statements are being tracked with
line number information, so it
is possible to have some statements not be tracked right. The
aberation in output is temporary - at the next
statement that is tracked, we see we are off, and emit a line
number. An example of the flaw:
var y1 = 17; var y2 = 37; var y3 = 43;
var xx = new String("");
y1 += y2; y2 = y3; y3 += y1 + y2;
for (var i=0; i<arr.length; i++) {
emits:
var $3_y1 = 17;
/* -*- file: #30 -*- */
var $4_y2 = 37;
/* -*- file: #30 -*- */
var $5_y3 = 43;
var $6_xx = new String("");
$3_y1 += $4_y2;
$4_y2 = $5_y3;
$5_y3 += $3_y1 + $4_y2;
/* -*- file: #33 -*- */
for (var $7_i = 0;$7_i < $1_arr.length;$7_i++) {
Notice that the line beginning y += y2 does not track correctly
for subsequent statements
on that line, but at the following 'for' statement, everything is
okay.
Due to the need to get this out and in use, we're reviewing
before these
flaws can be addressed. I hope to correct this with a followup
changeset.
Second, in trying to track this problem, is was convenient to
have a mechanism to dump the
compiler's AST to files before and after it is transformed by the
generator. SWF9 had a
way to do this (it was always put in the temp build directory),
I've pushed this capability into
all the compilers. There are now two options, invoked from lzc
via:
-DdumpASTInput=filename
-DdumpASTOutput=filename
Tests:
Ran compiler on optarg.lzx and observed output.
Added unusually formatted input and observed output.
Ran usual regressions, including runlzunit and lztest
Files:
M WEB-INF/lps/server/src/org/openlaszlo/sc/
JavascriptGenerator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9Generator.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/
SWF9ParseTreePrinter.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/TranslationUnit.java
M WEB-INF/lps/server/src/org/openlaszlo/sc/ParseTreePrinter.java
Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20080415-dda-G.tar
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com