Book a Demo

Author Topic: Improved AS3 Parsing  (Read 4148 times)

Scott Delamater

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Improved AS3 Parsing
« on: July 15, 2009, 04:35:59 am »
Currently, when code engineering an ActionScript 3.0 project in Enterprise Architect, the parser fails to import classes if it encounters a couple of things:

Alternate RegExp format
AS3 allows you to instantiate a RegExp object in two ways:

Code: [Select]
var pattern1:RegExp = new RegExp("test-\\d", "i");
var pattern2:RegExp = /test-\d/i;

EA parses fine when using a RegExp() constructor, but doesn't like the slash syntax.  When it encounters slash syntax, the import halts completely wherever it is, and any remaining classes aren't imported.

AS3 Namespaces (custom access control modifiers)
The parser doesn't like something about classes that use custom namespaces.  For example, if I have a class like:

Code: [Select]
package com.mydomain.messaging
{
      import com.mydomain.messaging.special_messaging_ns;
      
      public class Response
      {
            use namespace special_messaging_ns;
            ...
      }
}

The parser just ignores this class, and doesn't import it or any of its subclasses.  

Is there an easy way to fix these, or would this require a patch?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Improved AS3 Parsing
« Reply #1 on: July 15, 2009, 07:47:45 am »
Have you tried setting one of your model packages as a namespace root?

[Note that this feature might not work outside of specific languages. I know it supports .Net and Java, but I have no idea if the feature has been extended to AS.]

While we're on the subject... Did you set the AS Default Version to 3.0 (it defaults to 2.0) in the Tools | Options | Source Code Engineering | ActionScript?
« Last Edit: July 15, 2009, 07:49:57 am by Midnight »
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Improved AS3 Parsing
« Reply #2 on: July 15, 2009, 08:39:10 am »
Please contact Sparx Systems directly using the Registered Users Support page and we'll help you out.