Skip to content

Commit

Permalink
Add Go module
Browse files Browse the repository at this point in the history
  • Loading branch information
aofei committed Nov 2, 2018
1 parent 3b56c4a commit 0975233
Show file tree
Hide file tree
Showing 44 changed files with 64 additions and 59 deletions.
2 changes: 1 addition & 1 deletion buffer/buffer.go
Expand Up @@ -5,7 +5,7 @@ The `Reader` and `Writer` types implement the `io.Reader` and `io.Writer` respec
The `Lexer` type is useful for building lexers because it keeps track of the start and end position of a byte selection, and shifts the bytes whenever a valid token is found.
The `StreamLexer` does the same, but keeps a buffer pool so that it reads a limited amount at a time, allowing to parse from streaming sources.
*/
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

// defaultBufSize specifies the default initial length of internal buffers.
var defaultBufSize = 4096
Expand Down
2 changes: 1 addition & 1 deletion buffer/lexer.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion buffer/lexer_test.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion buffer/reader.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import "io"

Expand Down
2 changes: 1 addition & 1 deletion buffer/reader_test.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion buffer/streamlexer.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion buffer/streamlexer_test.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion buffer/writer.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

// Writer implements an io.Writer over a byte slice.
type Writer struct {
Expand Down
2 changes: 1 addition & 1 deletion buffer/writer_test.go
@@ -1,4 +1,4 @@
package buffer // import "github.com/tdewolff/parse/buffer"
package buffer // import "github.com/tdewolff/parse/v2/buffer"

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion common.go
@@ -1,5 +1,5 @@
// Package parse contains a collection of parsers for various formats in its subpackages.
package parse // import "github.com/tdewolff/parse"
package parse // import "github.com/tdewolff/parse/v2"

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion common_test.go
@@ -1,4 +1,4 @@
package parse // import "github.com/tdewolff/parse"
package parse // import "github.com/tdewolff/parse/v2"

import (
"encoding/base64"
Expand Down
2 changes: 1 addition & 1 deletion css/hash_test.go
@@ -1,4 +1,4 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import (
"testing"
Expand Down
6 changes: 3 additions & 3 deletions css/lex.go
@@ -1,5 +1,5 @@
// Package css is a CSS3 lexer and parser following the specifications at http://www.w3.org/TR/css-syntax-3/.
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

// TODO: \uFFFD replacement character for NULL bytes in strings for example, or atleast don't end the string early

Expand All @@ -8,8 +8,8 @@ import (
"io"
"strconv"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/parse/v2/buffer"
)

// TokenType determines the type of token, eg. a number or a semicolon.
Expand Down
2 changes: 1 addition & 1 deletion css/lex_test.go
@@ -1,4 +1,4 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import (
"bytes"
Expand Down
4 changes: 2 additions & 2 deletions css/parse.go
@@ -1,11 +1,11 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import (
"bytes"
"io"
"strconv"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/v2"
)

var wsBytes = []byte(" ")
Expand Down
4 changes: 2 additions & 2 deletions css/parse_test.go
@@ -1,12 +1,12 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import (
"bytes"
"fmt"
"io"
"testing"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/test"
)

Expand Down
4 changes: 2 additions & 2 deletions css/util.go
@@ -1,6 +1,6 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import "github.com/tdewolff/parse/buffer"
import "github.com/tdewolff/parse/v2/buffer"

// IsIdent returns true if the bytes are a valid identifier.
func IsIdent(b []byte) bool {
Expand Down
2 changes: 1 addition & 1 deletion css/util_test.go
@@ -1,4 +1,4 @@
package css // import "github.com/tdewolff/parse/css"
package css // import "github.com/tdewolff/parse/v2/css"

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion error.go
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"io"

"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2/buffer"
)

// Error is a parsing error returned by parser. It contains a message and an offset at which the error occurred.
Expand Down
3 changes: 3 additions & 0 deletions go.mod
@@ -0,0 +1,3 @@
module github.com/tdewolff/parse/v2

require github.com/tdewolff/test v1.0.0
2 changes: 2 additions & 0 deletions go.sum
@@ -0,0 +1,2 @@
github.com/tdewolff/test v1.0.0 h1:jOwzqCXr5ePXEPGJaq2ivoR6HOCi+D5TPfpoyg8yvmU=
github.com/tdewolff/test v1.0.0/go.mod h1:DiQUlutnqlEvdvhSn2LPGy4TFwRauAaYDsL+683RNX4=
2 changes: 1 addition & 1 deletion html/hash_test.go
@@ -1,4 +1,4 @@
package html // import "github.com/tdewolff/parse/html"
package html // import "github.com/tdewolff/parse/v2/html"

import (
"bytes"
Expand Down
6 changes: 3 additions & 3 deletions html/lex.go
@@ -1,12 +1,12 @@
// Package html is an HTML5 lexer following the specifications at http://www.w3.org/TR/html5/syntax.html.
package html // import "github.com/tdewolff/parse/html"
package html // import "github.com/tdewolff/parse/v2/html"

import (
"io"
"strconv"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/parse/v2/buffer"
)

// TokenType determines the type of token, eg. a number or a semicolon.
Expand Down
4 changes: 2 additions & 2 deletions html/lex_test.go
@@ -1,12 +1,12 @@
package html // import "github.com/tdewolff/parse/html"
package html // import "github.com/tdewolff/parse/v2/html"

import (
"bytes"
"fmt"
"io"
"testing"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/test"
)

Expand Down
4 changes: 2 additions & 2 deletions html/util.go
@@ -1,6 +1,6 @@
package html // import "github.com/tdewolff/parse/html"
package html // import "github.com/tdewolff/parse/v2/html"

import "github.com/tdewolff/parse"
import "github.com/tdewolff/parse/v2"

var (
singleQuoteEntityBytes = []byte("'")
Expand Down
2 changes: 1 addition & 1 deletion html/util_test.go
@@ -1,4 +1,4 @@
package html // import "github.com/tdewolff/parse/html"
package html // import "github.com/tdewolff/parse/v2/html"

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion js/hash_test.go
@@ -1,4 +1,4 @@
package js // import "github.com/tdewolff/parse/js"
package js // import "github.com/tdewolff/parse/v2/js"

import (
"testing"
Expand Down
4 changes: 2 additions & 2 deletions js/lex.go
@@ -1,12 +1,12 @@
// Package js is an ECMAScript5.1 lexer following the specifications at http://www.ecma-international.org/ecma-262/5.1/.
package js // import "github.com/tdewolff/parse/js"
package js // import "github.com/tdewolff/parse/v2/js"

import (
"io"
"strconv"
"unicode"

"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2/buffer"
)

var identifierStart = []*unicode.RangeTable{unicode.Lu, unicode.Ll, unicode.Lt, unicode.Lm, unicode.Lo, unicode.Nl, unicode.Other_ID_Start}
Expand Down
2 changes: 1 addition & 1 deletion js/lex_test.go
@@ -1,4 +1,4 @@
package js // import "github.com/tdewolff/parse/js"
package js // import "github.com/tdewolff/parse/v2/js"

import (
"bytes"
Expand Down
6 changes: 3 additions & 3 deletions json/parse.go
@@ -1,12 +1,12 @@
// Package json is a JSON parser following the specifications at http://json.org/.
package json // import "github.com/tdewolff/parse/json"
package json // import "github.com/tdewolff/parse/v2/json"

import (
"io"
"strconv"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/parse/v2/buffer"
)

// GrammarType determines the type of grammar
Expand Down
4 changes: 2 additions & 2 deletions json/parse_test.go
@@ -1,12 +1,12 @@
package json // import "github.com/tdewolff/parse/json"
package json // import "github.com/tdewolff/parse/v2/json"

import (
"bytes"
"fmt"
"io"
"testing"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/test"
)

Expand Down
2 changes: 1 addition & 1 deletion position.go
Expand Up @@ -5,7 +5,7 @@ import (
"io"
"strings"

"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2/buffer"
)

// Position returns the line and column number for a certain position in a file. It is useful for recovering the position in a file that caused an error.
Expand Down
2 changes: 1 addition & 1 deletion strconv/float.go
@@ -1,4 +1,4 @@
package strconv // import "github.com/tdewolff/parse/strconv"
package strconv // import "github.com/tdewolff/parse/v2/strconv"

import "math"

Expand Down
2 changes: 1 addition & 1 deletion strconv/float_test.go
@@ -1,4 +1,4 @@
package strconv // import "github.com/tdewolff/parse/strconv"
package strconv // import "github.com/tdewolff/parse/v2/strconv"

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion strconv/int.go
@@ -1,4 +1,4 @@
package strconv // import "github.com/tdewolff/parse/strconv"
package strconv // import "github.com/tdewolff/parse/v2/strconv"

import (
"math"
Expand Down
2 changes: 1 addition & 1 deletion strconv/int_test.go
@@ -1,4 +1,4 @@
package strconv // import "github.com/tdewolff/parse/strconv"
package strconv // import "github.com/tdewolff/parse/v2/strconv"

import (
"math"
Expand Down
2 changes: 1 addition & 1 deletion strconv/price_test.go
@@ -1,4 +1,4 @@
package strconv // import "github.com/tdewolff/parse/strconv"
package strconv // import "github.com/tdewolff/parse/v2/strconv"

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion svg/hash_test.go
@@ -1,4 +1,4 @@
package svg // import "github.com/tdewolff/parse/svg"
package svg // import "github.com/tdewolff/parse/v2/svg"

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion util.go
@@ -1,4 +1,4 @@
package parse // import "github.com/tdewolff/parse"
package parse // import "github.com/tdewolff/parse/v2"

// Copy returns a copy of the given byte slice.
func Copy(src []byte) (dst []byte) {
Expand Down
2 changes: 1 addition & 1 deletion util_test.go
@@ -1,4 +1,4 @@
package parse // import "github.com/tdewolff/parse"
package parse // import "github.com/tdewolff/parse/v2"

import (
"bytes"
Expand Down
6 changes: 3 additions & 3 deletions xml/lex.go
@@ -1,12 +1,12 @@
// Package xml is an XML1.0 lexer following the specifications at http://www.w3.org/TR/xml/.
package xml // import "github.com/tdewolff/parse/xml"
package xml // import "github.com/tdewolff/parse/v2/xml"

import (
"io"
"strconv"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/buffer"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/parse/v2/buffer"
)

// TokenType determines the type of token, eg. a number or a semicolon.
Expand Down
4 changes: 2 additions & 2 deletions xml/lex_test.go
@@ -1,12 +1,12 @@
package xml // import "github.com/tdewolff/parse/xml"
package xml // import "github.com/tdewolff/parse/v2/xml"

import (
"bytes"
"fmt"
"io"
"testing"

"github.com/tdewolff/parse"
"github.com/tdewolff/parse/v2"
"github.com/tdewolff/test"
)

Expand Down
4 changes: 2 additions & 2 deletions xml/util.go
@@ -1,6 +1,6 @@
package xml // import "github.com/tdewolff/parse/xml"
package xml // import "github.com/tdewolff/parse/v2/xml"

import "github.com/tdewolff/parse"
import "github.com/tdewolff/parse/v2"

var (
ltEntityBytes = []byte("<")
Expand Down
2 changes: 1 addition & 1 deletion xml/util_test.go
@@ -1,4 +1,4 @@
package xml // import "github.com/tdewolff/parse/xml"
package xml // import "github.com/tdewolff/parse/v2/xml"

import (
"testing"
Expand Down

0 comments on commit 0975233

Please sign in to comment.