PHP 클래스 League\CommonMark\Cursor

파일 보기 프로젝트 열기: colinodell/commonmark-php 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $line )
advance ( ) Move the cursor forwards
advanceBy ( integer $characters, $advanceByColumns = false ) Move the cursor forwards
advanceBySpaceOrTab ( ) : boolean Advances the cursor by a single space or tab, if present
advanceToEnd ( ) : integer Move the position to the very end of the line
advanceToFirstNonSpace ( ) : integer Parse zero or more space characters, including at most one newline
advanceWhileMatches ( string $character, integer | null $maximumCharactersToAdvance = null ) : integer Advances the cursor while the given character is matched
getCharacter ( integer | null $index = null ) : string | null
getColumn ( ) : integer
getFirstNonSpaceCharacter ( ) : string Returns the next character which isn't a space
getFirstNonSpacePosition ( ) : integer Returns the position of the next non-space character
getIndent ( ) : integer Calculates the current indent (number of spaces after current position)
getLine ( ) : string
getPosition ( ) : integer
getPreviousText ( ) : string
getRemainder ( ) : string
isAtEnd ( ) : boolean
isBlank ( ) : boolean Whether the remainder is blank
isIndented ( ) : boolean Whether the cursor is indented to INDENT_LEVEL
match ( string $regex ) : string | null Try to match a regular expression
peek ( integer $offset = 1 ) : string | null Returns the next character (or null, if none) without advancing forwards
restoreState ( CursorState $state )
saveState ( ) : CursorState

메소드 상세

__construct() 공개 메소드

public __construct ( string $line )
$line string

advance() 공개 메소드

Move the cursor forwards
public advance ( )

advanceBy() 공개 메소드

Move the cursor forwards
public advanceBy ( integer $characters, $advanceByColumns = false )
$characters integer Number of characters to advance by

advanceBySpaceOrTab() 공개 메소드

Advances the cursor by a single space or tab, if present
public advanceBySpaceOrTab ( ) : boolean
리턴 boolean

advanceToEnd() 공개 메소드

Move the position to the very end of the line
public advanceToEnd ( ) : integer
리턴 integer The number of characters moved

advanceToFirstNonSpace() 공개 메소드

Parse zero or more space characters, including at most one newline
public advanceToFirstNonSpace ( ) : integer
리턴 integer Number of positions moved

advanceWhileMatches() 공개 메소드

Advances the cursor while the given character is matched
public advanceWhileMatches ( string $character, integer | null $maximumCharactersToAdvance = null ) : integer
$character string Character to match
$maximumCharactersToAdvance integer | null Maximum number of characters to advance before giving up
리턴 integer Number of positions moved (0 if unsuccessful)

getCharacter() 공개 메소드

public getCharacter ( integer | null $index = null ) : string | null
$index integer | null
리턴 string | null

getColumn() 공개 메소드

public getColumn ( ) : integer
리턴 integer

getFirstNonSpaceCharacter() 공개 메소드

Returns the next character which isn't a space

getFirstNonSpacePosition() 공개 메소드

Returns the position of the next non-space character

getIndent() 공개 메소드

Calculates the current indent (number of spaces after current position)
public getIndent ( ) : integer
리턴 integer

getLine() 공개 메소드

public getLine ( ) : string
리턴 string

getPosition() 공개 메소드

public getPosition ( ) : integer
리턴 integer

getPreviousText() 공개 메소드

public getPreviousText ( ) : string
리턴 string

getRemainder() 공개 메소드

public getRemainder ( ) : string
리턴 string

isAtEnd() 공개 메소드

public isAtEnd ( ) : boolean
리턴 boolean

isBlank() 공개 메소드

Whether the remainder is blank
public isBlank ( ) : boolean
리턴 boolean

isIndented() 공개 메소드

Whether the cursor is indented to INDENT_LEVEL
public isIndented ( ) : boolean
리턴 boolean

match() 공개 메소드

Returns the matching text and advances to the end of that match
public match ( string $regex ) : string | null
$regex string
리턴 string | null

peek() 공개 메소드

Returns the next character (or null, if none) without advancing forwards
public peek ( integer $offset = 1 ) : string | null
$offset integer
리턴 string | null

restoreState() 공개 메소드

public restoreState ( CursorState $state )
$state CursorState

saveState() 공개 메소드

public saveState ( ) : CursorState
리턴 CursorState