Provides operations on token streams, for use by pretty printer.
- internal
Methods |
public
__construct
(
array
$tokens
) Create token stream instance. |
public findRight ( int $pos , $findTokenType ) |
public
getIndentationBefore
(
int
$pos
) :
int
Get indentation before token position.
|
public
getTokenCode
(
int
$from
,
int
$to
,
int
$indent
) :
string
Get the code corresponding to a token offset range, optionally adjusted for indentation.
|
public
haveBraces
(
int
$startPos
,
int
$endPos
) :
bool
Whether the given position is immediately surrounded by braces.
|
public haveBracesInRange ( int $startPos , int $endPos ) |
public
haveParens
(
int
$startPos
,
int
$endPos
) :
bool
Whether the given position is immediately surrounded by parenthesis.
|
public
haveTokenImmediatelyAfter
(
int
$pos
,
$expectedTokenType
) :
bool
Check whether the position is directly followed by a certain token type. During this check whitespace and comments are skipped.
|
public
haveTokenImmediatelyBefore
(
int
$pos
,
$expectedTokenType
) :
bool
Check whether the position is directly preceded by a certain token type. During this check whitespace and comments are skipped.
|
public
haveTokenInRange
(
int
$startPos
,
int
$endPos
,
$tokenType
) Whether the given position range contains a certain token type.
|
public skipLeft ( int $pos , $skipTokenType ) |
public
skipLeftWhitespace
(
int
$pos
) Return first non-whitespace token position smaller or equal to passed position.
|
public skipRight ( int $pos , $skipTokenType ) |
public
skipRightWhitespace
(
int
$pos
) Return first non-whitespace position greater or equal to passed position.
|
Properties |
private
$indentMap
|
private
$tokens
|
Methods |
private
calcIndentMap
() Precalculate the indentation at every token position.
|