As heading shouts, I need to make source code formatter to format PHP Codes.
RobertoP have written nice Lexical analyzer that means no need for me to tokenize file.
I just do not know how to "juggle" with tokens to produce the formatted code.
I appreciate any pointer especially simple tutorial.
Analyzer class is here