bblfsh-client


Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем
Группа

Группа

org.bblfsh
Идентификатор

Идентификатор

bblfsh-client
Последняя версия

Последняя версия

2.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

bblfsh-client
bblfsh-client
Ссылка на сайт

Ссылка на сайт

https://github.com/bblfsh/scala-client
Организация-разработчик

Организация-разработчик

org.bblfsh
Система контроля версий

Система контроля версий

https://github.com/bblfsh/scala-client

Скачать bblfsh-client

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.bblfsh/bblfsh-client/ -->
<dependency>
    <groupId>org.bblfsh</groupId>
    <artifactId>bblfsh-client</artifactId>
    <version>2.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.bblfsh/bblfsh-client/
implementation 'org.bblfsh:bblfsh-client:2.1.0'
// https://jarcasting.com/artifacts/org.bblfsh/bblfsh-client/
implementation ("org.bblfsh:bblfsh-client:2.1.0")
'org.bblfsh:bblfsh-client:jar:2.1.0'
<dependency org="org.bblfsh" name="bblfsh-client" rev="2.1.0">
  <artifact name="bblfsh-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.bblfsh', module='bblfsh-client', version='2.1.0')
)
libraryDependencies += "org.bblfsh" % "bblfsh-client" % "2.1.0"
[org.bblfsh/bblfsh-client "2.1.0"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.11.11
com.thesamet.scalapb : scalapb-runtime_2.11 jar 0.8.3
org.rogach : scallop_2.11 jar 3.0.3
commons-io : commons-io jar 2.5
com.thesamet.scalapb : scalapb-runtime-grpc_2.11 jar 0.8.3
io.grpc : grpc-netty jar 1.17.1

provided (2)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-reflect jar 2.11.11
ch.jodersky » sbt-jni-macros_2.11 jar 1.2.6

test (1)

Идентификатор библиотеки Тип Версия
org.scalatest : scalatest_2.11 jar 3.0.1

Модули Проекта

Данный проект не имеет модулей.

Babelfish Scala client Build Status

This is a Scala/JNI implementation of the Babelfish client. It uses ScalaPB for Protobuf/gRPC code generation and libuast for XPath queries.

Status

The latest scala-client v2.x supports the UASTv2 protocol.

Installation

Requirements

Java SDK 8

You need to install the Java SDK and its header files. The command for Debian and derived distributions would be:

sudo apt install openjdk-8 openjdk-8-jdk-headless
Scala 2.11

Currently we support Scala 2.11. We recommend using scalaVersion := "2.11.11" or above in your build.sbt file. This library is not compatible with Scala 2.12 or 2.13.

Building from sources

git clone https://github.com/bblfsh/scala-client.git
cd scala-client
./build.sh --clean --get-dependencies --all

This command would fetch dependencies for the package, compile native code (JNI) and the Scala code. gRPC/protobuf files are re-generate from src/main/proto on every ./sbt compile and are stored under ./target/src_managed/.

The jar file and the native module are generated in the build/ directory. If you move the jar file to some other path, the native (.so or .dylib) library must be in the same path.

If the build fails because it can't find the jni.h header file, run it setting JAVA_HOME (appropriately setting it to the right location for your system):

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
./build.sh --clean --get-dependencies --all

If the build fails with: build.sh: Permission denied, add execution permissions to the script:

chmod +x ./build.sh

build.sh script has been tested in Unix (Linux and macOS) and with Git Bash in Windows.

For more developer documentation please check our CONTRIBUTING guideline.

Apache Maven

The bblfsh-client package is available thorugh Maven central, so it can be easily added as a dependency in various package management systems. Examples of how to handle it for most common systems are included below; for other systems just look at Maven central's dependency information.

<dependency>
    <groupId>org.bblfsh</groupId>
    <artifactId>bblfsh-client</artifactId>
    <version>${version}</version>
</dependency>

Scala sbt

libraryDependencies += "org.bblfsh" % "bblfsh-client" % version

Usage

If you don't have a bblfsh server running you can execute it using the following command:

docker run --privileged --rm -it -p 9432:9432 --name bblfsh bblfsh/bblfshd

Please, read the getting started guide to learn more about how to use and deploy a bblfsh server, install language drivers, etc.

API

import scala.io.Source
import org.bblfsh.client.v2.BblfshClient, BblfshClient._
import gopkg.in.bblfsh.sdk.v2.protocol.driver.Mode

val client = BblfshClient("localhost", 9432)

val filename = "/path/to/file.py" // client responsible for encoding it to utf-8
val fileContent = Source.fromFile(filename).getLines.mkString("\n")
val resp = client.parse(filename, fileContent, Mode.SEMANTIC)

// Full response
println(resp.get)

// Filtered response
val it = client.filter(resp.get, "//uast:Identifier")
it.foreach(println)

Please read the Babelfish clients guide section to learn more about babelfish clients and their query language.

License

Apache 2.0

org.bblfsh

Babelfish

A self-hosted server for source code parsing

Версии библиотеки

Версия
2.1.0
2.0.2
2.0.0
1.11.0
1.10.1
1.9.1
1.8.2
1.8.1
1.8.0
1.7.0
1.5.3
1.5.2
1.5.1
1.5.0
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.2
1.2.1
1.2.0
1.1.0
1.0.1
1.0.0
0.1.0