TINMAN 3D / REALTIME TERRAIN
Software Development Kit - User Manual

class AstNode in Tinman.Core.Parsing

Represents a node of an abstract syntax tree (AST).

sealed class AstNode implements ICodeRange

Public / Attributes

Children

Returns the child nodes of this AST node.

public property Children { get }
type IVectorConst<AstNode>
value [not-null] The child nodes.

Count

Returns the number of child nodes.

public property Count { get }
type int32
value [>=0] The number of child nodes.

End

Index of last input token that belongs to this AST node (exclusive).

public property End { get }
type int32
value [>=0] The token index.

First

Returns the first child node (index 0).

public property First { get }
type AstNode
value The first child node or null if it does not exist.

Grammar

The grammar that owns Rule.

public property Grammar { get }
type Grammar
value The grammar object or null.

Last

Returns the last child node.

public property Last { get }
type AstNode
value The last child node or null if it does not exist.

Range

Returns source code range of this object.

public property Range { get }
type RangeI
value The source code character range or Inv if none.
implements ICodeRange.Range

Rule

The rule that has created this AST node.

public property Rule { get }
type IRule
value [not-null] The rule.

Second

Returns the first child node (index 1).

public property Second { get }
type AstNode
value The first child node or null if it does not exist.

Start

Index of first input token that belongs to this AST node (inclusive).

public property Start { get }
type int32
value [>=0] The token index.

Third

Returns the first child node (index 2).

public property Third { get }
type AstNode
value The first child node or null if it does not exist.

Type

The input token type.

public property Type { get }
type string
value [not-null] The token type.

Public / Methods

CheckCount

public method CheckCount (ICodeInput input, int32 minimum = 0, int32 maximum = 0)
params input
  minimum
  maximum

CheckType

public method CheckType (ICodeInput input, string expectedType)
params input
  expectedType

CheckValue

public method CheckValue (ICodeInput input, string expectedValue)
params input
  expectedValue

Child

Returns the first child node that has the given token type.

[Pure]
public method Child (string type)
type AstNode
params type [not-null] The token type.
returns The first matching child node or null.

Returns the n-th child node, assuming that it exists.

[Pure]
public method Child (int32 n)
type AstNode
params n [0..Children.Count-1] Index of child node.
returns [not-null] The child node.

CreatePsi

Creates the PSI model for this AST node.

public method CreatePsi (ICodeInput input, Context context)
type object
params input [not-null] The code input object.
  context [not-null] The context object.
returns [not-null] The PSI model object.

Exceptions:

Extract

Extracts the range of this AST node from the given string.

public method Extract (string sourceCode)
type string
params sourceCode [not-null] The source code string.
returns [not-null] The AST node range.

Remarks:

The given string must be identical to the parser input (e.g. see CodeInput).

See also:

ICodeInput.Range

ToString

[Pure]
public override method ToString ()
type string

ToStringGrammar

Generates a textual dump of the AST node hierarchy.

public method ToStringGrammar ()
type string
returns [not-null] The textual dump string.

See also:

RuleToSourceFlags.GrammarAst

ToStringTree

Returns a human-readable string representation of the AST node tree.

public method ToStringTree ()
type string
returns [not-null] The string representation.

Returns a human-readable string representation of the AST node tree.

public method ToStringTree (string input)
type string
params input Optional parser input string for more detailed dump.
returns [not-null] The string representation.

Value

Returns the value of this AST node.

[Pure]
public method Value (ICodeInput input)
type string
params input [not-null] The code input.
returns [not-null] The node value.