sdk.v2: gopkg.in/bblfsh/sdk.v2/uast/transformer/positioner Index | Files

package positioner

import "gopkg.in/bblfsh/sdk.v2/uast/transformer/positioner"

Index

Package Files

positions.go tokens.go

type Positioner Uses

type Positioner struct {
    // contains filtered or unexported fields
}

Positioner is a transformation that only changes positional information. The transformation should be initialized with the source code by calling OnCode.

func FromLineCol Uses

func FromLineCol() Positioner

FromLineCol fills the Offset field of all Position nodes by using their Line and Col.

func FromOffset Uses

func FromOffset() Positioner

FromOffset fills the Line and Col fields of all Position nodes by using their Offset.

func FromUnicodeOffset Uses

func FromUnicodeOffset() Positioner

FromUnicodeOffset fills the Line, Col and Offset fields of all Position nodes by interpreting their Offset as a 0-based Unicode character index.

func NewFillLineColFromOffset Uses

func NewFillLineColFromOffset() Positioner

NewFillLineColFromOffset fills the Line and Col fields of all Position nodes by using their Offset.

Deprecated: see FromOffset

func NewFillOffsetFromLineCol Uses

func NewFillOffsetFromLineCol() Positioner

NewFillOffsetFromLineCol fills the Offset field of all Position nodes by using their Line and Col.

Deprecated: see FromLineCol

func (Positioner) OnCode Uses

func (t Positioner) OnCode(code string) transformer.Transformer

OnCode uses the source code to update positional information of UAST nodes.

type TokenFromSource Uses

type TokenFromSource struct {
    // Key is the name of the token field to update. Uses uast.KeyToken, if not set.
    // Only nodes with this field will be considered.
    Key string
    // Types is the list of node types that will be updated. Empty means all nodes.
    Types []string
}

TokenFromSource extract node's token from the source code by using positional information.

func (TokenFromSource) OnCode Uses

func (t TokenFromSource) OnCode(code string) transformer.Transformer

OnCode implements transformer.CodeTransformer.

type VerifyToken Uses

type VerifyToken struct {
    // Key is the name of the token field to check. Uses uast.KeyToken, if not set.
    Key string
    // Types is the list of node types that will be checked. Empty means all nodes.
    Types []string
}

VerifyToken check that node's token matches its positional information.

func (VerifyToken) Verify Uses

func (t VerifyToken) Verify(code string, root nodes.Node) error

Package positioner imports 6 packages (graph) and is imported by 3 packages. Updated 2019-02-24. Refresh now. Tools for package owners.