A pretty printer for Java.
A note on operator precedence: This printer uses precedence
levels to control when to print parentheses around expressions.
The actual precedence values are the standard Java precedence
levels multiplied by ten.
author: Robert Grimm, Stacey Kuznetsov, Martin Hirzel version: $Revision: 1.69 $
containsLongExpression(GNode n) Determine whether the specified node contains a long expression.
This method considers blocks and array initializers to be long.
Parameters: n - The node.
protected void
endExpression(int prec) Stop printing an expression.
printDeclsAndStmts(GNode n) Print the specified node's children as declarations and/or
statements.
protected int
startExpression(int prec) Start printing an expression at the specified operator precedence
level.
See Also:JavaPrinter.endExpression(int) Parameters: prec - The expression's precedence level.
Determine whether the specified node contains a long expression.
This method considers blocks and array initializers to be long.
Parameters: n - The node. true if the node contains a long expression.
Enter an expression context. The new context has the specified
precedence level.
See Also:JavaPrinter.exitContext(int) Parameters: prec - The precedence level for the expression context. The previous precedence level.
Enter an expression context. The new context is appropriate for
an operand opposite the associativity of the current operator.
For example, when printing an additive expression, this method
should be called before printing the second operand, as additive
operators associate left-to-right.
See Also:JavaPrinter.exitContext(int) The previous precedence level.
Determine whether the specified declaration is long. A long
declaration requires multiple lines for readability. Examples
include declarations containing class bodies or blocks.
Parameters: decl - The declaration. true if the specified declaration is long.
Start printing an expression at the specified operator precedence
level.
See Also:JavaPrinter.endExpression(int) Parameters: prec - The expression's precedence level. The previous precedence level.