class ObjectTreeParser (View source)

Parses a Fusion File to object ast-nodes

Properties

protected $lexer
protected $contextPathAndFilename

Methods

__construct(Lexer $lexer, string|null $contextPathAndFilename)

No description

static FusionFile
parse(FusionSourceCode $fusionCode)

No description

consume()

Consume the current token.

bool
accept(int $tokenType)

Accepts a token of a given type.

expect(int $tokenType)

Expects a token of a given type.

bool
lazyExpect(int $tokenType)

Checks, if the token type matches the current, if so consume it and return true.

void
lazyBigGap()

OptionalBigGap = ( NEWLINE / OptionalSmallGap )*

void
lazySmallGap()

OptionalSmallGap = ( SPACE / SLASH_COMMENT / HASH_COMMENT / MULTILINE_COMMENT )*

parseFusionFile()

FusionFile = StatementList

parseStatementList(int|null $stopLookahead = null)

StatementList = ( Statement )*

parseStatement()

Statement = IncludeStatement / ObjectStatement

parseIncludeStatement()

IncludeStatement = INCLUDE ( STRING / CHAR / FILE_PATTERN ) EndOfStatement

parseObjectStatement()

ObjectStatement = ObjectPath ( ValueAssignment / ValueUnset / ValueCopy )? ( Block / EndOfStatement )

parseObjectPath()

ObjectPath = PathSegment ( '.' PathSegment )*

parsePathSegment()

PathSegment = ( PROTOTYPE_START FUSION_OBJECT_NAME ')' / OBJECT_PATH_PART / '@' OBJECT_PATH_PART / STRING / CHAR )

parseValueAssignment()

ValueAssignment = ASSIGNMENT PathValue

parsePathValue()

PathValue = ( CHAR / STRING / DSL_EXPRESSION / FusionObject / EelExpression )

parseDslExpression()

DslExpression = DSL_EXPRESSION_START DSL_EXPRESSION_CONTENT

parseValueUnset()

ValueUnset = UNSET

parseValueCopy()

ValueCopy = COPY ObjectPathAssignment

parseAssignedObjectPath()

AssignedObjectPath = '.'? ObjectPath

parseBlock()

Block: = '{' StatementList? '}'

void
parseEndOfStatement()

EndOfStatement = ( EOF / NEWLINE )

prepareParserException(ParserException $parserException)

No description

Details

protected __construct(Lexer $lexer, string|null $contextPathAndFilename)

No description

Parameters

Lexer $lexer
string|null $contextPathAndFilename

static FusionFile parse(FusionSourceCode $fusionCode)

No description

Parameters

FusionSourceCode $fusionCode

Return Value

FusionFile

protected Token consume()

Consume the current token.

Can only consume if accept was called before.

Return Value

Token

protected bool accept(int $tokenType)

Accepts a token of a given type.

The Lexer will look up the regex for the token and try to match it on the current string. First match wins.

Parameters

int $tokenType

Return Value

bool

protected Token expect(int $tokenType)

Expects a token of a given type.

The Lexer will look up the regex for the token and try to match it on the current string. First match wins.

Parameters

int $tokenType

Return Value

Token

Exceptions

ParserUnexpectedCharException

protected bool lazyExpect(int $tokenType)

Checks, if the token type matches the current, if so consume it and return true.

Parameters

int $tokenType

Return Value

bool

protected void lazyBigGap()

OptionalBigGap = ( NEWLINE / OptionalSmallGap )*

Return Value

void

protected void lazySmallGap()

OptionalSmallGap = ( SPACE / SLASH_COMMENT / HASH_COMMENT / MULTILINE_COMMENT )*

Return Value

void

protected FusionFile parseFusionFile()

FusionFile = StatementList

Return Value

FusionFile

protected StatementList parseStatementList(int|null $stopLookahead = null)

StatementList = ( Statement )*

Parameters

int|null $stopLookahead

When this tokenType is encountered the loop will be stopped

Return Value

StatementList

protected AbstractStatement parseStatement()

Statement = IncludeStatement / ObjectStatement

Return Value

AbstractStatement

protected IncludeStatement parseIncludeStatement()

IncludeStatement = INCLUDE ( STRING / CHAR / FILE_PATTERN ) EndOfStatement

Return Value

IncludeStatement

protected ObjectStatement parseObjectStatement()

ObjectStatement = ObjectPath ( ValueAssignment / ValueUnset / ValueCopy )? ( Block / EndOfStatement )

Return Value

ObjectStatement

protected ObjectPath parseObjectPath()

ObjectPath = PathSegment ( '.' PathSegment )*

Return Value

ObjectPath

protected AbstractPathSegment parsePathSegment()

PathSegment = ( PROTOTYPE_START FUSION_OBJECT_NAME ')' / OBJECT_PATH_PART / '@' OBJECT_PATH_PART / STRING / CHAR )

Return Value

AbstractPathSegment

protected ValueAssignment parseValueAssignment()

ValueAssignment = ASSIGNMENT PathValue

Return Value

ValueAssignment

protected AbstractPathValue parsePathValue()

PathValue = ( CHAR / STRING / DSL_EXPRESSION / FusionObject / EelExpression )

Return Value

AbstractPathValue

protected DslExpressionValue parseDslExpression()

DslExpression = DSL_EXPRESSION_START DSL_EXPRESSION_CONTENT

Return Value

DslExpressionValue

protected ValueUnset parseValueUnset()

ValueUnset = UNSET

Return Value

ValueUnset

protected ValueCopy parseValueCopy()

ValueCopy = COPY ObjectPathAssignment

Return Value

ValueCopy

protected AssignedObjectPath parseAssignedObjectPath()

AssignedObjectPath = '.'? ObjectPath

Return Value

AssignedObjectPath

protected Block parseBlock()

Block: = '{' StatementList? '}'

Return Value

Block

protected void parseEndOfStatement()

EndOfStatement = ( EOF / NEWLINE )

Return Value

void

protected ParserException prepareParserException(ParserException $parserException)

No description

Parameters

ParserException $parserException

Return Value

ParserException