StringParserGeneric string parser class
This is an abstract class for any type of string parser.
Located in /stringparser.class.php (line 68)
| Class | Description |
|---|---|
StringParser_BBCode
|
BB code string parser class |
boolean
$strict
= false (line 144)
Strict mode
Whether to stop parsing if a parse error occurs.
array
$_charactersAllowed
= array () (line 169)
Characters currently allowed
Note that this will only be evaluated in loop mode; in search mode this would ruin every performance increase. Note that only single characters are permitted here, no strings. Please also note that in loop mode, StringParser::_charactersSearch is evaluated before this variable.
If in strict mode, parsing is stopped if a character that is not allowed is encountered. If not in strict mode, the character is simply ignored.
array
$_charactersSearch
= array () (line 151)
Characters or strings to look for
integer
$_cpos
= -1 (line 109)
Current position in raw text
integer
$_length
= -1 (line 123)
Length of the text
int
$_parserMode
= STRINGPARSER_MODE_SEARCH (line 88)
String parser mode
There are two possible modes: searchmode and loop mode. In loop mode every single character is looked at in a loop and it is then decided what action to take. This is the most straight-forward approach to string parsing but due to the nature of PHP as a scripting language, it can also cost performance. In search mode the class posseses a list of relevant characters for parsing and uses the http://www.php.net/strpos function to search for the next relevant character. The search mode will be faster than the loop mode in most circumstances but it is also more difficult to implement. The subclass that does the string parsing itself will define which mode it will implement.
boolean
$_parsing
= false (line 134)
Flag if this object is already parsing a text
This flag is to prevent recursive calls to the parse() function that would cause very nasty things.
array
$_postfilters
= array () (line 190)
Postfilters
array
$_prefilters
= array () (line 183)
Prefilters
bool
$_recentlyReparsed
= false (line 197)
Recently reparsed?
mixed
$_root
= null (line 116)
Root node
array
$_stack
= array () (line 102)
Parse stack
int
$_status
= 0 (line 176)
Current parser status
string
$_text
= '' (line 95)
Raw text
Constructor StringParser (line 204)
Constructor
addFilter (line 216)
Add a filter
clearFilters (line 244)
Remove all filters
parse (line 272)
This function parses the text
_appendText (line 667)
Abstract method Append text depending on current status
_appendToLastTextChild (line 681)
Append text to last text child of current top parser stack node
_applyPostfilters (line 398)
Apply postfilters
It is possible to specify postfilters for the parser to do some manipulating of the string afterwards.
_applyPrefilters (line 380)
Apply prefilters
It is possible to specify prefilters for the parser to do some manipulating of the string beforehand.
_closeRemainingBlocks (line 479)
Abstract method: Close remaining blocks
_handleStatus (line 526)
Abstract method: Handle status
_loop (line 605)
Loop mode loop
_modifyTree (line 415)
Abstract method: Manipulate the tree
_outputTree (line 424)
Abstract method: Output tree
_parserInit (line 501)
Abstract method: Initialize the parser
_popNode (line 766)
Removes a node from the current parse stack
_pushNode (line 749)
Adds a node to the current parse stack
_reparseAfterCurrentBlock (line 438)
Restart parsing after current block
To achieve this the current top stack object is removed from the tree. Then the current item
_searchLoop (line 537)
Search mode loop
_setStatus (line 509)
Abstract method: Set a specific status
_strDetect (line 730)
Detects a string at the current position
_strpos (line 705)
Searches StringParser::_text for every needle that is
specified by using the http://www.php.net/strpos function. It returns an associative array with the key
pointing at the string that was found first and the key
- 'needle'
pointing at the offset at which the string was found first. If no needle was found, the
- 'offset'
element is
- 'needle'
and the
- false
element is
- 'offset'
.
- -1
_topNode (line 778)
Execute a method on the top element
_topNodeVar (line 798)
Get a variable of the top element
Documentation generated on Mon, 24 Apr 2006 21:38:07 +0200 by phpDocumentor 1.3.0RC5