cvs: phpdoc /en/reference/tokenizer book.xml constants.xml examples.xml reference.xml setup.xml

From: Date: Wed, 19 Dec 2007 22:33:46 +0000
Subject: cvs: phpdoc /en/reference/tokenizer book.xml constants.xml examples.xml reference.xml setup.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-673@lists.php.net to get a copy of this message
philip Wed Dec 19 22:33:46 2007 UTC Modified files: /phpdoc/en/reference/tokenizer book.xml setup.xml examples.xml constants.xml reference.xml Log: MFB: Upgrade to the new-reference-structure - Split reference.xml into book.xml and setup.xml - Moved from reference.xml to book.xml: - The intro text (partintro), and link to constant and the new example page - Moved from reference.xml to setup.xml: - The rest: requirements, installation, configuration, and resources - Changed the constants section to be an <appendix> - Changed the intro ID from <extname>.intro to intro.<extname>

http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tokenizer/book.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/tokenizer/book.xml diff -u /dev/null phpdoc/en/reference/tokenizer/book.xml:1.2 --- /dev/null Wed Dec 19 22:33:46 2007 +++ phpdoc/en/reference/tokenizer/book.xml Wed Dec 19 22:33:45 2007 @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.2 $ --> +<!-- Purpose: basic.other --> +<!-- Membership: core --> + +<book xml:id="book.tokenizer" xmlns="http://docbook.org/ns/docbook"> + <title>Tokenizer &Functions;</title> + <titleabbrev>Tokenizer</titleabbrev> + + <preface xml:id="intro.tokenizer"> + &reftitle.intro; + <para> + The tokenizer functions provide an interface to the + PHP tokenizer embedded in the Zend Engine. Using these + functions you may write your own PHP source analyzing + or modification tools without having to deal with the + language specification at the lexical level. + </para> + <para> + See also the <link linkend="tokens">appendix about tokens</link>. + </para> + </preface> + + &reference.tokenizer.setup; + &reference.tokenizer.constants; + &reference.tokenizer.examples; + &reference.tokenizer.reference; + +</book> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tokenizer/setup.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/tokenizer/setup.xml diff -u /dev/null phpdoc/en/reference/tokenizer/setup.xml:1.2 --- /dev/null Wed Dec 19 22:33:46 2007 +++ phpdoc/en/reference/tokenizer/setup.xml Wed Dec 19 22:33:45 2007 @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="tokenizer.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.setup; + + <section xml:id="tokenizer.requirements"> + &reftitle.required; + &no.requirement; + </section> + + &reference.tokenizer.configure; + + <section xml:id="tokenizer.configuration"> + &reftitle.runtime; + &no.config; + </section> + + <section xml:id="tokenizer.resources"> + &reftitle.resources; + &no.resource; + </section> + +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tokenizer/examples.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/tokenizer/examples.xml diff -u /dev/null phpdoc/en/reference/tokenizer/examples.xml:1.2 --- /dev/null Wed Dec 19 22:33:46 2007 +++ phpdoc/en/reference/tokenizer/examples.xml Wed Dec 19 22:33:46 2007 @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.2 $ --> + +<appendix xml:id="tokenizer.examples"> + &reftitle.examples; + <para> + Here is a simple example PHP scripts using the tokenizer that + will read in a PHP file, strip all comments from the source + and print the pure code only. + </para> + <example> + <title>Strip comments with the tokenizer</title> + <programlisting role="php"> +<![CDATA[ +<?php +/* +* 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 { + define('T_DOC_COMMENT', T_ML_COMMENT); +} + +$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; + } 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; + } + } +} +?> +]]> + </programlisting> + </example> +</appendix> + + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tokenizer/constants.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/tokenizer/constants.xml diff -u phpdoc/en/reference/tokenizer/constants.xml:1.7 phpdoc/en/reference/tokenizer/constants.xml:1.8 --- phpdoc/en/reference/tokenizer/constants.xml:1.7 Wed Jun 20 22:25:32 2007 +++ phpdoc/en/reference/tokenizer/constants.xml Wed Dec 19 22:33:45 2007 @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> -<section xml:id="tokenizer.constants" xmlns="http://docbook.org/ns/docbook"> +<!-- $Revision: 1.8 $ --> +<appendix xml:id="tokenizer.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> &reftitle.constants; <para> When the extension has either been compiled into PHP or dynamically loaded at runtime, the tokens listed in <xref linkend="tokens"/> are defined as constants. </para> -</section> +</appendix> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/tokenizer/reference.xml?r1=1.22&r2=1.23&diff_format=u Index: phpdoc/en/reference/tokenizer/reference.xml diff -u phpdoc/en/reference/tokenizer/reference.xml:1.22 phpdoc/en/reference/tokenizer/reference.xml:1.23 --- phpdoc/en/reference/tokenizer/reference.xml:1.22 Mon Dec 10 17:06:10 2007 +++ phpdoc/en/reference/tokenizer/reference.xml Wed Dec 19 22:33:46 2007 @@ -1,99 +1,13 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.22 $ --> -<!-- Purpose: basic.other --> -<!-- Membership: core --> +<!-- $Revision: 1.23 $ --> - <reference xml:id="ref.tokenizer" xmlns="http://docbook.org/ns/docbook"> - <title>Tokenizer Functions</title> - <titleabbrev>Tokenizer</titleabbrev> +<reference xml:id="ref.tokenizer" xmlns="http://docbook.org/ns/docbook"> + <titleabbrev>Tokenizer &Functions;</titleabbrev> - <partintro> - <section xml:id="tokenizer.intro"> - &reftitle.intro; - <para> - The tokenizer functions provide an interface to the - PHP tokenizer embedded in the Zend Engine. Using these - functions you may write your own PHP source analyzing - or modification tools without having to deal with the - language specification at the lexical level. - </para> - <para> - See also the <link linkend="tokens">appendix about tokens</link>. - </para> - </section> + &reference.tokenizer.entities.functions; - <section xml:id="tokenizer.requirements"> - &reftitle.required; - &no.requirement; - </section> +</reference> - &reference.tokenizer.configure; - - &reference.tokenizer.constants; - - <section xml:id="tokenizer.examples"> - &reftitle.examples; - <para> - Here is a simple example PHP scripts using the tokenizer that - will read in a PHP file, strip all comments from the source - and print the pure code only. - </para> - <example> - <title>Strip comments with the tokenizer</title> - <programlisting role="php"> -<![CDATA[ -<?php -/* - * 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 { - define('T_DOC_COMMENT', T_ML_COMMENT); -} - -$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; - } 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; - } - } -} -?> -]]> - </programlisting> - </example> - </section> - - - </partintro> - -&reference.tokenizer.entities.functions; - - </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml @@ -110,5 +24,8 @@ sgml-local-catalogs:nil sgml-local-ecat-files:nil End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 -->
« previous php.doc.cvs (#673) next »