A mechanism for reformatting a simple source code statement into a compound source
code statement is provided. Tokens are identified in unformatted source code, which
contains simple statements. A syntax tree is created from the identified tokens.
The syntax tree is used to identify one or more simple statements. In processing
a particular simple statement, potential statements are identified in the particular
simple statement. A tree of blocks, which identifies block levels, is created from
the potential statements. An intermediate textual representation is created where
each of the potential statements is on a different line. Indentation levels, which
correspond to the block levels in the tree of blocks, are associated with each
of the potential statements. Formatted source code is created by inserting begin
and end block indicators into the intermediate textual representation.