metaas announced: ActionScript DOM in Java

David Holroyd announced metaas on the OSFlash mailing list today and it looks very exciting indeed.

metaas is an ActionScript parser/code generator written in Java that, "provides Java applications with a 'Document Object Model' for ActionScript 3 code." David states in his email that the primary purpose of metaas is as a code generator but what excites me most are its potential uses in pre-processing/post-processing of ActionScript code, documentation generation, etc. Having an ActionScript-aware DOM in Java could also be useful for ActionScript editors like the open source ASDT project.

From the documentation, here's a snippet that demonstrates how to parse an ActionScript file:

[java]FileInputStream in = new FileInputStream("Test.as"); InputStreamReader reader = new InputStreamReader(in); ActionScriptFactory fact = new ActionScriptFactory(); ActionScriptParser parser = fact.newParser(); ASCompilationUnit unit = parser.parse(reader);

ASPackage pkg = unit.getPackage(); ASType type = pkg.getType(); List methods = type.getMethods(); for (Iterator i=methods.iterator(); i.hasNext(); ) { ASMethod meth = (ASMethod)i.next(); System.out.println(meth.getName()); }[/java]

Learn more about metaas on the metaas homepage.

Comments