Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
support v2 protocol
Browse files Browse the repository at this point in the history
Signed-off-by: Denys Smirnov <denys@sourced.tech>
  • Loading branch information
Denys Smirnov authored and dennwc committed Aug 2, 2018
1 parent 96e800b commit 01444fd
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
36 changes: 28 additions & 8 deletions Gopkg.lock

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

9 changes: 5 additions & 4 deletions driver/fixtures/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"testing"

"github.com/bblfsh/python-driver/driver/normalizer"
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
"gopkg.in/bblfsh/sdk.v2/sdk/driver/fixtures"
"gopkg.in/bblfsh/sdk.v2/driver"
"gopkg.in/bblfsh/sdk.v2/driver/fixtures"
"gopkg.in/bblfsh/sdk.v2/driver/native"
)

const projectRoot = "../../"
Expand All @@ -15,8 +16,8 @@ var Suite = &fixtures.Suite{
Lang: "python",
Ext: ".py",
Path: filepath.Join(projectRoot, fixtures.Dir),
NewDriver: func() driver.BaseDriver {
return driver.NewExecDriverAt(filepath.Join(projectRoot, "build/bin/native"))
NewDriver: func() driver.Native {
return native.NewDriverAt(filepath.Join(projectRoot, "build/bin/native"), native.UTF8)
},
Transforms: normalizer.Transforms,
BenchName: "issue_server101",
Expand Down
7 changes: 5 additions & 2 deletions driver/impl/impl.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package impl

import "gopkg.in/bblfsh/sdk.v2/sdk/driver"
import (
"gopkg.in/bblfsh/sdk.v2/driver/native"
"gopkg.in/bblfsh/sdk.v2/driver/server"
)

func init() {
// Can be overridden to link a native driver into a Go driver server.
driver.DefaultDriver = driver.NewExecDriver()
server.DefaultDriver = native.NewDriver(native.UTF8)
}
4 changes: 2 additions & 2 deletions driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
_ "github.com/bblfsh/python-driver/driver/impl"
"github.com/bblfsh/python-driver/driver/normalizer"

"gopkg.in/bblfsh/sdk.v2/sdk/driver"
"gopkg.in/bblfsh/sdk.v2/driver/server"
)

func main() {
driver.Run(normalizer.Transforms)
server.Run(normalizer.Transforms)
}
10 changes: 5 additions & 5 deletions driver/normalizer/transforms.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package normalizer

import "gopkg.in/bblfsh/sdk.v2/sdk/driver"
import "gopkg.in/bblfsh/sdk.v2/driver"

var Transforms = driver.Transforms{
Preprocess: Preprocess,
Normalize: Normalize,
Native: Native,
Code: Code,
Preprocess: Preprocess,
Normalize: Normalize,
Annotations: Native,
Code: Code,
}
8 changes: 4 additions & 4 deletions fixtures/_integration.py.legacy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Module {
. Roles: File,Module
. Children: {
. . 0: ClassDef {
. . . Roles: Declaration,Identifier,Statement,Type
. . . Roles: Type,Declaration,Identifier,Statement
. . . TOKEN "testcls1"
. . . StartPosition: {
. . . . Offset: 6
Expand All @@ -19,19 +19,19 @@ Module {
. . . }
. . . Children: {
. . . . 0: ClassDef.bases {
. . . . . Roles: Base,Declaration,Type
. . . . . Roles: Type,Declaration,Base
. . . . . Properties: {
. . . . . . internalRole: bases
. . . . . }
. . . . }
. . . . 1: ClassDef.decorator_list {
. . . . . Roles: Call,Declaration,Incomplete,Type
. . . . . Roles: Type,Declaration,Call,Incomplete
. . . . . Properties: {
. . . . . . internalRole: decorator_list
. . . . . }
. . . . }
. . . . 2: ClassDef.body {
. . . . . Roles: Body,Declaration,Type
. . . . . Roles: Type,Declaration,Body
. . . . . Properties: {
. . . . . . internalRole: body
. . . . . }
Expand Down

0 comments on commit 01444fd

Please sign in to comment.