cvs: phpdoc-pl /reference/tokenizer reference.xml

From: Date: Tue, 24 Feb 2004 02:07:52 +0000
Subject: cvs: phpdoc-pl /reference/tokenizer reference.xml
Groups: php.doc.pl 
Request: Send a blank email to doc-pl+get-303@lists.php.net to get a copy of this message
leszek Mon Feb 23 21:07:52 2004 EDT Added files: /phpdoc-pl/reference/tokenizer reference.xml Log: http://cvs.php.net/co.php/phpdoc-pl/reference/tokenizer/reference.xml?r=1.1&p=1 Index: phpdoc-pl/reference/tokenizer/reference.xml +++ phpdoc-pl/reference/tokenizer/reference.xml <?xml version="1.0" encoding="iso-8859-2"?> <!-- EN-Revision: 1.16 Maintainer: dombal Staus: ready --> <!-- $Revision: 1.1 $ --> <reference id="ref.tokenizer"> <title>Funkcje tokenizera</title> <titleabbrev>Tokenizer</titleabbrev> <partintro> <section id="tokenizer.intro"> &reftitle.intro; <para> Funkcje tokenizera s± interfejsem dostêpu do wewnêtrznego tokenizera wbudowanego w silniku Zend. U¿ywaj±c tych funkcji mo¿esz napisaæ swoje w³asne narzêdzia do analizy lub modyfikacji kodu PHP bez potrzeby zajmowania siê specyfikacj± jêzyka na poziomie analizy leksykalnej. </para> <para> Patrz tak¿e <link linkend="tokens">dodatek o tokenach</link>. </para> </section> <section id="tokenizer.requirements"> &reftitle.required; &no.requirement; </section> &reference.tokenizer.configure; &reference.tokenizer.constants; <section id="tokenizer.examples"> &reftitle.examples; <para> Poni¿ej prosty skrypt PHP u¿ywaj±cy tokenizera który wczyta plik PHP, usunie wszystkie komentarze ze ¼ród³a i wydrukuje tylko czysty kod. </para> <example> <title>Usuwanie komentarzy przy pomocy tokenizera</title> <programlisting role="php"> <![CDATA[ <?php $kod = file_get_contents("jakisplik.php"); $tokeny = token_get_all($kod); /* T_ML_COMMENT nie istnieje w PHP 5. * Nastêpuj±ce trzy linie definiuj± t± sta³a by zachowaæ kompatybilno¶æ * wsteczn±. * * Kolejne dwie linie definiuj± istniej±c± tylko w PHP 5 sta³± * T_DOC_COMMENT, któr± w PHP 4 podmienimy jako T_ML_COMMENT. */ if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } foreach ($tokeny as $token) { if (is_string($token)) { // prosty token jednoznakowy echo $token; } else { // tablica definiuj±ca token list($id, $tekst) = $token; switch ($id) { case T_COMMENT: case T_ML_COMMENT: // to zdefiniowali¶my case T_DOC_COMMENT: // to te¿ // brak akcji dla komentarzy break; default: // wszystko inne -> drukuj "jakie jest" echo $tekst; break; } } } ?> ]]> </programlisting> </example> </section> </partintro> &reference.tokenizer.functions; </reference> <!-- 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 -->

« previous php.doc.pl (#303) next »