Documentation
¶
Index ¶
- Constants
- func DiffPatterns(valid []*Pattern, pkg *astrav.Package) (string, float64, bool)
- func MatchPatterns(valid []*Pattern, pkg *astrav.Package) bool
- func Perm(nodes []Node) [][]Node
- type DefaultNode
- type FuncDecl
- type Node
- type Omit
- type Pattern
- func (s *Pattern) Children() []Node
- func (s *Pattern) DiffPattern(pattern *Pattern) (string, float64, bool)
- func (s *Pattern) DiffPkg(pkg *astrav.Package) (string, float64, bool)
- func (s *Pattern) Match(node Node) bool
- func (s *Pattern) MatchPkg(pkg *astrav.Package) bool
- func (s *Pattern) Populate(ast astrav.Node)
- func (s *Pattern) String() string
- func (s *Pattern) Walk(f func(node Node) bool)
- type SelectorExpr
- type Skip
Constants ¶
const ( // NodeTypeOmit will be omitted including its children. NodeTypeOmit astrav.NodeType = "omit" // NodeTypeSkip defines a node that is not taken into accound. It's children will be inlined. NodeTypeSkip astrav.NodeType = "skip" )
Special node types
Variables ¶
This section is empty.
Functions ¶
func DiffPatterns ¶
DiffPatterns matches a package against multiple valid patterns. If one of the valid patterns matches true is returned. DiffPatterns additionally returns a diff of the patterns.
func MatchPatterns ¶
MatchPatterns matches a package against multiple valid patterns. If one of the valid patterns matches true is returned.
Types ¶
type DefaultNode ¶
type DefaultNode struct {
// contains filtered or unexported fields
}
DefaultNode implements the default node definition
func (*DefaultNode) Children ¶
func (s *DefaultNode) Children() []Node
Children returns the child nodes.
type FuncDecl ¶
type FuncDecl struct { Name string // contains filtered or unexported fields }
FuncDecl node
type Node ¶
type Node interface { Match(Node) bool Populate(astrav.Node) Children() []Node Walk(f func(node Node) bool) // contains filtered or unexported methods }
Node represents a pattern node.
type Omit ¶
type Omit struct {
// contains filtered or unexported fields
}
Omit is a placeholder node that is to be omitted.
type Pattern ¶
type Pattern struct { Name string `json:"-"` // contains filtered or unexported fields }
Pattern implements a solutions pattern
func ExtractPattern ¶
ExtractPattern extracts the pattern from a given ast package
func ExtractPatternPermutations ¶
ExtractPatternPermutations extracts a list of patterns with nodes order exchanged where allowed.
func (*Pattern) DiffPattern ¶
DiffPattern checks the pattern against another pattern
type SelectorExpr ¶
type SelectorExpr struct { Name string // contains filtered or unexported fields }
SelectorExpr node
func (*SelectorExpr) Children ¶
func (s *SelectorExpr) Children() []Node
Children returns the child nodes.
func (*SelectorExpr) Match ¶
func (s *SelectorExpr) Match(node Node) bool
Match checks if given node matches the criteria
func (*SelectorExpr) Populate ¶
func (s *SelectorExpr) Populate(ast astrav.Node)
Populate populates the pattern node from a given ast node.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
solutions
|
|
hamming/10
Package hamming provides the Distance function.
|
Package hamming provides the Distance function. |
hamming/11
Package hamming contains function to calculate amount of character difference between two equal strings.
|
Package hamming contains function to calculate amount of character difference between two equal strings. |
hamming/12
Package hamming provides the Distance function.
|
Package hamming provides the Distance function. |
hamming/4
Package hamming is used for calculating difference between DNA It has a function Distance(string, string) (int,error), that accept 2 DNA strings and return difference in integer value, or -1 and error message
|
Package hamming is used for calculating difference between DNA It has a function Distance(string, string) (int,error), that accept 2 DNA strings and return difference in integer value, or -1 and error message |
hamming/8
Package hamming contains function to calculate amount of character difference between two equal strings.
|
Package hamming contains function to calculate amount of character difference between two equal strings. |
hamming/patterns/2
Package hamming implements hamming distance
|
Package hamming implements hamming distance |
isogram/3
Package isogram implements IsIsogram to check input string is an isogram
|
Package isogram implements IsIsogram to check input string is an isogram |
isogram/4
Package isogram tests for whether or not a word is an isogram
|
Package isogram tests for whether or not a word is an isogram |
permutations/3
Package twofer implements some sharing functionality.
|
Package twofer implements some sharing functionality. |
raindrops/1
Package raindrops converts number to string and outputs info depending on numbers factors
|
Package raindrops converts number to string and outputs info depending on numbers factors |
raindrops/10
Package raindrops convert a number to a string, the contents of which depend on the number's factors.
|
Package raindrops convert a number to a string, the contents of which depend on the number's factors. |
raindrops/11
Package raindrops convert a number to a string, the contents of which depend on the number's factors.
|
Package raindrops convert a number to a string, the contents of which depend on the number's factors. |
raindrops/13
Package raindrops is involved in converting numbers to pattern-based strings
|
Package raindrops is involved in converting numbers to pattern-based strings |
raindrops/14
Package raindrops converts ints into onomatopoeia depending on factors of that int.
|
Package raindrops converts ints into onomatopoeia depending on factors of that int. |
raindrops/17
Package raindrops is used to transform a number into the lovely sound of rain
|
Package raindrops is used to transform a number into the lovely sound of rain |
raindrops/18
Package raindrops is used to transform a number into the lovely sound of rain
|
Package raindrops is used to transform a number into the lovely sound of rain |
raindrops/2
Package raindrops provides a simple int to raindrop-speak conversion function
|
Package raindrops provides a simple int to raindrop-speak conversion function |
raindrops/4
Package raindrops is used to transform a number into the lovely sound of rain
|
Package raindrops is used to transform a number into the lovely sound of rain |
raindrops/6
Package raindrops convert a number to a string, the contents of which depend on the number's factors.
|
Package raindrops convert a number to a string, the contents of which depend on the number's factors. |
raindrops/7
Package raindrops ...
|
Package raindrops ... |
raindrops/8
Package raindrops convert a number to a string, the contents of which depend on the number's factors.
|
Package raindrops convert a number to a string, the contents of which depend on the number's factors. |
raindrops/patterns/1
Package raindrops provides a simple int to raindrop-speak conversion function
|
Package raindrops provides a simple int to raindrop-speak conversion function |
raindrops/patterns/2
Package raindrops is used to transform a number into the lovely sound of rain
|
Package raindrops is used to transform a number into the lovely sound of rain |
raindrops/patterns/3
Package raindrops is used to transform a number into the lovely sound of rain
|
Package raindrops is used to transform a number into the lovely sound of rain |
twofer/1
Package twofer should have a package comment that summarizes what it's about.
|
Package twofer should have a package comment that summarizes what it's about. |
twofer/10
Package twofer or 2-fer is short for two for one.
|
Package twofer or 2-fer is short for two for one. |
twofer/11
Package twofer implements some sharing functionality.
|
Package twofer implements some sharing functionality. |
twofer/12
Package twofer implements some sharing functionality.
|
Package twofer implements some sharing functionality. |
twofer/2
Package twofer should have a package comment that summarizes what it's about.
|
Package twofer should have a package comment that summarizes what it's about. |
twofer/3
Package twofer implements sharing functionality
|
Package twofer implements sharing functionality |
twofer/4
Package twofer should have a package comment that summarizes what it's about.
|
Package twofer should have a package comment that summarizes what it's about. |
twofer/5
Package twofer should have a package comment that summarizes what it's about.
|
Package twofer should have a package comment that summarizes what it's about. |
twofer/6
Package twofer implements a "Two-Fer" statement.
|
Package twofer implements a "Two-Fer" statement. |
twofer/7
Package twofer or 2-fer is short for two for one.
|
Package twofer or 2-fer is short for two for one. |
twofer/9
Package twofer implements some sharing functionality.
|
Package twofer implements some sharing functionality. |
twofer/patterns/1
Package twofer contains sharing algorithms.
|
Package twofer contains sharing algorithms. |
twofer/patterns/2
Package twofer contains sharing algorithms.
|
Package twofer contains sharing algorithms. |