diff --git a/src/Reader/FileReader.php b/src/Reader/FileReader.php index 85bee76..b808a78 100644 --- a/src/Reader/FileReader.php +++ b/src/Reader/FileReader.php @@ -15,8 +15,8 @@ class FileReader extends StringReader { /** * FileReader constructor. - * @param string $fileName - * @throws FileNotFoundException + * @param string $fileName 文件名 + * @throws FileNotFoundException 文件不存在时报错 * @author Jerry Yan <792602257@qq.com> * @date 2021/1/26 13:52 */ diff --git a/src/Token/TokenInterface.php b/src/Token/TokenInterface.php index d6667cf..4f361c2 100644 --- a/src/Token/TokenInterface.php +++ b/src/Token/TokenInterface.php @@ -38,19 +38,23 @@ abstract class TokenInterface /** * 获取链表第一个元素 - * @return ?$this + * @return $this * @author Jerry Yan <792602257@qq.com> * @date 2021/1/22 10:01 */ - public function getFirstToken(): ?TokenInterface + public function getFirstToken(): TokenInterface { - if ($this->hasPrevToken()) return $this->getPrevToken()->getFirstToken(); - else return $this; + return $this->hasPrevToken() ? $this->getPrevToken()->getFirstToken() : $this; } - public function getLastToken(): ?TokenInterface + /** + * 获取链表最后一个元素 + * @return $this + * @author Jerry Yan <792602257@qq.com> + * @date 2021/2/19 11:05 + */ + public function getLastToken(): TokenInterface { - if ($this->hasNextToken()) return $this->getNextToken()->getLastToken(); - else return $this; + return $this->hasNextToken() ? $this->getNextToken()->getLastToken() : $this; } public function hasPrevToken(): bool { @@ -84,4 +88,8 @@ abstract class TokenInterface { return $this->getLength(); } + public function getRawString(): string + { + return $this->_raw; + } } \ No newline at end of file diff --git a/src/Token/TokenType.php b/src/Token/TokenType.php deleted file mode 100644 index abea02f..0000000 --- a/src/Token/TokenType.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @date 2020/12/17 15:04 - */ - - -namespace JerryYan\DSL\Token; - - -/** - * Token分类Enum - * @package JerryYan\DSL\Token - * @author Jerry Yan <792602257@qq.com> - * @date 2020/12/17 15:04 - */ -final class TokenType -{ - -} \ No newline at end of file