Hi,

I need to format a js code, so I parse the code and then I want to
rebuild it from this syntax tree.
I know that there is this Decompiler class that should return the
source from the parser as a string.
So if I write:

...

Context context = (new ContextFactory()).enterContext();

...

CompilerEnvirons compilerEnv = new CompilerEnvirons();
compilerEnv.initFromContext(context);
compilerEnv.setGeneratingSource(true);
Parser parser = new Parser(compilerEnv, OwnErrorReporter.instance);

...
ScriptOrFnNode tree = parser.parse(source,null,2);

...

How to call the    "decompile"  method from the Decompiler class to
get the string representation of the source?

Or can someone give me an example how to use this method?

Thanks in advance,
Tina


_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to