Documentation
¶
Index ¶
- Constants
- func DecodeNodes(data []byte) (*ast.Node, error)
- func DecodeSourceFile(data []byte) (*ast.SourceFile, error)
- func EncodeNode(node *ast.Node, sourceFile *ast.SourceFile) ([]byte, error)
- func EncodeSourceFile(sourceFile *ast.SourceFile) ([]byte, error)
- func SourceFileHash(sourceFile *ast.SourceFile) string
Constants ¶
View Source
const ( NodeOffsetKind = iota * 4 NodeOffsetPos NodeOffsetEnd NodeOffsetNext NodeOffsetParent NodeOffsetData NodeOffsetFlags // NodeSize is the number of bytes that represents a single node in the encoded format. NodeSize )
View Source
const ( NodeDataTypeChildren uint32 = iota << 30 NodeDataTypeString NodeDataTypeExtendedData )
View Source
const ( NodeDataTypeMask uint32 = 0xc0_00_00_00 NodeDataChildMask uint32 = 0x00_00_00_ff NodeDataStringIndexMask uint32 = 0x00_ff_ff_ff )
View Source
const ( HeaderOffsetMetadata = iota * 4 HeaderOffsetHashLo0 HeaderOffsetHashLo1 HeaderOffsetHashHi0 HeaderOffsetHashHi1 HeaderOffsetParseOptions HeaderOffsetStringOffsets HeaderOffsetStringData HeaderOffsetExtendedData HeaderOffsetStructuredData HeaderOffsetNodes HeaderSize )
View Source
const (
ProtocolVersion uint8 = 5
)
View Source
const (
SyntaxKindNodeList uint32 = 1<<32 - 1
)
Variables ¶
This section is empty.
Functions ¶
func DecodeNodes ¶
DecodeNodes decodes binary-encoded AST data into a tree of *ast.Node objects.
func DecodeSourceFile ¶
func DecodeSourceFile(data []byte) (*ast.SourceFile, error)
DecodeSourceFile decodes binary-encoded data into an *ast.SourceFile.
func EncodeNode ¶
EncodeNode encodes an arbitrary AST node and its descendants into the binary format. The sourceFile is needed to provide the source text for efficient string encoding. When encoding a non-SourceFile node, the header hash and parse options fields will be zero.
func EncodeSourceFile ¶
func EncodeSourceFile(sourceFile *ast.SourceFile) ([]byte, error)
EncodeSourceFile encodes an entire source file AST into the binary format.
func SourceFileHash ¶
func SourceFileHash(sourceFile *ast.SourceFile) string
SourceFileHash returns the 128-bit content hash for a source file as a hex string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.