forked from mirror/glob
graphviz try
This commit is contained in:
parent
df67a5925f
commit
0be4bc46d1
|
@ -41,10 +41,10 @@ func TestCompilePattern(t *testing.T) {
|
|||
sep string
|
||||
exp match.Matcher
|
||||
}{
|
||||
// {
|
||||
// pattern: "{*,def,abc[a-z]*}ghi",
|
||||
// exp: match.Raw{"t"},
|
||||
// },
|
||||
{
|
||||
pattern: "a?*",
|
||||
exp: match.Raw{"t"},
|
||||
},
|
||||
} {
|
||||
glob, err := Compile(test.pattern, test.sep)
|
||||
if err != nil {
|
||||
|
|
|
@ -112,6 +112,23 @@ func (self BTree) Match(s string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
const tpl = `
|
||||
"%p"[label="%s"]
|
||||
"%p"[label="%s"]
|
||||
"%p"[label="%s"]
|
||||
"%p"->"%p"
|
||||
"%p"->"%p"
|
||||
`
|
||||
|
||||
func (self BTree) String() string {
|
||||
return fmt.Sprintf("[btree:%s<-%s->%s]", self.Left, self.Value, self.Right)
|
||||
// return fmt.Sprintf("[btree:%s<-%s->%s]", self.Left, self.Value, self.Right)
|
||||
|
||||
l, r := "nil", "nil"
|
||||
if self.Left != nil {
|
||||
l = self.Left.String()
|
||||
}
|
||||
if self.Right != nil {
|
||||
r = self.Right.String()
|
||||
}
|
||||
return fmt.Sprintf(tpl, &self, self.Value, &l, l, &r, r, &self, &l, &self, &r)
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ type Matcher interface {
|
|||
Match(string) bool
|
||||
Index(string) (int, []int)
|
||||
Len() int
|
||||
String() string
|
||||
}
|
||||
|
||||
type Matchers []Matcher
|
||||
|
|
Loading…
Reference in New Issue