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.

Begin​No​Ast


public method BeginNoAst → ()

Begins a new parser context frame (no AST modification).

Commit


public method Commit → ()

Commits the current parser context frame.

Commit​No​Ast


public method CommitNoAst → ()

Commits the current parser context frame (no AST modification).

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.

Create​Ast


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.

Get​Parser​Errors


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.

Reset


public method Reset → (2)

grammar opt : Grammar = null

The grammar to use or null.

input opt : ICodeInput = null

The code input to consume or null.

returns → ParserContext

this

Resets the parser context.

Rollback


public method Rollback → ()

Rolls back the current parser context frame.

Rollback​No​Ast


public method RollbackNoAst → ()

Rolls back the current parser context frame (no AST modification).

Rule​Position​Stack


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

Is​Eof


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.