Méthode | Description | |
---|---|---|
__construct ( SimpleSaxParser $parser, string $start = 'accept', boolean $case = false ) | Sets up the lexer in case insensitive matching by default. | |
addEntryPattern ( string $pattern, string $mode, string $new_mode ) | Adds a pattern that will enter a new parsing mode. | |
addExitPattern ( string $pattern, string $mode ) | Adds a pattern that will exit the current mode and re-enter the previous one. | |
addPattern ( string $pattern, string $mode = 'accept' ) | Adds a token search pattern for a particular parsing mode. | |
addSpecialPattern ( string $pattern, string $mode, string $special ) | Adds a pattern that has a special mode. | |
mapHandler ( string $mode, string $handler ) | Adds a mapping from a mode to another handler. | |
parse ( string $raw ) : boolean | Splits the page text into tokens. |
Méthode | Description | |
---|---|---|
decodeSpecial ( string $mode ) : string | Strips the magic underscore marking single token modes. | |
dispatchTokens ( string $unmatched, string $matched, string $mode = false ) : boolean | Sends the matched token and any leading unmatched text to the parser changing the lexer to a new mode if one is listed. | |
invokeParser ( string $content, boolean $is_match ) | Calls the parser method named after the current mode. | |
isModeEnd ( string $mode ) : boolean | Tests to see if the new mode is actually to leave the current mode and pop an item from the matching mode stack. | |
isSpecialMode ( string $mode ) : boolean | Test to see if the mode is one where this mode is entered for this token only and automatically leaves immediately afterwoods. | |
reduce ( string $raw ) : array/boolean | Tries to match a chunk of text and if successful removes the recognised chunk and any leading unparsed data. |
public __construct ( SimpleSaxParser $parser, string $start = 'accept', boolean $case = false ) | ||
$parser | SimpleSaxParser | Handling strategy by reference. |
$start | string | Starting handler. |
$case | boolean | True for case sensitive. |
public addExitPattern ( string $pattern, string $mode ) | ||
$pattern | string | Perl style regex, but ( and ) lose the usual meaning. |
$mode | string | Mode to leave. |
public addPattern ( string $pattern, string $mode = 'accept' ) | ||
$pattern | string | Perl style regex, but ( and ) lose the usual meaning. |
$mode | string | Should only apply this pattern when dealing with this type of input. |
protected decodeSpecial ( string $mode ) : string | ||
$mode | string | Mode to decode. |
Résultat | string | Underlying mode name. |
protected dispatchTokens ( string $unmatched, string $matched, string $mode = false ) : boolean | ||
$unmatched | string | Unmatched leading portion. |
$matched | string | Actual token match. |
$mode | string | Mode after match. A boolean false mode causes no change. |
Résultat | boolean | False if there was any error from the parser. |
protected invokeParser ( string $content, boolean $is_match ) | ||
$content | string | Text parsed. |
$is_match | boolean | Token is recognised rather than unparsed data. |
protected isSpecialMode ( string $mode ) : boolean | ||
$mode | string | Mode to test. |
Résultat | boolean | True if this is the exit mode. |
public mapHandler ( string $mode, string $handler ) | ||
$mode | string | Mode to be remapped. |
$handler | string | New target handler. |