func ParseFunction(parameterList, body string) (*ast.FunctionLiteral, error) {
	src := "(function(" + parameterList + ") {\n" + body + "\n})"
	parser := _newParser("", src, 1)
	program, err := parser.parse()
	if err != nil {
		return nil, err
	}
	return program.Body[0].(*ast.ExpressionStatement).Expression.(*ast.FunctionLiteral), nil
}
ParseFunction parses a given parameter list and body as a function and returns the
corresponding ast.FunctionLiteral node.

The parameter list, if any, should be a comma-separated list of identifiers.
package parser
import (
	"bytes"
	"errors"
	"io"
	"io/ioutil"
	"github.com/robertkrimen/otto/ast"
	"github.com/robertkrimen/otto/file"
	"github.com/robertkrimen/otto/token"
)
type Mode uint
const (
	IgnoreRegExpErrors Mode = 1 << iota  
)
type _parser struct {
	filename string
	str      string
	length   int
	base     int
	chr       rune  
	chrOffset int   
	offset    int   
	idx     file.Idx     
	token   token.Token  
	literal string       
	scope             *_scope
	insertSemicolon   bool  
	implicitSemicolon bool  
	errors ErrorList
	recover struct {
		idx   file.Idx
		count int
	}
	mode Mode
	file *file.File
}
func _newParser(filename, src string, base int) *_parser {
	return &_parser{
		chr:    ' ',  
		str:    src,
		length: len(src),
		base:   base,
		file:   file.NewFile(filename, src, base),
	}
}
func newParser(filename, src string) *_parser {
	return _newParser(filename, src, 1)
}
func ReadSource(filename string, src interface{}) ([]byte, error) {
	if src != nil {
		switch src := src.(type) {
		case string:
			return []byte(src), nil
		case []byte:
			return src, nil
		case *bytes.Buffer:
			if src != nil {
				return src.Bytes(), nil
			}
		case io.Reader:
			var bfr bytes.Buffer
			if _, err := io.Copy(&bfr, src); err != nil {
				return nil, err
			}
			return bfr.Bytes(), nil
		}
		return nil, errors.New("invalid source")
	}
	return ioutil.ReadFile(filename)
}
func ParseFile(fileSet *file.FileSet, filename string, src interface{}, mode Mode) (*ast.Program, error) {
	str, err := ReadSource(filename, src)
	if err != nil {
		return nil, err
	}
	{
		str := string(str)
		base := 1
		if fileSet != nil {
			base = fileSet.AddFile(filename, str)
		}
		parser := _newParser(filename, str, base)
		parser.mode = mode
		return parser.parse()
	}
}