mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-10 12:10:26 +00:00
17 lines
381 B
Go
17 lines
381 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))
|
||
|
|
||
|
return ParseFile(file, src, trace)
|
||
|
}
|