ecmaregex

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ecmaregex executes one checked ECMA-262 2020 Unicode regular expression guest in isolated WebAssembly instances. It is not the Refine language regular-expression engine.

Index

Constants

View Source
const (
	ArtifactName                      = "refine-ecma262.wasm"
	ArtifactSHA256                    = "ee1ff0212d3a3bd28a72f00033f51dad747c8b36e9302edbbbd35cf6a58bfe8f"
	ABIVersion                 uint32 = 2
	HardMemoryPages            uint32 = 512
	HardPatternUnits                  = 16384
	HardInputUnits                    = 1 << 20
	HardHandles                       = 1024
	HardEvaluations            uint64 = 10000
	HardWorkUnits              uint64 = 8 << 20
	HardPolls                  uint32 = 1000000
	HardDuration                      = time.Second
	HardInitializationDuration        = 10 * time.Second
	HardInitializationPolls    uint32 = 1000000
	HardSessions                      = 4
)

Variables

This section is empty.

Functions

func Artifact

func Artifact() []byte

Artifact returns a defensive copy for generators that must emit the exact guest as a sibling resource rather than a Java source constant.

func DistributionManifest

func DistributionManifest() []byte

DistributionManifest returns the checked guest build manifest.

func DistributionNotice

func DistributionNotice() []byte

DistributionNotice returns the complete guest notices and license texts as a defensive copy suitable for a generated artifact.

func IsFailure

func IsFailure(err error, kind FailureKind) bool

func UTF16

func UTF16(input string) ([]uint16, error)

Types

type Engine

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

func New

func New(ctx context.Context, limits InitLimits) (*Engine, error)

func (*Engine) Begin

func (e *Engine) Begin(ctx context.Context, limits Limits) (*Request, error)

func (*Engine) Close

func (e *Engine) Close(ctx context.Context) error

type Failure

type Failure struct {
	Kind  FailureKind
	Phase Phase
	// contains filtered or unexported fields
}

Failure deliberately excludes pattern and subject text from Error().

func (*Failure) Error

func (f *Failure) Error() string

func (*Failure) Unwrap

func (f *Failure) Unwrap() error

type FailureKind

type FailureKind string
const (
	SyntaxFailure   FailureKind = "syntax"
	ResourceFailure FailureKind = "resource"
	InternalFailure FailureKind = "internal"
)

type Handle

type Handle uint32

type InitLimits

type InitLimits struct {
	MaxDuration time.Duration
	MaxPolls    uint32
}

func DefaultInitLimits

func DefaultInitLimits() InitLimits

type Limits

type Limits struct {
	MaxPatternUnits        int
	MaxInputUnits          int
	MaxHandles             int
	MaxEvaluations         uint64
	MaxWorkUnits           uint64
	MaxPolls               uint32
	MaxDuration            time.Duration
	MaxCompilationPolls    uint32
	MaxCompilationDuration time.Duration
}

func DefaultLimits

func DefaultLimits() Limits

type Phase

type Phase string
const (
	InitializationPhase Phase = "initialization"
	CompilationPhase    Phase = "compilation"
	MatchPhase          Phase = "match"
	ReleasePhase        Phase = "release"
)

type Request

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

func (*Request) Close

func (r *Request) Close() error

func (*Request) Compile

func (r *Request) Compile(input string) (Handle, error)

func (*Request) CompileUTF16

func (r *Request) CompileUTF16(pattern []uint16) (handle Handle, failureResult error)

func (*Request) Release

func (r *Request) Release(handle Handle) error

func (*Request) Test

func (r *Request) Test(handle Handle, input string) (bool, error)

func (*Request) TestUTF16

func (r *Request) TestUTF16(handle Handle, subject []uint16) (matched bool, failureResult error)

Jump to

Keyboard shortcuts

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