tpl

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(result any, omitSemi ...bool)

func Fdump

func Fdump(w io.Writer, result any, prefix, indent string, omitSemi bool)

Types

type Compiler

type Compiler struct {
	cl.Result
	Fset *token.FileSet
}

Compiler represents a TPL compiler.

func FromFile

func FromFile(filename string, src any, fset *token.FileSet) (ret Compiler, err error)

FromFile creates a new TPL compiler from a file.

func New

func New(src any) (ret Compiler, err error)

New creates a new TPL compiler.

func (*Compiler) Match

func (p *Compiler) Match(filename string, src any, conf *Config) (next []*Token, result any, err error)

Match matches a source file.

func (*Compiler) Parse

func (p *Compiler) Parse(filename string, src any, conf *Config) (result any, err error)

Parse parses a source file.

func (*Compiler) ParseExpr

func (p *Compiler) ParseExpr(x string, conf *Config) (result any, err error)

ParseExpr parses an expression.

func (*Compiler) ParseExprFrom

func (p *Compiler) ParseExprFrom(filename string, src any, conf *Config) (result any, err error)

ParseExprFrom parses an expression from a file.

type Config

type Config struct {
	Scanner          Scanner
	ScanMode         scanner.ScanMode
	ScanErrorHandler scanner.ScanErrorHandler
}

Config represents a parsing configuration of Compiler.Parse.

type Scanner

type Scanner interface {
	Scan() Token
	Init(file *token.File, src []byte, err scanner.ScanErrorHandler, mode scanner.ScanMode)
}

Scanner represents a TPL scanner.

type Token

type Token = types.Token

A Token is a lexical unit returned by Scan.

Directories

Path Synopsis
encoding
csv
xml

Jump to

Keyboard shortcuts

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