gopatch

package
v0.0.0-...-df944e1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diff

type Diff struct {
	Package *string  `(('-' | '+')? 'package' @Ident)?`
	Imports []string `(('-' | '+')? 'import' @String )?`
	Expr    []Line   `@@+`
}

func (*Diff) After

func (d *Diff) After() pattern.Pattern

func (*Diff) Before

func (d *Diff) Before() pattern.Pattern

type DiffType

type DiffType int

func (*DiffType) Capture

func (d *DiffType) Capture(values []string) error

type Elision

type Elision struct {
	ast.Expr
}

func (Elision) Convert

func (Elision) Convert() pattern.Node

func (Elision) End

func (Elision) End() token.Pos

func (Elision) Pos

func (Elision) Pos() token.Pos

type GoPatch

type GoPatch struct {
	Patches []*Patch `@@*`
}

func Parse

func Parse(in io.Reader) (*GoPatch, error)

type Imports

type Imports struct {
	Imports []Line `@@+`
}

type Line

type Line struct {
	Type DiffType
	Data string
}

func (*Line) Parse

func (l *Line) Parse(lex *lexer.PeekingLexer) error

type MetaVariable

type MetaVariable struct {
	Name string `@Ident`
	Type string `"expression" | "identifier"`
}

type Package

type Package struct {
	X    string `@("+" | "-")*`
	Name string `@Ident`
}

type Patch

type Patch struct {
	MetaVariables []MetaVariable `("@" "@" ("var" @@)* "@" "@")?`
	Diff          Diff           `@@`
}

Jump to

Keyboard shortcuts

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