expr

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package expr implements text matching.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expr

type Expr interface {
	Match(data []byte) (mRes *MatchRes, ok bool)
	Repr() string
}

func NewSimpleExpr

func NewSimpleExpr(pattern string) Expr

func NewSimpleExprFirst

func NewSimpleExprFirst(pattern string, first int) Expr

func NewSimpleExprFirst200

func NewSimpleExprFirst200(pattern string) Expr

func NewSimpleExprLast

func NewSimpleExprLast(pattern string, last int) Expr

func NewSimpleExprLast20

func NewSimpleExprLast20(pattern string) Expr

func NewSimpleExprLast200

func NewSimpleExprLast200(pattern string) Expr

func NewSimpleExprListStr

func NewSimpleExprListStr(patterns []string) Expr

type ExprList

type ExprList interface {
	Expr
	Add(name string, expr Expr)
	GetName(no int) string
	Delete(name string)
}

func NewSimpleExprList

func NewSimpleExprList(exprs ...Expr) ExprList

func NewSimpleExprListNamed

func NewSimpleExprListNamed(exprs map[string][]Expr) ExprList

func NewSimpleExprListNamedOrdered

func NewSimpleExprListNamedOrdered(exprs []NamedExpr) ExprList

type MatchRes

type MatchRes struct {
	Start      int
	End        int
	GroupDict  map[string][]byte
	PatternNo  int
	Underlying *MatchRes // for result chaining
}

type NamedExpr

type NamedExpr struct {
	Name  string
	Exprs []Expr
}

type SimpleExprList

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

func (*SimpleExprList) Add

func (m *SimpleExprList) Add(name string, expr Expr)

func (*SimpleExprList) Delete

func (m *SimpleExprList) Delete(name string)

func (*SimpleExprList) GetName

func (m *SimpleExprList) GetName(index int) string

func (SimpleExprList) Match

func (m SimpleExprList) Match(data []byte) (*MatchRes, bool)

func (SimpleExprList) Repr

func (m SimpleExprList) Repr() string

func (SimpleExprList) String

func (m SimpleExprList) String() string

Jump to

Keyboard shortcuts

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