Source for file HighlightParser.inc

Documentation is available at HighlightParser.inc

  1. <?php
  2. /**
  3.  * Source Code Highlighting
  4.  *
  5.  * The classes in this file are responsible for the dynamic @example, @filesource
  6.  * and {@}source} tags output.  Using the phpDocumentor_HighlightWordParser,
  7.  * the phpDocumentor_HighlightParser retrieves PHP tokens one by one from the
  8.  * array generated by {@link phpDocumentorTWordParser} source retrieval functions
  9.  * and then highlights them individually.
  10.  *
  11.  * It accomplishes this highlighting through the assistance of methods in
  12.  * the output Converter passed to its parse() method, and then returns the
  13.  * fully highlighted source as a string
  14.  *
  15.  * phpDocumentor :: automatic documentation generator
  16.  * 
  17.  * PHP versions 4 and 5
  18.  *
  19.  * Copyright (c) 2002-2008 Gregory Beaver
  20.  * 
  21.  * LICENSE:
  22.  * 
  23.  * This library is free software; you can redistribute it
  24.  * and/or modify it under the terms of the GNU Lesser General
  25.  * Public License as published by the Free Software Foundation;
  26.  * either version 2.1 of the License, or (at your option) any
  27.  * later version.
  28.  * 
  29.  * This library is distributed in the hope that it will be useful,
  30.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  31.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  32.  * Lesser General Public License for more details.
  33.  * 
  34.  * You should have received a copy of the GNU Lesser General Public
  35.  * License along with this library; if not, write to the Free Software
  36.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  37.  *
  38.  * @category   ToolsAndUtilities
  39.  * @package    phpDocumentor
  40.  * @subpackage Parsers
  41.  * @author     Gregory Beaver <[email protected]>
  42.  * @copyright  2002-2008 Gregory Beaver
  43.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  44.  * @version    CVS: $Id: HighlightParser.inc 253641 2008-02-24 02:35:44Z ashnazg $
  45.  * @filesource
  46.  * @link       http://www.phpdoc.org
  47.  * @link       http://pear.php.net/PhpDocumentor
  48.  * @tutorial   tags.example.pkg, tags.filesource.pkg, tags.inlinesource.pkg
  49.  * @since      1.2.0beta3
  50.  * @todo       CS cleanup - change package to PhpDocumentor
  51.  */
  52.  
  53. /**
  54.  * Retrieve tokens from an array of tokens organized by line numbers
  55.  *
  56.  * @category   ToolsAndUtilities
  57.  * @package    phpDocumentor
  58.  * @subpackage Parsers
  59.  * @author     Gregory Beaver <[email protected]>
  60.  * @copyright  2002-2008 Gregory Beaver
  61.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  62.  * @version    Release: @VER@
  63.  * @link       http://www.phpdoc.org
  64.  * @link       http://pear.php.net/PhpDocumentor
  65.  * @since      1.2.0beta3
  66.  * @todo       CS cleanup - change package to PhpDocumentor
  67.  * @todo       CS cleanup - change class name to PhpDocumentor_*
  68.  */
  69. {
  70.     /**
  71.      * Hash used to keep track of line numbers that have already been initialized
  72.      * @var array 
  73.      * @access private
  74.      */
  75.     var $_listLineNums array();
  76.     /**
  77.      * Initialize the parser object
  78.      *
  79.      * @param array                         &$input  the input
  80.      * @param phpDocumentor_HighlightParser &$parser the parser
  81.      *
  82.      * @return void 
  83.      */
  84.     function setup(&$input&$parser)
  85.     {
  86.         $this->_parser     &$parser;
  87.         $this->data        &$input;
  88.         $this->_all        $input;
  89.         $this->_sourceline 0;
  90.         $this->pos         0;
  91.         $this->linenum     0;
  92.     }
  93.     
  94.     /**
  95.      * debugging function
  96.      *
  97.      * @return void 
  98.      * @access private
  99.      */
  100.     function printState()
  101.     {
  102.         $linenum $this->linenum;
  103.         $pos     $this->pos;
  104.         if (!isset($this->_all[$this->linenum][$this->pos])) {
  105.             $linenum++;
  106.             $pos 0;
  107.         }
  108.         $details '';
  109.         $token   $this->_all[$linenum][$pos];
  110.         if (is_array($token)) {
  111.             $details token_name($token[0]);
  112.             $token   htmlspecialchars($token[1]);
  113.         else {
  114.             $token htmlspecialchars($token);
  115.         }
  116.         debug('Next Token ' $this->linenum '-' $this->pos ':' $details);
  117.         var_dump($token);
  118.     }
  119.     
  120.     /**
  121.      * Retrieve the position of the next token that will be parsed
  122.      * in the internal token array
  123.      *
  124.      * @return array format: array(line number, position)
  125.      */
  126.     function nextToken()
  127.     {
  128.         $linenum $this->linenum;
  129.         $pos     $this->pos;
  130.         if (!isset($this->_all[$this->linenum][$this->pos])) {
  131.             $linenum++;
  132.             $pos 0;
  133.         }
  134.         if (!isset($this->_all[$linenum][$pos])) {
  135.             return false;
  136.         }
  137.         return array($linenum$pos);
  138.     }
  139.     
  140.     /**
  141.      * Retrieve the next token
  142.      *
  143.      * @return array|stringeither array(PHP token constant, token) or string
  144.      *                       non-specific separator
  145.      */
  146.     function getWord()
  147.     {
  148.         if (!isset($this->_all[$this->linenum][$this->pos])) {
  149.             $this->linenum++;
  150.             $this->pos 0;
  151.             if (!isset($this->_all[$this->linenum])) {
  152.                 return false;
  153.             }
  154.             $this->_parser->newLineNum();
  155.             return $this->getWord();
  156.         }
  157.         $word $this->_all[$this->linenum][$this->pos++];
  158.         return str_replace("\t"'    '$word);
  159.     }
  160.  
  161.     /**
  162.      * back the word parser to the previous token as defined by $last_token
  163.      *
  164.      * @param array|string$last_token token, or output from {@link nextToken()}
  165.      * @param bool         $is_pos     if true, backupPos interprets $last_token
  166.      *                                  to be the position in the internal token
  167.      *                                  array of the last token
  168.      *
  169.      * @return void 
  170.      */
  171.     function backupPos($last_token$is_pos false)
  172.     {
  173.         if (!$last_token{
  174.             return;
  175.         }
  176.         if ($is_pos{
  177.             $this->linenum $last_token[0];
  178.             $this->pos     $last_token[1];
  179.             return;
  180.         }
  181.         if ($last_token === false{
  182.             return;
  183.         }
  184.  
  185.         //fancy_debug('before', $this->linenum, $this->pos, 
  186.         //    token_name($this->_all[$this->linenum][$this->pos][0]),
  187.         //    htmlentities($this->_all[$this->linenum][$this->pos][1]),
  188.         //    $this->_all[$this->linenum]);
  189.  
  190.         do {
  191.             $this->pos--;
  192.             if ($this->pos 0{
  193.                 $this->linenum--;
  194.                 if ($this->linenum 0{
  195.                     var_dump($last_token);
  196.                     break;
  197.                 }
  198.                 $this->pos count($this->_all[$this->linenum]1;
  199.             }
  200.         while (!$this->tokenEquals($last_tokenstr_replace("\t"'    '
  201.             $this->_all[$this->linenum][$this->pos])));
  202.  
  203.         //fancy_debug('after', $this->linenum, $this->pos,
  204.         //    token_name($this->_all[$this->linenum][$this->pos][0]),
  205.         //    htmlentities($this->_all[$this->linenum][$this->pos][1]));
  206.     }
  207. }
  208.  
  209. /**
  210.  * Highlights source code using {@link parse()}
  211.  *
  212.  * @category   ToolsAndUtilities
  213.  * @package    phpDocumentor
  214.  * @subpackage Parsers
  215.  * @author     Gregory Beaver <[email protected]>
  216.  * @copyright  2002-2008 Gregory Beaver
  217.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  218.  * @version    Release: @VER@
  219.  * @link       http://www.phpdoc.org
  220.  * @link       http://pear.php.net/PhpDocumentor
  221.  * @since      1.2.0beta3
  222.  * @todo       CS cleanup - change package to PhpDocumentor
  223.  * @todo       CS cleanup - change class name to PhpDocumentor_*
  224.  */
  225. {
  226.     /**#@+
  227.      * @access private
  228.      */
  229.  
  230.     /**
  231.      * Highlighted source is built up in this string
  232.      * @var string 
  233.      */
  234.     var $_output;
  235.  
  236.     /**
  237.      * contents of the current source code line as it is parsed
  238.      * @var string 
  239.      */
  240.     var $_line;
  241.  
  242.     /**
  243.      * Used to retrieve highlighted tokens
  244.      * @var Converter a descendant of Converter
  245.      */
  246.     var $_converter;
  247.  
  248.     /**
  249.      * Path to file being highlighted, if this is from a @filesource tag
  250.      * @var false|stringfull path
  251.      */
  252.     var $_filesourcepath;
  253.  
  254.     /**
  255.      * @var array 
  256.      */
  257.     var $eventHandlers = array(
  258.         PARSER_EVENT_ARRAY                      => 'defaultHandler',
  259.         PARSER_EVENT_CLASS                      => 'handleClass',
  260.         PARSER_EVENT_COMMENT                    => 'handleComment',
  261.         PARSER_EVENT_DOCBLOCK_TEMPLATE          => 'handleDocBlockTemplate',
  262.         PARSER_EVENT_END_DOCBLOCK_TEMPLATE      => 'handleEndDocBlockTemplate',
  263.         PARSER_EVENT_LOGICBLOCK                 => 'handleLogicBlock',
  264.         PARSER_EVENT_METHOD_LOGICBLOCK          => 'handleMethodLogicBlock',
  265.         PARSER_EVENT_NOEVENTS                   => 'defaultHandler',
  266.         PARSER_EVENT_OUTPHP                     => 'defaultHandler',
  267.         PARSER_EVENT_CLASS_MEMBER               => 'handleClassMember',
  268.         PARSER_EVENT_DEFINE                     => 'defaultHandler',
  269.         PARSER_EVENT_DEFINE_PARAMS              => 'defaultHandler',
  270.         PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS  => 'defaultHandler',
  271.         PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS => 'defaultHandler',
  272.         PARSER_EVENT_DOCBLOCK                   => 'handleDocBlock',
  273.         PARSER_EVENT_TAGS                       => 'handleTags',
  274.         PARSER_EVENT_DESC                       => 'handleDesc',
  275.         PARSER_EVENT_DOCKEYWORD                 => 'handleTag',
  276.         PARSER_EVENT_DOCKEYWORD_EMAIL           => 'handleDockeywordEmail',
  277.         PARSER_EVENT_EOFQUOTE                   => 'handleQuote',
  278.         PARSER_EVENT_FUNCTION                   => 'handleFunction',
  279.         PARSER_EVENT_METHOD                     => 'handleMethod',
  280.         PARSER_EVENT_FUNCTION_PARAMS            => 'handleFunctionParams',
  281.         PARSER_EVENT_FUNC_GLOBAL                => 'handleFuncGlobal',
  282.         PARSER_EVENT_INLINE_DOCKEYWORD          => 'handleInlineDockeyword',
  283.         PARSER_EVENT_INCLUDE                    => 'defaultHandler',
  284.         PARSER_EVENT_INCLUDE_PARAMS             => 'defaultHandler',
  285.         PARSER_EVENT_QUOTE                      => 'handleQuote',
  286.         PARSER_EVENT_QUOTE_VAR                  => 'handleQuoteVar',
  287.         PARSER_EVENT_PHPCODE                    => 'handlePhpCode',
  288.         PARSER_EVENT_SINGLEQUOTE                => 'handleSingleQuote',
  289.         PARSER_EVENT_STATIC_VAR                 => 'defaultHandler',
  290.         PARSER_EVENT_STATIC_VAR_VALUE           => 'defaultHandler',
  291.         PARSER_EVENT_VAR                        => 'handleVar',
  292.     );
  293.  
  294.     /**
  295.      * event handlers for @tags
  296.      * @tutorial tags.pkg
  297.      */
  298.     var $tagHandlers array(
  299.         '*'              => 'defaultTagHandler',
  300.         'abstract'       => 'coreTagHandler',
  301.         'access'         => 'coreTagHandler',
  302.         'author'         => 'coreTagHandler',
  303.         'category'       => 'coreTagHandler',
  304.         'copyright'      => 'coreTagHandler',
  305.         'deprecated'     => 'coreTagHandler',
  306.         'example'        => 'coreTagHandler',
  307.         'filesource'     => 'coreTagHandler',
  308.         'final'          => 'coreTagHandler',
  309.         'global'         => 'globalTagHandler',
  310.         'ignore'         => 'coreTagHandler',
  311.         'license'        => 'coreTagHandler',
  312.         'link'           => 'coreTagHandler',
  313.         'name'           => 'coreTagHandler',
  314.         'package'        => 'coreTagHandler',
  315.         'param'          => 'paramTagHandler',
  316.         'parameter'      => 'paramTagHandler',
  317.         'see'            => 'coreTagHandler',
  318.         'since'          => 'coreTagHandler',
  319.         'subpackage'     => 'coreTagHandler',
  320.         'internal'       => 'coreTagHandler',
  321.         'return'         => 'returnTagHandler',
  322.         'static'         => 'coreTagHandler',
  323.         'staticvar'      => 'staticvarTagHandler',
  324.         'throws'         => 'coreTagHandler',
  325.         'todo'           => 'coreTagHandler',
  326.         'tutorial'       => 'coreTagHandler',
  327.         'uses'           => 'coreTagHandler',
  328.         'var'            => 'varTagHandler',
  329.         'version'        => 'coreTagHandler',
  330.         'property'       => 'propertyTagHandler',
  331.         'property-read'  => 'propertyTagHandler',
  332.         'property-write' => 'propertyTagHandler',
  333.         'method'         => 'propertyTagHandler'
  334.     );
  335.     /**#@-*/
  336.     
  337.     /**
  338.      * wraps the current line (via the converter) and resets it to empty
  339.      *
  340.      * @return void 
  341.      * @uses Converter::SourceLine() encloses {@link $_line} in a
  342.      *                                converter-specific format
  343.      */
  344.     function newLineNum()
  345.     {
  346.         if ($this->_pf_no_output_yet{
  347.             return;
  348.         }
  349.         $this->_flush_save();
  350.         $this->_line   .= $this->_converter->flushHighlightCache();
  351.         $this->_output .= $this->_converter->SourceLine($this->_wp->linenum,
  352.             $this->_line$this->_path);
  353.         $this->_line    '';
  354.     }
  355.     
  356.     /**
  357.      * Start the parsing at a certain line number
  358.      *
  359.      * @param int $num line number
  360.      *
  361.      * @return void 
  362.      */
  363.     function setLineNum($num)
  364.     {
  365.         $this->_wp->linenum $num;
  366.     }
  367.     
  368.     /**
  369.      * Parse a new file
  370.      *
  371.      * The parse() method is a do...while() loop that retrieves tokens one by
  372.      * one from the {@link $_event_stack}, and uses the token event array set up
  373.      * by the class constructor to call event handlers.
  374.      *
  375.      * The event handlers each process the tokens passed to them, and use the
  376.      * {@link _addoutput()} method to append the processed tokens to the
  377.      * {@link $_line} variable.  The word parser calls {@link newLineNum()}
  378.      * every time a line is reached.
  379.      *
  380.      * In addition, the event handlers use special linking functions
  381.      * {@link _link()} and its cousins (_classlink(), etc.) to create in-code
  382.      * hyperlinks to the documentation for source code elements that are in the
  383.      * source code.
  384.      *
  385.      * @param array         &$parse_data       the parse data
  386.      * @param Converter     &$converter        the converter object
  387.      * @param bool          $inlinesourceparse whether this data is from an
  388.      *                                          inline {@}source} tag
  389.      * @param string|false $class             if a string, it is the name of the
  390.      *                                          class whose method we are parsing
  391.      *                                          containing a {@}source} tag
  392.      * @param false|integer$linenum           starting line number from
  393.      *                                          {@}source linenum}
  394.      * @param false|string $filesourcepath    full path to file with @filesource
  395.      *                                          tag, if this is a @filesource parse
  396.      *
  397.      * @staticvar int used for recursion limiting if a handler for
  398.      *                 an event is not found
  399.      * @return bool 
  400.      * @uses setupStates() initialize parser state variables
  401.      * @uses configWordParser() pass $parse_data to prepare retrieval of tokens
  402.      * @todo CS cleanup - rename tokenizer_ext constant to uppercase
  403.      */
  404.     function parse (&$parse_data&$converter$inlinesourceparse false,
  405.         $class false$linenum false$filesourcepath false)
  406.     {
  407.         if (!tokenizer_ext{
  408.             if (is_array($parse_data)) {
  409.                 $parse_data join($parse_data'');
  410.             }
  411.             $parse_data    explode("\n"$parse_data);
  412.             $this->_output '';
  413.             foreach ($parse_data as $linenum => $line{
  414.                 if ($linenum 0{
  415.                     $this->_output .= $converter->SourceLine($linenum,
  416.                         $line$filesourcepath);
  417.                 }
  418.             }
  419.             return $converter->PreserveWhiteSpace($this->_output);
  420.         }
  421.         static $endrecur  0;
  422.         $this->_converter &$converter;
  423.         $converter->startHighlight();
  424.         $this->_path $filesourcepath;
  425.         $this->setupStates($inlinesourceparse$class);
  426.  
  427.         $this->configWordParser($parse_data);
  428.         if ($linenum !== false{
  429.             $this->setLineNum($linenum);
  430.         }
  431.         // initialize variables so E_ALL error_reporting doesn't complain
  432.         $pevent 0;
  433.         $word   0;
  434.  
  435.         do {
  436.             $lpevent $pevent;
  437.             $pevent  $this->_event_stack->getEvent();
  438.             if ($lpevent != $pevent{
  439.                 $this->_last_pevent $lpevent;
  440.             }
  441.  
  442.             if ($pevent == PARSER_EVENT_CLASS_MEMBER{
  443.                 $this->_wp->setWhitespace(true);
  444.             else {
  445.                 $this->_wp->setWhitespace(false);
  446.             }
  447.  
  448.             if (!is_array($word)) {
  449.                 $lw $word;
  450.             }
  451.             if (is_array($word&& $word[0!= T_WHITESPACE{
  452.                 $lw $word;
  453.             }
  454.             $dbg_linenum $this->_wp->linenum;
  455.             $dbg_pos     $this->_wp->getPos();
  456.             $word        $this->_wp->getWord();
  457.             if (is_array($word&& ($word[0== T_WHITESPACE || 
  458.                 $word[0== T_COMMENT&& 
  459.                 $pevent != PARSER_EVENT_CLASS_MEMBER
  460.             {
  461.                 //debug("added " . $this->_wp->linenum . '-' . $this->_wp->pos);
  462.                 $this->_addoutput($word);
  463.                 continue;
  464.             else {
  465.                 $this->_pv_last_word $lw;
  466.             }
  467.             if ($pevent != PARSER_EVENT_DOCBLOCK{
  468.                 $this->_pv_last_next_word $this->_pv_next_word;
  469.                 $this->_pv_next_word      $this->_wp->nextToken();
  470.             }
  471.             // in wordparser, have to keep track of lines
  472.             //$this->publishEvent(PHPDOCUMENTOR_EVENT_NEWLINENUM, 
  473.             //    $this->_wp->linenum);
  474.             if (PHPDOCUMENTOR_DEBUG == true{
  475.                 echo "LAST: ";
  476.                 if (is_array($this->_pv_last_word)) {
  477.                     echo token_name($this->_pv_last_word[0]
  478.                         ' => |' .
  479.                         htmlspecialchars($this->_pv_last_word[1]);
  480.                 else {
  481.                     echo "|" $this->_pv_last_word;
  482.                 }
  483.                 echo "|\n";
  484.                 echo "PEVENT: " $this->getParserEventName($pevent"\n";
  485.                 echo "LASTPEVENT: " .
  486.                     $this->getParserEventName($this->_last_pevent"\n";
  487.                 //echo "LINE: "   . $this->_line   . "\n";
  488.                 //echo "OUTPUT: " . $this->_output . "\n";
  489.                 echo $dbg_linenum '-' $dbg_pos ": ";
  490.                 if (is_array($word)) {
  491.                     echo token_name($word[0]' => |' htmlspecialchars($word[1]);
  492.                 else {
  493.                     echo '|'.htmlspecialchars($word);
  494.                 }
  495.                 echo "|\n";
  496.                 $this->_wp->printState();
  497.                 echo "NEXT TOKEN: ";
  498.                 $tok1 $this->_pv_next_word;
  499.                 $tok  $this->_wp->_all[$tok1[0]][$tok1[1]];
  500.                 if (is_array($tok)) {
  501.                     echo token_name($tok[0]' => ' $tok1[0'-' $tok1[1.
  502.                         '|' htmlspecialchars($tok[1]);
  503.                 else {
  504.                     echo "|" $tok;
  505.                 }
  506.                 echo "|\n";
  507.                 echo "-------------------\n\n\n";
  508.                 flush();
  509.             }
  510.             if ($word !== false && isset($this->eventHandlers[$pevent])) {
  511.                 $handle $this->eventHandlers[$pevent];
  512.                 $this->$handle($word$pevent);
  513.             elseif ($word !== false{
  514.                 debug('WARNING: possible error, no handler for event number '
  515.                      . $pevent);
  516.                 if ($endrecur++ == 25{
  517.                     die("FATAL ERROR, recursion limit reached");
  518.                 }
  519.             }
  520.         while (!($word === false));
  521.         if (strlen($this->_line)) {
  522.             $this->newLineNum();
  523.         }
  524.         return $this->_output;
  525.     }
  526.  
  527.     /**#@+
  528.      * Event Handlers
  529.      *
  530.      * All Event Handlers use {@link checkEventPush()} and
  531.      * {@link checkEventPop()} to set up the event stack and parser state.
  532.      *
  533.      * @param string|array $word   token value
  534.      * @param int          $pevent parser event from {@link Parser.inc}
  535.      *
  536.      * @return void
  537.      * @access private
  538.      */
  539.     /**
  540.      * Most tokens only need highlighting, and this method handles them
  541.      */
  542.     function defaultHandler($word$pevent)
  543.     {
  544.         $this->_addoutput($word);
  545.         if ($this->checkEventPush($word$pevent)) {
  546.             return;
  547.         }
  548.         $this->checkEventPop($word$pevent);
  549.     }
  550.     
  551.     /**
  552.      * Handles global declarations in a function, like:
  553.      *
  554.      * <code>
  555.      * function foobar()
  556.      * {
  557.      *     global $_phpDocumentor_setting;
  558.      * }
  559.      * </code>
  560.      *
  561.      * @uses _globallink() instead of _addoutput(), to link to global variables
  562.      *        if they are used in a function
  563.      */
  564.     function handleFuncGlobal($word$pevent)
  565.     {
  566.         if ($this->checkEventPush($word$pevent)) {
  567.             return;
  568.         }
  569.         $this->_globallink($word);
  570.         $this->checkEventPop($word$pevent);
  571.     }
  572.     
  573.     /**
  574.      * Handles strings in quotation marks and heredoc
  575.      *
  576.      * Special handling is needed for strings that contain variables like:
  577.      *
  578.      * <code>$a = "$test string"</code>
  579.      *
  580.      * The tokenizer parses out tokens '"',array(T_VARIABLE,'$test'),' string',
  581.      * and '"'.  Since it is possible to have $this->classvar in a string,
  582.      * we save a variable name just in case the next token is -> to allow linking
  583.      * to class members.  Otherwise, the string is simply highlighted.
  584.      *
  585.      * constant strings (with no $variables in them) are passed as a single
  586.      * entity, and so will be saved in the last token parsed.  This means the
  587.      * event handler must tell the word parser to re-retrieve the current token
  588.      * so that the correct event handler can process it.
  589.      */
  590.     function handleQuote($word$pevent)
  591.     {
  592.         if ($this->_pf_inmethod && is_array($word&& $word[0== T_VARIABLE{
  593.             $this->_pv_lastvar $word;
  594.         }
  595.         if ($this->checkEventPush($word$pevent)) {
  596.             $this->_addoutput($word);
  597.             return;
  598.         }
  599.         if ($this->_pf_quote_active &&
  600.             (($this->_pv_last_word == '"' && 
  601.             $this->_last_pevent != PARSER_EVENT_QUOTE||
  602.             (is_array($this->_pv_last_word&& 
  603.             $this->_pv_last_word[0== T_END_HEREDOC &&
  604.             $this->_last_pevent != PARSER_EVENT_EOFQUOTE))
  605.         {
  606.             $this->_pf_quote_active false;
  607.             $this->_wp->backupPos($word);
  608.             $this->_event_stack->popEvent();
  609.             return;
  610.         }
  611.         if (!$this->_pf_quote_active && 
  612.             (($this->_pv_last_word == '"' && 
  613.             $this->_last_pevent != PARSER_EVENT_QUOTE||
  614.             (is_array($this->_pv_last_word&& 
  615.             $this->_pv_last_word[0== T_END_HEREDOC &&
  616.             $this->_last_pevent != PARSER_EVENT_EOFQUOTE))
  617.         {
  618.             if (is_array($word&& $word[0== T_VARIABLE{
  619.                 $this->_pv_lastvar $word;
  620.             }
  621.             $this->_pf_quote_active      true;
  622.             $this->_save_highlight_state $this->_converter->getHighlightState();
  623.             $this->_converter->startHighlight();
  624.             $this->_addoutput($word);
  625.             $this->checkEventPop($word$pevent);
  626.             return;
  627.         elseif (is_array($this->_pv_last_word&& 
  628.             $this->_pv_last_word[0== T_CONSTANT_ENCAPSED_STRING
  629.         {
  630.             //$this->_pv_quote_data = $this->_pv_last_word[1];
  631.             $this->_event_stack->popEvent();
  632.             $this->_wp->backupPos($word);
  633.             return;
  634.         }
  635.         if ($this->checkEventPop($word$pevent)) {
  636.             $this->_pf_quote_active false;
  637.         }
  638.         $this->_addoutput($word);
  639.     }
  640.     
  641.     /**
  642.      * Handles {$variable} within a "quote"
  643.      *
  644.      * This is a simple handler, for a very complex
  645.      * array of legal syntax.  It is legal to nest control structures
  646.      * inside the {}, and other weird stuff.
  647.      */
  648.     function handleQuoteVar($word$pevent)
  649.     {
  650.         if ($this->checkEventPop($word$pevent)) {
  651.             $this->_pf_quote_active true;
  652.             $this->_addoutput($word);
  653.             return;
  654.         }
  655.         if ($this->_pf_inmethod && is_array($word&& $word[0== T_VARIABLE{
  656.             $this->_pv_lastvar $word;
  657.         }
  658.         if ($this->checkEventPush($word$pevent)) {
  659.             $this->_pf_quote_active false;
  660.             if (is_string($word&& ($word == '{' || $word == '"' || $word == "'")
  661.             {
  662.                 $this->_pf_quote_active true;
  663.                 $this->_pv_lastvar      false;
  664.             }
  665.         }
  666.         $this->_addoutput($word);
  667.     }
  668.     
  669.     /**
  670.      * Handles define() statements
  671.      *
  672.      * The only thing this handler cares about is retrieving the name of the
  673.      * define variable, and the end of the define statement, so after the name
  674.      * is found, it simply makes sure parentheses are matched as in this case:
  675.      *
  676.      * <code>
  677.      * define("test",array("hello",6 => 4, 5 => array('there')));
  678.      * </code>
  679.      *
  680.      * This handler and the DEFINE_PARAMS_PARENTHESIS handler (which is just
  681.      * {@link defaultHandler()} in this version, as nothing fancy is needed)
  682.      * work together to ensure proper parenthesis matching.
  683.      *
  684.      * If the define variable is documented, a link will be created to its
  685.      * documentation using the Converter passed.
  686.      */
  687.     function handleDefine($word$pevent)
  688.     {
  689.         static $token_save;
  690.         if (!isset($token_save)) {
  691.             $token_save array();
  692.         }
  693.         $e $this->checkEventPush($word$pevent);
  694.         if ($e && $e != PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS{
  695.             return;
  696.         }
  697.         
  698.         if (!isset($this->_pv_define_params_data)) {
  699.             $this->_pv_define_params_data '';
  700.         }
  701.         
  702.         if ($this->checkEventPop($word$pevent)) {
  703.             unset($token_save);
  704.             $this->_addoutput($word);
  705.         }
  706.         if ($this->_pf_definename_isset{
  707.             $this->_addoutput($word);
  708.         else {
  709.             if ($word != ","{
  710.                 $token_save[$word;
  711.                 if (is_array($word)) {
  712.                     $word $word[1];
  713.                 }
  714.                 $this->_pv_define_params_data .= $word;
  715.             else {
  716.                 if (substr($this->_pv_define_params_data01==
  717.                     substr($this->_pv_define_params_data,
  718.                         strlen($this->_pv_define_params_data1&&
  719.                     in_array(substr($this->_pv_define_params_data01)
  720.                         array('"'"'"))
  721.                 {
  722.                     // remove leading and ending quotation marks 
  723.                     // if there are only two
  724.                     $a substr($this->_pv_define_params_data01);
  725.                     $b substr($this->_pv_define_params_data1
  726.                         strlen($this->_pv_define_params_data2);
  727.                     if (strpos($b$a=== false{
  728.                         $this->_pv_define_params_data $b;
  729.                     }
  730.                 }
  731.                 $this->_pf_definename_isset true;
  732.  
  733.                 $link $this->_converter->getLink($this->_pv_define_params_data);
  734.                 foreach ($token_save as $token{
  735.                     if (is_object($link)) {
  736.                         if (is_array($token)) {
  737.                             $token $token[1];
  738.                         }
  739.                         $this->_addoutput($this->_converter->returnSee($link,
  740.                             $token));
  741.                     else {
  742.                         $this->_addoutput($save$token);
  743.                     }
  744.                 }
  745.                 $this->_pv_define_params_data '';
  746.             }
  747.         }
  748.     }
  749.     
  750.     /**
  751.      * Handles normal global code.  Special consideration is taken for DocBlocks
  752.      * as they need to retrieve the whole DocBlock before doing any output, so
  753.      * the parser flag {@link $_pf_no_output_yet} is set to tell
  754.      * {@link _addoutput()} not to spit anything out yet.
  755.      *
  756.      * @uses _link() make any global code that is a documentable element link
  757.      *        to the php manual or its documentation
  758.      */
  759.     function handlePhpCode($word$pevent)
  760.     {
  761.         $test $this->checkEventPush($word$pevent);
  762.         if ($test == PARSER_EVENT_DOCBLOCK || $test == PARSER_EVENT_COMMENT{
  763.             if (substr($word[1]02== '/*' && strpos($word[1]'*/')) {
  764.                 $this->_pv_last_word $word;
  765.                 if ($word[1== '/**#@-*/'{
  766.                     $this->_pf_docblock_template true;
  767.                 else {
  768.                     $this->_pf_docblock true;
  769.                 }
  770.                 return $this->handleDocBlock($wordPARSER_EVENT_DOCBLOCK);
  771.             }
  772.             $this->_pf_no_output_yet true;
  773.             $this->_pv_saveline      $this->_wp->linenum 1;
  774.             return;
  775.         }
  776.         if (is_array($word&& $word[0== T_DOUBLE_COLON{
  777.             $this->_pf_colon_colon true;
  778.         }
  779.         if (!$this->_pf_colon_colon && is_array($word&& $word[0== T_STRING{
  780.             $this->_pv_last_string $word;
  781.         }
  782.         $this->_link($word);
  783.         $this->checkEventPop($word$pevent);
  784.     }
  785.     
  786.     /**
  787.      * Handle the function declaration header
  788.      *
  789.      * This handler only sees the "function name" portion of the function
  790.      * declaration.  Handling of the function parameters is by
  791.      * {@link handleFunctionParams()}, and the function body is handled by
  792.      * {@link handleLogicBlock()}
  793.      */
  794.     function handleFunction($word$pevent)
  795.     {
  796.         if ($this->checkEventPush($word$pevent)) {
  797.             $this->_addoutput($word);
  798.             return;
  799.         }
  800.         if ($this->checkEventPop($word$pevent)) {
  801.             return;
  802.         }
  803.         $this->_link($word);
  804.     }
  805.     
  806.     /**
  807.      * Handle the method declaration header
  808.      *
  809.      * This handler only sees the "function name" portion of the method
  810.      * declaration.  Handling of the method parameters is by
  811.      * {@link handleFunctionParams()}, and the method body is handled by
  812.      * {@link handleMethodLogicBlock()}
  813.      */
  814.     function handleMethod($word$pevent)
  815.     {
  816.         if ($this->checkEventPush($word$pevent)) {
  817.             $this->_addoutput($word);
  818.             return;
  819.         }
  820.         if ($this->checkEventPop($word$pevent)) {
  821.             if ($word == ';'{
  822.                 $this->_addoutput($word);
  823.             }
  824.             return;
  825.         }
  826.         $this->_methodlink($word);
  827.     }
  828.     
  829.     /**
  830.      * Handler for the stuff between ( and ) in a function declaration
  831.      *
  832.      * <code>
  833.      * function handles($only,$these,$parameters){...}
  834.      * </code>
  835.      */
  836.     function handleFunctionParams($word$pevent)
  837.     {
  838.         if ($this->checkEventPush($word$pevent)) {
  839.             $this->_addoutput($word);
  840.             return;
  841.         }
  842.         $this->_addoutput($word);
  843.         $this->checkEventPop($word$pevent);
  844.     }
  845.     
  846.     /**
  847.      * Handler for function body.
  848.      *
  849.      * The function body is checked for php functions, documented constants,
  850.      * functions, and indirectly for global statements.  It hyperlinks to the
  851.      * documentation for detected elements is created.  Everything else is
  852.      * highlighted normally.
  853.      */
  854.     function handleLogicBlock($word$pevent)
  855.     {
  856.         if ($this->checkEventPush($word$pevent)) {
  857.             $this->_addoutput($word);
  858.             return;
  859.         }
  860.         if (is_array($word&& $word[0== T_DOUBLE_COLON{
  861.             $this->_pf_colon_colon true;
  862.         }
  863.         if (!$this->_pf_colon_colon && is_array($word&& $word[0== T_STRING{
  864.             $this->_pv_last_string $word;
  865.         }
  866.         $this->_link($word);
  867.         if ($this->checkEventPop($word$pevent)) {
  868.             $e $this->_event_stack->popEvent();
  869.             $this->_event_stack->pushEvent($e);
  870.             if ($e == PARSER_EVENT_FUNCTION{
  871.                 $this->_wp->backupPos($word)
  872.             }
  873.         }
  874.     }
  875.     
  876.     /**
  877.      * Handler for method body.
  878.      *
  879.      * Like functions, the method body is checked for php functions, documented
  880.      * constants, functions, and indirectly for global statements.  It also
  881.      * checks for "$this->XXXX" where XXXX is a class variable or method, and
  882.      * links to the documentation for detected elements is created.  Everything
  883.      * else is highlighted normally.
  884.      */
  885.     function handleMethodLogicBlock($word$pevent)
  886.     {
  887.         if (isset($this->_pv_prev_var_type)) {
  888.             //debug('prevtype is set');
  889.             if (!is_array($word)) {
  890.                 unset($this->_pv_prev_var_type);
  891.             else {
  892.                 if ($word[0!= T_WHITESPACE && 
  893.                     $word[0!= T_STRING && $word[0!= T_OBJECT_OPERATOR
  894.                 {
  895.                     //fancy_debug('unset', $word);
  896.                     unset($this->_pv_prev_var_type);
  897.                 }
  898.             }
  899.         }
  900.         $this->_pf_inmethod true;
  901.         if ($e $this->checkEventPush($word$pevent)) {
  902.             $this->_addoutput($word);
  903.             if ($e == PARSER_EVENT_CLASS_MEMBER{
  904.                 $this->_pf_no_output_yet true;
  905.             }
  906.             return;
  907.         }
  908.         if (is_array($word&& $word[0== T_DOUBLE_COLON{
  909.             $this->_pf_colon_colon true;
  910.         }
  911.         if (!$this->_pf_colon_colon && is_array($word&& $word[0== T_STRING{
  912.             $this->_pv_last_string $word;
  913.         }
  914.         if (is_array($word&& $word[0== T_VARIABLE{
  915.             $this->_pv_lastvar $word;
  916.         }
  917.         $this->_link($word);
  918.         if ($this->checkEventPop($word$pevent)) {
  919.             $this->_pf_inmethod false;
  920.             $e                  $this->_event_stack->popEvent();
  921.             $this->_event_stack->pushEvent($e);
  922.             if ($e == PARSER_EVENT_METHOD{
  923.                 $this->_wp->backupPos($word)
  924.             }
  925.         }
  926.     }
  927.     
  928.     /**
  929.      * Handles $obj->classmember in a method body
  930.      *
  931.      * This handler is responsible for linking to the documentation of a
  932.      * class member when it is used directly in a method body.
  933.      * 
  934.      * There are two methods of determining whether to link:
  935.      * - $this->member
  936.      * - $this->member->submember
  937.      *
  938.      * The first case is handled by the $_pv_lastvar variable, and the
  939.      * second case is handled by the $_pv_prev_var_type variable.  $_pv_lastvar
  940.      * is always set to the value of the last T_VARIABLE token, if and only if
  941.      * no text has occurred between the variable and a T_OBJECT_OPERATOR token
  942.      * "->".  handleClassMember will only link if the last variable encountered
  943.      * was $this.
  944.      *
  945.      * When $this->variable is encountered, the variable is looked up to see
  946.      * if it can be found, and if so, the contents of its @var tag are processed
  947.      * to see if the member variable is defined to have 1 and only 1 class.
  948.      * If so, the $_pv_prev_var_type variable is set to this classname.  When
  949.      * submember is processed, the HighlightParser checks to see if
  950.      * $_pv_prev_var_type::submember() or $_pv_prev_var_type::$submember exists,
  951.      * and if it does, it is linked to.
  952.      */
  953.     function handleClassMember($word$pevent)
  954.     {
  955.         if (!isset($this->_pv_lastvar&& !isset($this->_pv_prev_var_type)) {
  956.             //fancy_debug('returned from', $word, $this->_pv_prev_var_type);
  957.             $this->_pf_no_output_yet false;
  958.             $this->_event_stack->popEvent();
  959.             return $this->defaultHandler($word$pevent);
  960.         }
  961.         if (isset($this->_pv_cm_name)) {
  962.             $this->_pf_obj_op false;
  963.             $name             $this->_pv_cm_name;
  964.             unset($this->_pv_cm_name);
  965.             //debug('unset pvcmname');
  966.             $this->_event_stack->popEvent();
  967.             // control variable for _pv_prev_var_type
  968.             $setnow false;
  969.             if ((isset($this->_pv_lastvar&& $this->_pv_lastvar[1== '$this'||
  970.                 isset($this->_pv_prev_var_type)
  971.             {
  972.                 if (is_array($word&& $word[0== T_WHITESPACE{
  973.                     // preserve value of _pv_prev_var_type
  974.                     $setnow true;
  975.                     $save   $this->_wp->nextToken();
  976.                     $temp   $this->_wp->getWord();
  977.                     $this->_wp->backupPos($savetrue);
  978.                 }
  979.                 if ((is_string($word&& $word == '('|| (isset($temp&& 
  980.                     is_string($temp&& $temp == '(')
  981.                 {
  982.                     // it's a function
  983.                     $this->_pf_no_output_yet false;
  984.                     $this->_methodlink($name);
  985.                     unset($this->_pv_prev_var_type);
  986.                 else {
  987.                     // it's a variable
  988.                     //fancy_debug('name is ', $name);
  989.                     $this->_pf_no_output_yet false;
  990.                     $this->_varlink($nametrue);
  991.                     $templink 
  992.                         $this->_converter->getLink('object ' $this->_pv_class);
  993.                     $class    false;
  994.                     if (is_object($templink)) {
  995.                         $class $this->_converter->classes
  996.                             ->getClass($templink->name$templink->path);
  997.                     }
  998.                     if ($class{
  999.                         $varname $name;
  1000.                         if (is_array($varname)) {
  1001.                             $varname $name[1];
  1002.                         }
  1003.                         if ($varname{0!= '$'{
  1004.                             $varname '$'.$varname;
  1005.                         }
  1006.                         $var $class->getVar($this->_converter$varname);
  1007.                         
  1008.                         if (is_object($var&& $var->docblock->var{
  1009.                             $type $var->docblock->var->returnType;
  1010.                         }
  1011.                         if (isset($type)) {
  1012.                             if (strpos($type'object'=== false{
  1013.                                 $type 'object '.$type;
  1014.                             }
  1015.                             $type $this->_converter->getLink($type);
  1016.                             if (phpDocumentor_get_class($type== 'classlink'{
  1017.                                 // the variable's type is a class, 
  1018.                                 // save it for future ->
  1019.                                 //fancy_debug('set prev_var_type!', $type->name);
  1020.                                 $setnow                  true;
  1021.                                 $this->_pv_prev_var_type $type->name;
  1022.                             else {
  1023.                                 unset($this->_pv_prev_var_type);
  1024.                             }
  1025.                         else {
  1026.                             unset($this->_pv_prev_var_type);
  1027.                         }
  1028.                     else {
  1029.                         unset($this->_pv_prev_var_type);
  1030.                     }
  1031.                 }
  1032.             else {
  1033.                 $this->_pf_no_output_yet false;
  1034.                 // this does NewLinenum if necessary
  1035.                 $this->_wp->backupPos($word);
  1036.                 $this->_wp->getWord();
  1037.                 $this->_addoutput($name);
  1038.             }
  1039.             if (!$setnow{
  1040.                 //debug('unset prevtype, no setnow');
  1041.                 unset($this->_pv_prev_var_type);
  1042.             }
  1043.             unset($this->_pv_lastvar);
  1044.             $this->_pf_no_output_yet false;
  1045.             // this does NewLinenum if necessary
  1046.             $this->_wp->backupPos($word);
  1047.             $this->_wp->getWord();
  1048.             if ($word[0== T_OBJECT_OPERATOR{
  1049.                 $this->_wp->backupPos($word);
  1050.             else {
  1051.                 $this->_addoutput($word);
  1052.             }
  1053.             return;
  1054.         }
  1055.         if (!$this->_pf_obj_op && is_array($this->_pv_last_word&& 
  1056.             $this->_pv_last_word[0== T_OBJECT_OPERATOR
  1057.         {
  1058.             if ((isset($this->_pv_lastvar&& $this->_pv_lastvar[1== '$this'||
  1059.                 isset($this->_pv_prev_var_type)
  1060.             {
  1061.                 $this->_pf_obj_op true;
  1062.             else {
  1063.                 $this->_pf_no_output_yet false;
  1064.                 // this does NewLinenum if necessary
  1065.                 $this->_wp->backupPos($word);
  1066.                 $this->_wp->getWord();
  1067.                 $this->_addoutput($word);
  1068.                 $this->_event_stack->popEvent();
  1069.             }
  1070.         }
  1071.         if (is_array($word&& $word == T_WHITESPACE{
  1072.             $this->_pf_no_output_yet false;
  1073.             // this does NewLinenum if necessary
  1074.             $this->_wp->backupPos($word);
  1075.             $this->_wp->getWord();
  1076.             $this->_addoutput($word);
  1077.             return;
  1078.         }
  1079.         if ($this->_pf_obj_op{
  1080.             if (!(is_array($word&& ($word[0== T_STRING || 
  1081.                 $word[0== T_WHITESPACE))
  1082.             {
  1083.                 unset($this->_pv_lastvar);
  1084.                 //debug('unset lastvar');
  1085.                 $this->_event_stack->popEvent();
  1086.                 $this->_pf_no_output_yet false;
  1087.                 // this does NewLinenum if necessary
  1088.                 $this->_wp->backupPos($word);
  1089.                 $this->_wp->getWord();
  1090.                 $this->_addoutput($word);
  1091.                 return;
  1092.             }
  1093.             if ($word[0== T_STRING{
  1094.                 //fancy_debug('set pvcmname to', $word);
  1095.                 $this->_pv_cm_name $word;
  1096.             else {
  1097.                 $this->_pf_no_output_yet false;
  1098.                 // this does NewLinenum if necessary
  1099.                 $this->_wp->backupPos($word);
  1100.                 $this->_wp->getWord();
  1101.                 $this->_addoutput($word);
  1102.             }
  1103.         }
  1104.     }
  1105.     
  1106.     /**
  1107.      * Handles comments
  1108.      *
  1109.      * Comments are almost always single-line tokens, and so will be
  1110.      * in the last word.  This handler checks to see if the current token
  1111.      * is in fact a comment, and if it isn't, it backs up and returns control
  1112.      * to the parent event handler with that word.
  1113.      */
  1114.     function handleComment($word$pevent)
  1115.     {
  1116.         $w $this->_pv_last_word;
  1117.         // don't perform this check if this is a normal comment.  Docblocks
  1118.         // have the _pf_no_output_yet variable set to true
  1119.         if ($this->_pf_no_output_yet && is_array($w&& 
  1120.             (in_array($w[0]array(T_COMMENTT_DOC_COMMENT)) && 
  1121.             strpos($w[1]'/**'=== 0)
  1122.         {
  1123.             $this->_event_stack->popEvent();
  1124.             $this->_event_stack->pushEvent(PARSER_EVENT_DOCBLOCK);
  1125.             return $this->handleDocBlock($wordPARSER_EVENT_DOCBLOCK);
  1126.         }
  1127.         if ($this->_pf_no_output_yet{
  1128.             $flag                    1;
  1129.             $this->_pf_no_output_yet false;
  1130.             $this->_addoutput($this->_pv_last_word);
  1131.         }
  1132.         if (!is_array($word|| 
  1133.             !in_array($word[0]array(T_COMMENTT_DOC_COMMENT)) ||
  1134.             (in_array($word[0]array(T_COMMENTT_DOC_COMMENT)) && 
  1135.             strpos($word[1]'/**'=== 0)
  1136.         {
  1137.             $this->_event_stack->popEvent();
  1138.             if (strpos($this->_pv_last_word[1]"\n"!== false{
  1139.                 //$this->_wp->linenum++;
  1140.                 //$this->newLineNum();
  1141.             }
  1142.             $this->_wp->backupPos($this->_pv_last_word);
  1143.             $this->_wp->getWord();
  1144.             //var_dump($this->_wp->nextToken());
  1145.             return;
  1146.         elseif (isset($flag)) {
  1147.             $this->newLineNum();
  1148.         }
  1149.         $this->_addoutput($word);
  1150.         $this->checkEventPop($word$pevent);
  1151.         if (strpos($word[1]'*/'=== strlen($word[1]2{
  1152.             $this->_event_stack->popEvent();
  1153.         }
  1154.     }
  1155.     
  1156.     /**
  1157.      * Handle class declarations
  1158.      *
  1159.      * Handles the initial declaration line:
  1160.      *
  1161.      * <code>class X</code>
  1162.      * 
  1163.      * or
  1164.      * 
  1165.      * <code>class X extends Y implements I</code>
  1166.      *
  1167.      * @uses _classlink() to link to documentation for X and for Y class in
  1168.      *                     "class X extends Y"
  1169.      */
  1170.     function handleClass($word$pevent)
  1171.     {
  1172.         $this->_pf_in_class true;
  1173.         $a                  $this->checkEventPush($word$pevent);
  1174.  
  1175.         if (!isset($this->_pv_class&& is_array($word&& $word[0== T_STRING{
  1176.             $this->_pv_class $this->_converter->class $word[1];
  1177.             $this->_classlink($word);
  1178.             return;
  1179.         }
  1180.         
  1181.         if (is_array($word&& 
  1182.             in_array($word[0]array(T_PRIVATET_PROTECTEDT_PUBLIC))
  1183.         {
  1184.             $starttok $this->_wp->nextToken();
  1185.             $test     array(T_WHITESPACE);
  1186.             while ($test && $test[0== T_WHITESPACE{
  1187.                 $tok  $this->_wp->nextToken();
  1188.                 $test $this->_wp->getWord();
  1189.             // while
  1190.             
  1191.             if (is_array($test&& $test[0== T_VARIABLE{
  1192.                 $this->_wp->backupPos($toktrue);
  1193.                 return;
  1194.             }
  1195.             $this->_wp->backupPos($starttoktrue);
  1196.         }
  1197.         
  1198.         if (@in_array($this->_pv_last_word[0]
  1199.             array(T_PRIVATET_PROTECTEDT_PUBLIC))
  1200.         {
  1201.             if (is_array($word&& $word[0== T_VARIABLE{
  1202.                 $this->_wp->backupPos($this->_pv_last_word);
  1203.                 $this->_event_stack->pushEvent(PARSER_EVENT_VAR);
  1204.                 return;
  1205.             }
  1206.         }
  1207.  
  1208.         if ($this->_pf_extends_found && is_array($word&& $word[0== T_STRING{
  1209.             $this->_classlink($word);
  1210.             return;
  1211.         }
  1212.         if (is_array($word&& $word[0== T_EXTENDS{
  1213.             $this->_pf_extends_found true;
  1214.         }
  1215.         if ($a == PARSER_EVENT_DOCBLOCK{
  1216.             $this->_pf_no_output_yet true;
  1217.             $this->_pv_saveline      $this->_wp->linenum 1;
  1218.             return;
  1219.         }
  1220.         $this->_addoutput($word);
  1221.         if ($this->checkEventPop($word$pevent)) {
  1222.             $this->_pf_in_class false;
  1223.             unset($this->_pv_class);
  1224.         }
  1225.     }
  1226.     
  1227.     /**
  1228.      * Handles class variable declaration
  1229.      *
  1230.      * <code>
  1231.      * class X
  1232.      * {
  1233.      *     var $Y;
  1234.      * }
  1235.      * </code>
  1236.      *
  1237.      * @uses _varlink() make a link to $Y documentation in class variable
  1238.      *                   declaration "var $Y;"
  1239.      */
  1240.     function handleVar($word$pevent)
  1241.     {
  1242.         if ($this->checkEventPush($word$pevent)) {
  1243.             $this->_addoutput($word);
  1244.             return;
  1245.         }
  1246.         if (is_array($word&& $word[0== T_VARIABLE{
  1247.             return $this->_varlink($word);
  1248.         }
  1249.         $this->_addoutput($word);
  1250.         $this->checkEventPop($word$pevent);
  1251.     }
  1252.     
  1253.     /**
  1254.      * This handler is responsible for highlighting DocBlocks
  1255.      *
  1256.      * handleDocBlock determines whether the docblock is normal or a template,
  1257.      * and gathers all the lines of the docblock together before doing any
  1258.      * processing
  1259.      *
  1260.      * As it is not possible to distinguish any comment token from a docblock
  1261.      * token, this handler is also called for comments, and will pass control
  1262.      * to {@link handleComment()} if the comment is not a DocBlock
  1263.      *
  1264.      * @uses commonDocBlock() once all lines of the DocBlock have been retrieved
  1265.      */
  1266.     function handleDocBlock($word$pevent)
  1267.     {
  1268.         if (!($this->_pf_docblock || $this->_pf_docblock_template)) {
  1269.             if (strpos($this->_pv_last_word[1]'/**'!== 0{
  1270.                 // not a docblock
  1271.                 $this->_wp->backupPos($this->_pv_last_word);
  1272.                 $this->_event_stack->popEvent();
  1273.                 $this->_event_stack->pushEvent(PARSER_EVENT_COMMENT);
  1274.                 $this->_pf_no_output_yet false;
  1275.                 return;
  1276.             else {
  1277.                 $this->_pf_no_output_yet true;
  1278.                 $this->_pv_db_lines      array();
  1279.             }
  1280.         }
  1281.         $last_word $this->_pv_last_word[1];
  1282.         $dtype     '_pv_docblock';
  1283.         if ($last_word == '/**#@-*/'{
  1284.             // stop using docblock template
  1285.             $this->_pf_no_output_yet false;
  1286.             $this->_addDocBlockoutput('closetemplate'$last_word);
  1287.             if ($this->_pv_next_word !== false{
  1288.                 $this->_wp->backupPos($this->_pv_next_wordtrue);
  1289.             }
  1290.             $this->_event_stack->popEvent();
  1291.             return;
  1292.         }
  1293.         if (!($this->_pf_docblock || $this->_pf_docblock_template)) {
  1294.             $this->_pv_db_lines array();
  1295.             if (strpos($last_word'/**#@+'=== 0{
  1296.                 // docblock template definition
  1297.                 $this->_pf_docblock_template true;
  1298.             else {
  1299.                 $this->_pf_docblock true;
  1300.             }
  1301.             $this->_pv_db_lines[$last_word;
  1302.             if (strpos($last_word'*/'!== false{
  1303.                 $this->commonDocBlock();
  1304.                 return;
  1305.             }
  1306.             $this->_pv_db_lines[$word[1];
  1307.             if (strpos($word[1]'*/'!== false{
  1308.                 $this->commonDocBlock();
  1309.             }
  1310.         else {
  1311.             $this->_pv_db_lines[$word[1];
  1312.         }
  1313.         if (($this->_pf_docblock || $this->_pf_docblock_template&& 
  1314.             (strpos($word[1]'*/'!== false)
  1315.         {
  1316.             $this->commonDocBlock();
  1317.         }
  1318.     }
  1319.     /**#@-*/
  1320.  
  1321.     /**
  1322.      * This continuation of handleDocBlock splits DocBlock comments up into
  1323.      * phpDocumentor tokens.  It highlights DocBlock templates in a different
  1324.      * manner from regular DocBlocks, recognizes inline tags, regular tags,
  1325.      * and distinguishes between standard core tags and other tags, and
  1326.      * recognizes parameters to tags like @var.
  1327.      *
  1328.      * the type in "@var type description" will be highlighted as a php type,
  1329.      * and the var in "@param type $var description" will be highlighted as a
  1330.      * php variable.
  1331.      *
  1332.      * @return void 
  1333.      * @uses handleDesc() highlight inline tags in the description
  1334.      * @uses handleTags() highlight all tags
  1335.      * @access private
  1336.      */
  1337.     function commonDocBlock()
  1338.     {
  1339.         $this->_event_stack->popEvent();
  1340.         $lines $this->_pv_db_lines;
  1341.         $go    count($this->_pv_db_lines);
  1342.         for ($i=0$i $go$i++{
  1343.             if (substr(trim($lines[$i])02== '*/' || 
  1344.                 substr(trim($lines[$i])01!= '*' && 
  1345.                 substr(trim($lines[$i])03!= '/**'
  1346.             {
  1347.                 $lines[$iarray($lines[$i]false);
  1348.             elseif (substr(trim($lines[$i])03== '/**'{
  1349.                 $linesi array();
  1350.                 // remove leading "/**"
  1351.                 $linesi[1substr(trim($lines[$i])3);
  1352.                 if (empty($linesi[1])) {
  1353.                     $linesi[0$lines[$i];
  1354.                 else {
  1355.                     $linesi[0
  1356.                         substr($lines[$i]0strpos($lines[$i]$linesi[1]));
  1357.                 }
  1358.                 $lines[$i$linesi;
  1359.             else {
  1360.                 $linesi array();
  1361.                 // remove leading "* "
  1362.                 $linesi[1substr(trim($lines[$i])1);
  1363.                 if (empty($linesi[1])) {
  1364.                     $linesi[0$lines[$i];
  1365.                 else {
  1366.                     $linesi[0
  1367.                         substr($lines[$i]0strpos($lines[$i]$linesi[1]));
  1368.                 }
  1369.                 $lines[$i$linesi;
  1370.             }
  1371.         }
  1372.         for ($i 0$i count($lines)$i++{
  1373.             if ($lines[$i][1=== false{
  1374.                 continue;
  1375.             }
  1376.             if (substr(trim($lines[$i][1])01== '@' && 
  1377.                 substr(trim($lines[$i][1])02!= '@ '
  1378.             {
  1379.                 $tagindex $i;
  1380.                 $i        count($lines);
  1381.             }
  1382.         }
  1383.         if (isset($tagindex)) {
  1384.             $tags array_slice($lines$tagindex);
  1385.             $desc array_slice($lines0$tagindex);
  1386.         else {
  1387.             $tags array();
  1388.             $desc $lines;
  1389.         }
  1390.         //var_dump($desc, $tags);
  1391.         $this->_pf_no_output_yet false;
  1392.         $save                    $this->_wp->linenum;
  1393.         $this->_wp->linenum      $this->_pv_saveline;
  1394.         $this->handleDesc($desc);
  1395.         $this->handleTags($tags);
  1396.         $this->_pv_db_lines array();
  1397.         $this->_wp->linenum $save;
  1398.         if (strpos($this->_pv_last_word[1]'*/'!== false{
  1399.             $this->_wp->backupPos($this->_pv_next_wordtrue);
  1400.         }
  1401.         $this->_pf_docblock $this->_pf_docblock_template false;
  1402.     }
  1403.     
  1404.     /**
  1405.      * Handle the description area of a DocBlock
  1406.      *
  1407.      * This method simply finds inline tags and highlights them
  1408.      * separately from the rest of the description.
  1409.      *
  1410.      * @param mixed $desc the description piece(s)
  1411.      *
  1412.      * @return void 
  1413.      * @uses getInlineTags()
  1414.      * @access private
  1415.      */
  1416.     function handleDesc($desc)
  1417.     {
  1418.         $dbtype  'docblock';
  1419.         $dbtype .= ($this->_pf_docblock '' 'template');
  1420.         foreach ($desc as $line{
  1421.             $this->getInlineTags($line[0$line[1]);
  1422.             if (strpos($line[0]'*/'=== false &&
  1423.                 !(substr($line[0]02== '/*' && 
  1424.                 strpos($line[1]'*/'!== false)
  1425.             {
  1426.                 $this->newLineNum();
  1427.                 $this->_wp->linenum++;
  1428.             }
  1429.         }
  1430.         if ($this->_pf_internal{
  1431.             $this->_pf_internal false;
  1432.         }
  1433.     }
  1434.     
  1435.     /**
  1436.      * Handle phpDocumentor tags in a DocBlock
  1437.      *
  1438.      * This method uses the {@link $tagHandlers} array to determine which
  1439.      * method will handle tags found in the docblock, and passes the data to
  1440.      * the individual handlers one by one
  1441.      *
  1442.      * @param array $tags array of tags to handle
  1443.      *
  1444.      * @return void 
  1445.      * @access private
  1446.      */
  1447.     function handleTags($tags)
  1448.     {
  1449.         $newtags array();
  1450.         $curtag  array();
  1451.         for ($i=0$i count($tags)$i++{
  1452.             $tagsi trim($tags[$i][1]);
  1453.             if (substr($tagsi01== '@' && substr($tagsi02!= '@ '{
  1454.                 // start a new tag
  1455.                 $tags[$i][1array(substr($tags[$i][1]0
  1456.                     strpos($tags[$i][1]$tagsi))$tagsi);
  1457.                 if (!empty($curtag)) {
  1458.                     $newtags[$curtag;
  1459.                     $curtag    array();
  1460.                 }
  1461.                 $curtag[$tags[$i];
  1462.             else {
  1463.                 $curtag[$tags[$i];
  1464.             }
  1465.         }
  1466.         if (!empty($curtag)) {
  1467.             $newtags[$curtag;
  1468.         }
  1469.         foreach ($newtags as $tag{
  1470.             foreach ($tag as $i => $t{
  1471.                 if ($t[1=== false{
  1472.                     continue;
  1473.                 }
  1474.                 if (is_array($t[1])) {
  1475.                     $tag[$i][1][1]
  1476.                         = explode(" "str_replace("\t"'    '$t[1][1]));
  1477.                     $x $tag[$i][1][1];
  1478.                 }
  1479.             }
  1480.             $tagname   substr(array_shift($x)1);
  1481.             $restoftag $tag;
  1482.             if (isset($this->tagHandlers[$tagname])) {
  1483.                 $handle $this->tagHandlers[$tagname];
  1484.             else {
  1485.                 $handle $this->tagHandlers['*'];
  1486.             }
  1487.             $this->$handle($tagname$restoftag);
  1488.         }
  1489.     }
  1490.     
  1491.     /**
  1492.      * This handler recognizes all {@}inline} tags
  1493.      *
  1494.      * Normal inline tags are simply highlighted.  the {@}internal}} inline
  1495.      * tag {@tutorial tags.inlineinternal.pkg} is highlighted differently
  1496.      * to distinguish it from other inline tags.
  1497.      *
  1498.      * @param mixed $value       the tag value
  1499.      * @param bool  $endinternal indicates the end of an @internal tag
  1500.      *
  1501.      * @return void 
  1502.      * @access private
  1503.      */
  1504.     function getInlineTags($value$endinternal false)
  1505.     {
  1506.         if (!$value{
  1507.             return;
  1508.         }
  1509.         if ($this->_pf_internal && !$endinternal{
  1510.             if (strpos($value'}}'!== false{
  1511.                 $x strrpos($value'}}');
  1512.                 // add the rest of internal
  1513.                 $this->getInlineTags(substr($value0$x 3)true);
  1514.                 // strip internal from value
  1515.                 $value substr($valuestrrpos($value'}}'1);
  1516.                 // turn off internal
  1517.                 $this->_pf_internal false;
  1518.             }
  1519.         }
  1520.         if (!$value{
  1521.             return;
  1522.         }
  1523.         $dbtype  'docblock';
  1524.         $dbtype .= ($this->_pf_docblock '' 'template');
  1525.         $save    $value;
  1526.         $value   explode('{@'$value);
  1527.         $newval  array();
  1528.         // everything before the first {@ is normal text
  1529.         $this->_addDocBlockoutput($dbtype$value[0]);
  1530.         for ($i=1$i count($value)$i++{
  1531.             if (substr($value[$i]01== '}'{
  1532.                 $this->_addDocBlockoutput($dbtype'{@}' substr($value[$i]1));
  1533.             else {
  1534.                 $save      $value[$i];
  1535.                 $value[$istr_replace("\t""    "$value[$i]);
  1536.                 $value[$iexplode(" "$value[$i]);
  1537.                 $word      array_shift($value[$i]);
  1538.                 $val       join(' '$value[$i]);
  1539.                 if ($word == 'internal'{
  1540.                     $this->_pf_internal true;
  1541.                     $this->_addDocBlockoutput($dbtype'{@internal ');
  1542.                     $value[$isubstr($savestrlen('internal'1);
  1543.                     // strip internal and cycle as if it were normal text.
  1544.                     $this->_addDocBlockoutput($dbtype$value[$i]);
  1545.                     continue;
  1546.                 }
  1547.                 if (in_array(str_replace('}'''$word)$this->allowableInlineTags)
  1548.                 {
  1549.                     if (strpos($word'}')) {
  1550.                         $word str_replace('}'''$word);
  1551.                         $val  '} ' $val;
  1552.                     }
  1553.                     $val explode('}'$val);
  1554.                     if (count($val== 1{
  1555.                          //addError(PDERROR_UNTERMINATED_INLINE_TAG,
  1556.                          //    $word, '', $save);
  1557.                     }
  1558.                     $rest $val;
  1559.                     $val  array_shift($rest);
  1560.                     if ($endinternal{
  1561.                         $rest join('}'$rest);
  1562.                     else {
  1563.                         $rest join(' '$rest);
  1564.                     }
  1565.                     if (isset($this->inlineTagHandlers[$word])) {
  1566.                         $handle $this->inlineTagHandlers[$word];
  1567.                     else {
  1568.                         $handle $this->inlineTagHandlers['*'];
  1569.                     }
  1570.                     $this->$handle($word$val);
  1571.                     $this->_addDocBlockoutput($dbtype$rest);
  1572.                 else {
  1573.                     $val $word ' ' $val;
  1574.                     $this->_addDocBlockoutput($dbtype'{@' $val);
  1575.                 }
  1576.             }
  1577.         }
  1578.     }
  1579.  
  1580.     
  1581.     /**
  1582.      * Handles all inline tags
  1583.      *
  1584.      * @param string $name  the tag name
  1585.      * @param mixed  $value the tag value
  1586.      *
  1587.      * @return void 
  1588.      * @access private
  1589.      */
  1590.     function handleDefaultInlineTag($name$value)
  1591.     {
  1592.         $this->_addDocBlockoutput('inlinetag''{@' $name ' ' $value '}');
  1593.     }
  1594.  
  1595.     /**#@+
  1596.      * phpDocumentor DocBlock tag handlers
  1597.      *
  1598.      * @param string $name    tag name
  1599.      * @param array  $value   array of lines contained in the tag description
  1600.      *
  1601.      * @return void
  1602.      * @access private
  1603.      */
  1604.     /**
  1605.      * Handle normal tags
  1606.      *
  1607.      * This handler adds to outpu all comment information before the tag begins
  1608.      * as in " * " before "@todo" in " * @todo"
  1609.      *
  1610.      * Then, it highlights the tag as a regular or coretag based on $coretag.
  1611.      * Finally, it uses getInlineTags to highlight the description
  1612.      *
  1613.      * @param bool $coretag whether this tag is a core tag or not
  1614.      *
  1615.      * @uses getInlineTags() highlight a tag description
  1616.      */
  1617.     function defaultTagHandler($name$value$coretag false)
  1618.     {
  1619.         $dbtype  'docblock';
  1620.         $dbtype .= ($this->_pf_docblock '' 'template');
  1621.         foreach ($value as $line{
  1622.             $this->_addDocBlockoutput($dbtype$line[0]);
  1623.             if ($line[1=== false{
  1624.                 if (trim($line[0]!= '*/'{
  1625.                     $this->newLineNum();
  1626.                     $this->_wp->linenum++;
  1627.                 }
  1628.                 continue;
  1629.             }
  1630.             $this->_addDocBlockoutput($dbtype$line[1][0]);
  1631.             $stored '';
  1632.             if (is_array($line[1][1])) {
  1633.                 foreach ($line[1][1as $i => $tpart{
  1634.                     if ($tpart == '@' $name && $i == 0{
  1635.                         $tagname 'tag';
  1636.                         if ($coretag{
  1637.                             $tagname 'coretag';
  1638.                         }
  1639.                         $this->_addDocBlockoutput($tagname'@' $name);
  1640.                         continue;
  1641.                     }
  1642.                     $stored .= ' ' $tpart;
  1643.                 }
  1644.             else {
  1645.                 $stored $line[1];
  1646.             }
  1647.             $this->getInlineTags($stored);
  1648.             if (strpos($stored'*/'=== false{
  1649.                 $this->newLineNum();
  1650.                 $this->_wp->linenum++;
  1651.             }
  1652.         }
  1653.     }
  1654.     
  1655.     /**
  1656.      * main handler for "core" tags
  1657.      *
  1658.      * @see defaultTagHandler()
  1659.      */
  1660.     function coreTagHandler($name$value)
  1661.     {
  1662.         return $this->defaultTagHandler($name$valuetrue);
  1663.     }
  1664.     
  1665.     /**
  1666.      * Handles @global
  1667.      *
  1668.      * This handler works like {@link defaultTagHandler()} except it highlights
  1669.      * the type and variable (if present) in "@global type $variable" or
  1670.      * "@global type description"
  1671.      */
  1672.     function globalTagHandler($name$value)
  1673.     {
  1674.         $this->paramTagHandler($name$value);
  1675.     }
  1676.     
  1677.     /**
  1678.      * Handles @param
  1679.      *
  1680.      * This handler works like {@link defaultTagHandler()} except it highlights
  1681.      * the type and variable (if present) in "@param type $variable description"
  1682.      * or "@param type description"
  1683.      *
  1684.      * @param bool $checkforvar private parameter, checks for $var or not
  1685.      */
  1686.     function paramTagHandler($name$value$checkforvar true)
  1687.     {
  1688.         $dbtype  'docblock';
  1689.         $dbtype .= ($this->_pf_docblock '' 'template');
  1690.         $ret     $this->retrieveType($value0$checkforvar);
  1691.         foreach ($value as $num => $line{
  1692.             $this->_addDocBlockoutput($dbtype$line[0]);
  1693.             if ($line[1=== false{
  1694.                 if (trim($line[0]!= '*/'{
  1695.                     $this->newLineNum();
  1696.                     $this->_wp->linenum++;
  1697.                 }
  1698.                 continue;
  1699.             }
  1700.             $this->_addDocBlockoutput($dbtype$line[1][0]);
  1701.             $stored  '';
  1702.             $typeloc 1;
  1703.             $varloc  2;
  1704.             if (is_array($line[1][1])) {
  1705.                 $this->_addDocBlockoutput('coretag''@' $name ' ');
  1706.                 foreach ($ret[0as $text{
  1707.                     if (is_string($text)) {
  1708.                         $this->_addDocBlockoutput($dbtype$text);
  1709.                     }
  1710.                     if (is_array($text)) {
  1711.                         if ($text[0!= 'desc'{
  1712.                             $this->_addDocBlockoutput($text[0]$text[1]);
  1713.                         else {
  1714.                             $stored .= $text[1];
  1715.                         }
  1716.                     }
  1717.                 }
  1718.             else {
  1719.                 if (isset($ret[$num])) {
  1720.                     foreach ($ret[$numas $text{
  1721.                         if (is_string($text)) {
  1722.                             $this->_addDocBlockoutput($dbtype$text);
  1723.                         }
  1724.                         if (is_array($text)) {
  1725.                             if ($text[0!= 'desc'{
  1726.                                 $this->_addDocBlockoutput($text[0]$text[1]);
  1727.                             else {
  1728.                                 $stored .= $text[1];
  1729.                             }
  1730.                         }
  1731.                     }
  1732.                 else {
  1733.                     $stored $line[1];
  1734.                 }
  1735.             }
  1736.             $this->getInlineTags($stored);
  1737.             if (strpos($stored'*/'=== false{
  1738.                 $this->newLineNum();
  1739.                 $this->_wp->linenum++;
  1740.             }
  1741.         }
  1742.     }
  1743.     
  1744.     /**
  1745.      * handles the @staticvar tag
  1746.      *
  1747.      * @see paramTagHandler()
  1748.      */
  1749.     function staticvarTagHandler($name$value)
  1750.     {
  1751.         return $this->paramTagHandler($name$value);
  1752.     }
  1753.     
  1754.     /**
  1755.      * handles the @var tag
  1756.      *
  1757.      * @see paramTagHandler()
  1758.      */
  1759.     function varTagHandler($name$value)
  1760.     {
  1761.         return $this->paramTagHandler($name$value);
  1762.     }
  1763.     
  1764.     /**
  1765.      * Handles @return
  1766.      *
  1767.      * This handler works like {@link defaultTagHandler()} except it highlights
  1768.      * the type in "@return type description"
  1769.      */
  1770.     function returnTagHandler($name$value)
  1771.     {
  1772.         $this->paramTagHandler($name$valuefalse);
  1773.     }
  1774.  
  1775.     /**
  1776.      * Handles @property(-read or -write) and @method magic tags
  1777.      */
  1778.     function propertyTagHandler($name$value)
  1779.     {
  1780.         return $this->paramTagHandler($name$valuetrue);
  1781.     }
  1782.  
  1783.     /**#@-*/
  1784.     
  1785.     /**
  1786.      * Retrieve the type portion of a @tag type description
  1787.      *
  1788.      * Tags like @param, @return and @var all have a PHP type portion in their
  1789.      * description.  Since the type may contain the expression "object blah"
  1790.      * where blah is a classname, it makes parsing out the type field complex.
  1791.      *
  1792.      * Even more complicated is the case where a tag variable can contain
  1793.      * multiple types, such as object blah|object blah2|false, and so this
  1794.      * method handles these cases.
  1795.      *
  1796.      * @param array $value       array of words that were separated by spaces
  1797.      * @param 0|1  $state       0 = find the type, 1 = find the var, if present
  1798.      * @param bool  $checkforvar flag to determine whether to check for the end of a
  1799.      *                            type is defined by a $varname
  1800.      *
  1801.      * @return array Format: array(state (0 [find type], 1 [var], 2 [done]),
  1802.      * @access private
  1803.      */
  1804.     function retrieveType($value$state 0$checkforvar false)
  1805.     {
  1806.         $index  0;
  1807.         $result array();
  1808.         do {
  1809.             if (!isset($value[$index][1])) {
  1810.                 return $result;
  1811.             }
  1812.             $val $value[$index][1];
  1813.             if (empty($val)) {
  1814.                 return $result;
  1815.             }
  1816.             if ($index == 0{
  1817.                 $val $val[1];
  1818.                 array_shift($val);
  1819.             else {
  1820.                 $val explode(' '$val);
  1821.             }
  1822.             $ret              $this->_retrieveType($val$state$checkforvar);
  1823.             $state            $ret[0];
  1824.             $result[$index++$ret[1];
  1825.         while ((!$checkforvar && $state 1|| ($state && $checkforvar));
  1826.         return $result;
  1827.     }
  1828.  
  1829.     /**
  1830.      * used by {@link retrieveType()} in its work
  1831.      *
  1832.      * @param array $value       array of words that were separated by spaces
  1833.      * @param 0|1  $state       0 = find the type, 1 = find the var, if present
  1834.      * @param bool  $checkforvar flag to determine whether to check for the end of a
  1835.      *                            type is defined by a $varname
  1836.      *
  1837.      * @return array 
  1838.      * @access private
  1839.      */    
  1840.     function _retrieveType($value$state$checkforvar)
  1841.     {
  1842.         $result   array();
  1843.         $result[$this->_removeWhiteSpace($value0);
  1844.         if ($state == 0{
  1845.             if (!count($value)) {
  1846.                 return array(2$result);
  1847.             }
  1848.             $types '';
  1849.             $index 0;
  1850.             if (trim($value[0]== 'object'{
  1851.                 $result[array('tagphptype'$value[0' ');
  1852.                 $types   .= array_shift($value).' ';
  1853.                 $result[$this->_removeWhiteSpace($value0);
  1854.                 if (!count($value)) {
  1855.                     // was just passed "object"
  1856.                     return array(2$result);
  1857.                 }
  1858.                 if ($value[0]{0== '$' || substr($value[0]02== '&$'{
  1859.                     // was just passed "object"
  1860.                     // and the next thing is a variable name
  1861.                     if ($checkforvar{
  1862.                         $result[array('tagvarname' $value[0' ');
  1863.                         array_shift($value);
  1864.                     }
  1865.                     $result[array('desc'join(' '$value));
  1866.                     return array(2$result);
  1867.                 }
  1868.             }
  1869.             $done false;
  1870.             $loop = -1;
  1871.             do {
  1872.                 // this loop checks for type|type|type and for
  1873.                 // type|object classname|type|object classname2
  1874.                 if (strpos($value[0]'|')) {
  1875.                     $temptypes explode('|'$value[0]);
  1876.                     while (count($temptypes)) {
  1877.                         $type     array_shift($temptypes);
  1878.                         $result[array('tagphptype'$type);
  1879.                         if (count($temptypes)) {
  1880.                             $result['|';
  1881.                         }
  1882.                     }
  1883.                     if (trim($type== 'object'{
  1884.                         $result[array('tagphptype'$types ' ');
  1885.                         $result[$this->_removeWhiteSpace($value0);
  1886.                     else {
  1887.                         $done true;
  1888.                     }
  1889.                     array_shift($value);
  1890.                     if (count($value&& strlen($value[0]&& isset ($value[0]&& 
  1891.                         ($value[0]{0== '$' || substr($value[0]02== '&$')
  1892.                     {
  1893.                         // was just passed "object"
  1894.                         // and the next thing is a variable name
  1895.                         $result[array('tagvarname' $value[0' ');
  1896.                         array_shift($value);
  1897.                         $result[array('desc'join(' '$value));
  1898.                         return array(2$result);
  1899.                     }
  1900.                 else {
  1901.                     $result[array('tagphptype'$value[0' ');
  1902.                     array_shift($value);
  1903.                     $done true;
  1904.                 }
  1905.                 $loop++;
  1906.             while (!$done && count($value));
  1907.             if ($loop{
  1908.                 $result[' ';
  1909.             }
  1910.             // still searching for type
  1911.             if (!$done && !count($value)) {
  1912.                 return array(0$result);
  1913.             }
  1914.             // still searching for var
  1915.             if ($done && !count($value)) {
  1916.                 return array(1$result);
  1917.             }
  1918.         }
  1919.         $result[$this->_removeWhiteSpace($value0);
  1920.         $state    1;
  1921.         if ($checkforvar{
  1922.             if (count($value)) {
  1923.                 $state 2;
  1924.                 if (substr($value[0]01== '$' || 
  1925.                     substr($value[0]02== '&$'
  1926.                 {
  1927.                     $result[array('tagvarname' $value[0' ');
  1928.                     array_shift($value);
  1929.                 }
  1930.             else {
  1931.                 $state 1;
  1932.             }
  1933.         }
  1934.         $result[array('desc'join(' '$value));
  1935.         return array($state$result);
  1936.     }
  1937.     
  1938.     /**
  1939.      * captures trailing whitespace
  1940.      *
  1941.      * @param array &$value array of string
  1942.      * @param int   $index  index to seek non-whitespace to
  1943.      *
  1944.      * @return string whitespace
  1945.      * @access private
  1946.      */
  1947.     function _removeWhiteSpace(&$value$index)
  1948.     {
  1949.         $result '';
  1950.         if (count($value$index && empty($value[$index])) {
  1951.             $found false;
  1952.             for ($i $index$i count($value&& !strlen($value[$i])$i++{
  1953.                 $result .= ' ';
  1954.             }
  1955.             array_splice($value$index$i $index);
  1956.         }
  1957.         return $result;
  1958.     }
  1959.  
  1960.     /**#@+
  1961.      * Link generation methods
  1962.      *
  1963.      * @param string|array $word token to try to link
  1964.      *
  1965.      * @access private
  1966.      */
  1967.     /**
  1968.      * Generate a link to documentation for an element
  1969.      *
  1970.      * This method tries to link to documentation for functions, methods,
  1971.      * PHP functions, class names, and if found, adds the links to output
  1972.      * instead of plain text
  1973.      */
  1974.     function _link($word)
  1975.     {
  1976.         if (is_array($word&& $word[0== T_STRING{
  1977.             if ($this->_pf_colon_colon{
  1978.                 $this->_pf_colon_colon false;
  1979.  
  1980.                 $combo $this->_pv_last_string[1'::' $word[1'()';
  1981.                 //debug('testing ' . $combo);
  1982.                 $link $this->_converter->getLink($combo);
  1983.                 if (is_object($link)) {
  1984.                     $this->_addoutput($this->_converter->returnSee($link,
  1985.                         $word[1])true);
  1986.                     return;
  1987.                 }
  1988.                 $this->_addoutput($word);
  1989.                 return;
  1990.             }
  1991.             $link $this->_converter->getLink($word[1'()');
  1992.             if (is_object($link)) {
  1993.                 $this->_addoutput($this->_converter->returnSee($link,
  1994.                     $word[1])true);
  1995.                 return;
  1996.             elseif (is_string($link&& strpos($link'ttp://')) {
  1997.                 $this->_addoutput($this->_converter->returnLink($link,
  1998.                     $word[1])true);
  1999.                 return;
  2000.             else {
  2001.                 $link $this->_converter->getLink($word[1]);
  2002.                 if (is_object($link)) {
  2003.                     $word[1$this->_converter->returnSee($link$word[1]);
  2004.                 }
  2005.                 $this->_addoutput($wordtrue);
  2006.                 return;
  2007.             }
  2008.         }
  2009.         $this->_addoutput($word);
  2010.     }
  2011.     
  2012.     /**
  2013.      * Works like {@link _link()} except it only links to global variables
  2014.      */
  2015.     function _globallink($word)
  2016.     {
  2017.         if (!is_array($word)) {
  2018.             return $this->_addoutput($word);
  2019.         }
  2020.         if ($word[0!= T_VARIABLE{
  2021.             return $this->_addoutput($word);
  2022.         }
  2023.         if (is_array($word&& $word[0== T_VARIABLE{
  2024.             $link $this->_converter->getLink('global ' $word[1]);
  2025.             if (is_object($link)) {
  2026.                 $this->_addoutput($this->_converter->returnSee($link,
  2027.                     $word[1])true);
  2028.                 return;
  2029.             }
  2030.         }
  2031.         $this->_addoutput($word);
  2032.     }
  2033.     
  2034.     /**
  2035.      * Works like {@link _link()} except it only links to classes
  2036.      */
  2037.     function _classlink($word)
  2038.     {
  2039.         //debug("checking class " . $word[1]);
  2040.         if (is_array($word&& $word[0== T_STRING{
  2041.             $link $this->_converter->getLink($word[1]);
  2042.             if (is_object($link)) {
  2043.                 $this->_addoutput($this->_converter->returnSee($link,
  2044.                     $word[1])true);
  2045.                 return;
  2046.             }
  2047.         }
  2048.         $this->_addoutput($word);
  2049.     }
  2050.     
  2051.     /**
  2052.      * Works like {@link _link()} except it only links to methods
  2053.      */
  2054.     function _methodlink($word)
  2055.     {
  2056.         if (is_array($word&& $word[0== T_STRING{
  2057.             //debug("checking method " . $this->_pv_class . '::' . $word[1] . '()');
  2058.             if (isset($this->_pv_prev_var_type)) {
  2059.                 $link $this->_converter->getLink($this->_pv_prev_var_type '::' .
  2060.                     $word[1'()');
  2061.             else {
  2062.                 $link $this->_converter->getLink($this->_pv_class '::' 
  2063.                     $word[1'()');
  2064.             }
  2065.             if (is_object($link)) {
  2066.                 $this->_addoutput($this->_converter->returnSee($link,
  2067.                     $word[1])true);
  2068.                 return;
  2069.             }
  2070.             if (isset($this->_pv_prev_var_type)) {
  2071.                 $this->_addoutput($word);
  2072.                 return;
  2073.             }
  2074.             //debug("checking method " . $word[1] . '()');
  2075.             $link $this->_converter->getLink($word[1'()');
  2076.             if (is_object($link)) {
  2077.                 $this->_addoutput($this->_converter->returnSee($link,
  2078.                     $word[1])true);
  2079.                 return;
  2080.             }
  2081.         }
  2082.         $this->_addoutput($word);
  2083.     }
  2084.     
  2085.     /**
  2086.      * Works like {@link _link()} except it only links to class variables
  2087.      *
  2088.      * @param bool $justastring true if the $word is only a string
  2089.      */
  2090.     function _varlink($word$justastring=false)
  2091.     {
  2092.         if ($justastring{
  2093.             $word[0T_VARIABLE;
  2094.         }
  2095.         if (is_array($word&& $word[0== T_VARIABLE{
  2096.             $x ($justastring '$' '');
  2097.             //debug("checking var " . $this->_pv_class . '::' . $x . $word[1]);
  2098.             if (isset($this->_pv_prev_var_type)) {
  2099.                 //debug("checking var " . $this->_pv_prev_var_type . '::' .
  2100.                 //    $x . $word[1]);
  2101.                 $link $this->_converter->getLink($this->_pv_prev_var_type '::' .
  2102.                     $x $word[1]);
  2103.             else {
  2104.                 $link $this->_converter->getLink($this->_pv_class '::' 
  2105.                     $x $word[1]);
  2106.             }
  2107.             if (is_object($link)) {
  2108.                 $this->_addoutput($this->_converter->returnSee($link,
  2109.                     $word[1])true);
  2110.                 return;
  2111.             }
  2112.             //debug("checking var " . $x . $word[1]);
  2113.             if (isset($this->_pv_prev_var_type)) {
  2114.                 $this->_addoutput($word);
  2115.                 return;
  2116.             }
  2117.             $link $this->_converter->getLink($x $word[1]);
  2118.             if (is_object($link)) {
  2119.                 $this->_addoutput($this->_converter->returnSee($link,
  2120.                     $word[1])true);
  2121.                 return;
  2122.             }
  2123.         }
  2124.         $this->_addoutput($word);
  2125.     }
  2126.     /**#@-*/
  2127.     
  2128.     /**#@+
  2129.      * Output Methods
  2130.      * @access private
  2131.      */
  2132.     /**
  2133.      * This method adds output to {@link $_line}
  2134.      *
  2135.      * If a string with variables like "$test this" is present, then special
  2136.      * handling is used to allow processing of the variable in context.
  2137.      *
  2138.      * @param mixed $word         the string|array tag token and value
  2139.      * @param bool  $preformatted whether or not the $word is already formatted
  2140.      *
  2141.      * @return void 
  2142.      * @see _flush_save()
  2143.      */
  2144.     function _addoutput($word$preformatted false)
  2145.     {
  2146.         if ($this->_pf_no_output_yet{
  2147.             return;
  2148.         }
  2149.         if ($this->_pf_quote_active{
  2150.             if (is_array($word)) {
  2151.                 $this->_save .= $this->_converter->highlightSource($word[0],
  2152.                     $word[1]);
  2153.             else {
  2154.                 $this->_save .= $this->_converter->highlightSource(false,
  2155.                     $wordtrue);
  2156.             }
  2157.         else {
  2158.             $this->_flush_save();
  2159.             if (is_string($word&& trim($word== ''{
  2160.                 $this->_line .= $this->_converter->postProcess($word);
  2161.                 return;
  2162.             }
  2163.             if (is_array($word&& trim($word[1]== ''{
  2164.                 $this->_line .= $this->_converter->postProcess($word[1]);
  2165.                 return;
  2166.             }
  2167.             if (is_array($word)) {
  2168.                 $this->_line .= $this->_converter->highlightSource($word[0],
  2169.                     $word[1]$preformatted);
  2170.             else {
  2171.                 $this->_line .= $this->_converter->highlightSource(false,
  2172.                     $word$preformatted);
  2173.             }
  2174.         }
  2175.     }
  2176.     
  2177.     /** 
  2178.      * Like {@link _output()}, but for DocBlock highlighting
  2179.      *
  2180.      * @param mixed $dbtype       the docblock type
  2181.      * @param mixed $word         the string|array tag token and value
  2182.      * @param bool  $preformatted whether or not the $word is already formatted
  2183.      *
  2184.      * @return void 
  2185.      */
  2186.     function _addDocBlockoutput($dbtype$word$preformatted false)
  2187.     {
  2188.         if ($this->_pf_internal{
  2189.             $this->_line .= $this->_converter->highlightDocBlockSource('internal',
  2190.                 $word$preformatted);
  2191.         else {
  2192.             $this->_line .= $this->_converter->highlightDocBlockSource($dbtype,
  2193.                 $word$preformatted);
  2194.         }
  2195.     }
  2196.     
  2197.     /**
  2198.      * Flush a saved string variable highlighting
  2199.      *
  2200.      * {@source } 
  2201.      *
  2202.      * @return void 
  2203.      * @todo CS cleanup - rename to _flushSave() for camelCase rule
  2204.      */
  2205.     function _flush_save()
  2206.     {
  2207.         if (!empty($this->_save)) {
  2208.             $this->_save .= $this->_converter->flushHighlightCache();
  2209.             // clear the existing cache, reset it to the old value
  2210.             if (isset($this->_save_highlight_state)) {
  2211.                 $this->_converter->
  2212.                     _setHighlightCache($this->_save_highlight_state[0],
  2213.                          $this->_save_highlight_state[1]);
  2214.             }
  2215.             $this->_line .= $this->_converter->
  2216.                 highlightSource(T_CONSTANT_ENCAPSED_STRING$this->_savetrue);
  2217.             $this->_save  '';
  2218.         }
  2219.     }
  2220.     /**#@-*/
  2221.     
  2222.     /**
  2223.      * Give the word parser necessary data to begin a new parse
  2224.      *
  2225.      * @param array &$data all tokens separated by line number
  2226.      *
  2227.      * @return void 
  2228.      */
  2229.     function configWordParser(&$data)
  2230.     {
  2231.         $this->_wp->setup($data$this);
  2232.         $this->_wp->setWhitespace(true);
  2233.     }
  2234.  
  2235.     /**
  2236.      * Initialize all parser state variables
  2237.      *
  2238.      * @param bool         $inlinesourceparse true if we are highlighting an inline
  2239.      *                                         {@}source} tag's output
  2240.      * @param false|string$class             name of class we are going
  2241.      *                                         to start from
  2242.      *
  2243.      * @return void 
  2244.      * @uses $_wp sets to a new {@link phpDocumentor_HighlightWordParser}
  2245.      */
  2246.     function setupStates($inlinesourceparse$class)
  2247.     {
  2248.         $this->_output '';
  2249.         $this->_line   '';
  2250.         unset($this->_wp);
  2251.         $this->_wp          new phpDocumentor_HighlightWordParser;
  2252.         $this->_event_stack new EventStack;
  2253.         if ($inlinesourceparse{
  2254.             $this->_event_stack->pushEvent(PARSER_EVENT_PHPCODE);
  2255.             if ($class{
  2256.                 $this->_event_stack->pushEvent(PARSER_EVENT_CLASS);
  2257.                 $this->_pv_class $class;
  2258.             }
  2259.         else {
  2260.             $this->_pv_class null;
  2261.         }
  2262.  
  2263.         $this->_pv_define              null;
  2264.         $this->_pv_define_name         null;
  2265.         $this->_pv_define_value        null;
  2266.         $this->_pv_define_params_data  null;
  2267.         $this->_pv_dtype               null;
  2268.         $this->_pv_docblock            null;
  2269.         $this->_pv_dtemplate           null;
  2270.         $this->_pv_func                null;
  2271.         $this->_pv_global_name         null;
  2272.         $this->_pv_global_val          null;
  2273.         $this->_pv_globals             null;
  2274.         $this->_pv_global_count        null;
  2275.         $this->_pv_include_params_data null;
  2276.         $this->_pv_include_name        null;
  2277.         $this->_pv_include_value       null;
  2278.         $this->_pv_linenum             null;
  2279.         $this->_pv_periodline          null;
  2280.         $this->_pv_paren_count         0;
  2281.         $this->_pv_statics             null;
  2282.         $this->_pv_static_count        null;
  2283.         $this->_pv_static_val          null;
  2284.         $this->_pv_quote_data          null;
  2285.         $this->_pv_function_data       null;
  2286.         $this->_pv_var                 null;
  2287.         $this->_pv_varname             null;
  2288.         $this->_pf_definename_isset    false;
  2289.         $this->_pf_extends_found       false;
  2290.         $this->_pf_includename_isset   false;
  2291.         $this->_pf_get_source          false;
  2292.         $this->_pf_getting_source      false;
  2293.         $this->_pf_in_class            false;
  2294.         $this->_pf_in_define           false;
  2295.         $this->_pf_in_global           false;
  2296.         $this->_pf_in_include          false;
  2297.         $this->_pf_in_var              false;
  2298.         $this->_pf_funcparam_val       false;
  2299.         $this->_pf_quote_active        false;
  2300.         $this->_pf_reset_quote_data    true;
  2301.         $this->_pf_useperiod           false;
  2302.         $this->_pf_var_equals          false;
  2303.         $this->_pf_obj_op              false;
  2304.         $this->_pf_docblock            false;
  2305.         $this->_pf_docblock_template   false;
  2306.         $this->_pf_colon_colon         false;
  2307.         $this->_pv_last_string         false;
  2308.         $this->_pf_inmethod            false;
  2309.         $this->_pf_no_output_yet       false;
  2310.         $this->_pv_saveline            0;
  2311.         $this->_pv_next_word           false;
  2312.         $this->_save                   '';
  2313.     }
  2314.  
  2315.     /**
  2316.      * Initialize the {@link $tokenpushEvent, $wordpushEvent} arrays
  2317.      *
  2318.      * @return void 
  2319.      */
  2320.     function phpDocumentor_HighlightParser()
  2321.     {
  2322.         if (!defined('T_INTERFACE')) {
  2323.             define('T_INTERFACE'-1);
  2324.         }
  2325.         $this->allowableTags
  2326.             = $GLOBALS['_phpDocumentor_tags_allowed'];
  2327.         $this->allowableInlineTags
  2328.             = $GLOBALS['_phpDocumentor_inline_doc_tags_allowed'];
  2329.         $this->inlineTagHandlers
  2330.             = array('*' => 'handleDefaultInlineTag');
  2331.         /**************************************************************/
  2332.  
  2333.         $this->tokenpushEvent[PARSER_EVENT_NOEVENTS
  2334.             array(
  2335.                 T_OPEN_TAG => PARSER_EVENT_PHPCODE,
  2336.             );
  2337.  
  2338.         /**************************************************************/
  2339.  
  2340.         $this->tokenpushEvent[PARSER_EVENT_PHPCODE
  2341.             array(
  2342.                 T_FUNCTION      => PARSER_EVENT_FUNCTION,
  2343.                 T_CLASS         => PARSER_EVENT_CLASS,
  2344.                 T_INTERFACE     => PARSER_EVENT_CLASS,
  2345.                 T_INCLUDE_ONCE  => PARSER_EVENT_INCLUDE,
  2346.                 T_INCLUDE       => PARSER_EVENT_INCLUDE,
  2347.                 T_START_HEREDOC => PARSER_EVENT_EOFQUOTE,
  2348.                 T_REQUIRE       => PARSER_EVENT_INCLUDE,
  2349.                 T_REQUIRE_ONCE  => PARSER_EVENT_INCLUDE,
  2350.                 T_COMMENT       => PARSER_EVENT_COMMENT,
  2351.                 T_DOC_COMMENT   => PARSER_EVENT_DOCBLOCK,
  2352.             );
  2353.         $this->wordpushEvent[PARSER_EVENT_PHPCODE]  =
  2354.             array(
  2355.                 "define" => PARSER_EVENT_DEFINE,
  2356.                 '"'      => PARSER_EVENT_QUOTE,
  2357.                 '\''     => PARSER_EVENT_QUOTE,
  2358.             );
  2359.         /**************************************************************/
  2360.  
  2361.         $this->wordpushEvent[PARSER_EVENT_FUNCTION]  =
  2362.             array(
  2363.                 '{' => PARSER_EVENT_LOGICBLOCK,
  2364.                 '(' => PARSER_EVENT_FUNCTION_PARAMS,
  2365.             );
  2366.         $this->tokenpushEvent[PARSER_EVENT_FUNCTION=
  2367.             array(
  2368.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2369.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2370.             );
  2371.         $this->wordpopEvent[PARSER_EVENT_FUNCTION]   array("}");
  2372.         /**************************************************************/
  2373.  
  2374.         $this->tokenpopEvent[PARSER_EVENT_EOFQUOTEarray(T_END_HEREDOC);
  2375.         /**************************************************************/
  2376.  
  2377.         $this->tokenpushEvent[PARSER_EVENT_FUNCTION_PARAMS=
  2378.             array(
  2379.                 T_CONSTANT_ENCAPSED_STRING => PARSER_EVENT_QUOTE,
  2380.                 T_ARRAY                    => PARSER_EVENT_ARRAY,
  2381.                 T_COMMENT                  => PARSER_EVENT_COMMENT,
  2382.                 T_DOC_COMMENT              => PARSER_EVENT_DOCBLOCK,
  2383.             );
  2384.         $this->wordpushEvent[PARSER_EVENT_FUNCTION_PARAMS]  =
  2385.             array(
  2386.                 '"' => PARSER_EVENT_QUOTE,
  2387.                 "'" => PARSER_EVENT_QUOTE,
  2388.             );
  2389.         $this->wordpopEvent[PARSER_EVENT_FUNCTION_PARAMS]   array(")");
  2390.         /**************************************************************/
  2391.  
  2392.         $this->wordpushEvent[PARSER_EVENT_LOGICBLOCK]  
  2393.             array(
  2394.                 "{" => PARSER_EVENT_LOGICBLOCK,
  2395.                 '"' => PARSER_EVENT_QUOTE,
  2396.             );
  2397.         $this->tokenpushEvent[PARSER_EVENT_LOGICBLOCK=
  2398.             array(
  2399.                 T_GLOBAL                   => PARSER_EVENT_FUNC_GLOBAL,
  2400.                 T_STATIC                   => PARSER_EVENT_STATIC_VAR,
  2401.                 T_START_HEREDOC            => PARSER_EVENT_EOFQUOTE,
  2402.                 T_CURLY_OPEN               => PARSER_EVENT_LOGICBLOCK,
  2403.                 T_DOLLAR_OPEN_CURLY_BRACES => PARSER_EVENT_LOGICBLOCK,
  2404.             );
  2405.         $this->wordpopEvent[PARSER_EVENT_LOGICBLOCK]   array("}");
  2406.         $this->tokenpopEvent[PARSER_EVENT_LOGICBLOCK]  array(T_CURLY_OPEN);
  2407.  
  2408.         /**************************************************************/
  2409.  
  2410.         $this->tokenpushEvent[PARSER_EVENT_ARRAY
  2411.             array(
  2412.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2413.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2414.             );
  2415.         $this->wordpopEvent[PARSER_EVENT_ARRAY]   array(")");
  2416.         /**************************************************************/
  2417.  
  2418.         $this->tokenpushEvent[PARSER_EVENT_FUNC_GLOBAL=
  2419.             array(
  2420.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2421.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2422.             );
  2423.         $this->wordpopEvent[PARSER_EVENT_FUNC_GLOBAL]   array(";");
  2424.         /**************************************************************/
  2425.  
  2426.         $this->tokenpushEvent[PARSER_EVENT_STATIC_VAR=
  2427.             array(
  2428.                 T_CONSTANT_ENCAPSED_STRING => PARSER_EVENT_QUOTE,
  2429.                 T_COMMENT                  => PARSER_EVENT_COMMENT,
  2430.                 T_DOC_COMMENT              => PARSER_EVENT_DOCBLOCK,
  2431.             );
  2432.         $this->wordpushEvent[PARSER_EVENT_STATIC_VAR]  =
  2433.             array(
  2434.                 "=" => PARSER_EVENT_STATIC_VAR_VALUE,
  2435.             );
  2436.         $this->wordpopEvent[PARSER_EVENT_STATIC_VAR]   array(";");
  2437.         /**************************************************************/
  2438.  
  2439.         $this->tokenpushEvent[PARSER_EVENT_STATIC_VAR_VALUE
  2440.             array(
  2441.                 T_CONSTANT_ENCAPSED_STRING => PARSER_EVENT_QUOTE,
  2442.                 T_COMMENT                  => PARSER_EVENT_COMMENT,
  2443.                 T_DOC_COMMENT              => PARSER_EVENT_DOCBLOCK,
  2444.                 T_ARRAY                    => PARSER_EVENT_ARRAY,
  2445.             );
  2446.         $this->wordpushEvent[PARSER_EVENT_STATIC_VAR_VALUE]  =
  2447.             array(
  2448.                 '"' => PARSER_EVENT_QUOTE,
  2449.                 "'" => PARSER_EVENT_QUOTE,
  2450.             );
  2451.         $this->wordpopEvent[PARSER_EVENT_STATIC_VAR_VALUE]   array(";"",");
  2452.         /**************************************************************/
  2453.         $this->tokenpushEvent[PARSER_EVENT_QUOTE
  2454.             array(
  2455.                 T_OBJECT_OPERATOR => PARSER_EVENT_CLASS_MEMBER,
  2456.                 T_CURLY_OPEN      => PARSER_EVENT_QUOTE_VAR,
  2457.             );
  2458.         $this->wordpopEvent[PARSER_EVENT_QUOTE]   array('"');
  2459.         /**************************************************************/
  2460.         $this->tokenpushEvent[PARSER_EVENT_QUOTE_VAR
  2461.             array(
  2462.                 T_OBJECT_OPERATOR => PARSER_EVENT_CLASS_MEMBER,
  2463.                 T_CURLY_OPEN      => PARSER_EVENT_QUOTE_VAR,
  2464.             );
  2465.         $this->wordpushEvent[PARSER_EVENT_QUOTE_VAR]  =
  2466.             array(
  2467.                 "{" => PARSER_EVENT_QUOTE_VAR,
  2468.                 '"' => PARSER_EVENT_QUOTE_VAR,
  2469.                 "'" => PARSER_EVENT_QUOTE_VAR,
  2470.             );
  2471.         $this->wordpopEvent[PARSER_EVENT_QUOTE_VAR]   array('}');
  2472.         /**************************************************************/
  2473.  
  2474.         $this->tokenpushEvent[PARSER_EVENT_DEFINE
  2475.             array(
  2476.                 T_COMMENT                  => PARSER_EVENT_COMMENT,
  2477.                 T_DOC_COMMENT              => PARSER_EVENT_DOCBLOCK,
  2478.                 T_CONSTANT_ENCAPSED_STRING => PARSER_EVENT_QUOTE,
  2479.             );
  2480.         $this->wordpushEvent[PARSER_EVENT_DEFINE]  
  2481.             array(
  2482.                 "(" => PARSER_EVENT_DEFINE_PARAMS,
  2483.             );
  2484.         $this->wordpopEvent[PARSER_EVENT_DEFINE]   array(";");
  2485.         /**************************************************************/
  2486.  
  2487.         $this->tokenpushEvent[PARSER_EVENT_DEFINE_PARAMS
  2488.             array(
  2489.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2490.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2491.             );
  2492.         $this->wordpushEvent[PARSER_EVENT_DEFINE_PARAMS]  
  2493.             array(
  2494.                 "(" => PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS,
  2495.                 '"' => PARSER_EVENT_QUOTE,
  2496.                 "'" => PARSER_EVENT_QUOTE,
  2497.             );
  2498.         $this->wordpopEvent[PARSER_EVENT_DEFINE_PARAMS]   array(")");
  2499.         /**************************************************************/
  2500.  
  2501.         $this->tokenpushEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS=
  2502.             array(
  2503.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2504.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2505.             );
  2506.         $this->wordpushEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS]  =
  2507.             array(
  2508.                 "(" => PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS,
  2509.                 '"' => PARSER_EVENT_QUOTE,
  2510.                 "'" => PARSER_EVENT_QUOTE,
  2511.             );
  2512.         $this->wordpopEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS]   array(")");
  2513.         /**************************************************************/
  2514.  
  2515.         $this->tokenpushEvent[PARSER_EVENT_VAR
  2516.             array(
  2517.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2518.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2519.                 T_ARRAY       => PARSER_EVENT_ARRAY,
  2520.             );
  2521.         $this->wordpopEvent[PARSER_EVENT_VAR]   array(";");
  2522.         /**************************************************************/
  2523.  
  2524.         $this->tokenpushEvent[PARSER_EVENT_CLASS
  2525.             array(
  2526.                 T_FUNCTION    => PARSER_EVENT_METHOD,
  2527.                 T_VAR         => PARSER_EVENT_VAR,
  2528.                 T_COMMENT     => PARSER_EVENT_DOCBLOCK,
  2529.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2530.                 T_CLOSE_TAG   => PARSER_EVENT_OUTPHP,
  2531.             );
  2532.         $this->wordpopEvent[PARSER_EVENT_CLASS]   array("}");
  2533.         /**************************************************************/
  2534.  
  2535.         $this->wordpushEvent[PARSER_EVENT_METHOD]  =
  2536.             array(
  2537.                 '{' => PARSER_EVENT_METHOD_LOGICBLOCK,
  2538.                 '(' => PARSER_EVENT_FUNCTION_PARAMS,
  2539.             );
  2540.         $this->tokenpushEvent[PARSER_EVENT_METHOD=
  2541.             array(
  2542.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2543.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2544.             );
  2545.         $this->wordpopEvent[PARSER_EVENT_METHOD]   array("}"";");
  2546.         /**************************************************************/
  2547.  
  2548.         $this->wordpushEvent[PARSER_EVENT_METHOD_LOGICBLOCK]  
  2549.             array(
  2550.                 "{" => PARSER_EVENT_METHOD_LOGICBLOCK,
  2551.                 '"' => PARSER_EVENT_QUOTE,
  2552.             );
  2553.         $this->tokenpushEvent[PARSER_EVENT_METHOD_LOGICBLOCK=
  2554.             array(
  2555.                 T_OBJECT_OPERATOR          => PARSER_EVENT_CLASS_MEMBER,
  2556.                 T_GLOBAL                   => PARSER_EVENT_FUNC_GLOBAL,
  2557.                 T_STATIC                   => PARSER_EVENT_STATIC_VAR,
  2558.                 T_CURLY_OPEN               => PARSER_EVENT_LOGICBLOCK,
  2559.                 T_DOLLAR_OPEN_CURLY_BRACES => PARSER_EVENT_LOGICBLOCK,
  2560.             );
  2561.         $this->wordpopEvent[PARSER_EVENT_METHOD_LOGICBLOCK]   array("}");
  2562.         $this->tokenpopEvent[PARSER_EVENT_METHOD_LOGICBLOCK]  array(T_CURLY_OPEN);
  2563.         /**************************************************************/
  2564.  
  2565.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE
  2566.             array(
  2567.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2568.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2569.             );
  2570.         $this->wordpushEvent[PARSER_EVENT_INCLUDE]  
  2571.             array(
  2572.                 "(" => PARSER_EVENT_INCLUDE_PARAMS,
  2573.             );
  2574.         $this->wordpopEvent[PARSER_EVENT_INCLUDE]   array(";");
  2575.         /**************************************************************/
  2576.  
  2577.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE_PARAMS
  2578.             array(
  2579.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2580.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2581.             );
  2582.         $this->wordpushEvent[PARSER_EVENT_INCLUDE_PARAMS]  
  2583.             array(
  2584.                 "(" => PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS,
  2585.             );
  2586.         $this->wordpopEvent[PARSER_EVENT_INCLUDE_PARAMS]   array(")");
  2587.         /**************************************************************/
  2588.  
  2589.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS=
  2590.             array(
  2591.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2592.                 T_DOC_COMMENT => PARSER_EVENT_DOCBLOCK,
  2593.             );
  2594.         $this->wordpushEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS]  =
  2595.             array(
  2596.                 "(" => PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS,
  2597.             );
  2598.         $this->wordpopEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS]   array(")");
  2599.     }
  2600. }
  2601. ?>

Documentation generated on Mon, 05 Dec 2011 21:10:27 -0600 by phpDocumentor 1.4.4