AstBuilder extends AbstractAstBuilder implements AstBuilderInterface
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
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
build()
public
build(LineStream $lineStream, RootNode $ast[, array<string, string> $flatConstants = [] ]) : RootNode
Parameters
- $lineStream : LineStream
- $ast : RootNode
- $flatConstants : array<string, string> = []
Return values
RootNodeevaluateValueModifier()
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|nullgetOrAddNodeFromIdentifierStream()
protected
getOrAddNodeFromIdentifierStream(CurrentObjectPath $currentObjectPath, IdentifierTokenStream $tokenStream) : NodeInterface
Parameters
- $currentObjectPath : CurrentObjectPath
- $tokenStream : IdentifierTokenStream
Return values
NodeInterfacehandleIdentifierCopyLine()
protected
handleIdentifierCopyLine(IdentifierCopyLine $line, RootNode $rootNode, CurrentObjectPath $currentObjectPath) : NodeInterface|null
Parameters
- $line : IdentifierCopyLine
- $rootNode : RootNode
- $currentObjectPath : CurrentObjectPath
Return values
NodeInterface|nullhandleIdentifierReferenceLine()
"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
NodeInterfacehandleIdentifierUnsetLine()
protected
handleIdentifierUnsetLine(IdentifierUnsetLine $line, CurrentObjectPath $currentObjectPath) : void
Parameters
- $line : IdentifierUnsetLine
- $currentObjectPath : CurrentObjectPath