Re: [pdt-dev] 'unparsing' the AST

2009-12-08 Thread Raphael Pigulla
While those two examples were immensely helpful, I am still trying to 
figure out how to use the org.eclipse.php.internal.core.format package.


For example, I'm a bit confused as to how the class PhpFormatter 
actually works (or rather, how it is intended to be used, the 
documentation is a little sparse).
Its constructor requires a start and length parameter, which - I assume 
- is so one can selectively format parts of a document. The format() 
function then requires an org.w3c.dom.Node, which is presumably the root 
of the AST? Why is it then, that it does not accept 
org.eclipse.php.internal.core.ast.nodes.ASTNode? Do I need to convert 
the AST to DOM? Or am I missing something entirely here?


Also, what's the point of implementing the strategy pattern when all 
indentation strategies are hard-coded into private final members?


Basically all I want to do is read a PHP file, fiddle with the AST and 
then pretty-print it back out. Is PhpFormatter the wrong way to go here?


regards
raph
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev


RE: [pdt-dev] 'unparsing' the AST

2009-12-05 Thread Roy Ganor
I would probably start in
org.eclipse.php.internal.core.ast.rewrite.ASTRewrite (see the comments
in this class)

Roy
-Original Message-
From: pdt-dev-boun...@eclipse.org [mailto:pdt-dev-boun...@eclipse.org]
On Behalf Of Raphael Pigulla
Sent: Friday, December 04, 2009 12:06 PM
To: pdt-dev@eclipse.org
Subject: [pdt-dev] 'unparsing' the AST

Hi everyone,

I'm looking for a way to 'unparse' the AST of a PHP program back into 
source code. I've looked around the source and found the 
org.eclipse.php.internal.core.format package which is probably what I 
need to use, but I haven't figured out yet how to wire everything up.

Any help is appreciated.

Thanks a lot in advance
Raphael
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev
___
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev