private void FormatDocument_Click( object sender, RoutedEventArgs e )
{
CSharpFormattingOptions policy = FormattingOptionsFactory.CreateAllman();
CSharpParser parser = new CSharpParser();
SyntaxTree tree = parser.Parse( scriptTextBox.Text );
StringWriter writer = new StringWriter();
CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor( writer, policy );
outputVisitor.VisitSyntaxTree( tree );
scriptTextBox.Text = writer.ToString();
}