parser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSort

func DefaultSort(results []*Work) func(i, j int) bool

DefaultSort sorts a slice of Work by Path then Class.Name

Example for sorting Work output

var results []*Work
sort.SliceStable(results, DefaultSort(results))

func ExtractName

func ExtractName(name string) string

ExtractName removes the inner class and leading and trailing [L ;

func Parse

func Parse(config *Config, rc *zip.ReadCloser, callback func(*Work))

Parse reads all class files in the provided archive and executes the callback for each Order is not guaranteed.

func Scan

func Scan(config *Config, callback func(*Work)) (err error)

Scan reads all class files in the provided config.Archive path if config.Archive is a directory, all jar files within the directory are scanned

Types

type Class

type Class struct {

	// Name is the class name
	Name string
	// SuperClass is the super class name
	SuperClass string
	// contains filtered or unexported fields
}

func New

func New(r io.Reader) (jcp *Class, err error)

New is the main entry point for parsing java byte code The reader is expected to point at a class file byte stream

func (*Class) DebugOut

func (jcp *Class) DebugOut()

func (*Class) RefVisit

func (jcp *Class) RefVisit(f func(className string))

func (*Class) Visit

func (jcp *Class) Visit(f func(interface{}))

type Config

type Config struct {
	Archive         string
	Class           string
	PrintArchives   bool
	PrintClassNames bool
	PrintMethodRef  bool
	LogElapsed      bool
	DebugClass      string
	Workers         int
	MatchTarget     string
}

Config contains various flags used while parsing

func NewConfigFromArgs

func NewConfigFromArgs() (config *Config)

type Context

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

Context manages the input and output work channels and wait groups

type Work

type Work struct {
	Config   *Config
	Path     string
	ByteCode *bytes.Buffer
	Class    *Class
	Error    error
}

Work is the communication to and from the workers

type WorkChanGroup

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

Jump to

Keyboard shortcuts

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