You've already forked MyDSL
优化光标移动逻辑
This commit is contained in:
@ -62,7 +62,7 @@ abstract class ReaderInterface
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:43
|
||||
*/
|
||||
abstract public function skipUntil(string $end="*/"): bool;
|
||||
abstract public function skipUntil(string $end = "*/"): bool;
|
||||
|
||||
/**
|
||||
* 重置读取器
|
||||
@ -91,12 +91,37 @@ abstract class ReaderInterface
|
||||
{
|
||||
return $this->currentPosition;
|
||||
}
|
||||
|
||||
public function getNextPosition(): int
|
||||
{
|
||||
return $this->nextPosition;
|
||||
}
|
||||
|
||||
public function getCurrentLine(): int
|
||||
{
|
||||
return $this->currentLine;
|
||||
}
|
||||
|
||||
public function getCurrentLinePosition(): int
|
||||
{
|
||||
return $this->currentLinePosition;
|
||||
}
|
||||
|
||||
public function getCurrentToken(): string
|
||||
{
|
||||
return $this->currentToken;
|
||||
}
|
||||
|
||||
protected function moveCursorToNextChar(): void
|
||||
{
|
||||
$this->currentPosition++;
|
||||
$this->currentLinePosition++;
|
||||
}
|
||||
|
||||
protected function moveCursorToNextLine(int $chars = 1): void
|
||||
{
|
||||
$this->currentPosition += $chars;
|
||||
$this->currentLinePosition = 0;
|
||||
$this->currentLine++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user