vugu: github.com/vugu/vugu/gen Index | Files

package gen

import "github.com/vugu/vugu/gen"

Index

Package Files

parser-compact.go parser-go-pkg.go parser-go.go parser-util.go

type ParserGo Uses

type ParserGo struct {
    PackageName   string // name of package to use at top of files
    StructType    string // just the struct name, no "*" (replaces ComponentType and DataType)
    ComponentType string // just the struct name, no "*"
    DataType      string // just the struct name, no "*"
    OutDir        string // output dir
    OutFile       string // output file name with ".go" suffix

    NoOptimizeStatic bool // set to true to disable optimization of static blocks of HTML into vg-html expressions
    TinyGo           bool // set to true to enable TinyGo compatability changes to the generated code
}

ParserGo is a template parser that emits Go source code that will construct the appropriately wired VGNodes.

func (*ParserGo) Parse Uses

func (p *ParserGo) Parse(r io.Reader, fname string) error

Parse is an experiment... r is the actual input, fname is only used to emit line directives

type ParserGoPkg Uses

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

ParserGoPkg knows how to perform source file generation in relation to a package folder. Whereas ParserGo handles converting a single template, ParserGoPkg is a higher level interface and provides the functionality of the vugugen command line tool. It will scan a package folder for .vugu files and convert them to .go, with the appropriate defaults and logic.

func NewParserGoPkg Uses

func NewParserGoPkg(pkgPath string, opts *ParserGoPkgOpts) *ParserGoPkg

NewParserGoPkg returns a new ParserGoPkg with the specified options or default if nil. The pkgPath is required and must be an absolute path.

func (*ParserGoPkg) Opts Uses

func (p *ParserGoPkg) Opts() ParserGoPkgOpts

Opts returns the options.

func (*ParserGoPkg) Run Uses

func (p *ParserGoPkg) Run() error

Run does the work and generates the appropriate .go files from .vugu files. It will also create a go.mod file if not present and not SkipGoMod. Same for main.go and SkipMainGo (will also skip if package already has file with package name something other than main). Per-file code generation is performed by ParserGo.

type ParserGoPkgOpts Uses

type ParserGoPkgOpts struct {
    SkipRegisterComponentTypes bool // indicates func init() { vugu.RegisterComponentType(...) } code should not be emitted in each file
    SkipGoMod                  bool // do not try and create go.mod if it doesn't exist
    SkipMainGo                 bool // do not try and create main_wasm.go if it doesn't exist in a main package
    TinyGo                     bool // emit code intended for TinyGo compilation
}

ParserGoPkgOpts is the options for ParserGoPkg.

Package gen imports 22 packages (graph) and is imported by 1 packages. Updated 2019-12-14. Refresh now. Tools for package owners.