phpDocumentor
[ class tree: phpDocumentor ] [ index: phpDocumentor ] [ all elements ]

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

Documentation generated on Mon, 11 Mar 2019 15:08:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.