Generic string parser class
This is an abstract class for any type of string parser.
Located in /stringparser.class.php (line 66)
Class | Description |
---|---|
StringParser_BBCode | BB code string parser class |
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.
Characters or strings to look for
Current position in raw text
Length of the text
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 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.
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.
Postfilters
Prefilters
Recently reparsed?
Root node
Parse stack
Current parser status
Raw text
Add a filter
Remove all filters
This function parses the text
Abstract method Append text depending on current status
Append text to last text child of current top parser stack node
Apply postfilters
It is possible to specify postfilters for the parser to do some manipulating of the string afterwards.
Apply prefilters
It is possible to specify prefilters for the parser to do some manipulating of the string beforehand.
Abstract method: Close remaining blocks
Abstract method: Handle status
Abstract method: Manipulate the tree
Abstract method: Output tree
Adds a node to the current parse stack
Restart parsing after current block
To achieve this the current top stack object is removed from the tree. Then the current item
Abstract method: Set a specific status
Detects a string at the current position
Searches StringParser::_text for every needle that is
specified by using the strpos function. It returns an associative array with the key
Documentation generated on Mon, 10 Dec 2007 13:29:39 +0100 by phpDocumentor 1.4.0