kennyt Wed Jan 7 18:15:48 2004 EDT
Modified files: /phpdoc/en/reference/tokenizer constants.xml reference.xml /phpdoc/en/reference/tokenizer/functions token-get-all.xml Log: Noted that T_ML_COMMENT => T_COMMENT in PHP 5. (#25659) Changed short_open_tags to full tag. Index: phpdoc/en/reference/tokenizer/constants.xml diff -u phpdoc/en/reference/tokenizer/constants.xml:1.2 phpdoc/en/reference/tokenizer/constants.xml:1.3 --- phpdoc/en/reference/tokenizer/constants.xml:1.2 Wed May 28 19:03:10 2003 +++ phpdoc/en/reference/tokenizer/constants.xml Wed Jan 7 18:15:48 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <section id="tokenizer.constants"> &reftitle.constants; &extension.constants; @@ -1033,9 +1033,12 @@ (<type>integer</type>) </term> <listitem> - <simpara> - - </simpara> + <note> + <simpara> + <constant>T_ML_COMMENT</constant> is not defined in PHP 5. + All comments in PHP 5 are of token <constant>T_COMMENT</constant>. + </simpara> + </note> </listitem> </varlistentry> <varlistentry> Index: phpdoc/en/reference/tokenizer/reference.xml diff -u phpdoc/en/reference/tokenizer/reference.xml:1.14 phpdoc/en/reference/tokenizer/reference.xml:1.15 --- phpdoc/en/reference/tokenizer/reference.xml:1.14 Fri Dec 19 10:50:00 2003 +++ phpdoc/en/reference/tokenizer/reference.xml Wed Jan 7 18:15:48 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.14 $ --> +<!-- $Revision: 1.15 $ --> <reference id="ref.tokenizer"> <title>Tokenizer functions</title> <titleabbrev>Tokenizer</titleabbrev> @@ -42,6 +42,13 @@ <?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. + */ + if (!defined('T_ML_COMMENT')) { + define('T_ML_COMMENT', T_COMMENT); + } foreach ($tokens as $token) { if (is_string($token)) { // simple 1-character token @@ -51,7 +58,7 @@ list($id, $text) = $token; switch ($id) { case T_COMMENT: - case T_ML_COMMENT: + case T_ML_COMMENT: // we've defined this // no action on comments break; default: Index: phpdoc/en/reference/tokenizer/functions/token-get-all.xml diff -u phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.6 phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.7 --- phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.6 Mon Dec 15 11:53:25 2003 +++ phpdoc/en/reference/tokenizer/functions/token-get-all.xml Wed Jan 7 18:15:48 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="function.token-get-all"> <refnamediv> <refname>token_get_all</refname> @@ -30,17 +30,17 @@ <programlisting role="php"> <![CDATA[ <?php - $tokens = token_get_all('<?'); // => array(array(T_OPEN_TAG, '<?')); - $tokens = token_get_all('<? echo; ?>'); /* => array( - array(T_OPEN_TAG, '<?'), + $tokens = token_get_all('<?php'); // => array(array(T_OPEN_TAG, '<?')); + $tokens = token_get_all('<?php echo; ?>'); /* => array( + array(T_OPEN_TAG, '<?php'), array(T_ECHO, 'echo'), ';', array(T_CLOSE_TAG, '?>') ); */ /* Note in the following example that the string is parsed as T_INLINE_HTML - rather than the otherwise expected T_ML_COMMENT. + rather than the otherwise expected T_COMMENT (T_ML_COMMENT in PHP <5). This is because no open/close tags were used in the "code" provided. - This would be equivalent to putting a comment outside of <? ?> tags in a normal file. */ + This would be equivalent to putting a comment outside of <?php ?> tags in a normal file. */ $tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* comment */')); ?> ]]>