Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\Styling\Lexer Class Reference

A lexer (tokenizer) for variables used in styling templates. More...

Public Member Functions

 __construct ($formula, array $vars)
 
 getResult ()
 

Public Attributes

const PATT_INTEGER = '/^[0-9]+/'
 Allow stuff such as "1234".
 
const PATT_REAL = '/^[0-9]*\.[0-9]+|^[0-9]+\.[0-9]*/'
 Allow stuff such as "1.23", "1." or ".23".
 
const PATT_VAR_NAME = '/^[a-zA-Z0-9_\\.]+/'
 Pattern for variable names.
 

Protected Member Functions

 tokenize ()
 This method does the actual work.
 

Protected Attributes

 $formula
 Formula to be tokenized.
 
 $length
 Length of the formula.
 
 $parser
 Parser for the formula.
 
 $position
 Current position in the formula.
 

Detailed Description

A lexer (tokenizer) for variables used in styling templates.

Definition at line 28 of file Lexer.php.

Constructor & Destructor Documentation

Erebot\Styling\Lexer::__construct (   $formula,
array  $vars 
)

Constructs a new lexer for some formula.

Parameters
string$formulaSome formula to tokenize.
array$varsAn array of variables that may be used in the formula.

Definition at line 63 of file Lexer.php.

References Erebot\Styling\Lexer\$formula, and Erebot\Styling\Lexer\tokenize().

Member Function Documentation

Erebot\Styling\Lexer::getResult ( )

Returns the result of the formula.

Return values
mixedResult of the formula.

Definition at line 78 of file Lexer.php.


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