Skip to content

Commit

Permalink
[go] Move generated parser to its own folder
Browse files Browse the repository at this point in the history
- if we put it at project root and run gofmt ., vendor folder will get
formatted as well
  - golang/go#22173
  • Loading branch information
at15 committed Mar 23, 2018
1 parent e2d2549 commit 1e6ec9c
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ antlr:
.PHONY: gen-parser
gen-parser:
$(GEN_PARSER) -package org.reika.rcl.parser -o impl/rcl-j/src/main/java/org/reika/rcl/parser
$(GEN_PARSER) -package rcl -o impl/rcl-go -Dlanguage=Go
$(GEN_PARSER) -package rcl -o impl/rcl-go/rcl -Dlanguage=Go
3 changes: 2 additions & 1 deletion impl/rcl-go/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
vendor
.idea/
20 changes: 19 additions & 1 deletion impl/rcl-go/Gopkg.lock

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

6 changes: 5 additions & 1 deletion impl/rcl-go/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.PHONY: test
test:
go test -v -cover .
go test -v -cover ./rcl

.PHONY: fmt
fmt:
gofmt -d -l -w ./rcl

.PHONY: install
install:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions impl/rcl-go/rcl/parser_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package rcl

import (
"testing"

"github.com/antlr/antlr4/runtime/Go/antlr"
asst "github.com/stretchr/testify/assert"
)

func TestRCLParser_Rcl(t *testing.T) {
assert := asst.New(t)
input, err := antlr.NewFileStream("testdata/db-xephonk.rcl")
assert.Nil(err)
lexer := NewRCLLexer(input)
stream := antlr.NewCommonTokenStream(lexer, 0)
p := NewRCLParser(stream)
p.BuildParseTrees = true
tree := p.Rcl()
// TODO: visit the tree
t.Log(tree)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions impl/rcl-go/rcl/testdata/db-xephonk.rcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// a database example for awesome-time-series-database
// https://github.com/xephonhq/awesome-time-series-database
name = "Xephon-K"
backends = [
"Cassandra",
"Local Disk"
]
oss = true
github = "https://github.com/xephonhq/xephon-k"
articles = [
{
name = "Introduction to Time Series Database",
url = "https://zhuanlan.zhihu.com/p/29367404"
}
]

0 comments on commit 1e6ec9c

Please sign in to comment.