setName($name); $this->setChildren($children); $this->setNodeId($nodeId); return; } /** * Set rule name. * * @param string $name Rule name. * @return string */ public function setName($name) { $old = $this->_name; $this->_name = $name; return $old; } /** * Get rule name. * * @return string */ public function getName() { return $this->_name; } /** * Set rule's children. * * @param mixed $children Children. * @return mixed */ protected function setChildren($children) { $old = $this->_children; $this->_children = $children; return $old; } /** * Get rule's children. * * @return mixed */ public function getChildren() { return $this->_children; } /** * Set node ID. * * @param string $nodeId Node ID. * @return string */ public function setNodeId($nodeId) { $old = $this->_nodeId; if (false !== $pos = strpos($nodeId, ':')) { $this->_nodeId = substr($nodeId, 0, $pos); $this->_nodeOptions = str_split(substr($nodeId, $pos + 1)); } else { $this->_nodeId = $nodeId; $this->_nodeOptions = []; } return $old; } /** * Get node ID. * * @return string */ public function getNodeId() { return $this->_nodeId; } /** * Get node options. * * @retrun array */ public function getNodeOptions() { return $this->_nodeOptions; } /** * Set default ID. * * @param string $defaultId Default ID. * @return string */ public function setDefaultId($defaultId) { $old = $this->_defaultId; if (false !== $pos = strpos($defaultId, ':')) { $this->_defaultId = substr($defaultId, 0, $pos); $this->_defaultOptions = str_split(substr($defaultId, $pos + 1)); } else { $this->_defaultId = $defaultId; $this->_defaultOptions = []; } return $old; } /** * Get default ID. * * @return string */ public function getDefaultId() { return $this->_defaultId; } /** * Get default options. * * @return array */ public function getDefaultOptions() { return $this->_defaultOptions; } /** * Set PP representation of the rule. * * @param string $pp PP representation. * @return string */ public function setPPRepresentation($pp) { $old = $this->_pp; $this->_pp = $pp; $this->_transitional = false; return $old; } /** * Get PP representation of the rule. * * @return string */ public function getPPRepresentation() { return $this->_pp; } /** * Check whether the rule is transitional or not. * * @return bool */ public function isTransitional() { return $this->_transitional; } } /** * Flex entity. */ Consistency::flexEntity('Hoa\Compiler\Llk\Rule\Rule');