parser

package
v0.0.0-...-4a740ba Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyPackageFolder   = errors.New("You can't have empty logic folder or logic package contain no compatible function")
	ErrBadServiceName       = errors.New("Each service file must start with ServiceID")
	ErrBadServiceParameters = errors.New("Service functions must have just one struct as parameters")
)

Declare Errors Details

Functions

This section is empty.

Types

type File

type File struct {
	Name   string
	Data   []byte
	Parsed *ast.File
}

File :

type Function

type Function struct {
	Name      string
	Comment   string
	Parameter *Type // ChaparKhane just support one variable in Function input!
	Result    *Type // ChaparKhane just support one variable in Function output!
	Err       *Type // ChaparKhane just support one error in Function output!
	File      *File
	Decl      *ast.FuncDecl
}

Function store parsed data about logic Function!

type Import

type Import struct {
	UsageName    string
	PackageName  string
	DependencyID [16]byte // DependencyID in SabzCity version control
	FSPath       string   // Folder location in FileSystems
	File         *File
	ImportSpec   *ast.ImportSpec
}

Import :

type Repository

type Repository struct {
	Name         string
	DependencyID [16]byte               // DependencyID in SabzCity version control
	FSPath       string                 // Folder location in FileSystems
	Files        map[string]*File       // Name
	Imports      map[string]*Import     // UsageName
	Functions    map[string]*Function   // Name
	Types        map[string]*Type       // Name
	Dependencies map[string]*Repository // Name
}

Repository :

func NewRepository

func NewRepository() *Repository

NewRepository use to make new repository object otherwise initialize maps yourself!

func (*Repository) AddFile

func (repo *Repository) AddFile(f *File)

AddFile use to add file to Repository

func (*Repository) Parse

func (repo *Repository) Parse(FileName string, FileData []byte) (err error)

Parse use to add new file & parsed FileData and add to repo object!

type Type

type Type struct {
	Name      string
	ID        int
	Package   *Import // If nil means local package not imported!
	Type      string  // struct: embedded struct in this struct.
	Len       uint64  // Use in Array, Slice, Map, ...
	Exported  bool
	Pointer   bool
	InnerType []*Type
	Tags      map[string]string
	Comment   string
	File      *File
}

Type :

Jump to

Keyboard shortcuts

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