treesitter

package
v0.0.0-...-30047a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JavaLanguage

func JavaLanguage() *sitter.Language

JavaLanguage returns the singleton Tree-sitter Java language.

Types

type Parser

type Parser struct{}

Parser implements ParseJavaFilePort.

func New

func New() *Parser

New creates a new Parser.

func (*Parser) ListJavaComments

func (p *Parser) ListJavaComments(ctx context.Context, fsys fs.FS, path string) ([]parser.JavaComment, error)

ListJavaComments satisfies ListJavaCommentsPort. It parses the given Java file and returns every line_comment and block_comment node found anywhere in the syntax tree — at file scope, inside class bodies, inside method bodies, and inside nested types.

The same *Parser struct satisfies ParseJavaFilePort, ListJavaFieldsPort, and ListJavaCommentsPort (one collaborator, multiple ISP ports) without any shared mutable state.

Partial parses: when the tree contains ERROR or MISSING nodes the method still returns all comments collected up to that point, wrapped together with domerr.ErrPartialParse — mirroring the behaviour of ParseJavaFile.

func (*Parser) ListJavaFields

func (p *Parser) ListJavaFields(ctx context.Context, fsys fs.FS, path string) (model.JavaFileSummary, error)

ListJavaFields satisfies ListJavaFieldsPort. It parses the file and returns a JavaFileSummary populated with Path, Package, Imports, and Declarations[i].Fields only — Methods and other JavaDeclaration fields are left at their zero value so callers explicitly opt in to the field-only view.

The same *Parser struct satisfies both ParseJavaFilePort and ListJavaFieldsPort (one collaborator, multiple ISP ports) without any shared mutable state.

func (*Parser) ParseJavaFile

func (p *Parser) ParseJavaFile(ctx context.Context, fsys fs.FS, path string) (model.JavaFileSummary, error)

ParseJavaFile parses a single Java file and returns a JavaFileSummary. If the file has syntax errors, it returns the summary AND a wrapped ErrPartialParse.

type Walker

type Walker struct{}

Walker implements WalkJavaFilesPort.

func NewWalker

func NewWalker() *Walker

NewWalker creates a new Walker.

func (*Walker) WalkJavaFiles

func (w *Walker) WalkJavaFiles(ctx context.Context, fsys fs.FS) ([]string, error)

WalkJavaFiles returns all *.java files under src/main/java/ in sorted order. Skips src/test/, hidden directories, and target/ / build/ directories.

Directories

Path Synopsis
Package bundledqueries embeds the Tree-sitter query (.scm) sets that ship with the jitctx binary, indexed by canonical language id.
Package bundledqueries embeds the Tree-sitter query (.scm) sets that ship with the jitctx binary, indexed by canonical language id.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL