Skip to content

Commit

Permalink
Merge pull request gobwas#17 from shawnps/master
Browse files Browse the repository at this point in the history
gofmt -s
  • Loading branch information
gobwas authored Feb 12, 2017
2 parents bea32b9 + 75853f5 commit 51eb1ee
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 158 deletions.
2 changes: 1 addition & 1 deletion match/contains.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (self Contains) Index(s string) (int, []int) {
}

segments := acquireSegments(len(s) + 1)
for i, _ := range s {
for i := range s {
segments = append(segments, offset+i)
}

Expand Down
8 changes: 4 additions & 4 deletions match/match_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ func TestAppendMerge(t *testing.T) {
}{
{
[2][]int{
[]int{0, 6, 7},
[]int{0, 1, 3},
{0, 6, 7},
{0, 1, 3},
},
[]int{0, 1, 3, 6, 7},
},
{
[2][]int{
[]int{0, 1, 3, 6, 7},
[]int{0, 1, 10},
{0, 1, 3, 6, 7},
{0, 1, 10},
},
[]int{0, 1, 3, 6, 7, 10},
},
Expand Down
2 changes: 1 addition & 1 deletion match/max.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewMax(l int) Max {

func (self Max) Match(s string) bool {
var l int
for _ = range s {
for range s {
l += 1
if l > self.Limit {
return false
Expand Down
2 changes: 1 addition & 1 deletion match/min.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func NewMin(l int) Min {

func (self Min) Match(s string) bool {
var l int
for _ = range s {
for range s {
l += 1
if l >= self.Limit {
return true
Expand Down
2 changes: 1 addition & 1 deletion match/row.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (self Row) matchAll(s string) bool {

func (self Row) lenOk(s string) bool {
var i int
for _ = range s {
for range s {
i++
if i > self.RunesLength {
return false
Expand Down
124 changes: 62 additions & 62 deletions syntax/ast/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func TestParseString(t *testing.T) {
{
//pattern: "abc",
tokens: []lexer.Token{
lexer.Token{lexer.Text, "abc"},
lexer.Token{lexer.EOF, ""},
{lexer.Text, "abc"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindText, Text{Text: "abc"}),
Expand All @@ -38,10 +38,10 @@ func TestParseString(t *testing.T) {
{
//pattern: "a*c",
tokens: []lexer.Token{
lexer.Token{lexer.Text, "a"},
lexer.Token{lexer.Any, "*"},
lexer.Token{lexer.Text, "c"},
lexer.Token{lexer.EOF, ""},
{lexer.Text, "a"},
{lexer.Any, "*"},
{lexer.Text, "c"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindText, Text{Text: "a"}),
Expand All @@ -52,10 +52,10 @@ func TestParseString(t *testing.T) {
{
//pattern: "a**c",
tokens: []lexer.Token{
lexer.Token{lexer.Text, "a"},
lexer.Token{lexer.Super, "**"},
lexer.Token{lexer.Text, "c"},
lexer.Token{lexer.EOF, ""},
{lexer.Text, "a"},
{lexer.Super, "**"},
{lexer.Text, "c"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindText, Text{Text: "a"}),
Expand All @@ -66,10 +66,10 @@ func TestParseString(t *testing.T) {
{
//pattern: "a?c",
tokens: []lexer.Token{
lexer.Token{lexer.Text, "a"},
lexer.Token{lexer.Single, "?"},
lexer.Token{lexer.Text, "c"},
lexer.Token{lexer.EOF, ""},
{lexer.Text, "a"},
{lexer.Single, "?"},
{lexer.Text, "c"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindText, Text{Text: "a"}),
Expand All @@ -80,13 +80,13 @@ func TestParseString(t *testing.T) {
{
//pattern: "[!a-z]",
tokens: []lexer.Token{
lexer.Token{lexer.RangeOpen, "["},
lexer.Token{lexer.Not, "!"},
lexer.Token{lexer.RangeLo, "a"},
lexer.Token{lexer.RangeBetween, "-"},
lexer.Token{lexer.RangeHi, "z"},
lexer.Token{lexer.RangeClose, "]"},
lexer.Token{lexer.EOF, ""},
{lexer.RangeOpen, "["},
{lexer.Not, "!"},
{lexer.RangeLo, "a"},
{lexer.RangeBetween, "-"},
{lexer.RangeHi, "z"},
{lexer.RangeClose, "]"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindRange, Range{Lo: 'a', Hi: 'z', Not: true}),
Expand All @@ -95,10 +95,10 @@ func TestParseString(t *testing.T) {
{
//pattern: "[az]",
tokens: []lexer.Token{
lexer.Token{lexer.RangeOpen, "["},
lexer.Token{lexer.Text, "az"},
lexer.Token{lexer.RangeClose, "]"},
lexer.Token{lexer.EOF, ""},
{lexer.RangeOpen, "["},
{lexer.Text, "az"},
{lexer.RangeClose, "]"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindList, List{Chars: "az"}),
Expand All @@ -107,12 +107,12 @@ func TestParseString(t *testing.T) {
{
//pattern: "{a,z}",
tokens: []lexer.Token{
lexer.Token{lexer.TermsOpen, "{"},
lexer.Token{lexer.Text, "a"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.Text, "z"},
lexer.Token{lexer.TermsClose, "}"},
lexer.Token{lexer.EOF, ""},
{lexer.TermsOpen, "{"},
{lexer.Text, "a"},
{lexer.Separator, ","},
{lexer.Text, "z"},
{lexer.TermsClose, "}"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindAnyOf, nil,
Expand All @@ -128,14 +128,14 @@ func TestParseString(t *testing.T) {
{
//pattern: "/{z,ab}*",
tokens: []lexer.Token{
lexer.Token{lexer.Text, "/"},
lexer.Token{lexer.TermsOpen, "{"},
lexer.Token{lexer.Text, "z"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.Text, "ab"},
lexer.Token{lexer.TermsClose, "}"},
lexer.Token{lexer.Any, "*"},
lexer.Token{lexer.EOF, ""},
{lexer.Text, "/"},
{lexer.TermsOpen, "{"},
{lexer.Text, "z"},
{lexer.Separator, ","},
{lexer.Text, "ab"},
{lexer.TermsClose, "}"},
{lexer.Any, "*"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindText, Text{Text: "/"}),
Expand All @@ -153,29 +153,29 @@ func TestParseString(t *testing.T) {
{
//pattern: "{a,{x,y},?,[a-z],[!qwe]}",
tokens: []lexer.Token{
lexer.Token{lexer.TermsOpen, "{"},
lexer.Token{lexer.Text, "a"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.TermsOpen, "{"},
lexer.Token{lexer.Text, "x"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.Text, "y"},
lexer.Token{lexer.TermsClose, "}"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.Single, "?"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.RangeOpen, "["},
lexer.Token{lexer.RangeLo, "a"},
lexer.Token{lexer.RangeBetween, "-"},
lexer.Token{lexer.RangeHi, "z"},
lexer.Token{lexer.RangeClose, "]"},
lexer.Token{lexer.Separator, ","},
lexer.Token{lexer.RangeOpen, "["},
lexer.Token{lexer.Not, "!"},
lexer.Token{lexer.Text, "qwe"},
lexer.Token{lexer.RangeClose, "]"},
lexer.Token{lexer.TermsClose, "}"},
lexer.Token{lexer.EOF, ""},
{lexer.TermsOpen, "{"},
{lexer.Text, "a"},
{lexer.Separator, ","},
{lexer.TermsOpen, "{"},
{lexer.Text, "x"},
{lexer.Separator, ","},
{lexer.Text, "y"},
{lexer.TermsClose, "}"},
{lexer.Separator, ","},
{lexer.Single, "?"},
{lexer.Separator, ","},
{lexer.RangeOpen, "["},
{lexer.RangeLo, "a"},
{lexer.RangeBetween, "-"},
{lexer.RangeHi, "z"},
{lexer.RangeClose, "]"},
{lexer.Separator, ","},
{lexer.RangeOpen, "["},
{lexer.Not, "!"},
{lexer.Text, "qwe"},
{lexer.RangeClose, "]"},
{lexer.TermsClose, "}"},
{lexer.EOF, ""},
},
tree: NewNode(KindPattern, nil,
NewNode(KindAnyOf, nil,
Expand Down
Loading

0 comments on commit 51eb1ee

Please sign in to comment.