Documentation ¶
Index ¶
Constants ¶
const ( OpMatch instOp = iota OpJmp OpSplit OpRange )
the enumeration of operations
const StateLimit = 10000
StateLimit is the maximum number of states allowed
Variables ¶
var DefaultLimit = uint(10 * (1 << 20))
var ErrCompiledTooBig = fmt.Errorf("too many instructions")
ErrCompiledTooBig returned when regular expression parses into too many instructions
var ErrNoBytes = fmt.Errorf("byte literals are not allowed")
ErrNoBytes returned when byte literals are used
var ErrNoEmpty = fmt.Errorf("zero width assertions not allowed")
ErrNoEmpty returned when "zero width assertions" are used
var ErrNoLazy = fmt.Errorf("lazy quantifiers are not allowed")
ErrNoLazy returned when lazy quantifiers are used
var ErrNoWordBoundary = fmt.Errorf("word boundaries are not allowed")
ErrNoWordBoundary returned when word boundaries are used
var ErrTooManyStates = fmt.Errorf("dfa contains more than %d states", StateLimit)
ErrTooManyStates is returned if you attempt to build a Levenshtein automaton which requires too many states.
Functions ¶
This section is empty.
Types ¶
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp implements the vellum.Automaton interface for matcing a user specified regular expression.
func New ¶
NewRegexp creates a new Regular Expression automaton with the specified expression. By default it is limited to approximately 10MB for the compiled finite state automaton. If this size is exceeded, ErrCompiledTooBig will be returned.
func NewParsedWithLimit ¶
func NewWithLimit ¶
NewRegexpWithLimit creates a new Regular Expression automaton with the specified expression. The size of the compiled finite state automaton exceeds the user specified size, ErrCompiledTooBig will be returned.
func (*Regexp) Accept ¶
Accept returns the new state, resulting from the transition byte b when currently in the state s.
func (*Regexp) CanMatch ¶
CanMatch returns if the specified state can ever transition to a matching state.
func (*Regexp) WillAlwaysMatch ¶
WillAlwaysMatch returns if the specified state will always end in a matching state.