positioner

package
v2.16.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Positioner

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

func FromLineCol() Positioner

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

func FromOffset

func FromOffset() Positioner

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

func FromUnicodeOffset

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 deprecated

func NewFillLineColFromOffset() Positioner

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

Deprecated: see FromOffset

func NewFillOffsetFromLineCol deprecated

func NewFillOffsetFromLineCol() Positioner

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

Deprecated: see FromLineCol

func (Positioner) OnCode

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

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

type TokenFromSource

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

OnCode implements transformer.CodeTransformer.

type VerifyToken

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

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

Jump to

Keyboard shortcuts

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