|
Moodle
2.2.1
http://www.collinsharper.com
|

Public Member Functions | |
| SimpleLexer (&$parser, $start="accept", $case=false) | |
| addPattern ($pattern, $mode="accept") | |
| addEntryPattern ($pattern, $mode, $new_mode) | |
| addExitPattern ($pattern, $mode) | |
| addSpecialPattern ($pattern, $mode, $special) | |
| mapHandler ($mode, $handler) | |
| parse ($raw) | |
| _dispatchTokens ($unmatched, $matched, $mode=false) | |
| _isModeEnd ($mode) | |
| _isSpecialMode ($mode) | |
| _decodeSpecial ($mode) | |
| _invokeParser ($content, $is_match) | |
| _reduce ($raw) | |
Data Fields | |
| $_regexes | |
| $_parser | |
| $_mode | |
| $_mode_handlers | |
| $_case | |
Definition at line 180 of file parser.php.
| _decodeSpecial | ( | $ | mode | ) |
Strips the magic underscore marking single token modes.
| string | $mode | Mode to decode. |
Definition at line 399 of file parser.php.

| _dispatchTokens | ( | $ | unmatched, |
| $ | matched, | ||
| $ | mode = false |
||
| ) |
Sends the matched token and any leading unmatched text to the parser changing the lexer to a new mode if one is listed.
| string | $unmatched | Unmatched leading portion. |
| string | $matched | Actual token match. |
| string | $mode | Mode after match. A boolean false mode causes no change. |
Definition at line 344 of file parser.php.


| _invokeParser | ( | $ | content, |
| $ | is_match | ||
| ) |
Calls the parser method named after the current mode. Empty content will be ignored. The lexer has a parser handler for each mode in the lexer.
| string | $content | Text parsed. |
| boolean | $is_match | Token is recognised rather than unparsed data. private |
Definition at line 412 of file parser.php.

| _isModeEnd | ( | $ | mode | ) |
Tests to see if the new mode is actually to leave the current mode and pop an item from the matching mode stack.
| string | $mode | Mode to test. |
Definition at line 376 of file parser.php.

| _isSpecialMode | ( | $ | mode | ) |
Test to see if the mode is one where this mode is entered for this token only and automatically leaves immediately afterwoods.
| string | $mode | Mode to test. |
Definition at line 388 of file parser.php.

| _reduce | ( | $ | raw | ) |
Tries to match a chunk of text and if successful removes the recognised chunk and any leading unparsed data. Empty strings will not be matched.
| string | $raw | The subject to parse. This is the content that will be eaten. |
Definition at line 434 of file parser.php.

| addEntryPattern | ( | $ | pattern, |
| $ | mode, | ||
| $ | new_mode | ||
| ) |
Adds a pattern that will enter a new parsing mode. Useful for entering parenthesis, strings, tags, etc.
| string | $pattern | Perl style regex, but ( and ) lose the usual meaning. |
| string | $mode | Should only apply this pattern when dealing with this type of input. |
| string | $new_mode | Change parsing to this new nested mode. public |
Definition at line 238 of file parser.php.

| addExitPattern | ( | $ | pattern, |
| $ | mode | ||
| ) |
Adds a pattern that will exit the current mode and re-enter the previous one.
| string | $pattern | Perl style regex, but ( and ) lose the usual meaning. |
| string | $mode | Mode to leave. public |
Definition at line 256 of file parser.php.

| addPattern | ( | $ | pattern, |
| $ | mode = "accept" |
||
| ) |
Adds a token search pattern for a particular parsing mode. The pattern does not change the current mode.
| string | $pattern | Perl style regex, but ( and ) lose the usual meaning. |
| string | $mode | Should only apply this pattern when dealing with this type of input. public |
Definition at line 215 of file parser.php.

| addSpecialPattern | ( | $ | pattern, |
| $ | mode, | ||
| $ | special | ||
| ) |
Adds a pattern that has a special mode. Acts as an entry and exit pattern in one go, effectively calling a special parser handler for this token only.
| string | $pattern | Perl style regex, but ( and ) lose the usual meaning. |
| string | $mode | Should only apply this pattern when dealing with this type of input. |
| string | $special | Use this mode for this one token. public |
Definition at line 278 of file parser.php.

| mapHandler | ( | $ | mode, |
| $ | handler | ||
| ) |
Adds a mapping from a mode to another handler.
| string | $mode | Mode to be remapped. |
| string | $handler | New target handler. public |
Definition at line 294 of file parser.php.

| parse | ( | $ | raw | ) |
Splits the page text into tokens. Will fail if the handlers report an error or if no content is consumed. If successful then each unparsed and parsed token invokes a call to the held listener.
| string | $raw | Raw HTML text. |
Definition at line 308 of file parser.php.

| SimpleLexer | ( | &$ | parser, |
| $ | start = "accept", |
||
| $ | case = false |
||
| ) |
Sets up the lexer in case insensitive matching by default.
| SimpleSaxParser | $parser | Handling strategy by reference. |
| string | $start | Starting handler. |
| boolean | $case | True for case sensitive. public |
Definition at line 196 of file parser.php.

| $_case |
Definition at line 185 of file parser.php.
| $_mode |
Definition at line 183 of file parser.php.
| $_mode_handlers |
Definition at line 184 of file parser.php.
| $_parser |
Definition at line 182 of file parser.php.
| $_regexes |
Definition at line 181 of file parser.php.