pollita         Wed Aug 20 16:46:54 2003 EDT

  Modified files:              
    /phpdoc/en/reference/tokenizer/functions    token-get-all.xml 
  Log:
  Fix broken documentation.
  
Index: phpdoc/en/reference/tokenizer/functions/token-get-all.xml
diff -u phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.4 
phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.5
--- phpdoc/en/reference/tokenizer/functions/token-get-all.xml:1.4       Fri May 30 
08:04:48 2003
+++ phpdoc/en/reference/tokenizer/functions/token-get-all.xml   Wed Aug 20 16:46:54 
2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
   <refentry id="function.token-get-all">
    <refnamediv>
     <refname>token_get_all</refname>
@@ -11,21 +11,37 @@
      <type>array</type><methodname>token_get_all</methodname>
      <methodparam><type>string</type><parameter>source</parameter></methodparam>
     </methodsynopsis>
-    <para>
+    <simpara>
      <function>token_get_all</function> parses the given 
<parameter>source</parameter> 
-     string into PHP language tokens using the Zend engines lexical scanner.
-     The function returns an array of token descriptions. Each array element itself is
-     either a one character string or itself an array containing a token id and the 
-     string representation of that token in the source code.
-    </para>
+     string into PHP language tokens using the Zend engine&apos;s lexical scanner.
+     The function returns an array of token identifiers.  Each individual token
+     identifier is either a single character (i.e.: <constant>;</constant>,
+     <constant>.</constant>, <constant>&gt;</constant>, <constant>!</constant>, 
etc...),
+     or a two element array containing the token index in element 0, and the string
+     content of the original token in element 1.
+    </simpara>
+    <simpara>
+     For a list of parser tokens, see <xref linkend="tokens"/>, or use 
+     <function>token_name</function> to translate a token value into its string
+     representation.
+    </simpara>
     <example>
-     <title><function>token_get_all</function> example</title>
+     <title><function>token_get_all</function> examples</title>
      <programlisting role="php">
 <![CDATA[
 <?php
-  $tokens = token_get_all(";"); // => array(";")
-  $tokens = token_get_all("foreach"); // => array(T_FOREACH => "foreach")
-  $tokens = token_get_all("/* comment */"); // => array(T_ML_COMMENT => "/* comment 
*/")
+  $tokens = token_get_all('<?'); // => array(array(T_OPEN_TAG, '<?'));
+  $tokens = token_get_all('<? echo; ?>'); /* => array(
+                                                    array(T_OPEN_TAG,'<?'), 
+                                                    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.
+   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. */
+  $tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* 
comment */'));
 ?>
 ]]>
      </programlisting>


Reply via email to