AstBuilder extends AbstractAstBuilder implements AstBuilderInterface

FinalYes

The main TypoScript AST builder.

This creates a tree of Nodes, starting with the root node. Each node can have children. The implementation basically iterates a LineStream created by the tokenizers, and creates AST depending on the line type. It handles all the different operator lines like "=", "<" and so on.

Tags
internal:

Internal AST structure.

Attributes
#[AsAlias]
\TYPO3\CMS\Core\TypoScript\AST\AstBuilderInterface::class
#[Autoconfigure]
$public: true

Table of Contents

Interfaces

AstBuilderInterface
The main TypoScript AST builder.

Properties

$eventDispatcher  : EventDispatcherInterface
$flatConstants  : array<string, string>

Methods

__construct()  : mixed
build()  : RootNode
evaluateValueModifier()  : string|null
Evaluate operator functions, example TypoScript: "page.10.value := appendString(foo)"
getOrAddNodeFromIdentifierStream()  : NodeInterface
handleIdentifierCopyLine()  : NodeInterface|null
handleIdentifierReferenceLine()  : NodeInterface
"foo =< bar": Prepare a reference resolving.
handleIdentifierUnsetLine()  : void

Properties

$eventDispatcher

protected EventDispatcherInterface $eventDispatcher

$flatConstants

protected array<string, string> $flatConstants = []

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher) : mixed
Parameters
$eventDispatcher : EventDispatcherInterface

evaluateValueModifier()

Evaluate operator functions, example TypoScript: "page.10.value := appendString(foo)"

protected evaluateValueModifier(Token $functionNameToken, TokenStreamInterface $functionArgumentTokenStream, string|null $originalValue) : string|null
Parameters
$functionNameToken : Token
$functionArgumentTokenStream : TokenStreamInterface
$originalValue : string|null
Return values
string|null

handleIdentifierReferenceLine()

"foo =< bar": Prepare a reference resolving.

protected handleIdentifierReferenceLine(IdentifierReferenceLine $line, CurrentObjectPath $currentObjectPath) : NodeInterface

Note this does not resolve "=<" itself at this point since this operator can only be evaluated after the full AST has been established. Also, having a full AST-traverser run that does this is very expensive and "=<" is only done for "tt_content.myElement" and "lib.parseFunc" anyways. As such, "=<" is NOT a language construct itself and the AST-parser only marks nodes that use it by using the special node "ObjectReference". Resolving then happens "lazy" and "on demand" in ContentObjectRenderer cObjGetSingle() and mergeTSRef() for frontend "setup" TypoScript.

Parameters
$line : IdentifierReferenceLine
$currentObjectPath : CurrentObjectPath
Return values
NodeInterface

        
On this page

Search results