private static ptr <ast.File> parse(@string name, slice <byte> src, parser.Mode flags) { var(ast1, err) = parser.ParseFile(fset, name, src, flags); if (err != null) { { scanner.ErrorList(list, ok) = err._ <scanner.ErrorList>(); if (ok) { // If err is a scanner.ErrorList, its String will print just // the first error and then (+n more errors). // Instead, turn it into a new Error that will return // details for all the errors. foreach (var(_, e) in list) { fmt.Fprintln(os.Stderr, e); } os.Exit(2L); } } fatalf("parsing %s: %s", name, err); } return(_addr_ast1 !); }
private static void initParserMode() { parserMode = parser.ParseComments; if (allErrors.val) { parserMode |= parser.AllErrors; } }
// ProcessFiles invokes the cgo preprocessor on bp.CgoFiles, parses // the output and returns the resulting ASTs. // public static (slice <ptr <ast.File> >, error) ProcessFiles(ptr <build.Package> _addr_bp, ptr <token.FileSet> _addr_fset, Func <@string, @string> DisplayPath, parser.Mode mode) => func((defer, _, __) =>
public Config(ref ptr <token.FileSet> Fset = default, parser.Mode ParserMode = default, types.Config TypeChecker = default, Func <@string, bool> TypeCheckFuncBodies = default, ref ptr <build.Context> Build = default, @string Cwd = default, Func <@string, @string> DisplayPath = default, bool AllowErrors = default, slice <PkgSpec> CreatePkgs = default, map <@string, bool> ImportPkgs = default, Func <ptr <build.Context>, @string, @string, build.ImportMode, (ptr <build.Package>, error)> FindPackage = default, Action <ptr <PackageInfo>, slice <ptr <ast.File> > > AfterTypeCheck = default)