Node

The root class of all D syntax tree elements.

Members

Enums

State
enum State

The possible semantic states of a Node.

Functions

Is
Class Is()

Returns a reference to Class if this node can be cast to it.

addChild
void addChild(Node child)

Adds a child node.

addChildren
void addChildren(N children)

Adds a list of child nodes.

addOptChild
void addOptChild(Node child)

Adss a child node if not null.

addOptChildren
void addOptChildren(N children)

Adds a list of child nodes if not null.

copy
Node copy()

Returns a deep copy of this node.

dup
Node dup()

Returns a shallow copy of this object.

isDeclaration
bool isDeclaration()

Returns true if Declaration.

isExpression
bool isExpression()

Returns true if Expression.

isParameter
bool isParameter()

Returns true if Parameter.

isStatement
bool isStatement()

Returns true if Statement.

isType
bool isType()

Returns true if Type.

setLoc
void setLoc(Node other)

Sets the location tokens (begin and end) using another node.

setTokens
void setTokens(Token* begin, Token* end)

Sets the begin and end tokens.

to
Class to()

Casts this node to Class.

toText
cstring toText()

Returns the text spanned by the begin and end tokens. Warning: The Tokens must refer to the same piece of text.

Static variables

set_kind
enum set_kind;

This string is mixed into the constructor of a class that inherits from Node. It sets the member kind. E.g.: this.kind = NodeKind.IfStmt;

Variables

children
Node[] children;

List of subnodes. (May be removed to save space.)

end
Token* end;

The begin and end tokens of this node.

kind
NodeKind kind;

The kind of this node.

state
State state;

The semantic state of this node.

Meta