ASTSerializer

Serializes a complete parse tree.

Members

Aliases

write2B
alias write2B = writeXB!(ushort)

Writes 2 bytes.

write4B
alias write4B = writeXB!(uint)

Writes 4 bytes.

writeSB
alias writeSB = writeXB!(size_t)

Writes size_t.sizeof bytes.

Enums

TID
enum TID

An enumeration of types that may appear in the data.

Functions

indexOf
size_t indexOf(Token* token)

Returns the index number of a token. If token is null, size_t.max is returned.

serialize
ubyte[] serialize(Module mod)

Starts serialization.

write
void write(NodeKind k)

Writes the kind of a Node.

write
void write(Protection prot)

Writes the protection attribute.

write
void write(StorageClass stcs)

Writes the StorageClass attribute.

write
void write(LinkageType lnkg)

Writes the LinkageType attribute.

write
void write(Node n, TID tid)

Writes a node.

write
void write(Node[] nodes, TID tid)

Writes the mangled array type and then visits each node.

write
void write(char c)

Writes a char.

write
void write(bool b)

Writes a boolean.

write
void write(uint u)

Writes a uint.

write
void write(TOK tok)

Writes a TOK.

write
void write(Token* t)

Writes a Token.

write
void write(Token*[] tokens)

Writes an array of Tokens.

write
void write(Token*[][] tokenLists)

Writes an array of arrays of Tokens.

write1B
void write1B(ubyte x)

Writes 1 byte.

writeXB
void writeXB(T x)

Writes T.sizeof bytes.

Mixin templates

visitX
mixin template visitX(N)

Generates a visit method for a specific Node.

Static functions

mixinVisitMethods
char[] mixinVisitMethods()

Generates a list of mixin declarations for all Node classes. E.g.:

Variables

data
ubyte[] data;

The binary text.

firstToken
Token* firstToken;

The first token in the token array.

Inherited Members

From Visitor2

dispatch
void dispatch(Node n)

Calls the appropriate visit() method for a node.

dispatch
void dispatch(Node n, NodeKind k)

Allows calling the visit() method with a null node.

unhandled
void unhandled(Node n)

Called by visit() methods that were not overridden.

Meta