Documentation ¶
Overview ¶
Babelfish (https://doc.bblf.sh) Go client library provides functionality to both connect to the bblfsh daemon to parse code (obtaining an UAST as a result) and to analyse UASTs with the functionality provided by libuast.
Index ¶
- type Client
- type FatalError
- type NativeParseRequest
- func (r *NativeParseRequest) Content(content string) *NativeParseRequest
- func (r *NativeParseRequest) Do() (*protocol.NativeParseResponse, error)
- func (r *NativeParseRequest) DoWithContext(ctx context.Context) (*protocol.NativeParseResponse, error)
- func (r *NativeParseRequest) Encoding(encoding protocol.Encoding) *NativeParseRequest
- func (r *NativeParseRequest) Filename(filename string) *NativeParseRequest
- func (r *NativeParseRequest) Language(language string) *NativeParseRequest
- func (r *NativeParseRequest) ReadFile(fp string) *NativeParseRequest
- type ParseRequest
- func (r *ParseRequest) Content(content string) *ParseRequest
- func (r *ParseRequest) Do() (*protocol.ParseResponse, error)
- func (r *ParseRequest) DoWithContext(ctx context.Context) (*protocol.ParseResponse, error)
- func (r *ParseRequest) Encoding(encoding protocol.Encoding) *ParseRequest
- func (r *ParseRequest) Filename(filename string) *ParseRequest
- func (r *ParseRequest) Language(language string) *ParseRequest
- func (r *ParseRequest) ReadFile(fp string) *ParseRequest
- type SupportedLanguagesRequest
- type VersionRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *grpc.ClientConn // contains filtered or unexported fields }
Client holds the public client API to interact with the bblfsh daemon.
func NewClientWithConnection ¶
func NewClientWithConnection(conn *grpc.ClientConn) (*Client, error)
NewClientWithConnection returns a new bblfsh client given a grpc connection.
func (*Client) NewNativeParseRequest ¶
func (c *Client) NewNativeParseRequest() *NativeParseRequest
NewNativeParseRequest is a parsing request to get the AST.
func (*Client) NewParseRequest ¶
func (c *Client) NewParseRequest() *ParseRequest
NewParseRequest is a parsing request to get the UAST.
func (*Client) NewSupportedLanguagesRequest ¶
func (c *Client) NewSupportedLanguagesRequest() *SupportedLanguagesRequest
NewSupportedLanguagesRequest is a parsing request to get the supported languages.
func (*Client) NewVersionRequest ¶
func (c *Client) NewVersionRequest() *VersionRequest
NewVersionRequest is a parsing request to get the version of the server.
type FatalError ¶
type FatalError []string
FatalError is returned when response is returned with Fatal status code.
func (FatalError) Error ¶
func (e FatalError) Error() string
type NativeParseRequest ¶
type NativeParseRequest struct {
// contains filtered or unexported fields
}
NativeParseRequest is a parsing request to get the AST.
func (*NativeParseRequest) Content ¶
func (r *NativeParseRequest) Content(content string) *NativeParseRequest
Content sets the content of the parse request. It should be the source code that wants to be parsed.
func (*NativeParseRequest) Do ¶
func (r *NativeParseRequest) Do() (*protocol.NativeParseResponse, error)
Do performs the actual parsing by serializing the request, sending it to bblfsd and waiting for the response.
func (*NativeParseRequest) DoWithContext ¶
func (r *NativeParseRequest) DoWithContext(ctx context.Context) (*protocol.NativeParseResponse, error)
DoWithContext does the same as Do(), but sopporting cancellation by the use of Go contexts.
func (*NativeParseRequest) Encoding ¶
func (r *NativeParseRequest) Encoding(encoding protocol.Encoding) *NativeParseRequest
Encoding sets the text encoding of the content.
func (*NativeParseRequest) Filename ¶
func (r *NativeParseRequest) Filename(filename string) *NativeParseRequest
Filename sets the filename of the content.
func (*NativeParseRequest) Language ¶
func (r *NativeParseRequest) Language(language string) *NativeParseRequest
Language sets the language of the given source file to parse. if missing will be guess from the filename and the content.
func (*NativeParseRequest) ReadFile ¶
func (r *NativeParseRequest) ReadFile(fp string) *NativeParseRequest
ReadFile loads a file given a local path and sets the content and the filename of the request.
type ParseRequest ¶
type ParseRequest struct {
// contains filtered or unexported fields
}
ParseRequest is a parsing request to get the UAST.
func (*ParseRequest) Content ¶
func (r *ParseRequest) Content(content string) *ParseRequest
Content sets the content of the parse request. It should be the source code that wants to be parsed.
func (*ParseRequest) Do ¶
func (r *ParseRequest) Do() (*protocol.ParseResponse, error)
Do performs the actual parsing by serializing the request, sending it to bblfshd and waiting for the response.
func (*ParseRequest) DoWithContext ¶
func (r *ParseRequest) DoWithContext(ctx context.Context) (*protocol.ParseResponse, error)
DoWithContext does the same as Do(), but sopporting cancellation by the use of Go contexts.
func (*ParseRequest) Encoding ¶
func (r *ParseRequest) Encoding(encoding protocol.Encoding) *ParseRequest
Encoding sets the text encoding of the content.
func (*ParseRequest) Filename ¶
func (r *ParseRequest) Filename(filename string) *ParseRequest
Filename sets the filename of the content.
func (*ParseRequest) Language ¶
func (r *ParseRequest) Language(language string) *ParseRequest
Language sets the language of the given source file to parse. if missing will be guess from the filename and the content.
func (*ParseRequest) ReadFile ¶
func (r *ParseRequest) ReadFile(fp string) *ParseRequest
ReadFile loads a file given a local path and sets the content and the filename of the request.
type SupportedLanguagesRequest ¶
type SupportedLanguagesRequest struct {
// contains filtered or unexported fields
}
SupportedLanguagesRequest is a request to retrieve the supported languages.
func (*SupportedLanguagesRequest) Do ¶
func (r *SupportedLanguagesRequest) Do() (*protocol.SupportedLanguagesResponse, error)
Do performs the actual parsing by serializing the request, sending it to bblfsd and waiting for the response.
func (*SupportedLanguagesRequest) DoWithContext ¶
func (r *SupportedLanguagesRequest) DoWithContext(ctx context.Context) (*protocol.SupportedLanguagesResponse, error)
DoWithContext does the same as Do(), but sopporting cancellation by the use of Go contexts.
type VersionRequest ¶
type VersionRequest struct {
// contains filtered or unexported fields
}
VersionRequest is a request to retrieve the version of the server.
func (*VersionRequest) Do ¶
func (r *VersionRequest) Do() (*protocol.VersionResponse, error)
Do performs the actual parsing by serializing the request, sending it to bblfsd and waiting for the response.
func (*VersionRequest) DoWithContext ¶
func (r *VersionRequest) DoWithContext(ctx context.Context) (*protocol.VersionResponse, error)
DoWithContext does the same as Do(), but sopporting cancellation by the use of Go contexts.