Documentation
¶
Overview ¶
Package parse provides the ability to parse a .patch file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
// Name for the change, if any.
//
// Names must be valid Go identifiers.
Name string
// Metavariables defined for this change.
Meta *Meta
// Patch for this change.
Patch *Patch
}
Change is a single change in a patch. Changes are specified in the format,
@@ # metavariables go here @@ # patch goes here
Optionally, a name may be specified for a change between the first two "@@"s.
@ mychange @ # metavariables go here @@ # patch goes here
type Meta ¶
type Meta struct {
// Variables declared in this section.
Vars []*VarDecl
}
Meta represents the metavariables section of a change.
This consists of one or more declarations used in the patch.
type Patch ¶
type Patch struct {
// Positions at which the entire patch begins and ends.
StartPos, EndPos token.Pos
// The before and after versions of the Patch broken apart from the
// unified diff.
Minus, Plus *pgo.File
}
Patch is the patch portion of the change containing the unified diff of the match/transformation.
type Program ¶
type Program struct {
Changes []*Change
}
Program is a single gopatch program consisting of one or more changes.
type VarDecl ¶
type VarDecl struct {
// Position at which the "var" keyword appears.
VarPos token.Pos
// Names of the variables declared in this statement.
Names []*ast.Ident
// Type of the variables.
Type *ast.Ident
}
VarDecl is a single var declaration in a metavariable block.
var foo, bar identifier var baz, qux expression
Click to show internal directories.
Click to hide internal directories.