class Parser (View source)

The Fusion Parser

Properties

static $reservedParseTreeKeys

Reserved parse tree keys for internal usage.

protected DslFactory $dslFactory
protected ParserCache $parserCache

Methods

array
parse(string $sourceCode, string|null $contextPathAndFilename = null, array $mergedArrayTreeUntilNow = [])

Parses the given Fusion source code, resolves includes and returns a merged array tree as the result.

void
handleFileInclude(MergedArrayTree $mergedArrayTree, string $filePattern, string|null $contextPathAndFilename)

No description

handleDslTranspile(string $identifier, string $code)

No description

getFusionFile(string $sourceCode, string|null $contextPathAndFilename)

No description

Details

array parse(string $sourceCode, string|null $contextPathAndFilename = null, array $mergedArrayTreeUntilNow = [])

Parses the given Fusion source code, resolves includes and returns a merged array tree as the result.

Parameters

string $sourceCode

The Fusion source code to parse

string|null $contextPathAndFilename

An optional path and filename used for relative Fusion file includes

array $mergedArrayTreeUntilNow

Used internally for keeping track of the built merged array tree

Return Value

array

The merged array tree for the Fusion runtime, generated from the source code

Exceptions

Exception

protected void handleFileInclude(MergedArrayTree $mergedArrayTree, string $filePattern, string|null $contextPathAndFilename)

No description

Parameters

MergedArrayTree $mergedArrayTree
string $filePattern
string|null $contextPathAndFilename

Return Value

void

protected handleDslTranspile(string $identifier, string $code)

No description

Parameters

string $identifier
string $code

protected MergedArrayTreeVisitor getMergedArrayTreeVisitor(MergedArrayTree $mergedArrayTree)

No description

Parameters

MergedArrayTree $mergedArrayTree

Return Value

MergedArrayTreeVisitor

protected FusionFile getFusionFile(string $sourceCode, string|null $contextPathAndFilename)

No description

Parameters

string $sourceCode
string|null $contextPathAndFilename

Return Value

FusionFile