cvs: phpdoc /en/reference/tokenizer reference.xml

From: Date: Sat, 28 Aug 2004 10:24:19 +0000
Subject: cvs: phpdoc /en/reference/tokenizer reference.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969363549@lists.php.net to get a copy of this message
aidan Sat Aug 28 06:24:19 2004 EDT Modified files: /phpdoc/en/reference/tokenizer reference.xml Log: Fixed whitespace http://cvs.php.net/diff.php/phpdoc/en/reference/tokenizer/reference.xml?r1=1.18&r2=1.19&ty=u Index: phpdoc/en/reference/tokenizer/reference.xml diff -u phpdoc/en/reference/tokenizer/reference.xml:1.18 phpdoc/en/reference/tokenizer/reference.xml:1.19 --- phpdoc/en/reference/tokenizer/reference.xml:1.18 Wed Mar 31 13:53:59 2004 +++ phpdoc/en/reference/tokenizer/reference.xml Sat Aug 28 06:24:19 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <reference id="ref.tokenizer"> <title>Tokenizer Functions</title> <titleabbrev>Tokenizer</titleabbrev> @@ -40,40 +40,45 @@ <programlisting role="php"> <![CDATA[ <?php - $source = file_get_contents("somefile.php"); - $tokens = token_get_all($source); - /* T_ML_COMMENT does not exist in PHP 5. - * The following three lines define it in order to - * preserve backwards compatibility. - * - * The next two lines define the PHP 5-only T_DOC_COMMENT, - * which we will mask as T_ML_COMMENT for PHP 4. - */ - if (!defined('T_ML_COMMENT')) { +/* + * T_ML_COMMENT does not exist in PHP 5. + * The following three lines define it in order to + * preserve backwards compatibility. + * + * The next two lines define the PHP 5 only T_DOC_COMMENT, + * which we will mask as T_ML_COMMENT for PHP 4. + */ +if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); - } else { +} else { define('T_DOC_COMMENT', T_ML_COMMENT); - } - foreach ($tokens as $token) { +} + +$source = file_get_contents('example.php'); +$tokens = token_get_all($source); + +foreach ($tokens as $token) { if (is_string($token)) { - // simple 1-character token - echo $token; + // simple 1-character token + echo $token; } else { - // token array - list($id, $text) = $token; - switch ($id) { - case T_COMMENT: - case T_ML_COMMENT: // we've defined this - case T_DOC_COMMENT: // and this - // no action on comments - break; - default: - // anything else -> output "as is" - echo $text; - break; - } + // token array + list($id, $text) = $token; + + switch ($id) { + case T_COMMENT: + case T_ML_COMMENT: // we've defined this + case T_DOC_COMMENT: // and this + // no action on comments + break; + + default: + // anything else -> output "as is" + echo $text; + break; + } } - } +} ?> ]]> </programlisting>

« previous php.doc (#969363549) next »