Merge branch 'master' of github.com:/oec/goparsify

This commit is contained in:
Özgür Kesim 2019-11-28 15:34:37 +01:00
commit 29336c8a7a
13 changed files with 32 additions and 72 deletions

View File

@ -1,13 +0,0 @@
version: 2
jobs:
build:
docker:
- image: golang:1.9
working_directory: /go/src/github.com/vektah/goparsify
steps:
- checkout
- run: go get -u github.com/golang/dep/cmd/dep github.com/alecthomas/gometalinter && gometalinter --install
- run: dep ensure --vendor-only
- run: go vet ./...
- run: go test -v ./...
- run: gometalinter . --disable gocyclo

View File

@ -1,9 +0,0 @@
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
[*.go]
indent_style = tab
indent_size = 4

33
Gopkg.lock generated
View File

@ -1,33 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/davecgh/go-spew"
packages = ["spew"]
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
version = "v1.1.0"
[[projects]]
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
branch = "master"
name = "github.com/prataprc/goparsec"
packages = [".","json"]
revision = "82de4f9400c22ea84314f99bec5034895ae5eed9"
[[projects]]
name = "github.com/stretchr/testify"
packages = ["assert","require"]
revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
version = "v1.1.4"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "87eecb782b0100538dd03417f0dbedf48e19dec675ac73fb728f06da94d5606d"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,7 +0,0 @@
[[constraint]]
branch = "master"
name = "github.com/prataprc/goparsec"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.1.4"

View File

@ -3,7 +3,7 @@ package calc
import ( import (
"fmt" "fmt"
. "github.com/vektah/goparsify" . "github.com/oec/goparsify"
) )
var ( var (

View File

@ -45,7 +45,9 @@ func (dp *debugParser) logf(ps *State, result *Result, format string, args ...in
buf.WriteString(fmt.Sprintf("%-15s", ps.Preview(15))) buf.WriteString(fmt.Sprintf("%-15s", ps.Preview(15)))
buf.WriteString(" | ") buf.WriteString(" | ")
buf.WriteString(strings.Repeat(" ", len(activeParsers)-1)) buf.WriteString(strings.Repeat(" ", len(activeParsers)-1))
buf.WriteString(fmt.Sprint(append([]interface{}{format}, args...)...)) //buf.WriteString(fmt.Sprintf(format, args...))
buf.WriteString(format)
buf.WriteString(fmt.Sprint(args...))
if ps.Errored() { if ps.Errored() {
buf.WriteString(fmt.Sprintf(" did not find %s", ps.Error.expected)) buf.WriteString(fmt.Sprintf(" did not find %s", ps.Error.expected))
} else if result != nil { } else if result != nil {
@ -72,10 +74,10 @@ func (dp *debugParser) logStart(ps *State) {
func (dp *debugParser) logEnd(ps *State, result *Result) { func (dp *debugParser) logEnd(ps *State, result *Result) {
if log != nil { if log != nil {
if pendingOpenLog != "" { if pendingOpenLog != "" {
fmt.Fprintf(log, dp.logf(ps, result, dp.Name())) fmt.Fprint(log, dp.logf(ps, result, dp.Name()))
pendingOpenLog = "" pendingOpenLog = ""
} else { } else {
fmt.Fprintf(log, dp.logf(ps, result, "}")) fmt.Fprint(log, dp.logf(ps, result, "}"))
} }
} }
} }

10
go.mod Normal file
View File

@ -0,0 +1,10 @@
module github.com/oec/goparsify
go 1.12
require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prataprc/goparsec v0.0.0-20170801142144-82de4f9400c2
github.com/stretchr/testify v1.1.4
)

10
go.sum Normal file
View File

@ -0,0 +1,10 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prataprc/goparsec v0.0.0-20170801142144-82de4f9400c2 h1:JBQTPu1dlxC7Mp/lbF8WQMH206np5ZJYFbVyfjF9HL0=
github.com/prataprc/goparsec v0.0.0-20170801142144-82de4f9400c2/go.mod h1:YbpxZqbf10o5u96/iDpcfDQmbIOTX/iNCH/yBByTfaM=
github.com/stretchr/testify v1.1.4 h1:ToftOQTytwshuOSj6bDSolVUa3GINfJP/fg3OkkOzQQ=
github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/vektah/goparsify v0.0.0-20180611020250-3e20a3b9244a h1:kjtLFYYtOh6EJz4svAJjY4apt9SJFQxe23e0mzTnlng=
github.com/vektah/goparsify v0.0.0-20180611020250-3e20a3b9244a/go.mod h1:DSfslQMj3gv774kof/dg5pwh62XUjimkRBoF2DgdyaY=

View File

@ -1,7 +1,7 @@
package html package html
import ( import (
. "github.com/vektah/goparsify" . "github.com/oec/goparsify"
) )
func parse(input string) (result interface{}, err error) { func parse(input string) (result interface{}, err error) {

View File

@ -4,8 +4,8 @@ import (
"os" "os"
"testing" "testing"
"github.com/oec/goparsify"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/vektah/goparsify"
) )
func TestParse(t *testing.T) { func TestParse(t *testing.T) {

View File

@ -1,7 +1,7 @@
package json package json
import ( import (
. "github.com/vektah/goparsify" . "github.com/oec/goparsify"
) )
var ( var (

View File

@ -6,9 +6,9 @@ import (
"os" "os"
"github.com/oec/goparsify"
parsecJson "github.com/prataprc/goparsec/json" parsecJson "github.com/prataprc/goparsec/json"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/vektah/goparsify"
) )
func TestUnmarshal(t *testing.T) { func TestUnmarshal(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"runtime" "runtime"
"runtime/pprof" "runtime/pprof"
"github.com/vektah/goparsify" "github.com/oec/goparsify"
"github.com/vektah/goparsify/json" "github.com/oec/goparsify/json"
) )
var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file") var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")