[Laszlo-dev] script compiler parser bug with trailing ", " in array
P T Withington
ptw at pobox.com
Wed Jan 9 08:07:10 PST 2008
This was an error in es3 but is now allowed in es4, so you should file
a bug for Don to fix.
On Jan 9, 2008, at 10:40, "Henry Minsky" <henry.minsky at gmail.com> wrote:
> I get a parser error thrown bwhen I make an array with a trailing
> comma after the last element, like
>
> var forceload = [LzText,
> // LzInputText.
> LzView,
> LzNode,
> LzAnimator,
> LzAnimatorGroup,
> LzLayout,
> LzScript,
>
> ];
>
> I thought this was legal in JS, or maybe that's Python I'm thinking
> of?
>
> [echo] Compiling C:\users\hqm\openlaszlo\devildog/lps/includes/
> lfc/LFC9.lzl
> [java] No prec for ASTEmptyExpression in
> [java] org.openlaszlo.sc.CompilerException
> [java] at org.openlaszlo.sc.ParseTreePrinter.maybeAddParens
> (ParseTreePrinter.java:624)
> [java] at
> org.openlaszlo.sc.ParseTreePrinter.visitArrayLiteral
> (ParseTreePrinter.java:569)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:279)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> ( ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> ( ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> ( ParseTreePrinter.java:160)
> [java] at
> org.openlaszlo.sc.ParseTreePrinter.makeTranslationUnits
> (ParseTreePrinter.java:833)
> [java] at
> org.openlaszlo.sc.SWF9Generator.makeTranslationUnits
> (SWF9Generator.java :743)
> [java] at org.openlaszlo.sc.Compiler.compile(Compiler.java:
> 349)
> [java] at org.openlaszlo.sc.lzsc.compile(lzsc.java:110)
> [java] at org.openlaszlo.sc.lzsc.compile(lzsc.java:322)
> [java] at org.openlaszlo.sc.Main.main(Main.java:10)
> [java] No prec for ASTEmptyExpression in
> [java] org.openlaszlo.sc.CompilerException
> [java] at org.openlaszlo.sc.ParseTreePrinter.maybeAddParens
> (ParseTreePrinter.java:624)
> [java] at
> org.openlaszlo.sc.ParseTreePrinter.visitArrayLiteral
> (ParseTreePrinter.java:569)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:279)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
> [java] at org.openlaszlo.sc.ParseTreePrinter.visit
> (ParseTreePrinter.java:160)
>
>
> On Jan 9, 2008 10:35 AM, Henry Minsky < henry.minsky at gmail.com> wrote:
> I guess I can have a statement at the start of the LzApplication
> main class, that just makes a list of all the
> LFC classes that have LZX tag names, and that will force them to be
> loaded.
>
>
> On Jan 9, 2008 10:33 AM, Henry Minsky <henry.minsky at gmail.com> wrote:
> Interesting... LzNode looks at the ConstructorMap *before* it
> creates an LzText, so that would
> explain why it isn't there yet. Given this behavior, anyone have
> any suggestions as to how to build
> the constructormap table in the distributed way we're doing it
> currently?.
>
> For now, I'm just going to hardcode the whole table into the Laszlo
> application startup class I'm building.
>
>
>
>
> On Jan 9, 2008 10:29 AM, Donald Anderson < dda at ddanderson.com> wrote:
> Henry,
>
> At the time you have looked at ConstructorMap, have you
> already created a LzText object? If not, maybe it's doing
> lazy creation of the classes - I know that Java does this -
> static initializers and blocks don't occur until the class is
> loaded, and a class may not be loaded until some code executes
> that either creates an object of that type or references a static
> method/var.
>
> On Jan 9, 2008, at 9:59 AM, Henry Minsky wrote:
>
>>
>> In one of the LFC files I declare a global
>>
>> var ConstructorMap = {};
>>
>> which gets turned into it's own declaration file by the script
>> compiler
>>
>> ConstructorMap.as:
>>
>> package {
>> public var ConstructorMap = {};
>> }
>>
>>
>> In each LFC file I have a statement to add a tag to this global
>>
>>
>> dynamic class LzView extends LzNode {
>> static var tagname = 'view';
>> ConstructorMap[tagname] = LzView;
>>
>>
>> dynamic class LzAnimator extends LzAnimatorGroup {
>> static var tagname = 'animator';
>> ConstructorMap[tagname] = LzAnimator;
>>
>>
>> dynamic class LzText extends LzView {
>> static var tagname = 'text';
>> ConstructorMap[tagname] = LzText;
>>
>> But when the system is running, there is no entry in ConstructorMap
>> ['text'], in fact
>> the only entries in the ConstructorMap are
>>
>> view: [class LzView], node: [class LzNode], canvas: [class
>> LzCanvas],
>>
>> missing are animator, layout, animatorgroup, text
>>
>> So I'm wondering is there some arbitrary ordering issue where some
>> of the
>> classes are executing the "ConstructorMap[foo] = bar" before
>> ConstructorMap
>> actually gets initialized, and silently failing, or what? I can't
>> figure
>> out if this is a compiler bug in Flex or if I'm doing something
>> wrong. According to
>> the AS3 docs, statements at the top level of a class declaration
>> get executed once
>> when the class is defined. But I am wondering how that interacts
>> with global var initializations,
>> maybe the order is arbitrary?
>>
>>
>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com
>>
>
>
> --
>
> Don Anderson
> Java/C/C++, Berkeley DB, systems consultant
>
> voice: 617-547-7881
> email: dda at ddanderson.com
> www: http://www.ddanderson.com
>
>
>
>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20080109/912e02cb/attachment.html
More information about the Laszlo-dev
mailing list