/** * Resolves all tokens in this scope. * * @param int $i The current token index * @param array $tokens The tokens being parsed * @throws \gettext\pluralparser\ParseException If this token cannot be resolved */ public function resolve(&$i = 0, array &$tokens = null) { if (!$this->isResolved()) { parent::resolve($i, $tokens); $this->resolve0(); } }
/** * Removes the next token from the scope. * * @param int $i The current token index * @param array $tokens The tokens being parsed * @throws \gettext\pluralparser\ParseException If this token cannot be resolved */ public function resolve(&$i = 0, array &$tokens = null) { if (!$this->isResolved()) { parent::resolve($i, $tokens); if ($i + 1 < count($tokens)) { $this->value = array_splice($tokens, $i + 1, 1)[0]; if (!is_int($this->value)) { $this->value->resolve($i, $tokens); } } else { throw new \gettext\pluralparser\ParseException('No value to negate'); } } }
/** * Removes the left and right tokens from the scope. * * @param int $i The current token index * @param array $tokens The tokens being parsed * @throws \gettext\pluralparser\ParseException If this token cannot be resolved */ public function resolve(&$i = 0, array &$tokens = null) { if (!$this->isResolved()) { parent::resolve($i, $tokens); if ($i > 0 && $i + 1 < count($tokens)) { $this->rhs = array_splice($tokens, $i + 1, 1)[0]; $this->lhs = array_splice($tokens, $i - 1, 1)[0]; if (!is_int($this->rhs)) { $this->rhs->resolve($i, $tokens); } $i--; } else { throw new \gettext\pluralparser\ParseException($this->operator . 'without arguments'); } } }