xgo/compiler/parser/parse_source.go
earncef 5816186821 parser.ParseFile removed (#117)
* parser.ParseFile removed

* return values
2019-02-25 22:52:08 -08:00

17 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()
}