Plural rule parser.

This plural rule parser is implemented after the article "Top Down Operator Precedence" described in http://javascript.crockford.com/tdop/tdop.html.

package Default

 Methods

Create a new plural parser.

__construct() 

Advance the current token and optionally check the old token id.

advance(string $id = null) : void

Parameters

$id

string

Exceptions

\Zend\I18n\Exception\ParseException

Parse an expression.

expression(integer $rightBindingPower = 0) : \Zend\I18n\Translator\Plural\Symbol

Parameters

$rightBindingPower

integer

Returns

\Zend\I18n\Translator\Plural\Symbol

Parse a string.

parse(string $string) : \Zend\I18n\Translator\Plural\Symbol

Parameters

$string

string

Returns

\Zend\I18n\Translator\Plural\Symbol

Get the next token.

getNextToken() : array

Exceptions

\Zend\I18n\Exception\ParseException

Returns

array

Get a new symbol.

getSymbol(string $id) 

Parameters

$id

string

Populate the symbol table.

populateSymbolTable() : void

Register a left infix symbol.

registerLeftInfixSymbol(string $id, integer $leftBindingPower) : void

Parameters

$id

string

$leftBindingPower

integer

Register a prefix symbol.

registerPrefixSymbol(string $id, integer $leftBindingPower) : void

Parameters

$id

string

$leftBindingPower

integer

Register a right infix symbol.

registerRightInfixSymbol(string $id, integer $leftBindingPower) : void

Parameters

$id

string

$leftBindingPower

integer

Register a symbol.

registerSymbol(string $id, integer $leftBindingPower = 0) : \Zend\I18n\Translator\Plural\Symbol

Parameters

$id

string

$leftBindingPower

integer

Returns

\Zend\I18n\Translator\Plural\Symbol

 Properties

 

Current lexer position in the string.

$currentPos : integer

Default

 

Current token.

$currentToken : \Zend\I18n\Translator\Plural\Symbol

Default

 

String to parse.

$string : string

Default

 

Table of symbols.

$symbolTable : array

Default

array()