cvs: pear /PECL_Gen ExtensionParser.php /PECL_Gen/Tools Indent.php

From: Date: Sat, 27 Sep 2003 16:48:07 +0000
Subject: cvs: pear /PECL_Gen ExtensionParser.php /PECL_Gen/Tools Indent.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13134@lists.php.net to get a copy of this message
hholzgra Sat Sep 27 12:48:07 2003 EDT Modified files: /pear/PECL_Gen ExtensionParser.php /pear/PECL_Gen/Tools Indent.php Log: linetrim moved to indent functions Index: pear/PECL_Gen/ExtensionParser.php diff -u pear/PECL_Gen/ExtensionParser.php:1.8 pear/PECL_Gen/ExtensionParser.php:1.9 --- pear/PECL_Gen/ExtensionParser.php:1.8 Thu Sep 25 16:44:12 2003 +++ pear/PECL_Gen/ExtensionParser.php Sat Sep 27 12:48:06 2003 @@ -2,6 +2,7 @@ require_once "PECL/Gen/XmlParser.php"; require_once "PECL/Gen/Maintainer.php"; + require_once "PECL/Tools/Indent.php"; /** * Class that parses @@ -70,20 +71,6 @@ $this->helper = array_pop($this->helper_stack); } - /** - * Trim of leading and trailing whitespace only lines - * - * @access private - * @param string text - * @return string trimmed text - */ - static function linetrim($text) - { - $text = preg_replace('|^\s*\n|','', $text); - $text = preg_replace('|\n\s*$|',"\n", $text); - return $text; - } - function tagstart_extension($attr) { if (!isset($attr["name"])) return $this->raiseError("needed attribute 'name' not given"); @@ -98,12 +85,12 @@ function tagend_extension_summary($attr, $data) { - return $this->extension->set_summary(self::linetrim($data)); + return $this->extension->set_summary(linetrim($data)); } function tagend_extension_description($attr, $data) { - return $this->extension->set_description(self::linetrim($data)); + return $this->extension->set_description(linetrim($data)); } @@ -177,7 +164,7 @@ function tagend_function_description($attr, $data) { - return $this->helper->set_description(self::linetrim($data)); + return $this->helper->set_description(linetrim($data)); } function tagend_function_proto($attr, $data) @@ -187,7 +174,7 @@ function tagend_function_code($attr, $data) { - return $this->helper->set_code(self::linetrim($data)); + return $this->helper->set_code(linetrim($data)); } function tagend_functions_function($attr, $data) @@ -234,12 +221,12 @@ function tagend_resource_destruct($attr, $data) { - return $this->helper->set_destruct(self::linetrim($data)); + return $this->helper->set_destruct(linetrim($data)); } function tagend_resource_description($attr, $data) { - return $this->helper->set_description(self::linetrim($data)); + return $this->helper->set_description(linetrim($data)); } function tagend_resources_resource($attr, $data) @@ -289,7 +276,7 @@ } } - $const->set_desc(self::linetrim($data)); + $const->set_desc(linetrim($data)); return $this->extension->add_constant($const); @@ -375,7 +362,7 @@ } } - $ini->set_desc(self::linetrim($data)); + $ini->set_desc(linetrim($data)); $err = $this->extension->add_phpini($ini); if (PEAR::isError($err)) { @@ -428,7 +415,7 @@ function tagend_release_notes($attr, $data) { - return $this->helper->set_notes(self::linetrim($data)); + return $this->helper->set_notes(linetrim($data)); } function tagend_extension_release($attr, $data) @@ -500,44 +487,43 @@ function tagend_extension_code($attr, $data) { - $err = $this->extension->add_code($attr["role"], self::linetrim($data)); + $err = $this->extension->add_code($attr["role"], linetrim($data)); return $err; } function tagend_extension_makefile($attr, $data) { - return $this->extension->add_makefragment(self::linetrim($data)); + return $this->extension->add_makefragment(linetrim($data)); } function tagstart_test($attr) { - if (!isset($attr["name"])) return $this->raiseError("needed attribute 'name' not given"); $test = new PECL_Gen_Element_Test($attr['name']); if (PEAR::isError($test)) return $test; $this->push_helper($test); } function tagend_test_title($attr, $data) { - $this->helper->set_title(self::linetrim($data)); + $this->helper->set_title(linetrim($data)); } function tagend_test_skipif($attr, $data) { - $this->helper->set_skipif(self::linetrim($data)); + $this->helper->set_skipif(linetrim($data)); } function tagend_test_get($attr, $data) { - $this->helper->set_get(self::linetrim($data)); + $this->helper->set_get(linetrim($data)); } function tagend_test_post($attr, $data) { - $this->helper->set_post(self::linetrim($data)); + $this->helper->set_post(linetrim($data)); } function tagend_test_code($attr, $data) { - $this->helper->set_code(self::linetrim($data)); + $this->helper->set_code(linetrim($data)); } function tagend_test_output($attr, $data) { - $this->helper->set_output(self::linetrim($data)); + $this->helper->set_output(linetrim($data)); } function tagend_test($attr, $data) { Index: pear/PECL_Gen/Tools/Indent.php diff -u pear/PECL_Gen/Tools/Indent.php:1.1 pear/PECL_Gen/Tools/Indent.php:1.2 --- pear/PECL_Gen/Tools/Indent.php:1.1 Thu Sep 25 16:44:12 2003 +++ pear/PECL_Gen/Tools/Indent.php Sat Sep 27 12:48:07 2003 @@ -53,4 +53,20 @@ return $result; } + + /** + * Trim of leading and trailing whitespace-only lines + * + * @access private + * @param string text + * @return string trimmed text + */ + static function linetrim($text) + { + $text = preg_replace('|^\s*\n|','', $text); + $text = preg_replace('|\n\s*$|',"\n", $text); + return $text; + } + + ?>

« previous php.pear.cvs (#13134) next »