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

Source for file phpDocumentorTParser.inc

Documentation is available at phpDocumentorTParser.inc

  1. <?php
  2. /**
  3.  * tokenizer extension-based parser for PHP code
  4.  * 
  5.  * phpDocumentor :: automatic documentation generator
  6.  * 
  7.  * PHP versions 4 and 5
  8.  *
  9.  * Copyright (c) 2002-2006 Gregory Beaver
  10.  * 
  11.  * LICENSE:
  12.  * 
  13.  * This library is free software; you can redistribute it
  14.  * and/or modify it under the terms of the GNU Lesser General
  15.  * Public License as published by the Free Software Foundation;
  16.  * either version 2.1 of the License, or (at your option) any
  17.  * later version.
  18.  * 
  19.  * This library is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22.  * Lesser General Public License for more details.
  23.  * 
  24.  * You should have received a copy of the GNU Lesser General Public
  25.  * License along with this library; if not, write to the Free Software
  26.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27.  *
  28.  * @package    phpDocumentor
  29.  * @subpackage Parsers
  30.  * @author     Gregory Beaver <[email protected]>
  31.  * @copyright  2002-2006 Gregory Beaver
  32.  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL
  33.  * @version    CVS: $Id: phpDocumentorTParser.inc,v 1.18 2006/08/17 03:13:39 cellog Exp $
  34.  * @link       http://www.phpdoc.org
  35.  * @link       http://pear.php.net/PhpDocumentor
  36.  * @since      1.2
  37.  */
  38. /**
  39.  * Tokenizer-based parser for PHP source code
  40.  * @package phpDocumentor
  41.  * @subpackage Parsers
  42.  * @author Gregory Beaver <[email protected]>
  43.  * @version $Revision: 1.18 $
  44.  */
  45. class phpDocumentorTParser extends Parser
  46. {
  47.     /**#@+
  48.      * @access private
  49.      */
  50.     /**
  51.      * @var EventStack 
  52.      */
  53.     var $_event_stack;
  54.     /**
  55.      * last event triggered before the current event
  56.      * @var integer 
  57.      */
  58.     var $_last_pevent;
  59.     /**
  60.      * last word parsed
  61.      * @var integer 
  62.      */
  63.     var $_last_word;
  64.     /**
  65.      * full path of the currently parsed file
  66.      * @var string 
  67.      */
  68.     var $_path;
  69.     /**#@-*/
  70.     /**#@+
  71.      * Parser Variables
  72.      * @access private
  73.      */
  74.     var $_pv_class;
  75.     var $_pv_cur_class;
  76.     var $_pv_define;
  77.     var $_pv_define_name;
  78.     var $_pv_define_value;
  79.     var $_pv_define_params_data;
  80.     var $_pv_dtype;
  81.     var $_pv_docblock;
  82.     var $_pv_dtemplate;
  83.     var $_pv_func;
  84.     var $_pv_func_param;
  85.     var $_pv_findglobal;
  86.     var $_pv_global_name;
  87.     var $_pv_global_val;
  88.     var $_pv_globals;
  89.     var $_pv_global_count;
  90.     var $_pv_include_params_data;
  91.     var $_pv_include_name;
  92.     var $_pv_include_value;
  93.     var $_pv_linenum;
  94.     var $_pv_periodline;
  95.     var $_pv_paren_count 0;
  96.     var $_pv_statics;
  97.     var $_pv_static_count;
  98.     var $_pv_static_val;
  99.     var $_pv_quote_data;
  100.     var $_pv_function_data;
  101.     var $_pv_var;
  102.     var $_pv_varname;
  103.     var $_pv_var_value;
  104.     /**#@-*/
  105.     /**#@+
  106.      * Parser Flags
  107.      * @access private
  108.      */
  109.     var $_pf_definename_isset false;
  110.     var $_pf_includename_isset false;
  111.     var $_pf_get_source false;
  112.     var $_pf_getting_source false;
  113.     var $_pf_internal false;
  114.     var $_pf_in_class false;
  115.     var $_pf_in_define false;
  116.     var $_pf_in_global false;
  117.     var $_pf_in_include false;
  118.     var $_pf_in_var false;
  119.     var $_pf_funcparam_val false;
  120.     var $_pf_quote_active false;
  121.     var $_pf_reset_quote_data true;
  122.     var $_pf_useperiod false;
  123.     var $_pf_set_var_value false;
  124.     var $_pf_var_equals false;
  125.     /**#@-*/
  126.     /**
  127.      * relative path of the parsed file from the base parse directory
  128.      * @var string 
  129.      */
  130.     var $source_location;
  131.     var $eventHandlers = array(
  132.                                 PARSER_EVENT_ARRAY => 'handleArray',
  133.                                 PARSER_EVENT_VAR_ARRAY => 'handleArray',
  134.                                 PARSER_EVENT_VAR_ARRAY_COMMENT => 'handleVarArrayComment',
  135.                                 PARSER_EVENT_CLASS => 'handleClass',
  136.                                 PARSER_EVENT_COMMENT => 'handleComment',
  137.                                 PARSER_EVENT_DOCBLOCK_TEMPLATE => 'handleDocBlockTemplate',
  138.                                 PARSER_EVENT_END_DOCBLOCK_TEMPLATE => 'handleEndDocBlockTemplate',
  139.                                 PARSER_EVENT_LOGICBLOCK => 'handleLogicBlock',
  140.                                 PARSER_EVENT_NOEVENTS => 'defaultHandler',
  141.                                 PARSER_EVENT_OUTPHP => 'defaultHandler',
  142.                                 PARSER_EVENT_DEFINE => 'handleDefine',
  143.                                 PARSER_EVENT_DEFINE_PARAMS => 'handleDefineParams',
  144.                                 PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS => 'handleDefineParamsParenthesis',
  145.                                 PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS => 'handleIncludeParamsParenthesis',
  146.                                 PARSER_EVENT_DOCBLOCK => 'handleDocBlock',
  147.                                 PARSER_EVENT_TAGS => 'handleTags',
  148.                                 PARSER_EVENT_DESC => 'handleDesc',
  149.                                 PARSER_EVENT_DOCKEYWORD => 'handleTag',
  150.                                 PARSER_EVENT_DOCKEYWORD_EMAIL => 'handleDockeywordEmail',
  151.                                 PARSER_EVENT_EOFQUOTE => 'handleHereDoc',
  152.                                 PARSER_EVENT_FUNCTION => 'handleFunction',
  153.                                 PARSER_EVENT_FUNCTION_PARAMS => 'handleFunctionParams',
  154.                                 PARSER_EVENT_FUNCTION_PARAM_VAR => 'handleFunctionParams',
  155.                                 PARSER_EVENT_FUNC_GLOBAL => 'handleFuncGlobal',
  156.                                 PARSER_EVENT_DEFINE_GLOBAL => 'handleGlobal',
  157.                                 PARSER_EVENT_GLOBAL_VALUE => 'handleGlobalValue',
  158.                                 PARSER_EVENT_INLINE_DOCKEYWORD => 'handleInlineDockeyword',
  159.                                 PARSER_EVENT_INCLUDE => 'handleInclude',
  160.                                 PARSER_EVENT_INCLUDE_PARAMS => 'handleIncludeParams',
  161.                                 PARSER_EVENT_QUOTE => 'handleQuote',
  162.                                 PARSER_EVENT_PHPCODE => 'handlePhpCode',
  163.                                 PARSER_EVENT_SINGLEQUOTE => 'handleSingleQuote',
  164.                                 PARSER_EVENT_STATIC_VAR => 'handleStaticVar',
  165.                                 PARSER_EVENT_STATIC_VAR_VALUE => 'handleStaticValue',
  166.                                 PARSER_EVENT_VAR => 'handleVar',
  167.                                 PARSER_EVENT_ACCESS_MODIFIER => 'handleAccessModifier',
  168.                                 PARSER_EVENT_IMPLEMENTS => 'handleImplements',
  169.                                 PARSER_EVENT_CLASS_CONSTANT => 'handleClassConstant',
  170.     );
  171.     
  172.     var $inlineTagHandlers = array(
  173.                                 '*' => 'handleDefaultInlineTag',
  174.                                 'link' => 'handleLinkInlineTag',
  175.                                 );
  176.     
  177.     function phpDocumentorTParser()
  178.     {
  179.         $this->allowableTags $GLOBALS['_phpDocumentor_tags_allowed'];
  180.         $this->allowableInlineTags $GLOBALS['_phpDocumentor_inline_doc_tags_allowed'];
  181.         $this->subscribe(PHPDOCUMENTOR_EVENT_NEWLINENUM,$GLOBALS['phpDocumentor_errors']);
  182.         $this->subscribe(PHPDOCUMENTOR_EVENT_NEWFILE,$GLOBALS['phpDocumentor_errors']);
  183.         $this->tagHandlers['author''authorTagHandler';
  184.         $this->tagHandlers['filesource''filesourceTagHandler';
  185.         $this->setupEventStates();
  186.     }
  187.     
  188.     /**
  189.      * Parse a new file
  190.      *
  191.      * @param    string    $parse_data 
  192.      * @param    string    $path 
  193.      * @param    int    $base    number of directories to drop off the bottom when creating names using path
  194.      * @staticvar    integer    used for recursion limiting if a handler for an event is not found
  195.      * @return    bool 
  196.      */
  197.     function parse (&$parse_data$path$base 0$packages false)
  198.     {
  199.         global $_phpDocumentor_options;
  200.         static $endrecur 0;
  201.         $this->setupStates();
  202.         if (strlen($parse_data== 0)
  203.         {
  204.             return false;
  205.         }
  206.  
  207.         $this->configWordParser($parse_data);
  208.         // initialize variables so E_ALL error_reporting doesn't complain
  209.         $pevent 0;
  210.         $word 0;
  211.  
  212.         $page new ParserPage;
  213.         $page->setSource($this->_wp->getFileSource());
  214.         $page->setPath($path);
  215.         $this->_path $path;
  216.         $page->setPackageOutput($packages);
  217.         $page->setFile(basename($path));
  218.         $this->publishEvent(PHPDOCUMENTOR_EVENT_NEWFILE,basename($path));
  219.         //$name = str_replace("/","_",dirname($path)) . "_" . array_shift(explode(".",$page->getFile()));
  220.         // [email protected] 11/29/2001
  221.         $name str_replace':'''dirname($pathPATH_DELIMITER $page->getFile() );
  222.         $tmp explodePATH_DELIMITER$name );
  223.         $name implode"---"array_slice$tmp$base ) );
  224.         // if base is '', drive letter is present in windows
  225.  
  226.         $page->setName($name);
  227.         $temploc $_phpDocumentor_options['Program_Root'PATH_DELIMITERimplode(PATH_DELIMITER,
  228.             array_slice(explode(PATH_DELIMITER,$path),$base));
  229.         
  230.         if ($temploc == $_phpDocumentor_options['Program_Root'PATH_DELIMITER$temploc .= $path;
  231.         
  232.         $this->source_location = $source_location $temploc;
  233.         $page->setSourceLocation($source_location);
  234.  
  235.         $this->publishEvent(PHPDOCUMENTOR_EVENT_PAGE,$page);
  236.         unset($page);
  237.         do
  238.         {
  239.             $lpevent $pevent;
  240.             $pevent $this->_event_stack->getEvent();
  241.             if ($lpevent != $pevent)
  242.             {
  243.                 $this->_last_pevent $lpevent;
  244.             }
  245.  
  246.             $this->publishEvent(PHPDOCUMENTOR_EVENT_NEWSTATE,($pevent 100));
  247.  
  248.             $this->_pv_last_word $word;
  249.             $word $this->_wp->getWord();
  250.             if (isset($this->_pv_findglobal&& $word == $this->_pv_findglobal)
  251.             {
  252.                 $this->_last_pevent $pevent;
  253.                 $this->_event_stack->pushEvent($pevent PARSER_EVENT_DEFINE_GLOBAL);
  254.             }
  255.             // in wordparser, have to keep track of lines
  256.             $this->publishEvent(PHPDOCUMENTOR_EVENT_NEWLINENUM$this->_wp->linenum);
  257.             if ($this->_pf_get_source)
  258.             {
  259.                 if ($word[0== T_FUNCTION)
  260.                 {
  261.                     $this->_wp->retrievesource($word);
  262.                     $this->_pf_get_source false;
  263.                     $this->_pf_getting_source true;
  264.                 }
  265.             }
  266.  
  267.             if (0)//PHPDOCUMENTOR_DEBUG == true)
  268.             {
  269.                 echo "LAST: ";
  270.                 if (is_array($this->_pv_last_word))
  271.                 {
  272.                     echo token_name($this->_pv_last_word[0])' => |'.htmlspecialchars($this->_pv_last_word[1]);
  273.                 else echo "|" $this->_pv_last_word;
  274.                 echo "|\n";
  275.                 echo "PEVENT: " $this->getParserEventName($pevent"\n";
  276.                 echo "LASTPEVENT: " $this->getParserEventName($this->_last_pevent"\n";
  277.                 echo $this->_wp->getPos(": ";
  278.                 if (is_array($word))
  279.                 {
  280.                     echo token_name($word[0]).' => |'.htmlspecialchars($word[1]);
  281.                 else echo '|'.htmlspecialchars($word);
  282.                 echo "|\n-------------------\n\n\n";
  283.             }
  284.             if (0)//$this->_pf_getting_source && ($pevent == PARSER_EVENT_DOCBLOCK) || ($pevent == PARSER_EVENT_NOEVENTS))
  285.             {
  286.                 addError(PDERROR_SOURCE_TAG_FUNCTION_NOT_FOUND);
  287.                 // throw away source
  288.                 $this->_wp->getSource();
  289.             }
  290.             if (isset($this->eventHandlers[$pevent]))
  291.             {
  292.                 $handle $this->eventHandlers[$pevent];
  293.                 $this->$handle($word$pevent);
  294.             else
  295.             {
  296.                 debug('WARNING: possible error, no handler for event number '.$pevent);
  297.                 if ($endrecur++ == 25)
  298.                 {
  299.                     die("FATAL ERROR, recursion limit reached");
  300.                 }
  301.             }
  302.         while (!($word === false));
  303.     }
  304.  
  305.     /**#@+
  306.      * @access private
  307.      */
  308.     /**
  309.      * handler for COMMENT
  310.      */
  311.     function handleComment($word$pevent)
  312.     {
  313.         $this->_wp->backupPos();
  314.         $this->_event_stack->popEvent();
  315.     }
  316.     /**
  317.      * handler for PHPCODE.
  318.      * this handler recognizes the <code><?</code> php processor directive, and begins parsing php code
  319.      */
  320.     
  321.     function handlePhpCode($word$pevent)
  322.     {
  323.         $e $this->checkEventPush$word$pevent);
  324.         if (isset($this->_pv_findglobal&& $e)
  325.         {
  326.             if ($e != PARSER_EVENT_DEFINE_GLOBAL && $e != PARSER_EVENT_ARRAY && $e != PARSER_EVENT_QUOTE && $e != PARSER_EVENT_SINGLEQUOTE && $e != PARSER_EVENT_COMMENT && $e != PARSER_EVENT_COMMENTBLOCK)
  327.             {
  328.                 addError(PDERROR_GLOBAL_NOT_FOUND,$this->_pv_findglobal);
  329.                 $this->_wp->findGlobal(false);
  330.                 unset($this->_pv_findglobal);
  331.             }
  332.         }
  333.     }
  334.     
  335.     /**
  336.      * handler for FUNC_GLOBAL.
  337.      * this handler recognizes "global $var1, $var2" declarations in a function, and parses them
  338.      */
  339.     
  340.     function handleFuncGlobal($word$pevent)
  341.     {
  342.         if ($this->checkEventPop($word$pevent))
  343.         {
  344.             return;
  345.         }
  346.         if (!$this->checkEventPush($word$pevent))
  347.         {
  348.             if ($word == ',')
  349.             // another variable
  350.                 $this->_pv_global_count++;
  351.             else
  352.             {
  353.                 if (!isset($this->_pv_globals[$this->_pv_global_count]))
  354.                 $this->_pv_globals[$this->_pv_global_count'';
  355. //                if (!empty($this->_pv_globals[$this->_pv_global_count])) $this->_pv_global_count++;
  356.                 if (is_array($word)) $word $word[1];
  357.                 $this->_pv_globals[$this->_pv_global_count.= $word;
  358.             }
  359.         }
  360.     }
  361.     
  362.     /**
  363.      * handler for STATIC_VAR.
  364.      * this handler recognizes "static $var1, $var2 = 6" declarations in a function, and parses them
  365.      */
  366.     
  367.     function handleStaticVar($word$pevent)
  368.     {
  369.         if ($this->checkEventPop($word$pevent))
  370.         {
  371.             $this->_pv_static_count++;
  372.             return;
  373.         }
  374.         if (!$this->checkEventPush($word$pevent))
  375.         {
  376.             if ($word == ',')
  377.             {
  378.                 $this->_pv_static_count++;
  379.                 return;
  380.             }
  381.             if (!isset($this->_pv_statics[$this->_pv_static_count]))
  382.             $this->_pv_statics[$this->_pv_static_count'';
  383.             if (!empty($this->_pv_statics[$this->_pv_static_count])) $this->_pv_static_count++;
  384.             if (is_array($word)) $word $word[1];
  385.             $this->_pv_statics[$this->_pv_static_count$word;
  386.         }
  387.     }
  388.     
  389.     /**
  390.      * handler for STATIC_VAR_VALUE.
  391.      * this handler parses the 6 in "static $var1, $var2 = 6"
  392.      */
  393.     
  394.     function handleStaticValue($word$pevent)
  395.     {
  396.         if ($this->checkEventPush($word$pevent))
  397.         {
  398.             return;
  399.         }
  400.         if (!isset($this->_pv_static_val[$this->_pv_static_count])) $this->_pv_static_val[$this->_pv_static_count'';
  401.         if ($this->_last_pevent == PARSER_EVENT_QUOTE)
  402.         {
  403.             $this->_pv_static_val[$this->_pv_static_count.= $this->_pv_quote_data;
  404.             unset($this->_pv_quote_data);
  405.         }
  406.         if ($this->_last_pevent == PARSER_EVENT_ARRAY)
  407.         {
  408.             $this->_pv_static_val[$this->_pv_static_count.= $this->_pv_function_data;
  409.             $this->_pv_function_data '';
  410.         }
  411.         if ($this->checkEventPop($word$pevent))
  412.         {
  413.             $this->_pv_static_val[$this->_pv_static_counttrim($this->_pv_static_val[$this->_pv_static_count]);
  414.             $this->_wp->backupPos($word);
  415.             return;
  416.         else
  417.         {
  418.             if (is_array($word)) $word $word[1];
  419.             $this->_pv_static_val[$this->_pv_static_count.= $word;
  420.         }
  421.     }
  422.     
  423.     /**
  424.      * handler for LOGICBLOCK
  425.      *
  426.      * Logic Blocks are the stuff between { and } in a function/method.  A
  427.      * logic block can clearly contain other logic blocks, as in:
  428.      *
  429.      * <code>
  430.      * function test($a)
  431.      * {
  432.      *    if (testcondition)
  433.      *    { // nested logic block
  434.      *    }
  435.      * }
  436.      * </code>
  437.      *
  438.      * So, the exit portion of the logic block handler must check to see if the
  439.      * logic block being exited is the top-level, and it does this by retrieving
  440.      * the last event from the stack.  If it is a function (and not a logic block)
  441.      * then it backs up the word parser so that the function will exit properly.
  442.      *
  443.      * {@source 11}
  444.      */
  445.     
  446.     function handleLogicBlock($word$pevent)
  447.     {
  448.         $a $this->checkEventPush$word$pevent);
  449.         if ($this->checkEventPop($word,$pevent))
  450.         {
  451.             $e $this->_event_stack->popEvent();
  452.             $this->_event_stack->pushEvent($e);
  453.             if ($e == PARSER_EVENT_FUNCTION)
  454.             {
  455.                 $this->_wp->backupPos()
  456.             }
  457.         }
  458.     }
  459.     
  460.     /**
  461.      * handler for FUNCTION.
  462.      * this handler recognizes function declarations, and parses them.  The body
  463.      * of the function is parsed by handleLogicBlock()
  464.      * @see handleLogicBlock()
  465.      */
  466.     
  467.     function handleFunction($word$pevent)
  468.     {
  469.         if ($e $this->checkEventPush$word$pevent))
  470.         {
  471.             $this->_pv_function_data '';
  472.             if ($e == PARSER_EVENT_FUNCTION_PARAMS && !is_object($this->_pv_func))
  473.             {
  474.                 addErrorDie(PDERROR_FUNCTION_HAS_NONAME);
  475.             }
  476.             if ($e == PARSER_EVENT_COMMENT || $e == PARSER_EVENT_COMMENTBLOCK || $e == PARSER_EVENT_FUNCTION_PARAMS || $e == PARSER_EVENT_LOGICBLOCKreturn;
  477.         }
  478.     
  479.         if (!isset($this->_pv_func)) $this->_pv_func false;
  480.         if (is_object($this->_pv_func)) 
  481.         {
  482.             $this->_pv_globals array();
  483.             $this->_pv_global_count $this->_pv_static_count 0;
  484.             if ($this->_pf_in_class)
  485.             {
  486.                 $this->_pv_func new parserMethod($this->_pv_cur_class)
  487.             else
  488.             {
  489.                 $this->_pv_func new parserFunction;
  490.                 unset($this->_accessModifiers);
  491.             }
  492.             if (isset($this->_accessModifiers))
  493.             {
  494.                 $this->_pv_func->setModifiers($this->_accessModifiers);
  495.                 unset($this->_accessModifiers);
  496.             }
  497.             $this->_pv_func->setLineNumber($this->_wp->linenum 1);
  498.             if (is_string($word&& $word == '&')
  499.             $this->_pv_func->setReturnsReference();
  500.             if (is_array($word&& $word[0== T_STRING)
  501.             $this->_pv_func->setName($word[1]);
  502.         else
  503.         {
  504.             if ($this->_pv_func->getReturnsReference())
  505.             {
  506.                 if (is_array($word&& $word[0== T_STRING)
  507.                 {
  508.                     $this->_pv_func->setName($word[1]);
  509.                 }
  510.             }
  511.         }
  512.         if ($this->checkEventPop($word,$pevent)) 
  513.         {
  514.             $this->_pv_func->setEndLineNumber($this->_wp->linenum 1);
  515.             $this->_pv_func->addGlobals($this->_pv_globals);
  516.             $this->_pv_func->addStatics($this->_pv_statics,$this->_pv_static_val);
  517.             $this->_pv_globals array();
  518.             $this->_pv_global_count 0;
  519.             if ($this->_pf_getting_source)
  520.             {
  521.                 $x $this->_wp->getSource();
  522.                 $this->_pv_func->addSource($x);
  523.                 $this->_pf_get_source false;
  524.                 $this->_pf_getting_source false;
  525.             }
  526.             $this->publishEvent(PHPDOCUMENTOR_EVENT_FUNCTION,$this->_pv_func)
  527.             $this->_pv_func false
  528.             unset($this->_pv_quote_data)// subtle bug fixed by this, sometimes string
  529.                                           // from function body was picked up
  530.                                           // by the next function as a default value
  531.                                           // for a parameter!
  532.         
  533.     }
  534.  
  535.     /**
  536.      * Helper function for {@link handleFunctionParams()}
  537.      *
  538.      * This function adds a new parameter to the parameter list
  539.      */
  540.     function endFunctionParam($word)
  541.     {
  542.         if (isset($this->_pv_quote_data))
  543.         {
  544.             $this->_pv_function_data .= $this->_pv_quote_data;
  545.             unset($this->_pv_quote_data);
  546.         }
  547.         if (isset($this->_pv_function_param))
  548.         {
  549.             $this->_pv_func->addParam($this->_pv_function_param,$this->_pv_function_data,
  550.                 $this->_pf_funcparam_val$this->_pv_function_param_type);
  551.             unset($this->_pv_function_param);
  552.             $this->_pv_function_data '';
  553.             $this->_pf_funcparam_val false;
  554.             $this->_pv_function_param_type null;
  555.         }
  556.     }
  557.     /**
  558.      * handler for FUNCTION_PARAMS.
  559.      * this handler recognizes the parameters of a function within parentheses like function(param, param = default_value)
  560.      * and parses them
  561.      * @see endFunctionParam()
  562.      */
  563.     
  564.     function handleFunctionParams($word$pevent)
  565.     {
  566.         //echo $this->_wp->getPos() . ": word=|$word|\t\t\tlastword=|".$this->_pv_last_word."|\n";
  567.         //echo "function_param = '".$this->_pv_function_param."'\n";
  568.         //echo "function_data = '".$this->_pv_function_data."'\n";
  569.         $e1 $this->checkEventPush($word$pevent)
  570.  
  571.         if (!$e1)
  572.         {
  573.             if (($pop $this->checkEventPop($word,$pevent)) && $pevent == PARSER_EVENT_FUNCTION_PARAM_VAR)
  574.             // end of [typehint ]$param[= defaultval]
  575.                 if (is_string($word&& $word == ')'{
  576.                     $this->_wp->backupPos();
  577.                 }
  578.                 $this->endFunctionParam($word);
  579.             elseif ($word == '=')
  580.             // about to parse the default value
  581.                 $this->_pf_funcparam_val true;
  582.             else
  583.             {
  584.                 if ($this->_pf_funcparam_val)
  585.                 // parsing default value
  586.                     if (isset($this->_pv_quote_data))
  587.                     {
  588.                         $this->_pv_function_data .= $this->_pv_quote_data;
  589.                         unset($this->_pv_quote_data);
  590.                     }
  591.                     if (is_array($word)) $word $word[1];
  592.                     $this->_pv_function_data .= $word;
  593.                 else
  594.                 // pre-param
  595.                     if ($pop{
  596.                         return;
  597.                     }
  598.                     if (!isset($this->_pv_function_param)) $this->_pv_function_param '';
  599.                     if (is_array($word&& $pevent == PARSER_EVENT_FUNCTION_PARAMS)
  600.                     {
  601.                         if ($word[0== T_STRING || $word[0== T_ARRAY)
  602.                         // object or array type hint
  603.                             $this->_pv_function_param_type $word[1];
  604.                             return;
  605.                         }
  606.                         $word $word[1];
  607.                     }
  608.                     $this->_pv_function_param .= $word;
  609.                 }
  610.             }
  611.         elseif ($e1 == PARSER_EVENT_ARRAY)
  612.         {
  613.             $this->_wp->setWhiteSpace(true);
  614.         elseif ($e1 == PARSER_EVENT_FUNCTION_PARAM_VAR{
  615.             if (!isset($this->_pv_function_param)) $this->_pv_function_param '';
  616.             // we just got the $var part of the param
  617.             $this->_pv_function_param .= $word[1];
  618.         }
  619.     }
  620.  
  621.     /**
  622.      * handler for ARRAY.
  623.      * this event handler parses arrays in default values of function and var definitions
  624.      */
  625.     
  626.     function handleArray($word$pevent)
  627.     {
  628.         $e $this->checkEventPush$word$pevent);
  629.         if ($ereturn;
  630.  
  631.         if (!isset($this->_pv_function_data|| (isset($this->_pv_function_data&& empty($this->_pv_function_data)))
  632.         {
  633.             $this->_pv_function_data "array";
  634.         }
  635.  
  636.         if ($word == '(' && $this->_pv_paren_count++)
  637.         // need extra parentheses help
  638.             $this->_event_stack->pushEvent($pevent);
  639.         }
  640.         if (is_array($word))
  641.         {
  642.             $this->_pv_function_data .= $word[1];
  643.         else
  644.         $this->_pv_function_data .= $word;
  645.         //echo "function_data = |$this->_pv_function_data|\n";
  646.  
  647.         if ($this->checkEventPop($word,$pevent))
  648.         {
  649.             $this->_pv_paren_count--;
  650.             $this->_wp->setWhiteSpace(false);
  651.         }
  652.     }
  653.     
  654.     /**
  655.      * handler for HEREDOC in a function logic block.
  656.      * this handler recognizes function declarations, and parses them.  The body
  657.      * of the function is parsed by handleLogicBlock()
  658.      * @see handleLogicBlock()
  659.      */
  660.     
  661.     function handleHereDoc($word$pevent)
  662.     {
  663.         if (is_array($this->_pv_last_word&& $this->_pv_last_word[0== T_START_HEREDOC)
  664.         {
  665.             $save $word;
  666.             if (is_array($word)) $word $word[1];
  667.             $this->_pv_quote_data $this->_pv_last_word[1$word;
  668.             $this->_pf_quote_active true;
  669.         elseif (!$this->_pf_quote_active)
  670.         {
  671.             $this->_pv_quote_data $this->_pv_last_word[1];
  672.             $this->_event_stack->popEvent();
  673.             $this->_wp->backupPos();
  674.             return;
  675.         }
  676.         $save $word;
  677.         if (is_array($word)) $word $word[1];
  678.         $this->_pv_quote_data .= $word;
  679.         if ($this->checkEventPop($save$pevent))
  680.         {
  681.             $this->_pf_quote_active false;
  682.         }
  683.     }
  684.  
  685.     /**
  686.      * handler for QUOTE.
  687.      * this handler recognizes strings defined with double quotation marks (")
  688.      * and single quotation marks and handles them correctly
  689.      * in any place that they legally appear in php code
  690.      */
  691.     
  692.     function handleQuote($word$pevent)
  693.     {
  694.         if ($this->_pv_last_word == '"' || $this->_pv_last_word == "'" && $this->_last_pevent != PARSER_EVENT_QUOTE)
  695.         {
  696.             $save $word;
  697.             if (is_array($word)) $word $word[1];
  698.             $this->_pv_quote_data $this->_pv_last_word $word;
  699.             $this->_pf_quote_active true;
  700.             $this->checkEventPop($save$pevent);
  701.         elseif (!$this->_pf_quote_active)
  702.         {
  703.             $this->_pv_quote_data $this->_pv_last_word[1];
  704.             $this->_event_stack->popEvent();
  705.             $this->_wp->backupPos();
  706.             return;
  707.         }
  708.         $save $word;
  709.         if (is_array($word)) $word $word[1];
  710.         $this->_pv_quote_data .= $word;
  711.         if ($this->checkEventPop($save$pevent))
  712.         {
  713.             $this->_pf_quote_active false;
  714.         }
  715.     }
  716.  
  717.     /**
  718.      * handler for INCLUDE.
  719.      * this handler recognizes include/require/include_once/include_once statements, and publishes the
  720.      * data to Render
  721.      */
  722.     
  723.     function handleInclude($word$pevent)
  724.     {
  725.         if (!$this->_pf_in_include)
  726.         {
  727.             $this->_pv_linenum $this->_wp->linenum;
  728.         }
  729.         $this->_pf_in_include true;
  730.         $a $this->checkEventPush$word$pevent);
  731.         if (!$this->_pf_includename_isset)
  732.         {
  733.             $this->_pf_includename_isset true;
  734.             $w $this->_pv_last_word;
  735.             if (is_array($w)) $w $w[1];
  736.             $this->_pv_include_name $w;
  737.             if ($a)
  738.             $this->_pv_include_value '';
  739.             else
  740.             {
  741.                 if (is_array($word)) $word $word[1];
  742.                 $this->_pv_include_value $word;
  743.             }
  744.             unset($this->_pv_quote_data);
  745.         else
  746.         {
  747.             if (!$a)
  748.             {
  749.                 if (empty($this->_pv_include_params_data))
  750.                 {
  751.                     if ($word != ';')
  752.                     {
  753.                         if (is_array($word)) $word $word[1];
  754.                         $this->_pv_include_value .= $word;
  755.                     }
  756.                 }
  757.             else
  758.             {
  759.                 $this->_pv_include_params_data '';
  760.             }
  761.         }
  762.  
  763.         if ($this->checkEventPop($word,$pevent))
  764.         {
  765.             $this->_pv_include new parserInclude;
  766.             $this->_pv_include->setLineNumber($this->_pv_linenum 1);
  767.             $this->_pf_in_include false;
  768.             $this->_pv_include->setName($this->_pv_include_name);
  769.             $this->_pv_include->setValue($this->_pv_include_value);
  770.             $this->publishEvent(PHPDOCUMENTOR_EVENT_INCLUDE,$this->_pv_include);
  771.             $this->_pf_includename_isset false;
  772.             unset($this->_pv_include);
  773.             unset($this->_pv_include_name);
  774.             unset($this->_pv_include_value);
  775.             unset($this->_pv_include_params_data);
  776.         elseif ($this->_last_pevent == PARSER_EVENT_INCLUDE_PARAMS{
  777.             // include is part of a larger statement
  778.             // force ending of include
  779.             $this->_event_stack->popEvent();
  780.             $this->_pv_include new parserInclude;
  781.             $this->_pv_include->setLineNumber($this->_pv_linenum 1);
  782.             $this->_pf_in_include false;
  783.             $this->_pv_include->setName($this->_pv_include_name);
  784.             $this->_pv_include->setValue($this->_pv_include_value);
  785.             $this->publishEvent(PHPDOCUMENTOR_EVENT_INCLUDE,$this->_pv_include);
  786.             $this->_pf_includename_isset false;
  787.             unset($this->_pv_include);
  788.             unset($this->_pv_include_name);
  789.             unset($this->_pv_include_value);
  790.             unset($this->_pv_include_params_data);
  791.         }
  792.     }
  793.     
  794.     /**
  795.      * handler for INCLUDE_PARAMS.
  796.      * this handler parses the contents of ( ) in include/require/include_once/include_once statements
  797.      */
  798.     
  799.     function handleIncludeParams($word$pevent)
  800.     {
  801.         $e $this->checkEventPush$word$pevent);
  802.         if ($e == PARSER_EVENT_COMMENTreturn;
  803.         
  804.         if(!isset($this->_pv_include_params_data)) $this->_pv_include_params_data '';
  805.         
  806.         if ($this->checkEventPop($word,$pevent))
  807.         {
  808.             if (!empty($this->_pv_include_params_data))
  809.             $this->_pv_include_value $this->_pv_include_params_data;
  810.             else
  811.             {
  812.                 $w $this->_pv_last_word;
  813.                 if (is_array($w)) $w $w[1];
  814.                 $this->_pv_include_value $w;
  815.             }
  816.         }
  817.         if (is_array($word)) $word $word[1];
  818.         $this->_pv_include_params_data .= $word;
  819.     }
  820.     
  821.     /**
  822.      * handler for INCLUDE_PARAMS_PARENTHESIS.
  823.      * this handler takes all parenthetical statements within file in:
  824.      * include statement include(file), and handles them properly
  825.      */
  826.     
  827.     function handleIncludeParamsParenthesis($word$pevent)
  828.     {
  829.         $this->checkEventPush$word$pevent);
  830.         $this->checkEventPop$word$pevent);
  831.         if (is_array($word)) $word $word[1];
  832.         $this->_pv_include_params_data .= $word;
  833.     }
  834.  
  835.     /**
  836.      * handler for DEFINE.
  837.      * handles define(constant, value); statements
  838.      */
  839.     
  840.     function handleDefine($word$pevent)
  841.     {
  842.         if (!$this->_pf_in_define)
  843.         {
  844.             $this->_pv_linenum $this->_wp->linenum 1;
  845.         }
  846.         $this->_pf_in_define true;
  847.         $this->checkEventPush$word$pevent);
  848.  
  849.         $this->_pf_definename_isset false;
  850.         $this->_pv_define_params_data '';
  851.         unset($this->_pv_quote_data);
  852.         if ($this->checkEventPop($word,$pevent))
  853.         {
  854.             $this->_pf_in_define false;
  855.             $this->_pv_define new parserDefine;
  856.             $this->_pv_define->setLineNumber($this->_pv_linenum);
  857.             $this->_pv_define->setName($this->_pv_define_name);
  858.             $this->_pv_define->setValue($this->_pv_define_value);
  859.             $this->publishEvent(PHPDOCUMENTOR_EVENT_DEFINE,$this->_pv_define);
  860.             $this->_pf_definename_isset false;
  861.             unset($this->_pv_define);
  862.             unset($this->_pv_define_name);
  863.             unset($this->_pv_define_value);
  864.             $this->_pf_in_define false;
  865.             $this->_pv_define_params_data '';
  866.         }
  867.     }
  868.     
  869.     /**
  870.      * handler for DEFINE_PARAMS.
  871.      * handles the parsing of constant and value in define(constant, value);
  872.      */
  873.     
  874.     function handleDefineParams($word$pevent)
  875.     {
  876.         $e $this->checkEventPush$word$pevent);
  877.         if ($e && $e != PARSER_EVENT_DEFINE_PARAMS_PARENTHESISreturn;
  878.         
  879.         if(!isset($this->_pv_define_params_data)) $this->_pv_define_params_data '';
  880.         
  881.         if ($this->checkEventPop($word,$pevent))
  882.         {
  883.             if ($this->_last_pevent == PARSER_EVENT_QUOTE ||
  884.                 $this->_last_pevent == PARSER_EVENT_EOFQUOTE)
  885.             {
  886.                 $this->_pv_define_params_data .= $this->_pv_quote_data;
  887.                 unset($this->_pv_quote_data);
  888.             }
  889.             if (is_array($word)) $word $word[1];
  890.             if (!empty($this->_pv_define_params_data))
  891.             {
  892.                 //echo $this->_pv_define_params_data."\n";
  893.                 $this->_pv_define_value $this->_pv_define_params_data;
  894.             }
  895.             else
  896.             {
  897.                 $w $this->_pv_last_word;
  898.                 if (is_array($this->_pv_last_word)) $w $this->_pv_last_word[1];
  899.                 if (!empty($w))
  900.                 {
  901.                     $this->_pv_define_value $w;
  902.                 }
  903.                 else
  904.                 {
  905.                     $this->_pv_define_value "";
  906.                     switch ($w{
  907.                         case 0:
  908.                         $this->_pv_define_value "0";
  909.                         break;
  910.                         case null:
  911.                         $this->_pv_define_value "null";
  912.                         break;
  913.                         case "":
  914.                         $this->_pv_define_value "";
  915.                         break;
  916.                     }
  917.                 }
  918.             }
  919.         }
  920.         if ($this->_pf_definename_isset)
  921.         {
  922.             if (is_array($word)) $word $word[1];
  923.             $this->_pv_define_params_data .= $word;
  924.         else
  925.         {
  926.             if ($word != ",")
  927.             {
  928.                 if (is_array($word)) $word $word[1];
  929.                 $this->_pv_define_params_data .= $word;
  930.             else
  931.             {
  932.                 if (substr($this->_pv_define_params_data,0,1==
  933.                     substr($this->_pv_define_params_data,strlen($this->_pv_define_params_data1&&
  934.                     in_array(substr($this->_pv_define_params_data,0,1),array('"',"'")))
  935.                 // remove leading and ending quotation marks if there are only two
  936.                     $a substr($this->_pv_define_params_data,0,1);
  937.                     $b substr($this->_pv_define_params_data,1,strlen($this->_pv_define_params_data2);
  938.                     if (strpos($b,$a=== false)
  939.                     {
  940.                         $this->_pv_define_params_data $b;
  941.                     }
  942.                 }
  943.                 $this->_pf_definename_isset true;
  944.                 $this->_pv_define_name $this->_pv_define_params_data;
  945.                 $this->_pv_define_params_data '';
  946.             }
  947.         }
  948.     }
  949.     
  950.     /**
  951.      * handler for DEFINE_PARAMS_PARENTHESIS.
  952.      * this handler takes all parenthetical statements within constant or value in:
  953.      * define(constant, value) of a define statement, and handles them properly
  954.      */
  955.     
  956.     function handleDefineParamsParenthesis($word$pevent)
  957.     {
  958.         $e $this->checkEventPush$word$pevent);
  959.         $this->checkEventPop$word$pevent);
  960.         if ($this->_last_pevent == PARSER_EVENT_QUOTE)
  961.         {
  962.             $this->_pv_define_params_data .= $this->_pv_quote_data;
  963.             unset($this->_pv_quote_data);
  964.         }
  965.         if (is_array($word)) $word $word[1];
  966.         $this->_pv_define_params_data .= $word;
  967.     }
  968.  
  969.     /**
  970.      * handler for IMPLEMENTS.
  971.      * this handler parses a class statement's implements clause (PHP 5)
  972.      */
  973.     
  974.     function handleImplements($word$pevent)
  975.     {
  976.         if ($this->checkEventPop($word$pevent))
  977.         {
  978.             $this->_wp->backupPos();
  979.             return;
  980.         }
  981.         if (is_array($word&& $word[0== T_STRING)
  982.         {
  983.             $this->_pv_class->addImplements($word[1]);
  984.         }
  985.     }
  986.  
  987.     /**
  988.      * handler for ACCESS_MODIFIER.
  989.      * this handler parses public/private/protected/static/abstract PHP 5 modifiers
  990.      */
  991.     
  992.     function handleAccessModifier($word$pevent)
  993.     {
  994.         if (!isset($this->_accessModifiers))
  995.         {
  996.             $this->_accessModifiers array();
  997.         }
  998.         $this->_wp->backupPos();
  999.         $this->_event_stack->popEvent();
  1000.         if ($word[0== T_VARIABLE{
  1001.             // this is a PHP5-style variable with no "var"
  1002.             $this->_event_stack->pushEvent(PARSER_EVENT_VAR);
  1003.         }
  1004.         $this->_accessModifiers[strtolower($this->_pv_last_word[1]);
  1005.     }
  1006.  
  1007.     /**
  1008.      * handler for CLASS.
  1009.      * this handler parses a class/interface statement
  1010.      */
  1011.     
  1012.     function handleClass($word$pevent)
  1013.     {
  1014.         if (!$this->_pf_in_class)
  1015.         {
  1016.             $this->_pf_in_class true;
  1017.             if ($this->_pv_last_word[0== T_INTERFACE)
  1018.             {
  1019.                 $this->_pf_interface true;
  1020.             else
  1021.             {
  1022.                 $this->_pf_interface false;
  1023.             }
  1024.         }
  1025.         $a $this->checkEventPush$word$pevent);
  1026.  
  1027.         if (!isset($this->_pv_class)) $this->_pv_class false;
  1028.         if (!is_subclass_of($this->_pv_class,"parserBase"))
  1029.         {
  1030.             $this->_pv_class new parserClass;
  1031.             if (isset($this->_accessModifiers))
  1032.             {
  1033.                 $this->_pv_class->setModifiers($this->_accessModifiers);
  1034.                 unset($this->_accessModifiers);
  1035.             }
  1036.             if ($this->_pf_interface)
  1037.             {
  1038.                 $this->_pv_class->setInterface();
  1039.             }
  1040.             $this->_pv_class->setLineNumber($this->_wp->linenum 1);
  1041.             $this->_pv_class->setname($word[1]);
  1042.             $this->_pv_cur_class $word[1];
  1043.             $this->_pv_class->setSourceLocation($this->source_location);
  1044.         }
  1045.  
  1046.         if (is_array($this->_pv_last_word&& $this->_pv_last_word[0== T_EXTENDS)
  1047.         {
  1048.             // I don't know why I am so nice, this fixes 1150809
  1049.             if ($word[1== $this->_pv_class->getName()) {
  1050.                 addErrorDie(PDERROR_CANNOT_EXTEND_SELF$word[1]);
  1051.             }
  1052.             $this->_pv_class->setExtends($word[1]);
  1053.         }
  1054.  
  1055.         if ($word == "{")
  1056.         {
  1057.             $this->publishEvent(PHPDOCUMENTOR_EVENT_CLASS,$this->_pv_class);
  1058.         }
  1059.         //echo $this->wp->getPos() . ": |$word|\n";
  1060.         if ($this->checkEventPop($word,$pevent))
  1061.         {
  1062.             $this->_pv_class->setEndLineNumber($this->_wp->linenum 1);
  1063.             $this->_pf_in_class $this->_pf_interface false;
  1064.             // throw an event when class is done
  1065.             $this->_pv_class false;
  1066.         }
  1067.     }
  1068.     
  1069.     /**
  1070.      * handler for VAR_ARRAY_COMMENT
  1071.      * if parsing a default value, add the comment to the text
  1072.      */
  1073.     function handleVarArrayComment($word$pevent)
  1074.     {
  1075.         $this->_pv_function_data .= $this->_pv_last_word[1];
  1076.         return $this->handleComment($word$pevent);
  1077.     }
  1078.  
  1079.     /**
  1080.      * handler for VAR.
  1081.      * handle a var $varname = default_value; or var $varname; statement in a class definition
  1082.      */
  1083.     
  1084.     function handleVar($word$pevent)
  1085.     {
  1086.         if (!$this->_pf_in_var)
  1087.         {
  1088.             $this->_pf_set_var_value false;
  1089.             $this->_pv_var_value '';
  1090.             $this->_pv_linenum $this->_wp->linenum 1;
  1091.         }
  1092.         $this->_pf_in_var true;
  1093.         //echo $word."\n";
  1094.         $e $this->checkEventPush$word$pevent);
  1095.         
  1096.         if (!isset($this->_pv_var)) $this->_pv_var false;
  1097.         if ($word == '=' || $word == ';' || $word == ',')
  1098.         {
  1099.             $this->_wp->setWhitespace(true);
  1100.             $this->_pf_var_equals true;
  1101.             $this->_pv_var new parserVar($this->_pv_cur_class);
  1102.             $this->_pv_var->setName($this->_pv_varname);
  1103.         }
  1104.         if ($this->_last_pevent == PARSER_EVENT_VAR_ARRAY)
  1105.         {
  1106.             if (isset($this->_pv_function_data))
  1107.             $this->_pv_var->setValue($this->_pv_function_data);
  1108.             $this->_pf_set_var_value true;
  1109.             unset($this->_pv_function_data);
  1110.         elseif ($this->_pf_var_equals && $word != ';' && $word != '=' && $word != ',' && !$e)
  1111.         {
  1112.             if (is_array($word)) $word $word[1];
  1113.             $this->_pv_var_value .= $word;
  1114.         }
  1115.         if ($word == ',')
  1116.         {
  1117.             if (!$this->_pf_set_var_value)
  1118.             $this->_pv_var->setValue($this->_pv_var_value);
  1119.             $this->_pf_set_var_value false;
  1120.             unset($this->_pv_var_value);
  1121.             $this->_pv_var->setEndLineNumber($this->_wp->linenum 1);
  1122.             $this->_pv_var->setLineNumber($this->_pv_linenum);
  1123.             if (isset($this->_accessModifiers))
  1124.             {
  1125.                 $this->_pv_var->setModifiers($this->_accessModifiers);
  1126.             }
  1127.             $this->publishEvent(PHPDOCUMENTOR_EVENT_VAR,$this->_pv_var);
  1128.             unset($this->_pv_var);
  1129.             $this->_pf_in_var false;
  1130.             $this->_pf_var_equals false;
  1131.             $this->_pv_varname '';
  1132.             return;
  1133.         }
  1134.         if ($this->checkEventPop($word,$pevent))
  1135.         {
  1136.             $this->_wp->setWhitespace(false);
  1137.             if (!$this->_pf_set_var_value)
  1138.             $this->_pv_var->setValue($this->_pv_var_value);
  1139.             $this->_pf_set_var_value false;
  1140.             unset($this->_pv_var_value);
  1141.             $this->_pv_var->setEndLineNumber($this->_wp->linenum 1);
  1142.             $this->_pv_var->setLineNumber($this->_pv_linenum);
  1143.             if (isset($this->_accessModifiers))
  1144.             {
  1145.                 $this->_pv_var->setModifiers($this->_accessModifiers);
  1146.                 unset($this->_accessModifiers);
  1147.             }
  1148.             $this->publishEvent(PHPDOCUMENTOR_EVENT_VAR,$this->_pv_var);
  1149.             unset($this->_pv_var);
  1150.             $this->_pf_in_var false;
  1151.             $this->_pf_var_equals false;
  1152.             $this->_pv_varname '';
  1153.             return;
  1154.         }
  1155.         if ($word[0== T_VARIABLE)
  1156.         {
  1157.             $this->_pv_varname $word[1];
  1158.         }
  1159.  
  1160.     }
  1161.  
  1162.     /**
  1163.      * handler for CLASS_CONSTANT.
  1164.      * handle a const constname = default_value; statement in a class definition
  1165.      */
  1166.     
  1167.     function handleClassConstant($word$pevent)
  1168.     {
  1169.         if (!$this->_pf_in_const)
  1170.         {
  1171.             $this->_pf_set_const_value false;
  1172.             $this->_pv_const_value '';
  1173.             $this->_pv_linenum $this->_wp->linenum 1;
  1174.         }
  1175.         $this->_pf_in_const true;
  1176.         //echo $word."\n";
  1177.         $e $this->checkEventPush$word$pevent);
  1178.         
  1179.         if (!isset($this->_pv_const)) $this->_pv_const false;
  1180.         if ($word == '=' || $word == ';' || $word == ',')
  1181.         {
  1182.             $this->_wp->setWhitespace(true);
  1183.             $this->_pf_const_equals true;
  1184.             $this->_pv_const new parserConst($this->_pv_cur_class);
  1185.             $this->_pv_const->setName($this->_pv_constname);
  1186.         }
  1187.         if ($this->_last_pevent == PARSER_EVENT_VAR_ARRAY)
  1188.         {
  1189.             if (isset($this->_pv_function_data))
  1190.             $this->_pv_const->setValue($this->_pv_function_data);
  1191.             $this->_pf_set_const_value true;
  1192.             unset($this->_pv_function_data);
  1193.         elseif ($this->_pf_const_equals && $word != ';' && $word != '=' && $word != ',' && !$e)
  1194.         {
  1195.             if (is_array($word)) $word $word[1];
  1196.             $this->_pv_const_value .= $word;
  1197.         }
  1198.         if ($word == ',')
  1199.         {
  1200.             if (!$this->_pf_set_const_value)
  1201.             {
  1202.                 $this->_pv_const->setValue($this->_pv_const_value);
  1203.             }
  1204.             $this->_pf_set_const_value false;
  1205.             unset($this->_pv_const_value);
  1206.             $this->_pv_const->setEndLineNumber($this->_wp->linenum 1);
  1207.             $this->_pv_const->setLineNumber($this->_pv_linenum);
  1208.             $this->publishEvent(PHPDOCUMENTOR_EVENT_CONST,$this->_pv_const);
  1209.             unset($this->_pv_const);
  1210.             $this->_pf_in_const false;
  1211.             $this->_pf_const_equals false;
  1212.             $this->_pv_constname '';
  1213.             return;
  1214.         }
  1215.         if ($this->checkEventPop($word,$pevent))
  1216.         {
  1217.             $this->_wp->setWhitespace(false);
  1218.             if (!$this->_pf_set_const_value)
  1219.             $this->_pv_const->setValue($this->_pv_const_value);
  1220.             $this->_pf_set_const_value false;
  1221.             unset($this->_pv_const_value);
  1222.             $this->_pv_const->setEndLineNumber($this->_wp->linenum 1);
  1223.             $this->_pv_const->setLineNumber($this->_pv_linenum);
  1224.             $this->publishEvent(PHPDOCUMENTOR_EVENT_VAR,$this->_pv_const);
  1225.             unset($this->_pv_const);
  1226.             $this->_pf_in_const false;
  1227.             $this->_pf_const_equals false;
  1228.             $this->_pv_constname '';
  1229.             return;
  1230.         }
  1231.         if ($word[0== T_STRING && !$this->_pf_const_equals)
  1232.         {
  1233.             $this->_pv_constname $word[1];
  1234.         }
  1235.  
  1236.     }
  1237.     
  1238.     /**
  1239.      * Handler for the {@tutorial phpDocumentor.howto.pkg#using.command-line.javadocdesc}
  1240.      * command-line switch DocBlocks.
  1241.      */
  1242.     function JavaDochandleDocblock($word$pevent)
  1243.     {
  1244.         $this->commonDocBlock($word$pevent'handleJavaDocDesc');
  1245.     }
  1246.     
  1247.     /**
  1248.      * Handler for normal DocBlocks
  1249.      */
  1250.     function handleDocBlock($word$pevent)
  1251.     {
  1252.         $this->commonDocBlock($word$pevent'handleDesc');
  1253.     }
  1254.     
  1255.     /**
  1256.      * Common DocBlock Handler for both JavaDoc-format and normal DocBlocks
  1257.      */
  1258.     function commonDocBlock($word$pevent$deschandler)
  1259.     {
  1260.         $this->_wp->backupPos();
  1261.         $this->_event_stack->popEvent();
  1262.         $word $this->_pv_last_word[1];
  1263.         $dtype '_pv_docblock';
  1264.         if (strpos($word,'/**'!== 0)
  1265.         // not a docblock
  1266. //            $this->_wp->backupPos();
  1267.             $this->_event_stack->pushEvent(PARSER_EVENT_COMMENT);
  1268.             return;
  1269.         }
  1270.         if ($word == '/**#@-*/')
  1271.         // stop using docblock template
  1272.             unset($this->_pv_dtemplate);
  1273.             return;
  1274.         }
  1275.         if (strpos($word,'/**#@+'=== 0)
  1276.         // docblock template definition
  1277.             $dtype '_pv_dtemplate';
  1278.             // strip /**#@+ and */
  1279.             $word substr($word,6).'*';
  1280.             $word trim(substr($word,0,strlen($word3));
  1281.             if (strlen($word&& $word{0!= '*'{
  1282.                 $word "$word";
  1283.             }
  1284.         else
  1285.         {
  1286.             // strip /** and */
  1287.             $word substr($word,2);
  1288.             $word substr($word,0,strlen($word2);
  1289.         }
  1290.         $lines explode("\n",trim($word));
  1291.         $go count($lines);
  1292.         for($i=0;$i<$go;$i++)
  1293.         {
  1294.             if (substr(trim($lines[$i]),0,1!= '*'unset($lines[$i]);
  1295.             else
  1296.             $lines[$isubstr(trim($lines[$i]),1)// remove leading "* "
  1297.         }
  1298.         // remove empty lines
  1299.         $lines explode("\n",trim(join("\n",$lines)));
  1300.         for($i 0;$i<count($lines);$i++)
  1301.         {
  1302.             if (substr(trim($lines[$i]),0,1== '@' && substr(trim($lines[$i]),0,2!= '@ ')
  1303.             {
  1304.                 $tagindex $i;
  1305.                 $i count($lines);
  1306.             }
  1307.         }
  1308.         if (isset($tagindex))
  1309.         {
  1310.             $tags array_slice($lines,$tagindex);
  1311.             $desc array_slice($lines,0,$tagindex);
  1312.         else
  1313.         {
  1314.             $tags array();
  1315.             $desc $lines;
  1316.         }
  1317. //        var_dump($desc,$tags);
  1318.         $this->$dtype new parserDocBlock;
  1319.         $this->$dtype->setLineNumber($this->_wp->_docblock_linenum 1);
  1320.         $this->$dtype->setEndLineNumber($this->_wp->linenum);
  1321.         $this->_pv_dtype $dtype;
  1322.         $this->$deschandler($desc);
  1323.         $this->handleTags($tags);
  1324.         if ($dtype == '_pv_docblock')
  1325.         {
  1326.             $this->publishEvent(PHPDOCUMENTOR_EVENT_DOCBLOCK,$this->$dtype);
  1327.             $this->$dtype new parserDocBlock();
  1328.         else
  1329.         {
  1330.             $this->publishEvent(PHPDOCUMENTOR_EVENT_DOCBLOCK_TEMPLATE,$this->$dtype);
  1331.         }
  1332.     }
  1333.     
  1334.     /**
  1335.      * Handles JavaDoc descriptions
  1336.      */
  1337.     function handleJavaDocDesc($desc)
  1338.     {
  1339.         unset($this->_pv_periodline);
  1340.         $this->_pf_useperiod false;
  1341.         if (empty($desc)) {
  1342.             $desc array('');
  1343.         }
  1344.         foreach($desc as $i => $line)
  1345.         {
  1346.             $line trim($line);
  1347.             if (!isset($this->_pv_periodline&& substr($line,strlen($line1== '.')
  1348.             {
  1349.                 $this->_pv_periodline $i;
  1350.                 $this->_pf_useperiod true;
  1351.             }
  1352.         }
  1353.         if (!isset($this->_pv_periodline)) $this->_pv_periodline 0;
  1354.  
  1355.         $dtype $this->_pv_dtype;
  1356.         if ($dtype == '_pv_docblock')
  1357.         {
  1358.             $save $desc;
  1359.             // strip leading <p>
  1360.             if (strpos($desc[0],'<p>'=== 0$desc[0substr($desc[0],3);
  1361.             $sdesc new parserDesc;
  1362.             $desci '';
  1363.             for($i 0($i <= $this->_pv_periodline&& ($i count($desc))$i++)
  1364.             {
  1365.                 if (strpos($desc[$i],'.'!== false)
  1366.                 {
  1367.                     $desci .= substr($desc[$i],0,strpos($desc[$i],'.'1);
  1368.                 else
  1369.                 {
  1370.                     $desci .= $desc[$i];
  1371.                 }
  1372.                 $desci .= "\n";
  1373.             }
  1374.             $sdesc->add($this->getInlineTags($desci));
  1375.             $desc $save;
  1376.         
  1377.             $my_desc new parserDesc;
  1378.             if (isset($this->_pv_dtemplate))
  1379.             {
  1380.                 // copy template values if not overridden
  1381.                 if (!$this->_pv_docblock->getExplicitPackage())
  1382.                 {
  1383.                     if ($p $this->_pv_dtemplate->getKeyword('package'))
  1384.                     {
  1385.                         $this->_pv_docblock->addKeyword('package',$p);
  1386.                         $this->_pv_docblock->setExplicitPackage();
  1387.                     }
  1388.                     if ($p $this->_pv_dtemplate->getKeyword('category'))
  1389.                     {
  1390.                         $this->_pv_docblock->addKeyword('category',$p);
  1391.                         $this->_pv_docblock->setExplicitCategory();
  1392.                     }
  1393.                     if ($p $this->_pv_dtemplate->getKeyword('subpackage'))
  1394.                     {
  1395.                         $this->_pv_docblock->addKeyword('subpackage',$p);
  1396.                     }
  1397.                 }
  1398.                 $tags $this->_pv_dtemplate->listTags();
  1399.                 foreach($tags as $tag)
  1400.                 {
  1401.                     $this->_pv_docblock->addTag($tag);
  1402.                 }
  1403.                 if (!count($this->_pv_docblock->params)) $this->_pv_docblock->params $this->_pv_dtemplate->params;
  1404.                 $my_desc->add($this->_pv_dtemplate->desc);
  1405.             }
  1406. //            echo "i = ".$this->_pv_periodline."; i < " . count($desc) . "\n";
  1407.             $desci '';
  1408.             for($i 0$i count($desc)$i++)
  1409.             {
  1410.                 // the line will not be set if it doesn't start with a *
  1411.                 if (isset($desc[$i]))
  1412.                 {
  1413.                     $desci .= $desc[$i]."\n";
  1414.                 }
  1415.             }
  1416.             $my_desc->add($this->getInlineTags($desci));
  1417.         else
  1418.         {
  1419.             $sdesc new parserDesc;
  1420.             $save $desc;
  1421.             // strip leading <p>
  1422.             if (strpos($desc[0],'<p>'=== 0$desc[0substr($desc[0],3);
  1423.             $desci '';
  1424.             for($i 0($i <= $this->_pv_periodline&& ($i count($desc))$i++)
  1425.             {
  1426.                 if (strpos($desc[$i],'.'!== false)
  1427.                 {
  1428.                     $desci .= substr($desc[$i],0,strpos($desc[$i],'.'1);
  1429.                 else
  1430.                 {
  1431.                     $desci .= $desc[$i];
  1432.                 }
  1433.                 $desci .= "\n";
  1434.             }
  1435.             $sdesc->add($this->getInlineTags($desci));
  1436.             $desc $save;
  1437.         
  1438.             $my_desc new parserDesc;
  1439.             $desci '';
  1440.             for($i=0$i count($desc)$i++)
  1441.             {
  1442.                 if (isset($desc[$i]))
  1443.                     $desci .= $desci[$i]."\n";
  1444.             }
  1445.             $my_desc->add($this->getInlineTags($desci));
  1446.         }
  1447.         
  1448.         if ($this->_pf_internal)
  1449.         {
  1450.             addError(PDERROR_INTERNAL_NOT_CLOSED);
  1451.             $this->_pf_internal false;
  1452.         }
  1453.         $this->$dtype->setShortDesc($sdesc);
  1454.         $this->$dtype->setDesc($my_desc);
  1455.         unset($my_desc);
  1456. //        var_dump($this->$dtype);
  1457. //        exit;
  1458.     }
  1459.     
  1460.     /**
  1461.      * Process the Long Description of a DocBlock
  1462.      * @param array array of lines containing the description with leading
  1463.      *               asterisk "*" stripped off.
  1464.      */
  1465.     function handleDesc($desc)
  1466.     {
  1467.         unset($this->_pv_periodline);
  1468.         $this->_pf_useperiod false;
  1469.         foreach($desc as $i => $line)
  1470.         {
  1471.             $line trim($line);
  1472.             if (!isset($this->_pv_periodline&& substr($line,strlen($line1== '.')
  1473.             {
  1474.                 $this->_pv_periodline $i;
  1475.                 $this->_pf_useperiod true;
  1476.             }
  1477.         }
  1478.         if (!isset($this->_pv_periodline)) $this->_pv_periodline 0;
  1479.         if ($this->_pv_periodline 3)
  1480.         {
  1481.             $this->_pf_useperiod false;
  1482.         else
  1483.         {
  1484.             for($i 0$i $this->_pv_periodline$i++)
  1485.             {
  1486.                 if (strlen($desc[$i]== && isset($desc[$i 1]&& strlen($desc[$i 1]))
  1487.                 {
  1488.                     $this->_pv_periodline $i;
  1489.                 }
  1490.             }
  1491.         }
  1492.         for($i=0;$i <= $this->_pv_periodline && $i count($desc);$i++)
  1493.         {
  1494.             if (!strlen(trim($desc[$i]))) $this->_pf_useperiod false;
  1495.         }
  1496.         // figure out the shortdesc
  1497.         if ($this->_pf_useperiod === false)
  1498.         {
  1499.             // use the first non blank line for short desc
  1500.             for($i 0$i count($desc)$i++)
  1501.             {
  1502.                 if (strlen($desc[$i]0)
  1503.                 {
  1504.                     $this->_pv_periodline $i;
  1505.                     $i count($desc);
  1506.                 }
  1507.             }
  1508.         
  1509.             // check to see if we are going to use a blank line to end the shortdesc
  1510.             // this can only be in the first 4 lines
  1511.             if (count($desc4)
  1512.             {
  1513.                 $max 4;
  1514.             else {
  1515.                 $max count($desc);
  1516.             }
  1517.         
  1518.             for($i $this->_pv_periodline$i $max$i++)
  1519.             {
  1520.                 if (strlen(trim($desc[$i])) == 0)
  1521.                 {
  1522.                     $this->_pv_periodline $i;
  1523.                     $i $max;
  1524.                 }
  1525.             }
  1526.         }
  1527.  
  1528.         $dtype $this->_pv_dtype;
  1529.         if ($dtype == '_pv_docblock')
  1530.         {
  1531.             $sdesc new parserDesc;
  1532.             $desci '';
  1533.             for($i 0($i <= $this->_pv_periodline&& ($i count($desc))$i++)
  1534.             {
  1535.                 $desci .= $desc[$i]."\n";
  1536.             }
  1537.             $sdesc->add($this->getInlineTags($desci));
  1538.             $this->_pv_periodline++;
  1539.         
  1540.             $my_desc new parserDesc;
  1541.             if (isset($this->_pv_dtemplate))
  1542.             {
  1543.                 // copy template values if not overridden
  1544.                 if (!$this->_pv_docblock->getExplicitPackage())
  1545.                 {
  1546.                     if ($p $this->_pv_dtemplate->getKeyword('package'))
  1547.                     {
  1548.                         $this->_pv_docblock->addKeyword('package',$p);
  1549.                         $this->_pv_docblock->setExplicitPackage();
  1550.                     }
  1551.                     if ($p $this->_pv_dtemplate->getKeyword('category'))
  1552.                     {
  1553.                         $this->_pv_docblock->addKeyword('category',$p);
  1554.                         $this->_pv_docblock->setExplicitCategory();
  1555.                     }
  1556.                     if ($p $this->_pv_dtemplate->getKeyword('subpackage'))
  1557.                     {
  1558.                         $this->_pv_docblock->addKeyword('subpackage',$p);
  1559.                     }
  1560.                 }
  1561.                 $tags $this->_pv_dtemplate->listTags();
  1562.                 foreach($tags as $tag)
  1563.                 {
  1564.                     $this->_pv_docblock->addTag($tag);
  1565.                 }
  1566.                 if (!count($this->_pv_docblock->params)) {
  1567.                     $this->_pv_docblock->params $this->_pv_dtemplate->params;
  1568.                 }
  1569.                 if (!$this->_pv_docblock->return{
  1570.                     $this->_pv_docblock->return $this->_pv_dtemplate->return;
  1571.                 }
  1572.                 $my_desc->add($this->_pv_dtemplate->sdesc);
  1573.                 $my_desc->add($this->_pv_dtemplate->desc);
  1574.             }
  1575. //            echo "i = ".$this->_pv_periodline."; i < " . count($desc) . "\n";
  1576.             $desci '';
  1577.             for($i $this->_pv_periodline$i count($desc)$i++)
  1578.             {
  1579.                 // the line will not be set if it doesn't start with a *
  1580.                 if (isset($desc[$i]))
  1581.                 $desci .= $desc[$i]."\n";
  1582.             }
  1583.             $my_desc->add($this->getInlineTags($desci));
  1584.         else
  1585.         // this is a docblock template
  1586.             $sdesc new parserDesc;
  1587.             $desci '';
  1588.             for($i 0($i <= $this->_pv_periodline&& ($i count($desc))$i++)
  1589.             {
  1590.                 if (isset($desc[$i]))
  1591.                     $desci .= $desc[$i]."\n";
  1592.             }
  1593.             $sdesc->add($this->getInlineTags($desci));
  1594.             $this->_pv_periodline++;
  1595.         
  1596.             $my_desc new parserDesc;
  1597.             $desci '';
  1598.             for($i=$this->_pv_periodline$i count($desc)$i++)
  1599.             {
  1600.                 if (isset($desc[$i]))
  1601.                     $desci .= $desc[$i]."\n";
  1602.             }
  1603.             $my_desc->add($this->getInlineTags($desci));
  1604.         }
  1605.         if ($this->_pf_internal)
  1606.         {
  1607.             addError(PDERROR_INTERNAL_NOT_CLOSED);
  1608.             $this->_pf_internal false;
  1609.         }
  1610.         $this->$dtype->setShortDesc($sdesc);
  1611.         $this->$dtype->setDesc($my_desc);
  1612.         unset($my_desc);
  1613. //            var_dump($this->$dtype);
  1614. //            exit;
  1615.     }
  1616.     
  1617.     /**
  1618.      * Process the tags of a DocBlock
  1619.      * @param array array of lines that contain all @tags
  1620.      */
  1621.     function handleTags($tags)
  1622.     {
  1623.         $newtags array();
  1624.         $curtag '';
  1625.         for($i=0;$i count($tags);$i++)
  1626.         {
  1627.             if (strpos(trim($tags[$i]),'@'=== 0$tags[$iltrim($tags[$i]);
  1628.             if (substr($tags[$i],0,1== '@' && substr($tags[$i],0,2!= '@ ')
  1629.             // start a new tag
  1630.                 if (!empty($curtag))
  1631.                 {
  1632.                     $newtags[$curtag;
  1633.                 }
  1634.                 $curtag $tags[$i];
  1635.             else $curtag .= "\n".$tags[$i];
  1636.         }
  1637.         if (!empty($curtag)) $newtags[$curtag;
  1638.         foreach($newtags as $tag)
  1639.         {
  1640.             $x explode(' ',str_replace("\t",'    ',$tag));
  1641.             $tagname trim(substr(array_shift($x),1));
  1642.             $restoftag $x;
  1643.             if (isset($this->tagHandlers[$tagname])) {
  1644.                 $handle $this->tagHandlers[$tagname];
  1645.             else {
  1646.                 $handle $this->tagHandlers['*'];
  1647.             }
  1648.             $this->$handle($tagname,$restoftag);
  1649.         }
  1650.     }
  1651.     
  1652.     /**
  1653.      * Process all inline tags in text, and convert them to their abstract
  1654.      * object representations.
  1655.      * @param string|arraycomplete code to search for inline tags, if an
  1656.      *                      array, it's an array of strings
  1657.      * @return parserStringWithInlineTags 
  1658.      */
  1659.     function getInlineTags($value)
  1660.     {
  1661.         if (is_array($value)) $value join("\n",$value);
  1662.         global $_phpDocumentor_setting;
  1663.         $priv (isset($_phpDocumentor_setting['parseprivate']&& $_phpDocumentor_setting['parseprivate'== 'on');
  1664.         $a new parserStringWithInlineTags();
  1665.         if (!$priv && $this->_pf_internal)
  1666.         {
  1667.             if ($x strpos($value,'}}'))
  1668.             {
  1669.                 $x strrpos($value,'}}');
  1670.                 $value substr($value,$x 1);
  1671.                 $this->_pf_internal false;
  1672.             else $value '';
  1673.         elseif ($this->_pf_internal)
  1674.         {
  1675.             if ($x strpos($value,'}}'))
  1676.             {
  1677.                 $x strrpos($value,'}}');
  1678.                 $value substr($value,0,$xsubstr($value,$x+2);
  1679.             }
  1680.         }
  1681.         $save $value;
  1682.         $value explode('{@',$value);
  1683.         $newval array();
  1684.         if ($priv || (!$priv && !$this->_pf_internal)) {
  1685.             // ignore anything between {@internal and }}
  1686.             $a->add($value[0]);
  1687.         }
  1688.         for($i=1;$i<count($value);$i++)
  1689.         {
  1690.             if (substr($value[$i],0,1== '}')
  1691.             {
  1692.                 if ($priv || (!$priv && !$this->_pf_internal)) {
  1693.                     // ignore anything between {@internal and }}
  1694.                     $a->add('{@'.substr($value[$i],1));
  1695.                 }
  1696.             elseif (substr($value[$i],0,2== '*}')
  1697.             // used for inserting */ in code examples
  1698.                 if ($priv || (!$priv && !$this->_pf_internal)) {
  1699.                     // ignore anything between {@internal and }}
  1700.                     $a->add('*/'.substr($value[$i],2));
  1701.                 }
  1702.             else
  1703.             {
  1704.                 $save $value[$i];
  1705.                 $value[$isplit("[\t ]",str_replace("\t",'    ',$value[$i]));
  1706.                 $word trim(array_shift($value[$i]));
  1707.                 $val join(' ',$value[$i]);
  1708.                 if (trim($word== 'internal')
  1709.                 {
  1710.                     if ($this->_pf_internal{
  1711.                         addErrorDie(PDERROR_NESTED_INTERNAL);
  1712.                     }
  1713.                     $this->_pf_internal true;
  1714.                     $value[$isubstr($save,strlen('internal'1);
  1715.                     if (!$value[$i]{
  1716.                         $value[$i''// substr can set this to false
  1717.                     }
  1718.                     if (strpos($value[$i],'}}'!== false)
  1719.                     {
  1720.                         $x strrpos($value[$i],'}}');
  1721.                         // strip internal and cycle as if it were normal text.
  1722.                         $startval substr($value[$i],0,$x 1);
  1723.                         if ($priv{
  1724.                             $a->add($startval);
  1725.                         }
  1726.                         $value[$isubstr($value[$i],$x 1);
  1727.                         if (!$value[$i]$value[$i'';
  1728.                         $this->_pf_internal false;
  1729.                         $a->add($value[$i]);
  1730.                         continue;
  1731.                     elseif ($priv{
  1732.                         $a->add($value[$i]);
  1733.                     }
  1734.                     continue;
  1735.                 }
  1736.                 if (in_array(str_replace('}','',trim($word)),$this->allowableInlineTags))
  1737.                 {
  1738.                     if (strpos($word,'}'))
  1739.                     {
  1740.                         $res substr($word,strpos($word'}'));
  1741.                         $word str_replace('}','',trim($word));
  1742.                         $val $res.$val;
  1743.                     }
  1744.                     if ($priv || (!$priv && !$this->_pf_internal)) {
  1745.                         // ignore anything between {@internal and }}
  1746.                         if ($word == 'source')
  1747.                         {
  1748.                             $this->_pf_get_source true;
  1749.                         }
  1750.                     }
  1751.                     $val explode('}',$val);
  1752.                     if (count($val== 1)
  1753.                     {
  1754.                            addError(PDERROR_UNTERMINATED_INLINE_TAG,$word,'',$save);
  1755.                     }
  1756.                     $rest $val;
  1757.                     $val array_shift($rest);
  1758.                     $rest join('}',$rest);
  1759.                     if (isset($this->inlineTagHandlers[$word])) {
  1760.                         $handle $this->inlineTagHandlers[$word];
  1761.                     else {
  1762.                         $handle $this->inlineTagHandlers['*'];
  1763.                     }
  1764.                     $val $this->$handle($word,$val);
  1765.                     if ($priv || (!$priv && !$this->_pf_internal)) {
  1766.                         // ignore anything between {@internal and }}
  1767.                         $a->add($val);
  1768.                     }
  1769.                     if ($this->_pf_internal)
  1770.                     {
  1771.                         if (($x strpos($rest,'}}')) !== false)
  1772.                         {
  1773.                             $value[$i$rest;
  1774.                             $startval substr($value[$i],0,$x);
  1775.                             if ((false !== $startval&& $priv{
  1776.                                 $a->add($startval);
  1777.                             }
  1778.                             $value[$isubstr($value[$i],$x 2);
  1779.                             if (!$value[$i]{
  1780.                                 $value[$i'';
  1781.                             }
  1782.                             $this->_pf_internal false;
  1783.                             $a->add($value[$i]);
  1784.                         else {
  1785.                             $rest explode('}}'$rest);
  1786.                             if ($priv{
  1787.                                 $a->add(array_shift($rest));
  1788.                             }
  1789.                             $this->_pf_internal false;
  1790.                             // try this line again without internal
  1791.                             $value[$i--join('}}'$rest);
  1792.                             continue;
  1793.                         }
  1794.                     else {
  1795.                         $a->add($rest);
  1796.                     }
  1797.                 else
  1798.                 {
  1799.                     $val $word.' '.$val;
  1800.                     if ($priv || (!$priv && !$this->_pf_internal)) {
  1801.                         // ignore anything between {@internal and }}
  1802.                         $a->add('{@'.$val);
  1803.                     }
  1804.                 }
  1805.             }
  1806.         }
  1807.         return $a;
  1808.     }
  1809.     /**#@-*/
  1810.     /**#@+
  1811.      * @param string name of the tag
  1812.      * @param string any parameters passed to the inline tag
  1813.      * @access private
  1814.      */
  1815.     /**
  1816.      * Most inline tags require no special processing
  1817.      * 
  1818.      */
  1819.     function handleDefaultInlineTag($name$value)
  1820.     {
  1821.         $tag 'parser'.ucfirst($name).'InlineTag';
  1822.         return new $tag($value,$value);
  1823.     }
  1824.     
  1825.     /**
  1826.      * Handle the inline {@}link} tag
  1827.      * @tutorial tags.inlinelink.pkg
  1828.      */
  1829.     function handleLinkInlineTag($name$value)
  1830.     {
  1831.         // support hyperlinks of any protocol
  1832.         if (is_numeric(strpos($value,'://')) || (strpos(trim($value),'mailto:'=== 0))
  1833.         {
  1834.             $value str_replace('\\,''###commanana####'$value);
  1835.             if (strpos($value,','))
  1836.             {
  1837.                 $val new parserLinkInlineTag($value,$value);
  1838.             elseif (strpos(trim($value),' '))
  1839.             // if there is more than 1 parameter, the stuff after the space is the hyperlink text
  1840.                 $i1 strpos(trim($value),' '1;
  1841.                 $link substr(trim($value),0,$i1 1);
  1842.                 $text substr(trim($value),$i1);
  1843.                 $val new parserLinkInlineTag($link,$text);
  1844.             else
  1845.             {
  1846.                 $val new parserLinkInlineTag($value,$value);
  1847.             }
  1848.         else
  1849.         {
  1850.             $value str_replace('\\,''###commanana####'$value);
  1851.             if (!strpos($value,','))
  1852.             {
  1853.                 $testp explode('#',$value);
  1854.                 if (count($testp1)
  1855.                     $val new parserLinkInlineTag($value,$testp[1]);
  1856.                 else
  1857.                     $val new parserLinkInlineTag($value,$value);
  1858.             else
  1859.                 $val new parserLinkInlineTag($value,$value);
  1860.         }
  1861.         return $val;
  1862.     }
  1863.  
  1864.     /**#@-*/
  1865.     /**#@+
  1866.      * @access private
  1867.      * @param string name of tag
  1868.      * @param array all words in the tag that were separated by a space ' '
  1869.      */
  1870.     /**
  1871.      * Most tags only need the value as a string
  1872.      * @uses getInlineTags() all tag handlers check their values for inline tags
  1873.      */
  1874.     function defaultTagHandler($name$value)
  1875.     {
  1876.         $dtype $this->_pv_dtype;
  1877.         $this->$dtype->addKeyword($name,$this->getInlineTags(join(' ',$value)));
  1878.     }
  1879.     
  1880.     /**
  1881.      * @tutorial tags.example.pkg
  1882.      * @uses parserDocBlock::addExample()
  1883.      */
  1884.     function exampleTagHandler($name$value)
  1885.     {
  1886.         $dtype $this->_pv_dtype;
  1887.         $this->$dtype->addExample($this->getInlineTags(join(' ',$value))$this->_path);
  1888.     }
  1889.     
  1890.     /**
  1891.      * @tutorial tags.filesource.pkg
  1892.      * @uses phpDocumentorTWordParser::getFileSource() retrieves the source for
  1893.      *        use in the @filesource tag
  1894.      */
  1895.     function filesourceTagHandler($name$value)
  1896.     {
  1897.         $dtype $this->_pv_dtype;
  1898.         $this->$dtype->addFileSource($this->_path$this->_wp->getFileSource());
  1899.     }
  1900.     
  1901.     /**
  1902.      * @tutorial tags.uses.pkg
  1903.      */
  1904.     function usesTagHandler($name$value)
  1905.     {
  1906.         $dtype $this->_pv_dtype;
  1907.         $seel '';
  1908.         while ($seel == '' && count($value))
  1909.         {
  1910.             $seel array_shift($value);
  1911.         }
  1912.         $this->$dtype->addUses($this->getInlineTags($seel)$this->getInlineTags(join(' ',$value)));
  1913.     }
  1914.     
  1915.     /**
  1916.      * @tutorial tags.author.pkg
  1917.      */
  1918.     function authorTagHandler($name$value)
  1919.     {
  1920.         $dtype $this->_pv_dtype;
  1921.         $value join(' ',$value);
  1922.         if ((strpos($value,'<'!== false&& (strpos($value,'>'!== false))
  1923.         {
  1924.             $email substr($value,strpos($value,'<'1,strpos($value,'>'strpos($value,'<'1);
  1925.             $value str_replace('<'.$email.'>','<{@link mailto:'.$email.' ' .
  1926.                         $email '}>',$value);
  1927.         }
  1928.         $this->$dtype->addKeyword('author',$this->getInlineTags($value));
  1929.     }
  1930.     
  1931.     /**
  1932.      * @tutorial tags.package.pkg
  1933.      */
  1934.     function packageTagHandler($name$value)
  1935.     {
  1936.         if (count($value&& empty($value[0]))
  1937.         {
  1938.             $found false;
  1939.             for($i=0;$i<count($value&& !strlen($value[$i]);$i++);
  1940.             array_splice($value,0,$i);
  1941.         }
  1942.         $this->defaultTagHandler($name$value);
  1943.         $dtype $this->_pv_dtype;
  1944.         $this->$dtype->setExplicitPackage();
  1945.     }
  1946.     
  1947.     /**
  1948.      * @tutorial tags.category.pkg
  1949.      */
  1950.     function categoryTagHandler($name$value)
  1951.     {
  1952.         if (count($value&& empty($value[0]))
  1953.         {
  1954.             $found false;
  1955.             for($i=0;$i<count($value&& !strlen($value[$i]);$i++);
  1956.             array_splice($value,0,$i);
  1957.         }
  1958.         $this->defaultTagHandler($name$value);
  1959.         $dtype $this->_pv_dtype;
  1960.         $this->$dtype->setExplicitCategory();
  1961.     }
  1962.     
  1963.     /**
  1964.      * @tutorial tags.global.pkg
  1965.      */
  1966.     function globalTagHandler($name$value)
  1967.     {
  1968.         $info $this->retrieveType($valuetrue);
  1969.         if (!$infoaddErrorDie(PDERROR_MALFORMED_TAG'@global');
  1970.         $type $info['type'];
  1971.         $var $info['var'];
  1972.         $desc $info['desc'];
  1973.         $dtype $this->_pv_dtype;
  1974.         if (!$var && empty($desc))
  1975.         {
  1976.             if ($type{0== '$'addError(PDERROR_MALFORMED_GLOBAL_TAG);
  1977.             return $this->$dtype->addFuncGlobal($type,new parserStringWithInlineTags);
  1978.         }
  1979.         if ($var)
  1980.         // global define
  1981.             $this->_pv_global_type $type;
  1982.             if (!empty($desc)) $var .= ' '.$desc;
  1983.             $this->findGlobal(trim($var));
  1984.         elseif (!empty($desc))
  1985.         // function global
  1986.             if ($type{0== '$'addError(PDERROR_MALFORMED_GLOBAL_TAG);
  1987.             $this->$dtype->addFuncGlobal($type,$this->getInlineTags($desc));
  1988.         else
  1989.         {
  1990.             addError(PDERROR_MALFORMED_GLOBAL_TAG);
  1991.         }
  1992.     }
  1993.     
  1994.     /**
  1995.      * @tutorial tags.staticvar.pkg
  1996.      */
  1997.     function staticvarTagHandler($name$value)
  1998.     {
  1999.         $info $this->retrieveType($valuetrue);
  2000.         if (!$infoaddErrorDie(PDERROR_MALFORMED_TAG'@staticvar');
  2001.         $type $info['type'];
  2002.         $var $info['var'];
  2003.         $desc $info['desc'];
  2004.         $dtype $this->_pv_dtype;
  2005.         if (!$var && empty($desc))
  2006.         {
  2007.             $this->$dtype->addStaticVar(null,$type,new parserStringWithInlineTags);
  2008.         else
  2009.         {
  2010.             if ($var)
  2011.             {
  2012.                 $this->$dtype->addStaticVar($var,$type,$this->getInlineTags($desc));
  2013.             else
  2014.             {
  2015.                 $this->$dtype->addStaticVar(null,$type,$this->getInlineTags($desc));
  2016.             }
  2017.         }
  2018.     }
  2019.     
  2020.     /**
  2021.      * @tutorial tags.param.pkg
  2022.      */
  2023.     function paramTagHandler($name$value)
  2024.     {
  2025.         $info $this->retrieveType($valuetrue);
  2026.         //if (!$info) addErrorDie(PDERROR_MALFORMED_TAG, '@param');
  2027.         if (!$infoaddError(PDERROR_MALFORMED_TAG'@param')return}
  2028.         $type $info['type'];
  2029.         $var $info['var'];
  2030.         $desc $info['desc'];
  2031.         $dtype $this->_pv_dtype;
  2032.         if (!$var && empty($desc))
  2033.         {
  2034.             $this->$dtype->addParam(null,$type,new parserStringWithInlineTags);
  2035.         else
  2036.         {
  2037.             if ($var)
  2038.             {
  2039.                 $this->$dtype->addParam($var,$type,$this->getInlineTags($desc));
  2040.             else
  2041.             {
  2042.                 $this->$dtype->addParam(null,$type,$this->getInlineTags($desc));
  2043.             }
  2044.         }
  2045.     }
  2046.     
  2047.     /**
  2048.      * @tutorial tags.return.pkg
  2049.      */
  2050.     function returnTagHandler($name$value)
  2051.     {
  2052.         $info $this->retrieveType($valuetrue);
  2053.         //if (!$info) addErrorDie(PDERROR_MALFORMED_TAG, '@return');
  2054.         if (!$infoaddError(PDERROR_MALFORMED_TAG'@return')return}
  2055.         $type $info['type'];
  2056.         $desc $info['desc'];
  2057.         $dtype $this->_pv_dtype;
  2058.         $this->$dtype->addReturn($type,$this->getInlineTags($desc));
  2059.     }
  2060.     
  2061.     /**
  2062.      * @tutorial tags.var.pkg
  2063.      */
  2064.     function varTagHandler($name$value)
  2065.     {
  2066.         $info $this->retrieveType($valuetrue);
  2067.         if (!$infoaddErrorDie(PDERROR_MALFORMED_TAG'@var');
  2068.         $type $info['type'];
  2069.         $desc $info['desc'];
  2070.         $dtype $this->_pv_dtype;
  2071.         $this->$dtype->addVar($type,$this->getInlineTags($desc));
  2072.     }
  2073.     /**#@-*/
  2074.     /**#@+
  2075.      * @access private
  2076.      */
  2077.     
  2078.     /**
  2079.      * Retrieve the type portion of a @tag type description
  2080.      *
  2081.      * Tags like @param, @return and @var all have a PHP type portion in their
  2082.      * description.  Since the type may contain the expression "object blah"
  2083.      * where blah is a classname, it makes parsing out the type field complex.
  2084.      *
  2085.      * Even more complicated is the case where a tag variable can contain
  2086.      * multiple types, such as object blah|object blah2|false, and so this
  2087.      * method handles these cases.
  2088.      * @param array array of words that were separated by spaces
  2089.      * @param boolean flag to determine whether to check for the end of a
  2090.      *         type is defined by a $varname
  2091.      * @return array Format: array('type' => string, 'var' =>
  2092.      *                              false|string variable name, 'desc' => rest
  2093.      *                              of the tag)
  2094.      */
  2095.     function retrieveType($value$checkforvar false)
  2096.     {
  2097.         if (!count($value)) return false;
  2098.         $result array();
  2099.         $types '';
  2100.         // remove empty entries resulting from extra spaces between @tag and type
  2101.         $this->_removeWhiteSpace($value0);
  2102.         $index 0;
  2103.         if (trim($value[0]== 'object')
  2104.         {
  2105.             $types .= array_shift($value).' ';
  2106.             $this->_removeWhiteSpace($value0);
  2107.             if (!count($value))
  2108.             // was just passed "object"
  2109.                 $result array('type' => rtrim($types),'desc' => '');
  2110.                 if ($checkforvar$result['var'false;
  2111.                 return $result;
  2112.             }
  2113.             if ($value[0]{0== '$' || substr($value[0],0,2== '&$')
  2114.             // was just passed "object" and the next thing is a variable name
  2115.                 $result['var'trim($value[0]);
  2116.                 $result['type''object';
  2117.                 array_shift($value);
  2118.                 $result['desc'join(' '$value);
  2119.                 return $result;
  2120.             }
  2121.         }
  2122.         $done false;
  2123.         do
  2124.         // this loop checks for type|type|type and for
  2125.           // type|object classname|type|object classname2
  2126.             if (strpos($value[0]'|'))
  2127.             {
  2128.                 $temptypes explode('|'$value[0]);
  2129.                 while(count($temptypes))
  2130.                 {
  2131.                     $type array_shift($temptypes);
  2132.                     $types .= $type;
  2133.                     if (count($temptypes)) $types .= '|';
  2134.                 }
  2135.                 if (trim($type== 'object')
  2136.                 {
  2137.                     $types .= ' ';
  2138.                     $this->_removeWhiteSpace($value,0);
  2139.                 else $done true;
  2140.                 array_shift($value);
  2141.                 if (isset ($value[0]&& strlen($value[0]&& ($value[0]{0== '$' || substr($value[0],0,2== '&$'))
  2142.                 // was just passed "object" and the next thing is a variable name
  2143.                     $result['var'trim($value[0]);
  2144.                     $result['type'$types;
  2145.                     array_shift($value);
  2146.                     $result['desc'join(' '$value);
  2147.                     return $result;
  2148.                 }
  2149.             else
  2150.             {
  2151.                 $types .= $value[0];
  2152.                 array_shift($value);
  2153.                 $done true;
  2154.             }
  2155.         while (!$done && count($value));
  2156.         $result['type'rtrim($types);
  2157.         $this->_removeWhiteSpace($value,0);
  2158.         if ($checkforvar)
  2159.         {
  2160.             if (!count($value))
  2161.             {
  2162.                 $result['var'false;
  2163.             else
  2164.             {
  2165.                 if (substr($value[0],0,1== '$' || substr($value[0],0,2== '&$')
  2166.                 {
  2167.                     $result['var'trim($value[0]);
  2168.                     array_shift($value);
  2169.                 else $result['var'false;
  2170.             }
  2171.         }
  2172.         $result['desc'join(' ',$value);
  2173.         return $result;
  2174.     }
  2175.     
  2176.     /**
  2177.      * @param array array of string
  2178.      * @param integer index to seek non-whitespace to
  2179.      */
  2180.     function _removeWhiteSpace(&$value$index)
  2181.     {
  2182.         if (count($value$index && empty($value[$index]))
  2183.         {
  2184.             $found false;
  2185.             for($i=$index$i<count($value&& !strlen($value[$i])$i++);
  2186.             array_splice($value$index$i $index);
  2187.         }
  2188.     }
  2189.     
  2190.     /**
  2191.      * Retrieve all the tokens that represent the definition of the global
  2192.      * variable.
  2193.      *
  2194.      * {@source } 
  2195.      */
  2196.     function findGlobal($name)
  2197.     {
  2198.         $tokens token_get_all('<?php '.$name);
  2199.         $tokens array_slice($tokens,1);
  2200.         $this->_wp->findGlobal($tokens);
  2201.         $this->_pv_findglobal $name;
  2202.     }
  2203.  
  2204.     /**
  2205.      * handler for DEFINE_GLOBAL
  2206.      */
  2207.     function handleGlobal($word$pevent)
  2208.     {
  2209.         if (isset($this->_pv_findglobal))
  2210.         {
  2211.             $this->_pv_global_name $this->_pv_findglobal;
  2212.             unset($this->_pv_findglobal);
  2213.         }
  2214.         if (!$this->_pf_in_global)
  2215.         {
  2216.             $this->_pv_linenum $this->_wp->linenum 1;
  2217.         }
  2218.         $this->_pf_in_global true;
  2219.         if($this->checkEventPush($word$pevent))
  2220.         {
  2221.             $this->_wp->setWhitespace(true);
  2222.         }
  2223.         if ($this->checkEventPop($word$pevent))
  2224.         {
  2225.             $this->_pf_in_global false;
  2226.             $a new parserGlobal;
  2227.             $a->setDataType($this->_pv_global_type);
  2228.             $this->_pv_global_type '';
  2229.             $a->setLineNumber($this->_pv_linenum);
  2230.             $a->setName($this->_pv_global_name);
  2231.             if (isset($this->_pv_global_val))
  2232.             $a->setValue(trim($this->_pv_global_val));
  2233.             $this->publishEvent(PHPDOCUMENTOR_EVENT_GLOBAL,$a);
  2234.             unset($this->_pv_global_val);
  2235.             unset($this->_pv_global_type);
  2236.         }
  2237.     }
  2238.     
  2239.     /**
  2240.      * handler for GLOBAL_VALUE
  2241.      */
  2242.     function handleGlobalValue($word$pevent)
  2243.     {
  2244.         if ($this->checkEventPush($word$pevent)) return;
  2245.         $this->_wp->setWhitespace(true);
  2246.         if (!isset($this->_pv_global_val)) $this->_pv_global_val '';
  2247.         if ($this->_last_pevent == PARSER_EVENT_ARRAY)
  2248.         {
  2249.             $this->_pv_global_val .= $this->_pv_function_data;
  2250.             $this->_pv_function_data '';
  2251.         }
  2252.         if ($this->_last_pevent == PARSER_EVENT_QUOTE ||
  2253.             $this->_last_pevent == PARSER_EVENT_EOFQUOTE)
  2254.         {
  2255.             $this->_pv_global_val .= $this->_pv_quote_data;
  2256.             unset($this->_pv_quote_data);
  2257.         }
  2258.         if ($this->checkEventPop($word$pevent))
  2259.         {
  2260.             $this->_wp->setWhitespace(false);
  2261.             $this->_wp->backupPos();
  2262.             return;
  2263.         }
  2264.         if (is_array($word)) $word $word[1];
  2265.         $this->_pv_global_val .= $word;
  2266.     }
  2267.     
  2268.     /**#@-*/
  2269.     /**
  2270.      * this function checks whether parameter $word is a token for pushing a new event onto the Event Stack.
  2271.      * @return mixed    returns false, or the event number
  2272.      */
  2273.     
  2274.     function checkEventPush($word,$pevent)
  2275.     {
  2276.         if (is_array($word&& $word[0== T_STRING$word $word[1];
  2277.         if (is_array($word))
  2278.         {
  2279.             $pushEvent &$this->tokenpushEvent;
  2280.             $word $word[0];
  2281.         else
  2282.         {
  2283.             $pushEvent &$this->wordpushEvent;
  2284.             $word strtolower($word);
  2285.         }
  2286.         $e false;
  2287.         if (isset($pushEvent[$pevent]))
  2288.         {
  2289.             if (isset($pushEvent[$pevent][$word]))
  2290.             $e $pushEvent[$pevent][$word];
  2291.         }
  2292.         if ($e)
  2293.         {
  2294.             $this->_event_stack->pushEvent($e);
  2295.             return $e;
  2296.         else {
  2297.             return false;
  2298.         }
  2299.     }
  2300.  
  2301.     /**
  2302.      * this function checks whether parameter $word is a token for popping the current event off of the Event Stack.
  2303.      * @return mixed    returns false, or the event number popped off of the stack
  2304.      */
  2305.     
  2306.     function checkEventPop($word,$pevent)
  2307.     {
  2308.         if (is_array($word&& $word[0== T_STRING$word $word[1];
  2309.         if (is_array($word))
  2310.         {
  2311.             $popEvent &$this->tokenpopEvent;
  2312.             $word $word[0];
  2313.         else
  2314.         {
  2315.             $popEvent &$this->wordpopEvent;
  2316.             $word strtolower($word);
  2317.         }
  2318.         if (!isset($popEvent[$pevent])) return false;
  2319.         if (in_array($word,$popEvent[$pevent]))
  2320.         {
  2321.             return $this->_event_stack->popEvent();
  2322.         else {
  2323.             return false;
  2324.         }
  2325.     }
  2326.  
  2327.     function getToken($word)
  2328.     {
  2329.         if (is_array($word)) return $word[0];
  2330.         return false;
  2331.     }
  2332.     
  2333.     /**
  2334.      * setup the parser tokens, and the pushEvent/popEvent arrays
  2335.      * @see $tokens, $pushEvent, $popEvent
  2336.      */
  2337.     
  2338.     function setupStates()
  2339.     {
  2340.         unset($this->_wp);
  2341.         $this->_wp new phpDocumentorTWordParser;
  2342.         $this->_pv_class null;
  2343.         $this->_pv_cur_class null;
  2344.         $this->_pv_define null;
  2345.         $this->_pv_define_name null;
  2346.         $this->_pv_define_value null;
  2347.         $this->_pv_define_params_data null;
  2348.         $this->_pv_dtype null;
  2349.         $this->_pv_docblock null;
  2350.         $this->_pv_dtemplate null;
  2351.         $this->_pv_func null;
  2352.         $this->_pv_findglobal null;
  2353.         $this->_pv_global_name null;
  2354.         $this->_pv_global_val null;
  2355.         $this->_pv_globals null;
  2356.         $this->_pv_global_count null;
  2357.         $this->_pv_include_params_data null;
  2358.         $this->_pv_include_name null;
  2359.         $this->_pv_include_value null;
  2360.         $this->_pv_linenum null;
  2361.         $this->_pv_periodline null;
  2362.         $this->_pv_paren_count 0;
  2363.         $this->_pv_statics null;
  2364.         $this->_pv_static_count null;
  2365.         $this->_pv_static_val null;
  2366.         $this->_pv_quote_data null;
  2367.         $this->_pv_function_data null;
  2368.         $this->_pv_var null;
  2369.         $this->_pv_varname null;
  2370.         $this->_pv_const null;
  2371.         $this->_pv_constname null;
  2372.         $this->_pv_function_param_type null;
  2373.         $this->_pf_definename_isset false;
  2374.         $this->_pf_includename_isset false;
  2375.         $this->_pf_get_source false;
  2376.         $this->_pf_getting_source false;
  2377.         $this->_pf_in_class false;
  2378.         $this->_pf_in_define false;
  2379.         $this->_pf_in_global false;
  2380.         $this->_pf_in_include false;
  2381.         $this->_pf_in_var false;
  2382.         $this->_pf_in_const false;
  2383.         $this->_pf_funcparam_val false;
  2384.         $this->_pf_quote_active false;
  2385.         $this->_pf_reset_quote_data true;
  2386.         $this->_pf_useperiod false;
  2387.         $this->_pf_var_equals false;
  2388.         $this->_pf_const_equals false;
  2389.         $this->_event_stack new EventStack;
  2390.     }
  2391.     
  2392.     /**
  2393.      * Creates the state arrays
  2394.      */
  2395.     function setupEventStates()
  2396.     {
  2397.         if (!defined('T_DOC_COMMENT'))
  2398.         {
  2399.             define('T_DOC_COMMENT'T_DOC_COMMENT);
  2400.         }
  2401. /**************************************************************/
  2402.  
  2403.         $this->wordpushEvent[PARSER_EVENT_LOGICBLOCK
  2404.             array(
  2405.                 "{"    => PARSER_EVENT_LOGICBLOCK,
  2406.                 '"'    => PARSER_EVENT_QUOTE,
  2407.             );
  2408.         $this->tokenpushEvent[PARSER_EVENT_LOGICBLOCK=
  2409.             array(
  2410.                 T_GLOBAL    => PARSER_EVENT_FUNC_GLOBAL,
  2411.                 T_STATIC    => PARSER_EVENT_STATIC_VAR,
  2412.                 T_START_HEREDOC   => PARSER_EVENT_EOFQUOTE,
  2413.                 T_CURLY_OPEN    => PARSER_EVENT_LOGICBLOCK,
  2414.                 T_DOLLAR_OPEN_CURLY_BRACES => PARSER_EVENT_LOGICBLOCK,
  2415.             );
  2416.  
  2417.         $this->wordpopEvent[PARSER_EVENT_LOGICBLOCKarray("}");
  2418.         $this->tokenpopEvent[PARSER_EVENT_LOGICBLOCKarray(T_CURLY_OPEN);
  2419. /**************************************************************/
  2420.  
  2421.         $this->tokenpushEvent[PARSER_EVENT_NOEVENTS
  2422.             array(
  2423.                 T_OPEN_TAG => PARSER_EVENT_PHPCODE,
  2424.             );
  2425.  
  2426. /**************************************************************/
  2427.  
  2428.         $this->tokenpopEvent[PARSER_EVENT_EOFQUOTEarray(T_END_HEREDOC);
  2429. /**************************************************************/
  2430.  
  2431.         $this->tokenpushEvent[PARSER_EVENT_PHPCODE
  2432.             array(
  2433.                 T_FUNCTION     => PARSER_EVENT_FUNCTION,
  2434.                 T_ABSTRACT => PARSER_EVENT_ACCESS_MODIFIER,
  2435.                 T_CLASS     => PARSER_EVENT_CLASS,
  2436.                 T_INTERFACE => PARSER_EVENT_CLASS,
  2437.                 T_INCLUDE_ONCE => PARSER_EVENT_INCLUDE,
  2438.                 T_INCLUDE => PARSER_EVENT_INCLUDE,
  2439.                 T_REQUIRE    => PARSER_EVENT_INCLUDE,
  2440.                 T_REQUIRE_ONCE    => PARSER_EVENT_INCLUDE,
  2441.                 T_COMMENT   => PARSER_EVENT_DOCBLOCK,
  2442.                 T_DOC_COMMENT         => PARSER_EVENT_DOCBLOCK,
  2443. //                "/**#@+"    => PARSER_EVENT_DOCBLOCK_TEMPLATE,
  2444. //                "/**#@-*/"    => PARSER_EVENT_END_DOCBLOCK_TEMPLATE,
  2445.                 T_CLOSE_TAG         => PARSER_EVENT_OUTPHP,
  2446.             );
  2447.         $this->wordpushEvent[PARSER_EVENT_PHPCODE=
  2448.             array(
  2449.                 "define"     => PARSER_EVENT_DEFINE,
  2450.             );
  2451. /**************************************************************/
  2452.  
  2453.         $this->tokenpopEvent[PARSER_EVENT_OUTPHParray(T_OPEN_TAG);
  2454. /**************************************************************/
  2455.  
  2456.         $this->wordpushEvent[PARSER_EVENT_FUNCTION=
  2457.             array(
  2458.                 '{'     => PARSER_EVENT_LOGICBLOCK,
  2459.                 '('     => PARSER_EVENT_FUNCTION_PARAMS,
  2460.             );
  2461.         $this->tokenpushEvent[PARSER_EVENT_FUNCTION=
  2462.             array(
  2463.                 T_COMMENT   => PARSER_EVENT_COMMENT,
  2464.                 T_DOC_COMMENT => PARSER_EVENT_COMMENT,
  2465.             );
  2466.  
  2467.         $this->wordpopEvent[PARSER_EVENT_FUNCTIONarray("}",';');
  2468. /**************************************************************/
  2469.  
  2470.         $this->wordpopEvent[PARSER_EVENT_QUOTEarray('"');
  2471. /**************************************************************/
  2472.  
  2473.         $this->tokenpushEvent[PARSER_EVENT_FUNCTION_PARAMS=
  2474.             array(
  2475.                 T_VARIABLE => PARSER_EVENT_FUNCTION_PARAM_VAR,
  2476.                 T_COMMENT => PARSER_EVENT_COMMENT,
  2477.                 T_DOC_COMMENT => PARSER_EVENT_COMMENT,
  2478.             );
  2479.         $this->wordpopEvent[PARSER_EVENT_FUNCTION_PARAMSarray(")");
  2480. /**************************************************************/
  2481.  
  2482.         $this->tokenpushEvent[PARSER_EVENT_FUNCTION_PARAM_VAR=
  2483.             array(
  2484.                 T_CONSTANT_ENCAPSED_STRING => PARSER_EVENT_QUOTE,
  2485.                 T_COMMENT => PARSER_EVENT_COMMENT,
  2486.                 T_DOC_COMMENT => PARSER_EVENT_COMMENT,
  2487.                 T_ARRAY => PARSER_EVENT_ARRAY,
  2488.             );
  2489.         $this->wordpushEvent[PARSER_EVENT_FUNCTION_PARAM_VAR=
  2490.             array(
  2491.                 '"' => PARSER_EVENT_QUOTE,
  2492.                 "'" => PARSER_EVENT_QUOTE,
  2493.             );
  2494.         $this->wordpopEvent[PARSER_EVENT_FUNCTION_PARAM_VARarray(","")");
  2495. /**************************************************************/
  2496.  
  2497.         $this->tokenpushEvent[PARSER_EVENT_ARRAY
  2498.             array(
  2499.                 T_COMMENT  => PARSER_EVENT_COMMENT,
  2500.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2501.             );
  2502.         $this->wordpopEvent[PARSER_EVENT_ARRAYarray(")");
  2503. /**************************************************************/
  2504.  
  2505.         $this->tokenpushEvent[PARSER_EVENT_VAR_ARRAY
  2506.             array(
  2507.                 T_COMMENT  => PARSER_EVENT_VAR_ARRAY_COMMENT,
  2508.                 T_DOC_COMMENT     => PARSER_EVENT_VAR_ARRAY_COMMENT,
  2509.             );
  2510.         $this->wordpopEvent[PARSER_EVENT_VAR_ARRAYarray(")");
  2511. /**************************************************************/
  2512.  
  2513.         $this->tokenpushEvent[PARSER_EVENT_FUNC_GLOBAL=
  2514.             array(
  2515.                 T_COMMENT   => PARSER_EVENT_COMMENT,
  2516.                 T_DOC_COMMENT    => PARSER_EVENT_COMMENT,
  2517.             );
  2518.  
  2519.         $this->wordpopEvent[PARSER_EVENT_FUNC_GLOBALarray(";");
  2520. /**************************************************************/
  2521.  
  2522.         $this->tokenpushEvent[PARSER_EVENT_STATIC_VAR=
  2523.             array(
  2524.                 T_CONSTANT_ENCAPSED_STRING  => PARSER_EVENT_QUOTE,
  2525.                 T_COMMENT   => PARSER_EVENT_COMMENT,
  2526.                 T_DOC_COMMENT    => PARSER_EVENT_COMMENT,
  2527.             );
  2528.         $this->wordpushEvent[PARSER_EVENT_STATIC_VAR=
  2529.             array(
  2530.                 "="        => PARSER_EVENT_STATIC_VAR_VALUE,
  2531.             );
  2532.         $this->wordpopEvent[PARSER_EVENT_STATIC_VARarray(";");
  2533. /**************************************************************/
  2534.  
  2535.         $this->tokenpushEvent[PARSER_EVENT_STATIC_VAR_VALUE
  2536.             array(
  2537.                 T_CONSTANT_ENCAPSED_STRING  => PARSER_EVENT_QUOTE,
  2538.                 T_COMMENT   => PARSER_EVENT_COMMENT,
  2539.                 T_DOC_COMMENT    => PARSER_EVENT_COMMENT,
  2540.                 T_ARRAY     => PARSER_EVENT_ARRAY,
  2541.             );
  2542.         $this->wordpushEvent[PARSER_EVENT_STATIC_VAR_VALUE=
  2543.             array(
  2544.                 '"' => PARSER_EVENT_QUOTE,
  2545.                 "'" => PARSER_EVENT_QUOTE,
  2546.             );
  2547.         $this->wordpopEvent[PARSER_EVENT_STATIC_VAR_VALUEarray(";",",");
  2548. /**************************************************************/
  2549.  
  2550.         $this->tokenpushEvent[PARSER_EVENT_DEFINE
  2551.             array(
  2552.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2553.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2554.                 T_CONSTANT_ENCAPSED_STRING        => PARSER_EVENT_QUOTE,
  2555.             );
  2556.         $this->wordpushEvent[PARSER_EVENT_DEFINE
  2557.             array(
  2558.                 "("     => PARSER_EVENT_DEFINE_PARAMS,
  2559.             );
  2560.         $this->wordpopEvent[PARSER_EVENT_DEFINEarray(";");
  2561. /**************************************************************/
  2562.  
  2563.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE
  2564.             array(
  2565.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2566.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2567.             );
  2568.         $this->wordpushEvent[PARSER_EVENT_INCLUDE
  2569.             array(
  2570.                 "("     => PARSER_EVENT_INCLUDE_PARAMS,
  2571.             );
  2572.         $this->wordpopEvent[PARSER_EVENT_INCLUDEarray(";");
  2573. /**************************************************************/
  2574.  
  2575.         $this->tokenpushEvent[PARSER_EVENT_DEFINE_PARAMS
  2576.             array(
  2577.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2578.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2579.                 T_START_HEREDOC => PARSER_EVENT_EOFQUOTE,
  2580.             );
  2581.         $this->wordpushEvent[PARSER_EVENT_DEFINE_PARAMS
  2582.             array(
  2583.                 "("    =>    PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS,
  2584.                 '"' => PARSER_EVENT_QUOTE,
  2585.                 "'" => PARSER_EVENT_QUOTE,
  2586.             );
  2587.         $this->wordpopEvent[PARSER_EVENT_DEFINE_PARAMSarray(")");
  2588. /**************************************************************/
  2589.  
  2590.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE_PARAMS
  2591.             array(
  2592.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2593.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2594.             );
  2595.         $this->wordpushEvent[PARSER_EVENT_INCLUDE_PARAMS
  2596.             array(
  2597.                 "("    =>    PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS,
  2598.             );
  2599.         $this->wordpopEvent[PARSER_EVENT_INCLUDE_PARAMSarray(")");
  2600. /**************************************************************/
  2601.  
  2602.         $this->tokenpushEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS=
  2603.             array(
  2604.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2605.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2606.             );
  2607.         $this->wordpushEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS=
  2608.             array(
  2609.                 "("    =>    PARSER_EVENT_DEFINE_PARAMS_PARENTHESIS,
  2610.                 '"' => PARSER_EVENT_QUOTE,
  2611.                 "'" => PARSER_EVENT_QUOTE,
  2612.             );
  2613.         $this->wordpopEvent[PARSER_EVENT_DEFINE_PARAMS_PARENTHESISarray(")");
  2614. /**************************************************************/
  2615.  
  2616.         $this->tokenpushEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS=
  2617.             array(
  2618.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2619.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2620.             );
  2621.         $this->wordpushEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS=
  2622.             array(
  2623.                 "("    =>    PARSER_EVENT_INCLUDE_PARAMS_PARENTHESIS,
  2624.             );
  2625.         $this->wordpopEvent[PARSER_EVENT_INCLUDE_PARAMS_PARENTHESISarray(")");
  2626. /**************************************************************/
  2627.  
  2628.         $this->tokenpushEvent[PARSER_EVENT_VAR
  2629.             array(
  2630.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2631.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2632.                 T_ARRAY     => PARSER_EVENT_VAR_ARRAY,
  2633.             );
  2634.         $this->wordpopEvent[PARSER_EVENT_VARarray(";");
  2635. /**************************************************************/
  2636.  
  2637.         $this->tokenpushEvent[PARSER_EVENT_CLASS_CONSTANT
  2638.             array(
  2639.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2640.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2641.                 T_ARRAY     => PARSER_EVENT_VAR_ARRAY,
  2642.             );
  2643.         $this->wordpopEvent[PARSER_EVENT_CLASS_CONSTANTarray(";");
  2644. /**************************************************************/
  2645.  
  2646.         $this->wordpopEvent[PARSER_EVENT_IMPLEMENTSarray('{');
  2647. /**************************************************************/
  2648.  
  2649.         $this->tokenpushEvent[PARSER_EVENT_CLASS
  2650.             array(
  2651.                 T_ABSTRACT      => PARSER_EVENT_ACCESS_MODIFIER,
  2652.                 T_PUBLIC      => PARSER_EVENT_ACCESS_MODIFIER,
  2653.                 T_PRIVATE      => PARSER_EVENT_ACCESS_MODIFIER,
  2654.                 T_PROTECTED      => PARSER_EVENT_ACCESS_MODIFIER,
  2655.                 T_STATIC      => PARSER_EVENT_ACCESS_MODIFIER,
  2656.                 T_IMPLEMENTS      => PARSER_EVENT_IMPLEMENTS,
  2657.                 T_CONST        => PARSER_EVENT_CLASS_CONSTANT,
  2658.                 T_FUNCTION     => PARSER_EVENT_FUNCTION,
  2659.                 T_VAR         => PARSER_EVENT_VAR,
  2660.                 T_COMMENT         => PARSER_EVENT_DOCBLOCK,
  2661.                 T_DOC_COMMENT         => PARSER_EVENT_DOCBLOCK,
  2662.                 T_CLOSE_TAG        => PARSER_EVENT_OUTPHP,
  2663.             );
  2664.         $this->wordpopEvent[PARSER_EVENT_CLASSarray("}");
  2665. /**************************************************************/
  2666.  
  2667.         $this->tokenpushEvent[PARSER_EVENT_DEFINE_GLOBAL
  2668.             array(
  2669.                 T_COMMENT => PARSER_EVENT_COMMENT,
  2670.                 T_DOC_COMMENT => PARSER_EVENT_COMMENT,
  2671.             );
  2672.         $this->wordpushEvent[PARSER_EVENT_DEFINE_GLOBAL
  2673.             array(
  2674.                 "="    => PARSER_EVENT_GLOBAL_VALUE,
  2675.             );
  2676.         $this->wordpopEvent[PARSER_EVENT_DEFINE_GLOBALarray(";");
  2677. /**************************************************************/
  2678.  
  2679.         $this->tokenpushEvent[PARSER_EVENT_GLOBAL_VALUE
  2680.             array(
  2681.                 T_ARRAY => PARSER_EVENT_ARRAY,
  2682.                 T_COMMENT     => PARSER_EVENT_COMMENT,
  2683.                 T_DOC_COMMENT     => PARSER_EVENT_COMMENT,
  2684.                 T_START_HEREDOC => PARSER_EVENT_EOFQUOTE,
  2685.             );
  2686.         $this->wordpushEvent[PARSER_EVENT_GLOBAL_VALUE=
  2687.             array(
  2688.                 '"' => PARSER_EVENT_QUOTE,
  2689.                 "'" => PARSER_EVENT_QUOTE,
  2690.             );
  2691.         $this->wordpopEvent[PARSER_EVENT_GLOBAL_VALUEarray(";");
  2692.     }
  2693.     
  2694.     function configWordParser(&$data)
  2695.     {
  2696.         $this->_wp->setup($data);
  2697.         $this->_wp->setWhitespace(false);
  2698.     }
  2699. }
  2700. ?>

Documentation generated on Tue, 24 Oct 2006 09:25:53 -0500 by phpDocumentor 1.3.1