Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDecodingRequest = errors.NewKind("error decoding request") ErrEncodingResponse = errors.NewKind("error encoding response") )
Functions ¶
func FillLineColFromOffset ¶
FillLineColFromOffset gets the original source code and its parsed form as *Node and fills every Line and Column field using its Offset.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client to communicate with a driver.
func (*Client) Parse ¶
func (c *Client) Parse(req *protocol.ParseRequest) *protocol.ParseResponse
type Driver ¶
type Driver struct { // Version of the driver. Version string // Build identifier. Build string // ParserBuilder creates a Parser. ParserBuilder ParserBuilder // Annotate contains an *ann.Rule to convert AST to UAST. Annotate *ann.Rule // In is the input of the driver. Defaults to os.Stdin. In io.Reader // Out is the output of the driver. Defaults to os.Stdout. Out io.Writer // Err is the error output of the driver. Defaults to os.Stderr. Err io.Writer }
Driver implements a driver.
type ParserBuilder ¶
type ParserBuilder func(ParserOptions) (Parser, error)
ParserBuilder is a function that given ParserOptions creates a Parser.
type ParserOptions ¶
type ParserOptions struct {
NativeBin string `long:"native-bin" description:"alternative path for the native binary" default:"/opt/driver/bin/native"`
}
type TransformationParser ¶
type TransformationParser struct { // Parser to delegate parsing. Parser // Transformation function to apply to resulting *uast.Node. The first // argument is the original source code from the request. Any // transformation to *uast.Node should be performed in-place. If error // is returned, it will be propagated to the Parse call. Transformation func([]byte, *uast.Node) error }
TransformationParser wraps another Parser and applies a transformation to its results.
func (*TransformationParser) Parse ¶
func (p *TransformationParser) Parse(req *protocol.ParseRequest) *protocol.ParseResponse
Parse calls the wrapped Parser and applies the transformation to its result.
Click to show internal directories.
Click to hide internal directories.