gep

package
v0.0.0-...-c4a3be8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2018 License: BSD-2-Clause-Views Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GepParts

type GepParts struct {
	// A slice of parts. Elements are all generated by calling to
	// Interface.GenXxxPart()
	Parts villa.Slice

	// All imported package names
	Imports villa.StrSet
	// All included and required paths
	Depends villa.StrSet

	// Whether the root source is marked as includeonly
	IncludeOnly bool
}

GepParts is the data-structure for parsed results

func Parse

func Parse(f Interface, src string) (parts *GepParts, err error)

Parse parses the source with a predefined Interface.

type Interface

type Interface interface {
	// Load a file with specified path. The path is extracted from
	// include/require primitives
	Load(path villa.Path) (string, error)

	// Generate a part object for a raw source
	GenRawPart(src string) interface{}

	// Generate a part object for a code source <% %>
	GenCodePart(src string) interface{}

	// Generate a part object for a evaluation source <%= %>
	GenEvalPart(src string) interface{}

	// Output an error message
	Error(message string)
}

Interface defines some actions for parsing

Jump to

Keyboard shortcuts

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