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 FromUTF16Offset ¶
func FromUTF16Offset() Positioner
FromUTF16Offset fills the Line, Col and Offset fields of all Position nodes by interpreting their Offset as a 0-based UTF-16 code point index.
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 ¶
func (t TokenFromSource) OnCode(code string) transformer.Transformer
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.