Пример #1
0
// ParseReader gets the template content from an io.Reader type
func (p *Kolonish) ParseReader(name string, rdr io.Reader) (*parser.AST, error) {
	b := parser.NewBuilder()
	lex := NewReaderLexer(rdr)
	return b.Parse(name, lex)
}
Пример #2
0
// ParseString is the same as Parse, but receives a string instead of []byte
func (p *Kolonish) ParseString(name, template string) (*parser.AST, error) {
	b := parser.NewBuilder()
	lex := NewStringLexer(template)
	return b.Parse(name, lex)
}