func ParseSource(src string, srcPath string,
	incPaths []string, checkSrc bool) (string, []string, *Ast, error) {
	return ParseSourceBytes([]byte(src), srcPath, incPaths, checkSrc)
}
ParseSource parses a souce string into an ast.

src is the mro source code.

srcpath is the path to the source code file (if applicable), used for
debugging information.

incpaths is the orderd set of search paths to use when resolving include
directives.

if checksrc is true, then the parser will verify that stage src values
refer to code that actually exists.

Deprecated: Use ParseSourceBytes instead.
package syntax
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/martian-lang/martian/martian/util"
)
func (global *Ast) err(nodable AstNodable, msg string, v ...interface{}) error {
	return &AstError{global, nodable.getNode(), fmt.Sprintf(msg, v...)}
}
func (global *Ast) compile() error {
	if err := global.CompileTypes(); err != nil {
		return err
	}
	if err := global.Callables.compile(global); err != nil {
		return err
	}
	if err := global.compileStages(); err != nil {
		return err
	}
	if err := global.compilePipelineDecs(); err != nil {
		return err
	}
	if err := global.compilePipelineArgs(); err != nil {
		return err
	}
	if err := global.compileCall(); err != nil {
		return err
	}
	return nil
}
func (src *SrcParam) FindPath(searchPaths []string) (string, error) {
	if filepath.IsAbs(src.Path) {
		_, err := os.Stat(src.Path)
		if err != nil {
			return src.Path, &wrapError{
				innerError: err,
				loc:        src.Node.Loc,
			}
		}
		return src.Path, nil
	}
	if src.Node.Loc.File != nil {
		p := filepath.Join(filepath.Dir(src.Node.Loc.File.FullPath), src.Path)
		if _, err := os.Stat(p); err == nil {
			return p, nil
		}
	}
	if p, found := util.SearchPaths(src.Path, searchPaths); !found {
		return src.Path, &wrapError{
			innerError: fmt.Errorf(
				"SourcePathError: searched (%s) but stage source path not found '%s'",
				strings.Join(searchPaths, ", "), src.Path),
			loc: src.Node.Loc,
		}
	} else {
		return p, nil
	}
}
func (global *Ast) checkSrcPaths(stagecodePaths []string) error {
	var errs ErrorList
	for _, stage := range global.Stages {
		if stage.Src.Lang != "exec" && stage.Src.Lang != "comp" {
			if _, err := stage.Src.FindPath(stagecodePaths); err != nil {
				errs = append(errs, err)
			}
		}
	}
	return errs.If()
}
func (src *SourceFile) checkIncludes(fullPath string, inc *SourceLoc) error {
	var errs ErrorList
	if fullPath == src.FullPath {
		errs = append(errs, &wrapError{
			innerError: fmt.Errorf("Include cycle: %s included", src.FullPath),
			loc:        *inc,
		})
	} else {
		for _, parent := range src.IncludedFrom {
			if err := parent.File.checkIncludes(fullPath, inc); err != nil {
				errs = append(errs, err)
			}
		}
	}
	return errs.If()
}
type Parser struct {
	intern *stringIntern
}