Skip to content

Commit

Permalink
Merge pull request #14 from conflowio/move_to_conflowio
Browse files Browse the repository at this point in the history
Move project to github.com/conflowio/parsley
  • Loading branch information
bandesz authored Oct 30, 2021
2 parents 86e58e6 + b202551 commit a28c260
Show file tree
Hide file tree
Showing 121 changed files with 1,986 additions and 535 deletions.
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ version: 2
jobs:
test:
docker:
- image: circleci/golang:1.16
working_directory: /go/src/github.com/opsidian/parsley
- image: circleci/golang:1.17
working_directory: /go/src/github.com/conflowio/parsley
steps:
- checkout
- run: make check
- run: make test

workflows:
Expand Down
25 changes: 25 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
run:
tests: false
timeout: 10m

linters:
enable:
- depguard
- exportloopref
- unparam
- wastedassign

linters-settings:
depguard:
list-type: blacklist
include-go-root: true
packages-with-error-message:
- github.com/davecgh/go-spew/spew: "used for debugging - should not appear in the codebase"
- io/ioutil: "deprecated in go1.16 - see https://golang.org/doc/go1.16#ioutil"

govet:
settings:
printf:
funcs:
- parsley.NewErrorf
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,24 @@ test: ## Runs all the tests

generate-mocks: ## Regenerates all mocks with mockery
go generate ./...

.PHONY: update-dependencies
update-dependencies: ## Updates all dependencies
@echo "Updating Go dependencies"
@cat go.mod | grep -E "^\t" | grep -v "// indirect" | cut -f 2 | cut -d ' ' -f 1 | xargs -n 1 -t go get -d -u
@go mod vendor
@go mod tidy

.PHONY: lint
lint: ## Runs linting checks
@echo "Running lint checks"
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./...

.PHONY: check
check: lint check-go-generate

.PHONY: check-go-generate
check-go-generate:
@echo "Checking 'go generate ./...'"
@go generate ./...
@ scripts/check_git_changes.sh "make go-generate"
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Parsley - Parser combinator library written in Go

[![CircleCI status](https://circleci.com/gh/opsidian/parsley.svg?style=shield&circle-token=c42cce0e1ae1496645d1d6dc640d86a9e6de808d)](https://circleci.com/gh/opsidian/parsley) [![GoDoc](https://godoc.org/github.com/opsidian/parsley?status.svg)](https://godoc.org/github.com/opsidian/parsley) [![Latest release](https://img.shields.io/github/release/opsidian/parsley.svg)](https://github.com/opsidian/parsley/releases/latest)
[![CircleCI status](https://circleci.com/gh/conflowio/parsley.svg?style=shield&circle-token=c42cce0e1ae1496645d1d6dc640d86a9e6de808d)](https://circleci.com/gh/conflowio/parsley) [![GoDoc](https://godoc.org/github.com/conflowio/parsley?status.svg)](https://godoc.org/github.com/conflowio/parsley) [![Latest release](https://img.shields.io/github/release/conflowio/parsley.svg)](https://github.com/conflowio/parsley/releases/latest)

Parsley is a general parser combinator library which can be used to parse context-free, left-recursive languages. It handles indirect as well as direct left-recursion in polynomial time and defines a memoization helper for speeding up parsing time. The language grammar can be easily translated to a set of rules using parsers and combinators.

Expand Down Expand Up @@ -119,13 +119,13 @@ The **add** variable will contain a parser which is able to parse the given expr

#### More examples

There is a JSON-like parser implementation in the [examples/json](examples/json) directory. It also gives you some
There is a JSON-like parser implementation in the [examples/json](examples/json) directory.

For a more complex expression parser you can check out the [Flint interpolation language](https://github.com/opsidian/flint).
For a more complex expression parser you can check out the [Conflow language](https://github.com/conflowio/conflow).

### Documentation

Please more information about the available parsers and combinators please check out the [Go docs](https://godoc.org/github.com/opsidian/parsley).
Please more information about the available parsers and combinators please check out the [Go docs](https://godoc.org/github.com/conflowio/parsley).

## Library packages

Expand Down Expand Up @@ -164,15 +164,15 @@ $ cd examples/json/json
$ go test -bench=. -benchmem
goos: darwin
goarch: amd64
pkg: github.com/opsidian/parsley/examples/json/json
pkg: github.com/conflowio/parsley/examples/json/json
BenchmarkParsleyJSON1k-4 20000 79929 ns/op 26557 B/op 570 allocs/op
BenchmarkParsleyJSON10k-4 2000 681273 ns/op 248000 B/op 4435 allocs/op
BenchmarkParsleyJSON100k-4 200 6999517 ns/op 6011530 B/op 41647 allocs/op
BenchmarkEncodingJSON1k-4 50000 23834 ns/op 5794 B/op 113 allocs/op
BenchmarkEncodingJSON10k-4 10000 190699 ns/op 44140 B/op 869 allocs/op
BenchmarkEncodingJSON100k-4 1000 1880887 ns/op 418492 B/op 8153 allocs/op
PASS
ok github.com/opsidian/parsley/examples/json/json 11.410s
ok github.com/conflowio/parsley/examples/json/json 11.410s
```

## LICENSE
Expand Down
35 changes: 20 additions & 15 deletions ast/astfakes/fake_reader_pos_setter_node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ast/empty_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package ast
import (
"fmt"

"github.com/opsidian/parsley/parsley"
"github.com/conflowio/parsley/parsley"
)

// EmptyNode represents an empty node
Expand Down
5 changes: 3 additions & 2 deletions ast/empty_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ package ast_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
)

var _ = Describe("EmptyNode", func() {
Expand Down
4 changes: 2 additions & 2 deletions ast/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package ast

import "github.com/opsidian/parsley/parsley"
import "github.com/conflowio/parsley/parsley"

// AppendNode appends
func AppendNode(n1, n2 parsley.Node) parsley.Node {
Expand All @@ -33,7 +33,7 @@ type ReaderPosSetter interface {
}

// ReaderPosSetterNode defines a node which also implements the ReaderPosSetter interface
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . ReaderPosSetterNode
//counterfeiter:generate . ReaderPosSetterNode
type ReaderPosSetterNode interface {
parsley.Node
ReaderPosSetter
Expand Down
7 changes: 4 additions & 3 deletions ast/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo/extensions/table"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"
"github.com/opsidian/parsley/parsley/parsleyfakes"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
"github.com/conflowio/parsley/parsley/parsleyfakes"
)

var _ = Describe("AppendNode", func() {
Expand Down
2 changes: 1 addition & 1 deletion ast/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package ast

import "github.com/opsidian/parsley/parsley"
import "github.com/conflowio/parsley/parsley"

// InterpreterFunc defines a helper to implement the Interpreter interface with functions
type InterpreterFunc func(userCtx interface{}, node parsley.NonTerminalNode) (interface{}, parsley.Error)
Expand Down
4 changes: 2 additions & 2 deletions ast/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package interpreter
import (
"fmt"

"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"
"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
)

// Select returns with an interpreter which returns the value of the selected node
Expand Down
9 changes: 5 additions & 4 deletions ast/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ package interpreter_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/ast/interpreter"
"github.com/opsidian/parsley/parsley"
"github.com/opsidian/parsley/parsley/parsleyfakes"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/ast/interpreter"
"github.com/conflowio/parsley/parsley"
"github.com/conflowio/parsley/parsley/parsleyfakes"
)

var _ = Describe("Interpreter", func() {
Expand Down
7 changes: 4 additions & 3 deletions ast/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ package ast_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"
"github.com/opsidian/parsley/parsley/parsleyfakes"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
"github.com/conflowio/parsley/parsley/parsleyfakes"
)

var _ = Describe("Interpreter", func() {
Expand Down
2 changes: 1 addition & 1 deletion ast/node_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package ast

import "github.com/opsidian/parsley/parsley"
import "github.com/conflowio/parsley/parsley"

// NodeList contains a list of nodes, should be used when a parser returns with multiple results
// If you call any of the parsley.Node methods on it then it will behave as it would be the first node.
Expand Down
9 changes: 5 additions & 4 deletions ast/node_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ package ast_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/ast/astfakes"
"github.com/opsidian/parsley/parsley"
"github.com/opsidian/parsley/parsley/parsleyfakes"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/ast/astfakes"
"github.com/conflowio/parsley/parsley"
"github.com/conflowio/parsley/parsley/parsleyfakes"
)

var _ = Describe("NodeList", func() {
Expand Down
2 changes: 1 addition & 1 deletion ast/nonterminal_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package ast
import (
"fmt"

"github.com/opsidian/parsley/parsley"
"github.com/conflowio/parsley/parsley"
)

// NonTerminalNode represents a branch node in the AST
Expand Down
7 changes: 4 additions & 3 deletions ast/nonterminal_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"
"github.com/opsidian/parsley/parsley/parsleyfakes"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
"github.com/conflowio/parsley/parsley/parsleyfakes"
)

var _ = Describe("NonTerminalNode", func() {
Expand Down
9 changes: 9 additions & 0 deletions ast/package.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2017 Opsidian Ltd.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

package ast

//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
2 changes: 1 addition & 1 deletion ast/terminal_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package ast
import (
"fmt"

"github.com/opsidian/parsley/parsley"
"github.com/conflowio/parsley/parsley"
)

// TerminalNode is a leaf node in the AST
Expand Down
5 changes: 3 additions & 2 deletions ast/terminal_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ package ast_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opsidian/parsley/ast"
"github.com/opsidian/parsley/parsley"

"github.com/conflowio/parsley/ast"
"github.com/conflowio/parsley/parsley"
)

var _ = Describe("TerminalNode", func() {
Expand Down
Loading

0 comments on commit a28c260

Please sign in to comment.