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

Bip 5 #16

Merged
merged 1 commit into from
Jun 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
- docker

before_script:
- go get -v gopkg.in/bblfsh/sdk.v1/...
- go get -v gopkg.in/bblfsh/sdk.v2/...
- bblfsh-sdk prepare-build .
- go get -v -t ./driver/...

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ build-native-internal:

rm $(BUILD_PATH)/bin/native || true
ln -s /opt/driver/src/ast $(BUILD_PATH)/bin/native

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# php-driver ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/php-driver.svg?branch=master)](https://travis-ci.org/bblfsh/php-driver) ![Native Version](https://img.shields.io/badge/php%20version-7.1.15--r0-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.9-63afbf.svg)
# php-driver ![Driver Status](https://img.shields.io/badge/status-beta-dbd25c.svg) [![Build Status](https://travis-ci.org/bblfsh/php-driver.svg?branch=master)](https://travis-ci.org/bblfsh/php-driver) ![Native Version](https://img.shields.io/badge/php%20version-7.1.17--r0-aa93ea.svg) ![Go Version](https://img.shields.io/badge/go%20version-1.9-63afbf.svg)

php driver for [babelfish](https://github.com/bblfsh/bblfshd).

Expand All @@ -8,7 +8,7 @@ Development Environment

Requirements:
- `docker`
- [`bblfsh-sdk`](https://github.com/bblfsh/sdk) _(go get -u gopkg.in/bblfsh/sdk.v1/...)_
- [`bblfsh-sdk`](https://github.com/bblfsh/sdk) _(go get -u gopkg.in/bblfsh/sdk.v2/...)_
- UAST converter dependencies _(go get -t -v ./...)_

To initialize the build system execute: `bblfsh-sdk prepare-build`, at the root of the project. This will install the SDK at `.sdk` for this driver.
Expand Down
34 changes: 34 additions & 0 deletions driver/fixtures/fixtures_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package fixtures

import (
"path/filepath"
"testing"

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

const projectRoot = "../../"

var Suite = &fixtures.Suite{
Lang: "php",
Ext: ".php",
Path: filepath.Join(projectRoot, fixtures.Dir),
NewDriver: func() driver.BaseDriver {
return driver.NewExecDriverAt(filepath.Join(projectRoot, "native/ast"))
},
Transforms: driver.Transforms{
Native: normalizer.Native,
Code: normalizer.Code,
},
BenchName: "complex",
}

func TestPHPDriver(t *testing.T) {
Suite.RunTests(t)
}

func BenchmarkPHPDriver(b *testing.B) {
Suite.RunBenchmarks(b)
}
8 changes: 8 additions & 0 deletions driver/impl/impl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package impl

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

func init() {
// Can be overridden to link a native driver into a Go driver server.
driver.DefaultDriver = driver.NewExecDriver()
}
8 changes: 6 additions & 2 deletions driver/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package main

import (
_ "github.com/bblfsh/php-driver/driver/impl"
"github.com/bblfsh/php-driver/driver/normalizer"

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

func main() {
driver.Run(normalizer.ToNode, normalizer.Transformers)
driver.Run(driver.Transforms{
Native: normalizer.Native,
Code: normalizer.Code,
})
}
Loading