Constants |
public League |
Methods |
public __construct(string $line)
|
public advance() : void Move the cursor forwards |
public advanceBy(int $characters, bool $advanceByColumns = false) : void Move the cursor forwards
|
public advanceBySpaceOrTab() : bool Advances the cursor by a single space or tab, if present |
public advanceToEnd() : int Move the position to the very end of the line
|
public advanceToNextNonSpaceOrNewline() : int Parse zero or more space characters, including at most one newline. Tab characters are not parsed with this function.
|
public advanceToNextNonSpaceOrTab() : int Parse zero or more space/tab characters
|
public getCharacter(?int $index = NULL) : ?string |
public getColumn() : int |
public getCurrentCharacter() : ?string Slightly-optimized version of getCurrent(null) |
public getIndent() : int Calculates the current indent (number of spaces after current position) |
public getLine() : string |
public getNextNonSpaceCharacter() : ?string Returns the next character which isn't a space (or tab) |
public getNextNonSpacePosition() : int Returns the position of the next character which is not a space (or tab) |
public getPosition() : int |
public getPreviousText() : string |
public getRemainder() : string |
public getSubstring(int $start, ?int $length = NULL) : string |
public isAtEnd() : bool |
public isBlank() : bool Whether the remainder is blank |
public isIndented() : bool Whether the cursor is indented to INDENT_LEVEL |
public match(string $regex) : ?string Try to match a regular expression Returns the matching text and advances to the end of that match
|
public peek(int $offset = 1) : ?string Returns the next character (or null, if none) without advancing forwards |
public restoreState(League Restore the cursor to a previous state. Pass in the value previously obtained by calling saveState(). |
public saveState() : League Encapsulates the current state of this cursor in case you need to rollback later. WARNING: Do not parse or use the return value for ANYTHING except for passing it back into restoreState(), as the number of values and their contents may change in any future release without warning. |
Properties |
private array $charCache = []
|
private int $column = 0 |
private int $currentPosition = 0
|
private int $indent = 0 |
private bool $isMultibyte
|
private $lastTabPosition = NULL
|
private int $length
|
private string $line
|
private ?int $nextNonSpaceCache = NULL |
private bool $partiallyConsumedTab = false |
private int $previousPosition = 0 |