Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | List of all members
Lexer Class Reference

Accepts text and breaks it into tokens. More...

Inheritance diagram for Lexer:
search_lexer

Public Member Functions

 __construct (&$parser, $start="accept", $case=false)
 Sets up the lexer in case insensitive matching by default. More...
 
 addEntryPattern ($pattern, $mode, $new_mode)
 Adds a pattern that will enter a new parsing mode. More...
 
 addExitPattern ($pattern, $mode)
 Adds a pattern that will exit the current mode and re-enter the previous one. More...
 
 addPattern ($pattern, $mode="accept")
 Adds a token search pattern for a particular parsing mode. More...
 
 addSpecialPattern ($pattern, $mode, $special)
 Adds a pattern that has a special mode. More...
 
 Lexer (&$parser, $start="accept", $case=false)
 Old syntax of class constructor. More...
 
 mapHandler ($mode, $handler)
 Adds a mapping from a mode to another handler. More...
 
 parse ($raw)
 Splits the page text into tokens. More...
 

Public Attributes

 $_case
 
 $_mode
 
 $_mode_handlers
 
 $_parser
 
 $_regexes
 

Detailed Description

Accepts text and breaks it into tokens.

Some optimisation to make the sure the content is only scanned by the PHP regex parser once. Lexer modes must not start with leading underscores.

License
Public Domain

The documentation for this class was generated from the following file: