ParserContext

Description

sealed class Tinman.Core.Parsing.ParserContext

Derived from

Disposable abstract

Represents the context while parsing the content of a ICodeInput object.

Public / Methods

Begin


public method Begin → (1)

right opt : bool = false

Calling from the ast-if-right rule?

Begins a new parser context frame.

Commit


public method Commit → ()

Commits the current parser context frame.

Consume


public method Consume → (1)

opt : int32 = 1

Number of input tokens to consume.

Consumes the next opt input tokens and advances the position accordingly.

CreateAst


public method CreateAst → (1)

rule in : IGrammarRule

The enclosing grammar rule.

returns → AstNode

The created AstNode object.

Creates an AstNode object from the current parser content.

GetParserErrors


public method GetParserErrors → ()

returns → ValidateResult

The parser errors.

Returns the collected parser errors.

Peek


public method Peek → (1)

offset opt : int32 = 0

The relative offset.

returns → char

The token or '\0' for out-of-range offsets.

Peeks a token relative to the current position without modifying the current position.

If the resulting token offset lies outside the valid range, the default value of the token type will be returned.

Rollback


public method Rollback → ()

Rolls back the current parser context frame.

RulePositionStack


public method RulePositionStack → (1)

rule in : IRule

The rule object.

returns → ParserContextStack

The position stack.

Returns the position stack for the given rule.

Skip


public method Skip → ()

returns → bool

true if at least one input character has been skipped, false if not.

Skips subsequent input according to the skip rule of the current grammar of the top-most grammar rule.

Public / Attributes

IsEof


public attribute IsEof → (get)

value : bool

true if there are no more input tokens following the current position, false if at least one more token will follow.

Has the end of the input token sequence been reached?

Position


public attribute Position → (get)

value : int32

[>=0]
The current position.

Returns the current position.

Remaining


public attribute Remaining → (get)

value : int32

[>=0]
The number of remaining input tokens.

Returns the number of remaining input tokens.