Hi,
I just put together the first alpha swcs for use. You can get this zip here;
as3parser-framework_0.1_alpha.zip
The zip file contains 2 SWC libraries;
- as3parser-framework_0.1_alpha.swc
- as3builder-framework_0.1_alpha.swc
This is very alpha, but now you can experiment without the source. These are right out of the Library project so they contain the unit tests as well. This won’t be the case in the future.
Have fun,
Mike
Hi,
Well the I figured the framework needed a static API to access the AS3Parsers internal parse methods. I finally got around to making this and unit testing it to the point of insanity. This was for a special purpose though, the TestAS3FragmentParser unit test is more like a guide on what you can pass each method. If you haven’t checked out that unit test, you should.
Wiki Docs;
The below link shows usage and XML AST information for every method listed below, you should check it out if your interested in the AST models.
AS3FragmentParser API
Source for the unit test;
AS3FragmentParser Unit test
Parse methods;
parseCompilationUnit()
parsePackage()
parsePackageContent()
parseClassContent()
parseInterfaceContent()
parseMetaData()
parseConstants()
parseVariables()
parseMethods()
parseStatement()
parsePrimaryExpression()
parseExpression()
An example of what you will find on the wiki page.
parseCompilationUnit()
Usage:
var ast:IParserNode = AS3FragmentParser.parseCompilationUnit(source);
// convoluted example but shows nesting
trace(ast.getChild(0).getChild(0).stringValue); // my.domain
trace(ast.getChild(0).getLastChild().getChild(0).getChild(0).stringValue); // Test
trace(ast.getChild(0).getLastChild().getChild(0).getKind("mod").stringValue); // public
Source:
package my.domain
{
public class Test
{
}
}
class InternalClass
{
}
AST:
<compilation-unit>
<package>
<name>my.domain</name>
<content>
<class>
<name>Test</name>
<mod-list>
<mod>public</mod>
</mod-list>
<content></content>
</class>
</content>
</package>
<content>
<class>
<name>InternalClass</name>
<content></content>
</class>
</content>
</compilation-unit>
Why ?
This class was written because I’m getting into the BLOCK building, yes, you will be able to create expressions!
Mike
Recent Comments