parse

package
v3.3.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StopOnError bool

Functions

func ListOfGoFilesInDir

func ListOfGoFilesInDir(path string) (gofiles []string, err error)

func TranslateToZebraSchema

func TranslateToZebraSchema(path string, fs *FileSet) (*zebra.Schema, error)

TranslateToZebraSchema takes the FileSet already in `fs`, assumes it was generated by parsing `path` (to Go source file), and returns a ZebraPack specified schema; i.e. a *zebra.Schema. TODO: handled top-level arrays/other types besides structs. Currently we only record structs.

Types

type FileSet

type FileSet struct {
	Package    string              // package name
	Specs      map[string]ast.Expr // type specs in file
	Identities map[string]gen.Elem // processed from specs
	Directives []string            // raw preprocessor directives
	Imports    []*ast.ImportSpec   // imports
	Cfg        *cfg.ZebraConfig

	ZebraSchemaId int64
	PackageInfo   *loader.PackageInfo
	LoadedProg    *loader.Program
	QuickPack     map[string]*loader.PackageInfo
	Fset          *token.FileSet
}

A FileSet is the in-memory representation of a parsed file.

func File

func File(c *cfg.ZebraConfig) (*FileSet, error)

File parses a file at the relative path provided and produces a new *FileSet. If you pass in a path to a directory, the entire directory will be parsed. If unexport is false, only exported identifiers are included in the FileSet. If the resulting FileSet would be empty, an error is returned.

func (*FileSet) PrintTo

func (f *FileSet) PrintTo(p *gen.Printer) error

func (*FileSet) SaveMsgpackFile

func (fs *FileSet) SaveMsgpackFile(parsedPath, path string) error

Jump to

Keyboard shortcuts

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