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

Documentation generated on Tue, 24 Oct 2006 09:23:07 -0500 by phpDocumentor 1.3.1