Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: c:/www/apache/doc2//parser/PhpdocParserRegExp.php
PHPDOC 2000/12/03 - PHPDoc

PhpdocParserRegExp

PhpdocObject
   |
  +-- PhpdocParserRegExp

Defines all regular expressions.

 

private class PhpdocParserRegExp extends PhpdocObject

Defines all regular expressions.
This class defines all regular expressions. To make theconfiguration and customization of PHPDoc as simple aspossible I decided to define all regular expressions in one class.From a programming point of view there's no need to do so.

AuthorsUlf Wendel <ulf.wendel@phpdoc.de>
Version$Id: $

 
Direct known subclasses: PhpdocParserTags

Methods inherited from PhpdocObject

setflagoutput, out, nametourl, outl, introspection

Private Method Summary

void

buildComplexRegExps()

Builds complex regular expressions for the parser.

Fields inherited from PhpdocObject

$err, $application, $warn, $flag_output

Private Field Summary

array

$PHPDOC_TAGS

Array of phpdoc tags, indexed by the tagname.
array

$C_BASE

Basis regular expressions used to compose complex expressions to grep doc comments.
array

$C_COMPLEX

List of regular expressions used to grep complex doc comments.
array

$PHP_BASE

Basic RegExps used to analyse PHP Code.
array

$PHP_COMPLEX

List of regular expressions used to grep complex php code elements.
array

$TAGS

Array of RegExp matching the syntax of several complex tags.

Private Method Details

buildComplexRegExps

private void buildComplexRegExps( )

  Builds complex regular expressions for the parser.
PHPDoc has a small set of basic regular expressions. All complexregular expressions are made out of the basic ones. The compositionin done in this method. Note: every derived class mustcall this method in it's constructor!

Returns void

See Also $PHP_BASE, $PHP_COMPLEX, $C_BASE, $C_COMPLEX

Private Field Details

$PHPDOC_TAGS

private array $PHPDOC_TAGS

>>array( "@parameter" => '@param[eter] (object objectname|type) [$varname] [description]', "@param" => '@param[eter] (object objectname|type) [$varname] [description]', "@return" => '@return (object objectname|type) [$varname] [description]', "@access" => '@access', "@abstract" => '@abstract', "@static" => '@static', "@final" => '@final', "@throws" => '@throws exception [, exception]', "@see" => '@see (function()|$varname|(module|class)(function()|$varname)) [, (funtion()|$varname|(module|class)(function()|$varname))]', "@link" => '@link URL [description]', "@var" => '@var (object objectname|type) [$varname]', "@global" => '@global (object objectname|type) $varname [description]', "@constant" => '@const[ant] label [description]', "@const" => '@const[ant] label [description]', "@author" => '@author Name [<email>] [, Name [<email>]', "@copyright" => '@copyright description', "@version" => '@version label', "@since" => '@since label', "@deprecated" => '@deprec[ated] description', "@deprec" => '@deprec[ated] description', "@brother" => '@(brother|sister) (function()|$varname)', "@sister" => '@(brother|sister) (function()|$varname)', "@include" => '@include description', "@exclude" => '@exclude label', "@modulegroup" => '@modulegroup label', "@module" => '@module label', "@package" => '@package label', "@magic" => '@magic description', "@todo" => '@todo description' )<<

Array of phpdoc tags, indexed by the tagname.
... grepping information is really not a parser. Don'tchange the order the tags are listed. If you introducenew tags write the long variant of the tagname (parameter)in front of the shortcut (param).


$C_BASE

private final array $C_BASE

>>array( #"block" => '/\*\*((?:(?!\*).)*(?:\n(?!\s*\*/)\s*\*(?:(?!\*/).)*)*)\*/', "module" => "[^\s]+", "module_separator" => "::", "module_tags" => "(@modulegroup|@module)", "vartype" => "(string|integer|int|long|real|double|float|boolean|bool|mixed|array|object)", "access" => "(private|public)" )<<

Basis regular expressions used to compose complex expressions to grep doc comments.
PHPDoc tries to compose all complex regular expressionsfrom a list of basic ones. This array contains all expressionsused grep complex doc comments and the surrounding keywords.

See Also buildComplexRegExps(), $C_COMPLEX

$C_COMPLEX

private final array $C_COMPLEX

>>array( "objectname_optional" => "", "see_var" => "", "see_function" => "", "see_moduleclass" => "", "module_doc" => "", "module_tags" => "", "module_separator" => "", "module_separator_len" => 0, "module_separator_len_neg" => 0 )<<

List of regular expressions used to grep complex doc comments.
As with $PHP_COMPLEX all complex expressions are build using basicones in buildComplexRegExps().

See Also buildComplexRegexps(), $C_BASE

$PHP_BASE

private final array $PHP_BASE

>>array ( "space" => "\s+", "space_optional" => "\s*", "break" => "[\n\r]", "php_open_long" => "<\?php\s", # zend_scanner.l use (space in our case) eighter. Might be slightly faster. "php_open_short" => "<\?", "php_open_asp" => "<%", "php_open_short_print" => "<\?=", "php_open_asp_print" => "<%=", # do not change the single quotes to double ones "label" => '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\xzf-\xff]*', "use" => "(include_once|include|require_once|require)", "assignment" => "\s*([,=])\s*", "boolean" => "(true|false)", "string" => "[^\s]+", "string_enclosed" => "(['\"])(?:\\\\\\1|[^\\1])*?\\1", "int_oct" => "[+-]?\s*0[0-7]+", "int_hex" => "[+-]?\s*0[xX][0-9A-Fa-f]+", "float" => "[+-]?\s*\d*\.\d+", "float_exponent" => "[+-]?\s*\d*(?:\.\d+)*[eE][+-]?\d+", "number" => "[+-]?\s*\d+", "array" => "array\s*\(", "empty_array" => "array\s*\(\s*\)\s*" )<<

Basic RegExps used to analyse PHP Code.
PHPDoc tries to compose all complex regular expressionsfrom some basic expressions. This array containsall expressions used to build $PHP_COMPLEX.There're some differences to the RegExps in zend-scanner.l,e.g. I decided to write "\s+" instead of "[ \n\r\t]+" whichshould be identical as long as perl compatible regularexpressions are used. Another point is that I did not breakdown numbers to LNUM/DNUM.

See Also $PHP_COMPLEX

$PHP_COMPLEX

private array $PHP_COMPLEX

>>array ( "varname" => "", "functionname" => "", "classname" => "", "php_open_script" => "", "var" => "", "undoc_var" => "", "function" => "", "undoc_function" => "", "class" => "", "undoc_class" => "", "class_extends" => "", "undoc_class_extends" => "", "const" => "", "undoc_const" => "", "use" => "", "undoc_use" => "", "argument" => "", "type_boolean" => "", "type_string" => "", "type_string_enclosed" => "", "type_int_oct" => "", "type_int_hex" => "", "type_float" => "", "type_float_exponent" => "", "type_number" => "", "type_array" => "", "type_empty_array" => "" )<<

List of regular expressions used to grep complex php code elements.
The RegExp of the variable types is slightly changed to thatone in $PHP_BASE, getVariableTypeAndValue() needs this."undoc_*" is used to grep all keywords those who have a doccomment in front and those without. See getPhodocParagraphs()for more details on this.

See Also buildComplexRegExps(), $PHP_BASE

$TAGS

private array $TAGS

>>array ( "return" => "", "var" => "", # @var, @param "global" => "", "access" => "", "module" => "", # @module, @modulegroup "const" => "", # @const, @constant "see_var" => "", # @see "see_function" => "", # @see "see_class" => "", # @see "see_module" => "", # @see "link" => "@([^\s]+)(.*)@is", # @link "brother" => "", "author" => "<\s*([a-z]([-a-z0-9_.])*@([-a-z0-9_]*\.)+[a-z]{2,})\s*>", # @author <email> part "all" => "" # list of all known tags )<<

Array of RegExp matching the syntax of several complex tags.
The array is filled by the constructor.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta