‪TYPO3CMS  ‪main
TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream Class Reference
Inheritance diagram for TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream:
TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream TYPO3\CMS\Core\TypoScript\Tokenizer\Token\TokenStreamInterface

Public Member Functions

 __toString ()
 
 append (TokenInterface $token)
 
 setRelative ()
 
 isRelative ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream
 __serialize ()
 
 isEmpty ()
 
 reset ()
 
 getNext ()
 
 peekNext ()
 
 getAll ()
 
 setAll (array $tokens)
 

Protected Member Functions

 serialize ()
 

Private Attributes

bool $relative = false
 

Additional Inherited Members

- ‪Protected Attributes inherited from ‪TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream
array $tokens = []
 
int $currentIndex = -1
 

Detailed Description

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.

: Internal tokenizer structure.

Definition at line 43 of file IdentifierTokenStream.php.

Member Function Documentation

◆ __toString()

TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream::__toString ( )

When rendering a source string from multiple identifiers, dots between single identifiers need to be added again. 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().

Reimplemented from TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream.

Definition at line 52 of file IdentifierTokenStream.php.

References TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream\getNext(), and TYPO3\CMS\Core\TypoScript\Tokenizer\Token\AbstractTokenStream\reset().

◆ append()

◆ isRelative()

TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream::isRelative ( )

True if this identifier stream is relative to given context.

Definition at line 102 of file IdentifierTokenStream.php.

References TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream\$relative.

Referenced by TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream\serialize().

◆ serialize()

TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream::serialize ( )
protected

◆ setRelative()

TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream::setRelative ( )

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

Definition at line 93 of file IdentifierTokenStream.php.

Member Data Documentation

◆ $relative

bool TYPO3\CMS\Core\TypoScript\Tokenizer\Token\IdentifierTokenStream::$relative = false
private