Compare commits

...

2 Commits

Author SHA1 Message Date
re 44ce8ea2aa repo fixes 2022-12-12 17:26:23 +03:00
re bb6a74629b repo fixes 2022-12-12 17:24:35 +03:00
17 changed files with 71 additions and 58 deletions

View File

@ -3,12 +3,13 @@ package main
import (
"flag"
"fmt"
"github.com/gobwas/glob"
"github.com/gobwas/glob/match"
"github.com/gobwas/glob/match/debug"
"os"
"strings"
"unicode/utf8"
"git.internal/re/glob"
"git.internal/re/glob/match"
"git.internal/re/glob/match/debug"
)
func main() {

View File

@ -3,11 +3,12 @@ package main
import (
"flag"
"fmt"
"github.com/gobwas/glob"
"os"
"strings"
"testing"
"unicode/utf8"
"git.internal/re/glob"
)
func benchString(r testing.BenchmarkResult) string {

View File

@ -7,9 +7,9 @@ import (
"fmt"
"reflect"
"github.com/gobwas/glob/match"
"github.com/gobwas/glob/syntax/ast"
"github.com/gobwas/glob/util/runes"
"git.internal/re/glob/match"
"git.internal/re/glob/syntax/ast"
"git.internal/re/glob/util/runes"
)
func optimizeMatcher(matcher match.Matcher) match.Matcher {

View File

@ -1,11 +1,12 @@
package compiler
import (
"github.com/gobwas/glob/match"
"github.com/gobwas/glob/match/debug"
"github.com/gobwas/glob/syntax/ast"
"reflect"
"testing"
"git.internal/re/glob/match"
"git.internal/re/glob/match/debug"
"git.internal/re/glob/syntax/ast"
)
var separators = []rune{'.'}

View File

@ -1,8 +1,8 @@
package glob
import (
"github.com/gobwas/glob/compiler"
"github.com/gobwas/glob/syntax"
"git.internal/re/glob/compiler"
"git.internal/re/glob/syntax"
)
// Glob represents compiled glob pattern.
@ -35,7 +35,6 @@ type Glob interface {
// pattern-list:
// pattern { `,` pattern }
// comma-separated (without spaces) patterns
//
func Compile(pattern string, separators ...rune) (Glob, error) {
ast, err := syntax.Parse(pattern)
if err != nil {

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module git.internal/re/glob
go 1.19

View File

@ -2,7 +2,8 @@ package match
import (
"fmt"
"github.com/gobwas/glob/util/strings"
"git.internal/re/glob/util/strings"
)
type Any struct {

View File

@ -3,8 +3,9 @@ package debug
import (
"bytes"
"fmt"
"github.com/gobwas/glob/match"
"math/rand"
"git.internal/re/glob/match"
)
func Graphviz(pattern string, m match.Matcher) string {

View File

@ -2,8 +2,9 @@ package match
import (
"fmt"
"github.com/gobwas/glob/util/runes"
"unicode/utf8"
"git.internal/re/glob/util/runes"
)
type List struct {

View File

@ -5,7 +5,7 @@ import (
"strings"
"unicode/utf8"
sutil "github.com/gobwas/glob/util/strings"
sutil "git.internal/re/glob/util/strings"
)
type PrefixAny struct {

View File

@ -2,8 +2,9 @@ package match
import (
"fmt"
"github.com/gobwas/glob/util/runes"
"unicode/utf8"
"git.internal/re/glob/util/runes"
)
// single represents ?

View File

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
sutil "github.com/gobwas/glob/util/strings"
sutil "git.internal/re/glob/util/strings"
)
type SuffixAny struct {

View File

@ -7,7 +7,7 @@
## Install
```shell
go get github.com/gobwas/glob
go get git.internal/re/glob
```
## Example
@ -16,7 +16,7 @@
package main
import "github.com/gobwas/glob"
import "git.internal/re/glob"
func main() {
var g glob.Glob
@ -137,8 +137,8 @@ Pattern | Fixture | Match | Speed (ns/op)
`^ab.*ef$` | `abcdef` | `true` | 375
`^ab.*ef$` | `af` | `false` | 145
[godoc-image]: https://godoc.org/github.com/gobwas/glob?status.svg
[godoc-url]: https://godoc.org/github.com/gobwas/glob
[godoc-image]: https://godoc.org/git.internal/re/glob?status.svg
[godoc-url]: https://godoc.org/git.internal/re/glob
[travis-image]: https://travis-ci.org/gobwas/glob.svg?branch=master
[travis-url]: https://travis-ci.org/gobwas/glob

View File

@ -3,8 +3,9 @@ package ast
import (
"errors"
"fmt"
"github.com/gobwas/glob/syntax/lexer"
"unicode/utf8"
"git.internal/re/glob/syntax/lexer"
)
type Lexer interface {

View File

@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"github.com/gobwas/glob/syntax/lexer"
"git.internal/re/glob/syntax/lexer"
)
type stubLexer struct {

View File

@ -3,8 +3,9 @@ package lexer
import (
"bytes"
"fmt"
"github.com/gobwas/glob/util/runes"
"unicode/utf8"
"git.internal/re/glob/util/runes"
)
const (
@ -146,8 +147,10 @@ func (l *lexer) termsLeave() {
l.termsLevel--
}
var inTextBreakers = []rune{char_single, char_any, char_range_open, char_terms_open}
var inTermsBreakers = append(inTextBreakers, char_terms_close, char_comma)
var (
inTextBreakers = []rune{char_single, char_any, char_range_open, char_terms_open}
inTermsBreakers = append(inTextBreakers, char_terms_close, char_comma)
)
func (l *lexer) fetchItem() {
r := l.read()

View File

@ -1,8 +1,8 @@
package syntax
import (
"github.com/gobwas/glob/syntax/ast"
"github.com/gobwas/glob/syntax/lexer"
"git.internal/re/glob/syntax/ast"
"git.internal/re/glob/syntax/lexer"
)
func Parse(s string) (*ast.Node, error) {