dank

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DFAState

type DFAState struct {
	ID      int
	NFAIDs  []int // sorted for key
	Trans   map[byte]int
	IsFinal bool
}

DFAState represents a DFA state (subset of NFA states).

type DankEncoder

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

DankEncoder is the main struct matching Python's C++ backend.

func NewDankEncoder

func NewDankEncoder(regexStr string, fixedSlice int) *DankEncoder

NewDankEncoder initializes and builds the automaton using C++ algorithm.

func (*DankEncoder) GenerateAtFixedLength

func (d *DankEncoder) GenerateAtFixedLength(fixedLen int) []string

GenerateAtFixedLength returns all strings of exactly fixedLen

func (*DankEncoder) NumNFAStates

func (d *DankEncoder) NumNFAStates() int

NumNFAStates returns the number of NFA states (for debugging)

func (*DankEncoder) NumStates

func (d *DankEncoder) NumStates() int

NumStates returns the number of DFA states

func (*DankEncoder) NumWords

func (d *DankEncoder) NumWords(minLen, maxLen int) int64

NumWords counts accepted strings using DP

type NFAState

type NFAState struct {
	ID      int
	Trans   map[byte]map[int]bool // byte -> set of state IDs
	IsFinal bool
}

NFAState represents a state in the Thompson NFA (C++ style).

Jump to

Keyboard shortcuts

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