cucumberexpressions

package module
v6.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2018 License: MIT Imports: 7 Imported by: 2

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ALTERNATIVE_NON_WHITESPACE_TEXT_REGEXP = regexp.MustCompile(`([^\s^/]+)((/[^\s^/]+)+)`)
View Source
var ANONYMOUS_REGEXPS = `.*`
View Source
var DOUBLE_ESCAPE = `\\\\`
View Source
var ESCAPE_REGEXP = regexp.MustCompile(`([\\^[$.|?*+])`)
View Source
var FLOAT_REGEXPS = []*regexp.Regexp{
	regexp.MustCompile(`-?\d*\.\d+`),
}
View Source
var HAS_FLAG_REGEXP = regexp.MustCompile(`\(\?[imsU-]+(:.*)?\)`)
View Source
var ILLEGAL_PARAMETER_NAME_REGEXP = regexp.MustCompile(`([\[\]()$.|?*+])`)
View Source
var INTEGER_REGEXPS = []*regexp.Regexp{
	regexp.MustCompile(`-?\d+`),
	regexp.MustCompile(`\d+`),
}
View Source
var OPTIONAL_REGEXP = regexp.MustCompile(`(\\\\\\\\)?\([^)]+\)`)
View Source
var PARAMETER_REGEXP = regexp.MustCompile(`(\\\\\\\\)?{([^}]*)}`)
View Source
var STRING_REGEXPS = []*regexp.Regexp{
	regexp.MustCompile(`"([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'`),
}
View Source
var UNESCAPE_REGEXP = regexp.MustCompile(`(\\([\[$.|?*+\]]))`)
View Source
var WORD_REGEXPS = []*regexp.Regexp{
	regexp.MustCompile(`[^\s]+`),
}

Functions

func CheckParameterTypeName

func CheckParameterTypeName(typeName string) error

func CompareParameterTypeMatchers

func CompareParameterTypeMatchers(a, b *ParameterTypeMatcher) int

func CompareParameterTypes

func CompareParameterTypes(pt1, pt2 *ParameterType) int

func NewAmbiguousParameterTypeError

func NewAmbiguousParameterTypeError(parameterTypeRegexp, expressionRegexp string, parameterTypes []*ParameterType, generatedExpressions []*GeneratedExpression) error

func NewCucumberExpressionError

func NewCucumberExpressionError(text string) error

func NewUndefinedParameterTypeError

func NewUndefinedParameterTypeError(typeName string) error

Types

type AmbiguousParameterTypeError

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

func (*AmbiguousParameterTypeError) Error

type Argument

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

func BuildArguments

func BuildArguments(treeRegexp *TreeRegexp, text string, parameterTypes []*ParameterType) []*Argument

func NewArgument

func NewArgument(group *Group, parameterType *ParameterType) *Argument

func (*Argument) GetValue

func (a *Argument) GetValue() interface{}

func (*Argument) Group

func (a *Argument) Group() *Group

func (*Argument) ParameterType

func (a *Argument) ParameterType() *ParameterType

type BuiltInParameterTransformer

type BuiltInParameterTransformer struct {
}

func (BuiltInParameterTransformer) Transform

func (s BuiltInParameterTransformer) Transform(fromValue string, toValueType interface{}) (interface{}, error)

type CombinatorialGeneratedExpressionFactory

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

func NewCombinatorialGeneratedExpressionFactory

func NewCombinatorialGeneratedExpressionFactory(expressionTemplate string, parameterTypeCombinations [][]*ParameterType) *CombinatorialGeneratedExpressionFactory

func (*CombinatorialGeneratedExpressionFactory) GenerateExpressions

type CucumberExpression

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

func NewCucumberExpression

func NewCucumberExpression(expression string, parameterTypeRegistry *ParameterTypeRegistry) (*CucumberExpression, error)

func (*CucumberExpression) Match

func (c *CucumberExpression) Match(text string, typeHints ...reflect.Type) ([]*Argument, error)

func (*CucumberExpression) Regexp

func (c *CucumberExpression) Regexp() *regexp.Regexp

func (*CucumberExpression) Source

func (c *CucumberExpression) Source() string

type CucumberExpressionError

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

func (*CucumberExpressionError) Error

func (e *CucumberExpressionError) Error() string

type CucumberExpressionGenerator

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

func NewCucumberExpressionGenerator

func NewCucumberExpressionGenerator(parameterTypeRegistry *ParameterTypeRegistry) *CucumberExpressionGenerator

func (*CucumberExpressionGenerator) GenerateExpressions

func (c *CucumberExpressionGenerator) GenerateExpressions(text string) []*GeneratedExpression

type Expression

type Expression interface {
	Match(text string, typeHints ...reflect.Type) ([]*Argument, error)
	Regexp() *regexp.Regexp
	Source() string
}

type GeneratedExpression

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

func NewGeneratedExpression

func NewGeneratedExpression(expressionTemplate string, parameterTypes []*ParameterType) *GeneratedExpression

func (*GeneratedExpression) ParameterNames

func (g *GeneratedExpression) ParameterNames() []string

func (*GeneratedExpression) ParameterTypes

func (g *GeneratedExpression) ParameterTypes() []*ParameterType

func (*GeneratedExpression) Source

func (g *GeneratedExpression) Source() string

type GeneratedExpressionList

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

func (*GeneratedExpressionList) Push

func (*GeneratedExpressionList) ToArray

type Group

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

func NewGroup

func NewGroup(value *string, start, end int, children []*Group) *Group

func (*Group) Children

func (g *Group) Children() []*Group

func (*Group) End

func (g *Group) End() int

func (*Group) Start

func (g *Group) Start() int

func (*Group) Value

func (g *Group) Value() *string

func (*Group) Values

func (g *Group) Values() []*string

type GroupBuilder

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

func NewGroupBuilder

func NewGroupBuilder() *GroupBuilder

func (*GroupBuilder) Add

func (g *GroupBuilder) Add(groupBuilder *GroupBuilder)

func (*GroupBuilder) Build

func (g *GroupBuilder) Build(submatches []*Submatch, indexIterator *IntIterator) *Group

func (*GroupBuilder) Capturing

func (g *GroupBuilder) Capturing() bool

func (*GroupBuilder) Children

func (g *GroupBuilder) Children() []*GroupBuilder

func (*GroupBuilder) MoveChildrenTo

func (g *GroupBuilder) MoveChildrenTo(groupBuilder *GroupBuilder)

func (*GroupBuilder) SetNonCapturing

func (g *GroupBuilder) SetNonCapturing()

func (*GroupBuilder) SetSource

func (g *GroupBuilder) SetSource(value string)

func (*GroupBuilder) Source

func (g *GroupBuilder) Source() string

type GroupBuilderStack

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

func (*GroupBuilderStack) Len

func (s *GroupBuilderStack) Len() int

func (*GroupBuilderStack) Peek

func (s *GroupBuilderStack) Peek() *GroupBuilder

func (*GroupBuilderStack) Pop

func (s *GroupBuilderStack) Pop() *GroupBuilder

func (*GroupBuilderStack) Push

func (s *GroupBuilderStack) Push(value *GroupBuilder)

type IntIterator

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

func NewIntIterator

func NewIntIterator(size int) *IntIterator

func (*IntIterator) Next

func (s *IntIterator) Next() int

type IntStack

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

func (*IntStack) Len

func (s *IntStack) Len() int

func (*IntStack) Peek

func (s *IntStack) Peek() int

func (*IntStack) Pop

func (s *IntStack) Pop() int

func (*IntStack) Push

func (s *IntStack) Push(value int)

type InterfaceIterator

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

func (*InterfaceIterator) Next

func (i *InterfaceIterator) Next() interface{}

type InterfaceStack

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

func (*InterfaceStack) Len

func (i *InterfaceStack) Len() int

func (*InterfaceStack) Peek

func (i *InterfaceStack) Peek() interface{}

func (*InterfaceStack) Pop

func (i *InterfaceStack) Pop() interface{}

func (*InterfaceStack) Push

func (i *InterfaceStack) Push(value interface{})

type ParameterByTypeTransformer

type ParameterByTypeTransformer interface {
	// toValueType accepts either reflect.Type or reflect.Kind
	Transform(fromValue string, toValueType interface{}) (interface{}, error)
}

type ParameterType

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

func NewParameterType

func NewParameterType(name string, regexps []*regexp.Regexp, type1 string, transform func(...*string) interface{}, useForSnippets bool, preferForRegexpMatch bool) (*ParameterType, error)

func (*ParameterType) Name

func (p *ParameterType) Name() string

func (*ParameterType) PreferForRegexpMatch

func (p *ParameterType) PreferForRegexpMatch() bool

func (*ParameterType) Regexps

func (p *ParameterType) Regexps() []*regexp.Regexp

func (*ParameterType) Transform

func (p *ParameterType) Transform(groupValues []*string) interface{}

func (*ParameterType) Type

func (p *ParameterType) Type() string

func (*ParameterType) UseForSnippets

func (p *ParameterType) UseForSnippets() bool

type ParameterTypeMatcher

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

func NewParameterTypeMatcher

func NewParameterTypeMatcher(parameterType *ParameterType, r *regexp.Regexp, text string, matchPosition int) *ParameterTypeMatcher

func (*ParameterTypeMatcher) AdvanceTo

func (p *ParameterTypeMatcher) AdvanceTo(newMatchPosition int) *ParameterTypeMatcher

func (*ParameterTypeMatcher) Find

func (p *ParameterTypeMatcher) Find() bool

func (*ParameterTypeMatcher) Group

func (p *ParameterTypeMatcher) Group() string

func (*ParameterTypeMatcher) ParameterType

func (p *ParameterTypeMatcher) ParameterType() *ParameterType

func (*ParameterTypeMatcher) Start

func (p *ParameterTypeMatcher) Start() int

type ParameterTypeRegistry

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

func NewParameterTypeRegistry

func NewParameterTypeRegistry() *ParameterTypeRegistry

func (*ParameterTypeRegistry) DefineParameterType

func (p *ParameterTypeRegistry) DefineParameterType(parameterType *ParameterType) error

func (*ParameterTypeRegistry) LookupByRegexp

func (p *ParameterTypeRegistry) LookupByRegexp(parameterTypeRegexp string, expressionRegexp string, text string) (*ParameterType, error)

func (*ParameterTypeRegistry) LookupByTypeName

func (p *ParameterTypeRegistry) LookupByTypeName(name string) *ParameterType

func (*ParameterTypeRegistry) ParameterTypes

func (p *ParameterTypeRegistry) ParameterTypes() []*ParameterType

type RegularExpression

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

func NewRegularExpression

func NewRegularExpression(expressionRegexp *regexp.Regexp, parameterTypeRegistry *ParameterTypeRegistry) *RegularExpression

func (*RegularExpression) Match

func (r *RegularExpression) Match(text string, typeHints ...reflect.Type) ([]*Argument, error)

func (*RegularExpression) Regexp

func (r *RegularExpression) Regexp() *regexp.Regexp

func (*RegularExpression) Source

func (r *RegularExpression) Source() string

type Submatch

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

type TreeRegexp

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

func NewTreeRegexp

func NewTreeRegexp(regexp *regexp.Regexp) *TreeRegexp

func (*TreeRegexp) GroupBuilder

func (t *TreeRegexp) GroupBuilder() *GroupBuilder

func (*TreeRegexp) Match

func (t *TreeRegexp) Match(s string) *Group

func (*TreeRegexp) Regexp

func (t *TreeRegexp) Regexp() *regexp.Regexp

type UndefinedParameterTypeError

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

func (*UndefinedParameterTypeError) Error

Jump to

Keyboard shortcuts

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