counter

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package counter implements buffered position-based editing of byte slices.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotate

func Annotate(name, output string) uint64

Annotate Annotate

func ConsumeEnergy

func ConsumeEnergy(n uint64) uint64

ConsumeEnergy consume energy

func ResetEnergy added in v0.5.11

func ResetEnergy()

ResetEnergy reset energy

func SetEnergy

func SetEnergy(n uint64)

SetEnergy set energy

Types

type Block

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

Block represents the information about a basic block to be recorded in the analysis. Note: Our definition of basic block is based on control structures; we don't break apart && and ||. We could but it doesn't seem important enough to bother.

type Buffer

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

A Buffer is a queue of edits to apply to a given byte slice.

func NewBuffer

func NewBuffer(data []byte) *Buffer

NewBuffer returns a new buffer to accumulate changes to an initial data slice. The returned buffer maintains a reference to the data, so the caller must ensure the data is not modified until after the Buffer is done being used.

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

Bytes returns a new byte slice containing the original data with the queued edits applied.

func (*Buffer) Delete

func (b *Buffer) Delete(start, end int)

Delete delete

func (*Buffer) Insert

func (b *Buffer) Insert(pos int, new string)

Insert insert

func (*Buffer) Replace

func (b *Buffer) Replace(start, end int, new string)

Replace replace

func (*Buffer) String

func (b *Buffer) String() string

String returns a string containing the original data with the queued edits applied.

type File

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

File is a wrapper for the state of a file used in the parser. The basic parse tree walker is a method of this type.

func (*File) Visit

func (f *File) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface.

Jump to

Keyboard shortcuts

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