protocol

package
v2.16.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2019 License: GPL-3.0 Imports: 18 Imported by: 3

Documentation

Overview

Package protocol is a generated protocol buffer package.

It is generated from these files:

driver.proto

It has these top-level messages:

ParseRequest
ParseResponse
ParseError

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthDriver = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDriver   = fmt.Errorf("proto: integer overflow")
)
View Source
var Mode_name = map[int32]string{
	0: "DEFAULT_MODE",
	1: "NATIVE",
	2: "PREPROCESSED",
	4: "ANNOTATED",
	8: "SEMANTIC",
}
View Source
var Mode_value = map[string]int32{
	"DEFAULT_MODE": 0,
	"NATIVE":       1,
	"PREPROCESSED": 2,
	"ANNOTATED":    4,
	"SEMANTIC":     8,
}

Functions

func AsDriver

func AsDriver(cc *grpc.ClientConn) driver.Driver

func DialOptions

func DialOptions() []grpc.DialOption

DialOptions returns a set of common options that should be used when dialing bblfsh server.

It automatically enables OpenTrace if a global tracer is set.

func RegisterDriver

func RegisterDriver(srv *grpc.Server, d driver.Driver)

func RegisterDriverServer

func RegisterDriverServer(s *grpc.Server, srv DriverServer)

func ServerOptions

func ServerOptions() []grpc.ServerOption

ServerOptions returns a set of common options that should be used in bblfsh server.

It automatically enables OpenTrace if a global tracer is set.

Types

type DriverClient

type DriverClient interface {
	// Parse returns an UAST for a given source file.
	Parse(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
}

func NewDriverClient

func NewDriverClient(cc *grpc.ClientConn) DriverClient

type DriverServer

type DriverServer interface {
	// Parse returns an UAST for a given source file.
	Parse(context.Context, *ParseRequest) (*ParseResponse, error)
}

type Mode

type Mode int32
const (
	// DefaultMode selects the transformation mode that is considered to produce UAST of the best quality.
	Mode_DefaultMode Mode = 0
	// Native disables any UAST transformations and emits a native language AST as returned by the parser.
	Mode_Native Mode = 1
	// Preprocessed runs only basic transformation over native AST (normalize positional info, type fields).
	Mode_Preprocessed Mode = 2
	// Annotated UAST is based on native AST, but provides role annotations for nodes.
	Mode_Annotated Mode = 4
	// Semantic UAST normalizes native AST nodes to a unified structure where possible.
	Mode_Semantic Mode = 8
)

func (Mode) EnumDescriptor

func (Mode) EnumDescriptor() ([]byte, []int)

func (Mode) String

func (x Mode) String() string

type ParseError

type ParseError struct {
	// Text is an error message.
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
}

func (*ParseError) Descriptor

func (*ParseError) Descriptor() ([]byte, []int)

func (*ParseError) Marshal

func (m *ParseError) Marshal() (dAtA []byte, err error)

func (*ParseError) MarshalTo

func (m *ParseError) MarshalTo(dAtA []byte) (int, error)

func (*ParseError) ProtoMessage

func (*ParseError) ProtoMessage()

func (*ParseError) ProtoSize

func (m *ParseError) ProtoSize() (n int)

func (*ParseError) Reset

func (m *ParseError) Reset()

func (*ParseError) String

func (m *ParseError) String() string

func (*ParseError) Unmarshal

func (m *ParseError) Unmarshal(dAtA []byte) error

type ParseRequest

type ParseRequest struct {
	// Content stores the content of a source file. Required.
	Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// Language can be set optionally to disable automatic language detection.
	Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// Filename can be set optionally to assist automatic language detection.
	Filename string `protobuf:"bytes,3,opt,name=filename,proto3" json:"filename,omitempty"`
	// Mode sets a transformation pipeline used for UAST.
	Mode Mode `protobuf:"varint,4,opt,name=mode,proto3,enum=gopkg.in.bblfsh.sdk.v2.protocol.Mode" json:"mode,omitempty"`
}

ParseRequest is a request to parse a file and get its UAST.

func (*ParseRequest) Descriptor

func (*ParseRequest) Descriptor() ([]byte, []int)

func (*ParseRequest) Marshal

func (m *ParseRequest) Marshal() (dAtA []byte, err error)

func (*ParseRequest) MarshalTo

func (m *ParseRequest) MarshalTo(dAtA []byte) (int, error)

func (*ParseRequest) ProtoMessage

func (*ParseRequest) ProtoMessage()

func (*ParseRequest) ProtoSize

func (m *ParseRequest) ProtoSize() (n int)

func (*ParseRequest) Reset

func (m *ParseRequest) Reset()

func (*ParseRequest) String

func (m *ParseRequest) String() string

func (*ParseRequest) Unmarshal

func (m *ParseRequest) Unmarshal(dAtA []byte) error

type ParseResponse

type ParseResponse struct {
	// UAST is a binary encoding of the resulting UAST.
	Uast []byte `protobuf:"bytes,1,opt,name=uast,proto3" json:"uast,omitempty"`
	// Language that was automatically detected.
	Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"`
	// Errors is a list of parsing errors.
	// Only set if parser was able to return a response. Otherwise gRPC error codes are used.
	Errors []*ParseError `protobuf:"bytes,3,rep,name=errors" json:"errors,omitempty"`
}

ParseResponse is the reply to ParseRequest.

func (*ParseResponse) Descriptor

func (*ParseResponse) Descriptor() ([]byte, []int)

func (*ParseResponse) Marshal

func (m *ParseResponse) Marshal() (dAtA []byte, err error)

func (*ParseResponse) MarshalTo

func (m *ParseResponse) MarshalTo(dAtA []byte) (int, error)

func (*ParseResponse) Nodes

func (m *ParseResponse) Nodes() (nodes.Node, error)

func (*ParseResponse) ProtoMessage

func (*ParseResponse) ProtoMessage()

func (*ParseResponse) ProtoSize

func (m *ParseResponse) ProtoSize() (n int)

func (*ParseResponse) Reset

func (m *ParseResponse) Reset()

func (*ParseResponse) String

func (m *ParseResponse) String() string

func (*ParseResponse) Unmarshal

func (m *ParseResponse) Unmarshal(dAtA []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL