5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-14 17:50:26 +00:00
matterbridge/vendor/github.com/d5/tengo/compiler/parser/parse_source.go
2019-03-05 23:10:45 +01:00

18 lines
401 B
Go

package parser
import (
"io"
"github.com/d5/tengo/compiler/ast"
"github.com/d5/tengo/compiler/source"
)
// ParseSource parses source code 'src' and builds an AST.
func ParseSource(filename string, src []byte, trace io.Writer) (res *ast.File, err error) {
fileSet := source.NewFileSet()
file := fileSet.AddFile(filename, -1, len(src))
p := NewParser(file, src, trace)
return p.ParseFile()
}