ObjectTreeParser
class ObjectTreeParser (View source)
Parses a Fusion File to object ast-nodes
Properties
protected | $lexer | ||
protected | $contextPathAndFilename |
Methods
No description
Accepts a token of a given type.
Checks, if the token type matches the current, if so consume it and return true.
OptionalBigGap = ( NEWLINE / OptionalSmallGap )*
OptionalSmallGap = ( SPACE / SLASH_COMMENT / HASH_COMMENT / MULTILINE_COMMENT )*
FusionFile = StatementList
StatementList = ( Statement )*
Statement = IncludeStatement / ObjectStatement
IncludeStatement = INCLUDE ( STRING / CHAR / FILE_PATTERN ) EndOfStatement
ObjectStatement = ObjectPath ( ValueAssignment / ValueUnset / ValueCopy )? ( Block / EndOfStatement )
ObjectPath = PathSegment ( '.' PathSegment )*
PathSegment = ( PROTOTYPE_START FUSION_OBJECT_NAME ')' / OBJECT_PATH_PART / '@' OBJECT_PATH_PART / STRING / CHAR )
ValueAssignment = ASSIGNMENT PathValue
PathValue = ( CHAR / STRING / DSL_EXPRESSION / FusionObject / EelExpression )
DslExpression = DSL_EXPRESSION_START DSL_EXPRESSION_CONTENT
ValueUnset = UNSET
ValueCopy = COPY ObjectPathAssignment
AssignedObjectPath = '.'? ObjectPath
Block: = '{' StatementList? '}'
EndOfStatement = ( EOF / NEWLINE )
Details
protected
__construct(Lexer $lexer, string|null $contextPathAndFilename)
No description
static FusionFile
parse(string $sourceCode, string|null $contextPathAndFilename = null)
No description
protected Token
consume()
Consume the current token.
Can only consume if accept was called before.
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.
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.
protected bool|null
lazyExpect(int $tokenType)
Checks, if the token type matches the current, if so consume it and return true.
protected void
lazyBigGap()
OptionalBigGap = ( NEWLINE / OptionalSmallGap )*
protected void
lazySmallGap()
OptionalSmallGap = ( SPACE / SLASH_COMMENT / HASH_COMMENT / MULTILINE_COMMENT )*
protected FusionFile
parseFusionFile()
FusionFile = StatementList
protected StatementList
parseStatementList(int|null $stopLookahead = null)
StatementList = ( Statement )*
protected AbstractStatement
parseStatement()
Statement = IncludeStatement / ObjectStatement
protected IncludeStatement
parseIncludeStatement()
IncludeStatement = INCLUDE ( STRING / CHAR / FILE_PATTERN ) EndOfStatement
protected ObjectStatement
parseObjectStatement()
ObjectStatement = ObjectPath ( ValueAssignment / ValueUnset / ValueCopy )? ( Block / EndOfStatement )
protected ObjectPath
parseObjectPath()
ObjectPath = PathSegment ( '.' PathSegment )*
protected AbstractPathSegment
parsePathSegment()
PathSegment = ( PROTOTYPE_START FUSION_OBJECT_NAME ')' / OBJECT_PATH_PART / '@' OBJECT_PATH_PART / STRING / CHAR )
protected ValueAssignment
parseValueAssignment()
ValueAssignment = ASSIGNMENT PathValue
protected AbstractPathValue
parsePathValue()
PathValue = ( CHAR / STRING / DSL_EXPRESSION / FusionObject / EelExpression )
protected DslExpressionValue
parseDslExpression()
DslExpression = DSL_EXPRESSION_START DSL_EXPRESSION_CONTENT
protected ValueUnset
parseValueUnset()
ValueUnset = UNSET
protected ValueCopy
parseValueCopy()
ValueCopy = COPY ObjectPathAssignment
protected AssignedObjectPath
parseAssignedObjectPath()
AssignedObjectPath = '.'? ObjectPath
protected Block
parseBlock()
Block: = '{' StatementList? '}'
protected void
parseEndOfStatement()
EndOfStatement = ( EOF / NEWLINE )
protected ParserException
prepareParserException(ParserException $parserException)
No description