sourceparse

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sourceparse shares read-only source input and syntax between classifiers and literal previews.

Index

Constants

This section is empty.

Variables

Functions

func Call

func Call(node *sitter.Node) (*sitter.Node, []*sitter.Node)

func GlobExpression

func GlobExpression(pattern string) (string, bool)

GlobExpression translates gitignore glob syntax to a regular expression over slash-separated relative paths.

func JavaScriptString

func JavaScriptString(source string) (string, bool)

func JavaScriptValue

func JavaScriptValue(node *sitter.Node, source []byte) (any, bool)

func Open

func Open(path string) (*os.File, error)

func Parse

func Parse(data []byte, language *sitter.Language, canceled func() bool) (*sitter.Tree, error)

Parse leaves the tree and cancellation policy with its caller. A nil cancellation predicate uses the ordinary non-interruptible parser.

func Path

func Path(cwd, path string) string

Types

type IgnoreRule

type IgnoreRule struct {
	Pattern *regexp.Regexp
	Negate  bool
	DirOnly bool
	// basename rules have no inner slash and match an entry at any depth.
	Basename bool
}

IgnoreRule is one pattern from an ignore file, matched against paths relative to the directory that holds the file.

func ParseIgnore

func ParseIgnore(line string) (IgnoreRule, bool)

Jump to

Keyboard shortcuts

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