final class TokenStream
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Tokens read one at a time, with one token of lookahead.

Methods§

public function __construct(private non-empty-list<Token> $tokens)

Parameters

$tokensnon-empty-list<Token>The tokens, ending with an end-of-file token
public function next(): Token

Takes the next token.

Returns

Token The token taken; the end-of-file token is taken again and again
Test cases 13
Called from 16
Calls 2
public function eof(): bool

Reports whether the file has ended.

Returns

bool True at the end-of-file token
Test cases 3
Called from 1
Calls 2

Private surface 2§

Implementation details, listed for orientation only.

private int $position = 0
private non-empty-list<Token> $tokens

Test cases 54§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 3
Other tests reaching this symbol 51

Relations§

Instantiated in 1
Method calls 17
Type declarations 16