glob

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package glob defines a globbing syntax and implements matching routines.

Globs match a slash separated series of glob expressions.

// Patterns:
term ['/' term]*
term:
'*'         matches any sequence of non-Separator characters
'?'         matches any single non-Separator character
'[' [ '^' ] { character-range } ']'
// Character classes (must be non-empty):
c           matches character c (c != '*', '?', '\\', '[', '/')
'\\' c      matches character c
// Character-ranges:
c           matches character c (c != '\\', '-', ']')
'\\' c      matches character c
lo '-' hi   matches character c for lo <= c <= hi

This package is DEPRECATED. Use v.io/v23/glob instead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Glob

type Glob struct {
	*glob.Glob
}

Glob represents a slash separated path glob pattern. Deprecated: use v.io/v23/glob.Glob instead.

func Parse

func Parse(pattern string) (*Glob, error)

Parse returns a new Glob. Deprecated: use v.io/v23/glob.Parse instead.

func (*Glob) Finished

func (g *Glob) Finished() bool

Finished returns true if the pattern cannot match anything. Deprecated: use v.io/v23/glob.Finished instead.

func (*Glob) MatchInitialSegment

func (g *Glob) MatchInitialSegment(segment string) (matched bool, exact bool, remainder *Glob)

MatchInitialSegment tries to match segment against the initial element of g. Returns: matched, a boolean indicating whether the match was successful; exact, a boolean indicating whether segment matched a fixed string pattern; remainder, a Glob representing the unmatched remainder of g. Deprecated: use v.io/v23/glob.MatchInitialSegment instead.

func (*Glob) PartialMatch

func (g *Glob) PartialMatch(start int, elems []string) (matched bool, exact bool, remainder *Glob)

PartialMatch tries matching elems against part of a glob pattern. Returns: matched, a boolean indicating whether each element e_i of elems matches the (start + i)th element of the glob pattern; exact, a boolean indicating whether elems matched a fixed string pattern. <path> is considered an exact match for pattern <path>/...; remainder, a Glob representing the unmatched remainder of g. remainder will be empty if the pattern is completely matched.

Note that if the glob is recursive elems can have more elements then the glob pattern and still get a true result. Deprecated: use v.io/v23/glob.PartialMatch instead.

func (*Glob) Split

func (g *Glob) Split(start int) *Glob

Split returns the suffix of g starting at the path element corresponding to start. Deprecated: use v.io/v23/glob.Split instead.

func (*Glob) SplitFixedElements

func (g *Glob) SplitFixedElements() ([]string, *Glob)

SplitFixedElements returns the part of the glob pattern that contains only fixed elements, and the glob that follows it. Deprecated: use v.io/v23/glob.SplitFixedElements instead.

func (*Glob) SplitFixedPrefix

func (g *Glob) SplitFixedPrefix() ([]string, *Glob)

SplitFixedPrefix returns the part of the glob pattern that contains only fixed elements, and the glob that follows it. Deprecated: use v.io/v23/glob.SplitFixedPrefix instead.

func (*Glob) Tail

func (g *Glob) Tail() *Glob

Tail returns the suffix of g starting at the second element. Deprecated: use v.io/v23/glob.Tail instead.

Jump to

Keyboard shortcuts

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