// Parse given raw amber template string. func (c *Compiler) Parse(input string) (err error) { defer func() { if r := recover(); r != nil { err = errors.New(r.(string)) } }() parser, err := parser.StringParser(input) if err != nil { return } c.node = parser.Parse() return }
// Parse the amber template file in given path func (c *Compiler) ParseFile(filename string) (err error) { defer func() { if r := recover(); r != nil { err = errors.New(r.(string)) } }() parser, err := parser.FileParser(filename) if err != nil { return } c.node = parser.Parse() c.filename = filename return }
// Parse given raw amber template bytes, and the filename that belongs with it func (c *Compiler) ParseData(input []byte, filename string) (err error) { defer func() { if r := recover(); r != nil { err = errors.New(r.(string)) } }() parser, err := parser.ByteParser(input) parser.SetFilename(filename) if err != nil { return } c.node = parser.Parse() return }