IdentifierTokenStream extends AbstractTokenStream

FinalYes

A list of single identifier (!) tokens: TokenType::T_IDENTIFIER, and only of those.

This is used in TS lines that know certain parts have to be lists of identifier tokens only. For instance a LineIdentifierAssignment "foo.bar = barValue" return this stream for getIdentifierTokenStream(): The left side of an assignment line is a list of identifier tokens.

Identifiers can be "relative" on the right side for "<" (LineIdentifierCopy) and "=<" (LineIdentifierReference). Examples are "foo.bar < .baz" and "foo.bar =< .baz". These are identified by having a "." (dot) at the beginning on the right side. For these places, the toggle "relative" is set to true for the AST-builder to look for relative copy and copy-reference. The generic example are "relative" references in TS menus: 'RO < .NO'

For example, with "foo.bar < baz", the Tokenizer creates a LineIdentifierCopy line, having a TokenStreamIdentifier list of the T_IDENTIFIER tokens for 'foo' and 'bar' for getIdentifierTokenStream(), plus a TokenStreamIdentifier list of T_IDENTIFIER tokens for 'baz' for getValueTokenStream().

Note identifier streams on the left side (foo.bar = ...) are never relative, this toggle is true for "<" and "=<" only.

Lines that know they can only return TokenStreamIdentifier's - they are more specific than just TokenStream, are type-hinted as such. For instance getIdentifierTokenStream() type hints TokenStreamIdentifier.

Tags
internal:

Internal tokenizer structure.

Table of Contents

Properties

$currentIndex  : int
$tokens  : array<string|int, TokenInterface>

Methods

__serialize()  : array<string|int, mixed>
When storing to cache, we only store FE relevant properties and skip irrelevant things. For instance $currentIndex should always initialize to -1 and does not need to be stored.
__toString()  : string
When rendering a source string from multiple identifiers, dots between single identifiers need to be added again.
append()  : self
Append a token to the stream.
getAll()  : array<string|int, TokenInterface>
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
getNext()  : TokenInterface|null
Get next token and raise pointer.
isEmpty()  : bool
We sometimes create a stream but don't add tokens.
isRelative()  : bool
True if this identifier stream is relative to given context.
peekNext()  : TokenInterface|null
Get next token but do not raise pointer.
reset()  : static
Reset current pointer. Typically, call this before iterating with getNext().
setAll()  : self
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
setRelative()  : self
This identifier token stream is relative! There is a dot on the right side of something like "foo.bar < .baz"
serialize()  : array<string|int, mixed>

Properties

$currentIndex

protected int $currentIndex = -1

Methods

__serialize()

When storing to cache, we only store FE relevant properties and skip irrelevant things. For instance $currentIndex should always initialize to -1 and does not need to be stored.

public final __serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

When rendering a source string from multiple identifiers, dots between single identifiers need to be added again.

public __toString() : string

This is used in RootNode->toArray() to create that insane '< lib.whatever' as value when using the reference operator: "foo =< lib.whatever". See ContentObjectRenderer cObjGetSingle() and mergeTSRef().

Return values
string

getAll()

Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.

public getAll() : array<string|int, TokenInterface>
Return values
array<string|int, TokenInterface>

isEmpty()

We sometimes create a stream but don't add tokens.

public isEmpty() : bool

This method returns true if tokens have been added.

Return values
bool

isRelative()

True if this identifier stream is relative to given context.

public isRelative() : bool
Return values
bool

reset()

Reset current pointer. Typically, call this before iterating with getNext().

public reset() : static
Return values
static

setAll()

Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.

public setAll(array<string|int, mixed> $tokens) : self
Parameters
$tokens : array<string|int, mixed>
Return values
self

setRelative()

This identifier token stream is relative! There is a dot on the right side of something like "foo.bar < .baz"

public setRelative() : self
Return values
self

serialize()

protected serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results