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

Commit 01444fd

Browse files
Denys Smirnovdennwc
authored andcommitted
support v2 protocol
Signed-off-by: Denys Smirnov <[email protected]>
1 parent 96e800b commit 01444fd

File tree

6 files changed

+49
-25
lines changed

6 files changed

+49
-25
lines changed

Gopkg.lock

Lines changed: 28 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

driver/fixtures/fixtures_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ import (
55
"testing"
66

77
"github.com/bblfsh/python-driver/driver/normalizer"
8-
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
9-
"gopkg.in/bblfsh/sdk.v2/sdk/driver/fixtures"
8+
"gopkg.in/bblfsh/sdk.v2/driver"
9+
"gopkg.in/bblfsh/sdk.v2/driver/fixtures"
10+
"gopkg.in/bblfsh/sdk.v2/driver/native"
1011
)
1112

1213
const projectRoot = "../../"
@@ -15,8 +16,8 @@ var Suite = &fixtures.Suite{
1516
Lang: "python",
1617
Ext: ".py",
1718
Path: filepath.Join(projectRoot, fixtures.Dir),
18-
NewDriver: func() driver.BaseDriver {
19-
return driver.NewExecDriverAt(filepath.Join(projectRoot, "build/bin/native"))
19+
NewDriver: func() driver.Native {
20+
return native.NewDriverAt(filepath.Join(projectRoot, "build/bin/native"), native.UTF8)
2021
},
2122
Transforms: normalizer.Transforms,
2223
BenchName: "issue_server101",

driver/impl/impl.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package impl
22

3-
import "gopkg.in/bblfsh/sdk.v2/sdk/driver"
3+
import (
4+
"gopkg.in/bblfsh/sdk.v2/driver/native"
5+
"gopkg.in/bblfsh/sdk.v2/driver/server"
6+
)
47

58
func init() {
69
// Can be overridden to link a native driver into a Go driver server.
7-
driver.DefaultDriver = driver.NewExecDriver()
10+
server.DefaultDriver = native.NewDriver(native.UTF8)
811
}

driver/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
_ "github.com/bblfsh/python-driver/driver/impl"
55
"github.com/bblfsh/python-driver/driver/normalizer"
66

7-
"gopkg.in/bblfsh/sdk.v2/sdk/driver"
7+
"gopkg.in/bblfsh/sdk.v2/driver/server"
88
)
99

1010
func main() {
11-
driver.Run(normalizer.Transforms)
11+
server.Run(normalizer.Transforms)
1212
}

driver/normalizer/transforms.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package normalizer
22

3-
import "gopkg.in/bblfsh/sdk.v2/sdk/driver"
3+
import "gopkg.in/bblfsh/sdk.v2/driver"
44

55
var Transforms = driver.Transforms{
6-
Preprocess: Preprocess,
7-
Normalize: Normalize,
8-
Native: Native,
9-
Code: Code,
6+
Preprocess: Preprocess,
7+
Normalize: Normalize,
8+
Annotations: Native,
9+
Code: Code,
1010
}

fixtures/_integration.py.legacy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Module {
22
. Roles: File,Module
33
. Children: {
44
. . 0: ClassDef {
5-
. . . Roles: Declaration,Identifier,Statement,Type
5+
. . . Roles: Type,Declaration,Identifier,Statement
66
. . . TOKEN "testcls1"
77
. . . StartPosition: {
88
. . . . Offset: 6
@@ -19,19 +19,19 @@ Module {
1919
. . . }
2020
. . . Children: {
2121
. . . . 0: ClassDef.bases {
22-
. . . . . Roles: Base,Declaration,Type
22+
. . . . . Roles: Type,Declaration,Base
2323
. . . . . Properties: {
2424
. . . . . . internalRole: bases
2525
. . . . . }
2626
. . . . }
2727
. . . . 1: ClassDef.decorator_list {
28-
. . . . . Roles: Call,Declaration,Incomplete,Type
28+
. . . . . Roles: Type,Declaration,Call,Incomplete
2929
. . . . . Properties: {
3030
. . . . . . internalRole: decorator_list
3131
. . . . . }
3232
. . . . }
3333
. . . . 2: ClassDef.body {
34-
. . . . . Roles: Body,Declaration,Type
34+
. . . . . Roles: Type,Declaration,Body
3535
. . . . . Properties: {
3636
. . . . . . internalRole: body
3737
. . . . . }

0 commit comments

Comments
 (0)