mode = $mode; } /** * Get the lexer mode this action should transition the lexer to. * * @return int The lexer mode for this `mode` command. */ public function getMode() : int { return $this->mode; } /** * {@inheritdoc} * * @return int This method returns {@see LexerActionType::MODE}. */ public function getActionType() : int { return LexerActionType::MODE; } /** * {@inheritdoc} * * @return bool This method returns `false`. */ public function isPositionDependent() : bool { return false; } /** * {@inheritdoc} * * This action is implemented by calling {@see Lexer::mode()} with the * value provided by {@see LexerModeAction::getMode()}. */ public function execute(Lexer $lexer) : void { $lexer->mode($this->mode); } public function hashCode() : int { return Hasher::hash($this->getActionType(), $this->mode); } public function equals(object $other) : bool { if ($this === $other) { return true; } if (!$other instanceof self) { return false; } return $this->mode === $other->mode; } public function __toString() : string { return \sprintf('mode(%d)', $this->mode); } }