Represents a node of an abstract syntax tree (AST).
sealed class
|
AstNode
|
implements
|
ICodeRange
|
Returns the child nodes of this AST node.
public
property
|
Children
{
get
}
|
||
type
|
IVectorConst<AstNode>
|
||
value
|
|
The child nodes. |
Returns the number of child nodes.
public
property
|
Count
{
get
}
|
||
type
|
int32
|
||
value
|
|
The number of child nodes. |
Index of last input token that belongs to this AST node (exclusive).
public
property
|
End
{
get
}
|
||
type
|
int32
|
||
value
|
|
The token index. |
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. |
The grammar that owns Rule.
public
property
|
Grammar
{
get
}
|
||
type
|
Grammar
|
||
value
|
The
grammar
object
or
null . |
Returns the last child node.
public
property
|
Last
{
get
}
|
||
type
|
AstNode
|
||
value
|
The
last
child
node
or
null
if
it
does
not
exist. |
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
|
The rule that has created this AST node.
public
property
|
Rule
{
get
}
|
||
type
|
IRule
|
||
value
|
|
The rule. |
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. |
Index of first input token that belongs to this AST node (inclusive).
public
property
|
Start
{
get
}
|
||
type
|
int32
|
||
value
|
|
The token index. |
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. |
The input token type.
public
property
|
Type
{
get
}
|
||
type
|
string
|
||
value
|
|
The token type. |
public
method
|
CheckCount
(ICodeInput input,
int32 minimum = 0,
int32 maximum = 0)
|
||
params
|
input
|
||
minimum
|
|||
maximum
|
public
method
|
CheckType
(ICodeInput input,
string expectedType)
|
||
params
|
input
|
||
expectedType
|
public
method
|
CheckValue
(ICodeInput input,
string expectedValue)
|
||
params
|
input
|
||
expectedValue
|
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
|
|
The child node. |
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
|
|
The PSI model object. |
Exceptions:
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
|
|
The AST node range. |
Remarks:
The given string must be identical to the parser input (e.g. see CodeInput).
See also:
ICodeInput.Range
[Pure]
|
||||
public
override
method
|
ToString
()
|
|||
type
|
string
|
Generates a textual dump of the AST node hierarchy.
public
method
|
ToStringGrammar
()
|
||
type
|
string
|
||
returns
|
|
The textual dump string. |
See also:
RuleToSourceFlags.GrammarAstReturns a human-readable string representation of the AST node tree.
public
method
|
ToStringTree
()
|
||
type
|
string
|
||
returns
|
|
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
|
|
The string representation. |
Returns the value of this AST node.
[Pure]
|
||||
public
method
|
Value
(ICodeInput input)
|
|||
type
|
string
|
|||
params
|
input
|
[not-null]
|
The code input. | |
returns
|
|
The node value. |