From d1f1fb9877749e909039e884650efdec07e2f50f Mon Sep 17 00:00:00 2001 From: nikic <+@ni-po.com> Date: Tue, 31 May 2011 16:43:46 +0200 Subject: [PATCH] Add goto support to pretty printer --- lib/Node/Stmt/Goto.php | 3 +++ lib/Node/Stmt/Label.php | 3 +++ lib/PrettyPrinter/Zend.php | 8 ++++++++ lib/PrettyPrinterAbstract.php | 1 + 4 files changed, 15 insertions(+) diff --git a/lib/Node/Stmt/Goto.php b/lib/Node/Stmt/Goto.php index 9a7d2cc..9b334e1 100644 --- a/lib/Node/Stmt/Goto.php +++ b/lib/Node/Stmt/Goto.php @@ -1,5 +1,8 @@ expr ? ' ' . $this->p($node->expr) : ''); } + public function pStmt_Label(Node_Stmt_Label $node) { + return $node->name . ':'; + } + + public function pStmt_Goto(Node_Stmt_Goto $node) { + return 'goto ' . $node->name; + } + // Other public function pStmt_Echo(Node_Stmt_Echo $node) { diff --git a/lib/PrettyPrinterAbstract.php b/lib/PrettyPrinterAbstract.php index aead286..340aca7 100644 --- a/lib/PrettyPrinterAbstract.php +++ b/lib/PrettyPrinterAbstract.php @@ -82,6 +82,7 @@ abstract class PrettyPrinterAbstract || $node instanceof Node_Stmt_Switch || $node instanceof Node_Stmt_While || $node instanceof Node_Stmt_TryCatch + || $node instanceof Node_Stmt_Label ) { $return .= "\n"; } else {