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.

 Methods

Create a new plural parser.

__construct() 

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

advance(string $id) : void

Parameters

$id

string

Exceptions

\Zend\I18n\Exception\ParseException

Parse an expression.

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

Parameters

$rightBindingPower

integer

Returns

Parse a string.

parse(string $string) : array

Parameters

$string

string

Returns

array

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) : \Zend\I18n\Translator\Plural\Symbol

Parameters

$id

string

$leftBindingPower

integer

Returns

 Properties

 

Current lexer position in the string.

$currentPos : integer

 

Current token.

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

 

String to parse.

$string : string

 

Table of symbols.

$symbolTable : array