Zend\I18n\Translator\Plural\Parser
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>.
Synopsis
class Parser
{
- // members
- protected string $string;
- protected int $currentPos;
- protected Symbol $currentToken;
- protected array $symbolTable;
- // methods
- public void __construct()
- protected void populateSymbolTable()
- protected void registerLeftInfixSymbol()
- protected void registerRightInfixSymbol()
- protected void registerPrefixSymbol()
- protected Symbol registerSymbol()
- protected void getSymbol()
- public array parse()
- public Symbol expression()
- public void advance()
- protected array getNextToken()
Members
protected
- $currentPos
—
int
Current lexer position in the string. - $currentToken
—
Zend\I18n\Translator\Plural\Symbol
Current token. - $string
—
string
String to parse. - $symbolTable
—
array
Table of symbols.
Methods
protected
- getNextToken() — Get the next token.
- getSymbol() — Get a new symbol.
- populateSymbolTable() — Populate the symbol table.
- registerLeftInfixSymbol() — Register a left infix symbol.
- registerPrefixSymbol() — Register a prefix symbol.
- registerRightInfixSymbol() — Register a right infix symbol.
- registerSymbol() — Register a symbol.
public
- __construct() — Create a new plural parser.
- advance() — Advance the current token and optionally check the old token id.
- expression() — Parse an expression.
- parse() — Parse a string.