pythonruntime

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExternalLexStates = [][]bool{
	{false, false, false, false, false, false, false, false, false, false, false, false},
	{true, true, true, true, true, true, true, true, true, true, true, true},
	{false, false, false, true, false, false, false, true, false, false, false, false},
	{false, false, true, true, false, false, false, true, false, false, false, false},
	{true, false, false, true, false, false, false, true, false, false, false, false},
	{true, true, false, true, false, false, false, true, false, false, false, false},
	{false, false, false, true, false, false, false, true, false, false, true, false},
	{false, false, false, true, false, false, false, true, false, true, false, false},
	{false, false, false, true, false, false, false, true, true, false, false, false},
	{true, false, false, false, false, false, false, true, false, false, false, false},
	{false, false, true, true, false, false, false, true, false, false, false, true},
	{false, false, false, true, false, false, false, true, false, false, false, true},
	{false, false, false, false, false, false, false, true, true, false, false, false},
	{false, false, false, false, false, false, false, true, false, false, true, false},
	{false, false, false, false, false, false, false, true, false, true, false, false},
	{false, false, false, false, false, false, false, true, false, false, false, false},
	{false, false, false, false, true, true, true, true, false, false, false, false},
	{false, false, true, false, false, false, false, true, false, false, false, false},
	{true, true, false, false, false, false, false, true, false, false, false, false},
}

ExternalLexStates mirrors C tree-sitter ts_external_scanner_states. Rows are external lex state IDs; columns are Python external token indices.

Functions

func DeserializeState

func DeserializeState(s *State, buf []byte)

func SerializeState

func SerializeState(s *State, buf []byte) int

Types

type Delimiter

type Delimiter byte

This state and encoding serve Python-derived external scanners. Keep this file separate from Python registration so a subset does not publish Python metadata when it only includes a derivative grammar.

const (
	DelimiterSingleQuote Delimiter = 1 << 0
	DelimiterDoubleQuote Delimiter = 1 << 1
	DelimiterBackQuote   Delimiter = 1 << 2
	DelimiterRaw         Delimiter = 1 << 3
	DelimiterFormat      Delimiter = 1 << 4
	DelimiterTriple      Delimiter = 1 << 5
	DelimiterBytes       Delimiter = 1 << 6
)

func (Delimiter) EndChar

func (d Delimiter) EndChar() rune

func (Delimiter) IsBytes

func (d Delimiter) IsBytes() bool

func (Delimiter) IsFormat

func (d Delimiter) IsFormat() bool

func (Delimiter) IsRaw

func (d Delimiter) IsRaw() bool

func (Delimiter) IsTriple

func (d Delimiter) IsTriple() bool

type PythonExternalScanner

type PythonExternalScanner struct {
	// contains filtered or unexported fields
}

func Bind

Bind uses the caller's positional binder and preserves its diagnostics.

func (PythonExternalScanner) Create

func (PythonExternalScanner) Create() any

func (PythonExternalScanner) Deserialize

func (PythonExternalScanner) Deserialize(payload any, buf []byte)

func (PythonExternalScanner) Destroy

func (PythonExternalScanner) Destroy(payload any)

func (PythonExternalScanner) ExternalScannerASCIIEquivalenceClass

func (PythonExternalScanner) ExternalScannerASCIIEquivalenceClass(b byte) uint8

ASCII digits share every character branch, including string and comment scans.

func (PythonExternalScanner) ExternalScannerForLanguage

func (PythonExternalScanner) ExternalScannerForLanguage(lang *gotreesitter.Language) gotreesitter.ExternalScanner

func (PythonExternalScanner) PreservesStateOnScanFailure

func (PythonExternalScanner) PreservesStateOnScanFailure() bool

func (PythonExternalScanner) RequiresIncrementalPrefixFrontierProof

func (PythonExternalScanner) RequiresIncrementalPrefixFrontierProof() bool

RequiresIncrementalPrefixFrontierProof prevents a changed indentation prefix from transferring a reduction that belongs to the old source.

func (PythonExternalScanner) Scan

func (p PythonExternalScanner) Scan(payload any, lexer *gotreesitter.ExternalLexer, validSymbols []bool) bool

func (PythonExternalScanner) Serialize

func (PythonExternalScanner) Serialize(payload any, buf []byte) int

func (PythonExternalScanner) SupportsIncrementalReuse

func (PythonExternalScanner) SupportsIncrementalReuse() bool

SupportsIncrementalReuse enables checkpoint-authenticated subtree reuse. Python serializes its complete indentation and string-delimiter state, so a reused boundary is accepted only after the live scanner matches its start checkpoint and restores its end checkpoint.

func (PythonExternalScanner) UsesExternalScannerCheckpoints

func (PythonExternalScanner) UsesExternalScannerCheckpoints() bool

type State

type State struct {
	Indents                  []uint16
	Delimiters               []Delimiter
	InsideInterpolatedString bool
}

func (*State) SyncInsideInterpolatedString

func (s *State) SyncInsideInterpolatedString()

Jump to

Keyboard shortcuts

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