package meg
Import Path
github.com/multiformats/go-multiaddr/x/meg (on go.dev)
Dependency Relation
imports 4 packages, and imported by one package
Involved Source Files
package meg implements Regular Expressions for multiaddr Components. It's short for "Megular Expressions"
sugar.go
Package-Level Type Names (total 6)
func CaptureWithF(code int, f CaptureFunc) Pattern
func CaptureZeroOrMoreWithF(code int, f CaptureFunc) Pattern
ListOfMatchable is anything list-like that contains Matchable items.
This allows us to convert a slice of []T as a []Matchable when *T implements
Matchable. In the future, this may not be required if Go generics allows us
to say S ~[]T, and *T implements Matchable. This may also not be required if
we move this out of its own package and depend on Multiaddr and Components
directly.
( ListOfMatchable) Get(i int) Matchable
( ListOfMatchable) Len() int
Matchable is an interface for any thing that can be matched against by this
package. In the future, we may use multiaddr.Component types directly.
Bytes() returns the underlying bytes of the matchable. For multiaddr
Components, this includes the protocol code and possibly the varint
encoded size.
( Matchable) Code() int
RawValue() returns the byte representation of the Value
Value() returns the string representation of the matchable.
*github.com/multiformats/go-multiaddr.Component
Matchable : github.com/apache/arrow-go/v18/internal/hashing.ByteSlice
func ListOfMatchable.Get(i int) Matchable
Matcher holds a graph of match state nodes. Use PatternToMatcher to create.
( Matcher) String() string
Matcher : expvar.Var
Matcher : fmt.Stringer
func PatternToMatcher(patterns ...Pattern) Matcher
func Match[L](matcher Matcher, components L) (bool, error)
MatchState is the Thompson NFA for a regular expression.
( MatchState) String() string
MatchState : expvar.Var
MatchState : fmt.Stringer
Pattern is a curried MatchState. Given the slice of current MatchStates and a
handle (int index) to the next MatchState, it returns a (possibly modified)
slice of next MatchStates and handle to the inserted MatchState.
Package-Level Functions (total 16)
func CaptureBytes(code int, val *[]byte) Pattern func CaptureOneOrMoreBytes(code int, vals *[][]byte) Pattern func CaptureOneOrMoreStrings(code int, vals *[]string) Pattern func CaptureString(code int, val *string) Pattern func CaptureWithF(code int, f CaptureFunc) Pattern func CaptureZeroOrMoreBytes(code int, vals *[][]byte) Pattern func CaptureZeroOrMoreStrings(code int, vals *[]string) Pattern func CaptureZeroOrMoreWithF(code int, f CaptureFunc) Pattern
Type Parameters:
L: ListOfMatchable
Match returns whether the given Components match the Matcher
Errors are used to communicate capture errors.
If the error is non-nil the returned bool will be false.
Components must be a ListOfMatchable to allow us to use a slice of []T as a
[]Matchable when *T implements Matchable.
func PatternToMatcher(patterns ...Pattern) Matcher func ZeroOrMore(code int) Pattern
Package-Level Variables (only one)
Any is a special code that matches any value.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |