Versions in this module Expand all Collapse all v1 v1.0.2 Mar 29, 2026 Changes in this version + const LANGUAGE_VERSION + const MIN_COMPATIBLE_LANGUAGE_VERSION + func NewQuery(language *Language, source string) (*Query, *QueryError) + func SetAllocator(newMalloc func(size uint) unsafe.Pointer, ...) + type CaptureQuantifier int + const CaptureQuantifierOne + const CaptureQuantifierOneOrMore + const CaptureQuantifierZero + const CaptureQuantifierZeroOrMore + const CaptureQuantifierZeroOrOne + type Decoder interface + Decode func(data []byte) (codePoint int32, bytesRead uint32) + type IncludedRangesError struct + Index uint32 + func (i *IncludedRangesError) Error() string + type InputEdit struct + NewEndByte uint + NewEndPosition Point + OldEndByte uint + OldEndPosition Point + StartByte uint + StartPosition Point + type Language struct + Inner *C.TSLanguage + func NewLanguage(ptr unsafe.Pointer) *Language + func (l *Language) AbiVersion() uint32 + func (l *Language) FieldCount() uint32 + func (l *Language) FieldIdForName(name string) uint16 + func (l *Language) FieldNameForId(id uint16) string + func (l *Language) IdForNodeKind(kind string, named bool) uint16 + func (l *Language) LookaheadIterator(state uint16) *LookaheadIterator + func (l *Language) Metadata() *LanguageMetadata + func (l *Language) NextState(state uint16, id uint16) uint16 + func (l *Language) NodeKindCount() uint32 + func (l *Language) NodeKindForId(id uint16) string + func (l *Language) NodeKindIsNamed(id uint16) bool + func (l *Language) NodeKindIsSupertype(id uint16) bool + func (l *Language) NodeKindIsVisible(id uint16) bool + func (l *Language) ParseStateCount() uint32 + func (l *Language) Version() uint32 + type LanguageError struct + func (l *LanguageError) Error() string + type LanguageMetadata struct + MajorVersion uint8 + MinorVersion uint8 + PatchVersion uint8 + type LogType int + const LogTypeLex + const LogTypeParse + type Logger = func(LogType, string) + type LookaheadIterator struct + func (l *LookaheadIterator) Close() + func (l *LookaheadIterator) Iter() []uint16 + func (l *LookaheadIterator) IterNames() []string + func (l *LookaheadIterator) Language() *Language + func (l *LookaheadIterator) Reset(language *Language, state uint16) bool + func (l *LookaheadIterator) ResetState(state uint16) bool + func (l *LookaheadIterator) Symbol() uint16 + func (l *LookaheadIterator) SymbolName() string + type Node struct + func (n *Node) ByteRange() (uint, uint) + func (n *Node) Child(i uint) *Node + func (n *Node) ChildByFieldId(fieldId uint16) *Node + func (n *Node) ChildByFieldName(fieldName string) *Node + func (n *Node) ChildCount() uint + func (n *Node) ChildWithDescendant(descendant *Node) *Node + func (n *Node) Children(cursor *TreeCursor) []Node + func (n *Node) ChildrenByFieldName(fieldName string, cursor *TreeCursor) []Node + func (n *Node) DescendantCount() uint + func (n *Node) DescendantForByteRange(start, end uint) *Node + func (n *Node) DescendantForPointRange(start, end Point) *Node + func (n *Node) Edit(edit *InputEdit) + func (n *Node) EndByte() uint + func (n *Node) EndPosition() Point + func (n *Node) Equals(other Node) bool + func (n *Node) FieldNameForChild(childIndex uint32) string + func (n *Node) FieldNameForNamedChild(namedChildIndex uint32) string + func (n *Node) FirstChildForByte(byteOffset uint) *Node + func (n *Node) FirstNamedChildForByte(byteOffset uint) *Node + func (n *Node) GrammarId() uint16 + func (n *Node) GrammarName() string + func (n *Node) HasChanges() bool + func (n *Node) HasError() bool + func (n *Node) Id() uintptr + func (n *Node) IsError() bool + func (n *Node) IsExtra() bool + func (n *Node) IsMissing() bool + func (n *Node) IsNamed() bool + func (n *Node) Kind() string + func (n *Node) KindId() uint16 + func (n *Node) Language() *Language + func (n *Node) NamedChild(i uint) *Node + func (n *Node) NamedChildCount() uint + func (n *Node) NamedChildren(cursor *TreeCursor) []Node + func (n *Node) NamedDescendantForByteRange(start, end uint) *Node + func (n *Node) NamedDescendantForPointRange(start, end Point) *Node + func (n *Node) NextNamedSibling() *Node + func (n *Node) NextParseState() uint16 + func (n *Node) NextSibling() *Node + func (n *Node) Parent() *Node + func (n *Node) ParseState() uint16 + func (n *Node) PrevNamedSibling() *Node + func (n *Node) PrevSibling() *Node + func (n *Node) Range() Range + func (n *Node) StartByte() uint + func (n *Node) StartPosition() Point + func (n *Node) ToSexp() string + func (n *Node) Utf16Text(source []uint16) []uint16 + func (n *Node) Utf8Text(source []byte) string + func (n *Node) Walk() *TreeCursor + type ParseOptions struct + ProgressCallback func(ParseState) bool + type ParseState struct + CurrentByteOffset uint32 + HasError bool + type Parser struct + func NewParser() *Parser + func (p *Parser) CancellationFlag() *uintptr + func (p *Parser) Close() + func (p *Parser) IncludedRanges() []Range + func (p *Parser) Language() *Language + func (p *Parser) Logger() *Logger + func (p *Parser) Parse(text []byte, oldTree *Tree) *Tree + func (p *Parser) ParseCtx(ctx context.Context, text []byte, oldTree *Tree) *Tree + func (p *Parser) ParseCustomEncoding(callback func(int, Point) []byte, oldTree *Tree, options *ParseOptions, ...) *Tree + func (p *Parser) ParseUTF16(text []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseUTF16BE(text []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseUTF16BEWith(callback func(int, Point) []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseUTF16BEWithOptions(callback func(int, Point) []uint16, oldTree *Tree, options *ParseOptions) *Tree + func (p *Parser) ParseUTF16LE(text []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseUTF16LEWith(callback func(int, Point) []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseUTF16LEWithOptions(callback func(int, Point) []uint16, oldTree *Tree, options *ParseOptions) *Tree + func (p *Parser) ParseUTF16With(callback func(int, Point) []uint16, oldTree *Tree) *Tree + func (p *Parser) ParseWith(callback func(int, Point) []byte, oldTree *Tree) *Tree + func (p *Parser) ParseWithOptions(callback func(int, Point) []byte, oldTree *Tree, options *ParseOptions) *Tree + func (p *Parser) PrintDotGraphs(file *os.File) + func (p *Parser) Reset() + func (p *Parser) SetCancellationFlag(flag *uintptr) + func (p *Parser) SetIncludedRanges(ranges []Range) error + func (p *Parser) SetLanguage(l *Language) error + func (p *Parser) SetLogger(logger Logger) + func (p *Parser) SetTimeoutMicros(timeoutMicros uint64) + func (p *Parser) StopPrintingDotGraphs() + func (p *Parser) TimeoutMicros() uint64 + type Point struct + Column uint + Row uint + func NewPoint(row, column uint) Point + type PropertyPredicate struct + Positive bool + Property QueryProperty + type Query struct + TextPredicates [][]TextPredicateCapture + func (q *Query) CaptureIndexForName(name string) (uint, bool) + func (q *Query) CaptureNames() []string + func (q *Query) CaptureQuantifiers(index uint) []CaptureQuantifier + func (q *Query) Close() + func (q *Query) DisableCapture(captureName string) + func (q *Query) DisablePattern(index uint) + func (q *Query) EndByteForPattern(index uint) uint + func (q *Query) GeneralPredicates(index uint) []QueryPredicate + func (q *Query) IsPatternGuaranteedAtStep(byteOffset uint) bool + func (q *Query) IsPatternNonLocal(index uint) bool + func (q *Query) IsPatternRooted(index uint) bool + func (q *Query) PatternCount() uint + func (q *Query) PropertyPredicates(index uint) []PropertyPredicate + func (q *Query) PropertySettings(index uint) []QueryProperty + func (q *Query) StartByteForPattern(index uint) uint + type QueryCapture struct + Index uint32 + Node Node + type QueryCaptures struct + func (qc *QueryCaptures) Next() (*QueryMatch, uint) + func (qc *QueryCaptures) SetByteRange(startByte uint, endByte uint) + func (qc *QueryCaptures) SetPointRange(startPoint Point, endPoint Point) + type QueryCursor struct + func NewQueryCursor() *QueryCursor + func (qc *QueryCursor) Captures(query *Query, node *Node, text []byte) QueryCaptures + func (qc *QueryCursor) Close() + func (qc *QueryCursor) DidExceedMatchLimit() bool + func (qc *QueryCursor) MatchLimit() uint + func (qc *QueryCursor) Matches(query *Query, node *Node, text []byte) QueryMatches + func (qc *QueryCursor) MatchesWithOptions(query *Query, node *Node, text []byte, options QueryCursorOptions) QueryMatches + func (qc *QueryCursor) SetByteRange(startByte uint, endByte uint) *QueryCursor + func (qc *QueryCursor) SetMatchLimit(limit uint) + func (qc *QueryCursor) SetMaxStartDepth(depth *uint) *QueryCursor + func (qc *QueryCursor) SetPointRange(startPoint Point, endPoint Point) *QueryCursor + func (qc *QueryCursor) SetTimeoutMicros(timeoutMicros uint64) + func (qc *QueryCursor) TimeoutMicros() uint64 + type QueryCursorOptions struct + ProgressCallback func(QueryCursorState) bool + type QueryCursorState struct + CurrentByteOffset uint32 + type QueryError struct + Column uint + Kind QueryErrorKind + Message string + Offset uint + Row uint + func (e QueryError) Error() string + type QueryErrorKind int + const QueryErrorCapture + const QueryErrorField + const QueryErrorLanguage + const QueryErrorNodeType + const QueryErrorPredicate + const QueryErrorStructure + const QueryErrorSyntax + type QueryMatch struct + Captures []QueryCapture + PatternIndex uint + func (qm *QueryMatch) Id() uint + func (qm *QueryMatch) NodesForCaptureIndex(captureIndex uint) []Node + func (qm *QueryMatch) Remove() + type QueryMatches struct + func (qm *QueryMatches) Next() *QueryMatch + func (qm *QueryMatches) SetByteRange(startByte uint, endByte uint) + func (qm *QueryMatches) SetPointRange(startPoint Point, endPoint Point) + type QueryPredicate struct + Args []QueryPredicateArg + Operator string + type QueryPredicateArg struct + CaptureId *uint + String *string + type QueryProperty struct + CaptureId *uint + Key string + Value *string + func NewQueryProperty(key string, value *string, captureId *uint) QueryProperty + type Range struct + EndByte uint + EndPoint Point + StartByte uint + StartPoint Point + func (r *Range) FromTSRange(tr C.TSRange) + func (r *Range) ToTSRange() C.TSRange + type TextPredicateCapture struct + CaptureId uint + MatchAllNodes bool + Positive bool + Type TextPredicateType + Value any + type TextPredicateType int + const TextPredicateTypeAnyString + const TextPredicateTypeEqCapture + const TextPredicateTypeEqString + const TextPredicateTypeMatchString + type Tree struct + func (t *Tree) ChangedRanges(other *Tree) []Range + func (t *Tree) Clone() *Tree + func (t *Tree) Close() + func (t *Tree) Edit(edit *InputEdit) + func (t *Tree) IncludedRanges() []Range + func (t *Tree) Language() *Language + func (t *Tree) PrintDotGraph(file int) + func (t *Tree) RootNode() *Node + func (t *Tree) RootNodeWithOffset(offsetBytes int, offsetExtent Point) *Node + func (t *Tree) Walk() *TreeCursor + type TreeCursor struct + func (tc *TreeCursor) Close() + func (tc *TreeCursor) Copy() *TreeCursor + func (tc *TreeCursor) Depth() uint32 + func (tc *TreeCursor) DescendantIndex() uint32 + func (tc *TreeCursor) FieldId() uint16 + func (tc *TreeCursor) FieldName() string + func (tc *TreeCursor) GotoDescendant(descendantIndex uint32) + func (tc *TreeCursor) GotoFirstChild() bool + func (tc *TreeCursor) GotoFirstChildForByte(byteIndex uint32) *uint + func (tc *TreeCursor) GotoFirstChildForPoint(point Point) *uint + func (tc *TreeCursor) GotoLastChild() bool + func (tc *TreeCursor) GotoNextSibling() bool + func (tc *TreeCursor) GotoParent() bool + func (tc *TreeCursor) GotoPreviousSibling() bool + func (tc *TreeCursor) Node() *Node + func (tc *TreeCursor) Reset(node Node) + func (tc *TreeCursor) ResetTo(cursor *TreeCursor)