- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 151 for Fset (0.09 sec)
-
src/go/ast/example_test.go
src := ` package main func main() { println("Hello, World!") } ` // Create the AST by parsing src. fset := token.NewFileSet() // positions are relative to fset f, err := parser.ParseFile(fset, "", src, 0) if err != nil { panic(err) } // Print the AST. ast.Print(fset, f) // Output: // 0 *ast.File { // 1 . Package: 2:1 // 2 . Name: *ast.Ident {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 15 21:44:50 UTC 2024 - 6.1K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go
return b.cfg } func (b *Block) String() string { return fmt.Sprintf("block %d (%s)", b.Index, b.comment(nil)) } func (b *Block) comment(fset *token.FileSet) string { s := b.Kind.String() if fset != nil && b.Stmt != nil { s = fmt.Sprintf("%s@L%d", s, fset.Position(b.Stmt.Pos()).Line) } return s } // Return returns the return statement at the end of this block if present, nil // otherwise. //
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 7.7K bytes - Viewed (0) -
src/go/types/eval.go
// complete position information relative to the provided file // set. // // The meaning of the parameters fset, pkg, and pos is the // same as in [CheckExpr]. An error is returned if expr cannot // be parsed successfully, or the resulting expr AST cannot be // type-checked. func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (_ TypeAndValue, err error) { // parse expressions
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Oct 19 12:02:03 UTC 2023 - 3.1K bytes - Viewed (0) -
src/go/types/format.go
var fset *token.FileSet var qf Qualifier if check != nil { fset = check.fset qf = check.qualifier } return sprintf(fset, qf, false, format, args...) } func (check *Checker) trace(pos token.Pos, format string, args ...any) { fmt.Printf("%s:\t%s%s\n", check.fset.Position(pos), strings.Repeat(". ", check.indent), sprintf(check.fset, check.qualifier, true, format, args...), )
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 30 19:19:55 UTC 2024 - 3.5K bytes - Viewed (0) -
src/go/types/eval_test.go
} } func TestEvalBasic(t *testing.T) { fset := token.NewFileSet() for _, typ := range Typ[Bool : String+1] { testEval(t, fset, nil, nopos, typ.Name(), typ, "", "") } } func TestEvalComposite(t *testing.T) { fset := token.NewFileSet() for _, test := range independentTestTypes { testEval(t, fset, nil, nopos, test.src, nil, test.str, "") } } func TestEvalArith(t *testing.T) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 15 19:56:15 UTC 2024 - 8.3K bytes - Viewed (0) -
src/go/ast/commentmap_test.go
return buf.String() } func TestCommentMap(t *testing.T) { fset := token.NewFileSet() f, err := parser.ParseFile(fset, "", src, parser.ParseComments) if err != nil { t.Fatal(err) } cmap := NewCommentMap(fset, f, f.Comments) // very correct association of comments for n, list := range cmap { key := fmt.Sprintf("%2d: %T", fset.Position(n.Pos()).Line, n) got := ctext(list) want := res[key]
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 09 15:35:30 UTC 2022 - 3.9K bytes - Viewed (0) -
src/go/types/resolver_test.go
goto L2 } L2: } `, } pkgnames := []string{ "fmt", "math", } // parse package files fset := token.NewFileSet() var files []*ast.File for _, src := range sources { files = append(files, mustParse(fset, src)) } // resolve and type-check package AST importer := new(resolveTestImporter) conf := Config{Importer: importer}
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 4.5K bytes - Viewed (0) -
src/go/printer/performance_test.go
log.Fatalf("print error: %s", err) } } // cannot initialize in init because (printer) Fprint launches goroutines. func initialize() { const filename = "testdata/parser.go" src, err := os.ReadFile(filename) if err != nil { log.Fatalf("%s", err) } file, err := parser.ParseFile(fset, filename, src, parser.ParseComments) if err != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 09 15:10:10 UTC 2022 - 1.8K bytes - Viewed (0) -
src/go/printer/example_test.go
// file set fset. funcAST, fset := parseFunc("example_test.go", "printSelf") // Print the function body into buffer buf. // The file set is provided to the printer so that it knows // about the original source formatting and can add additional // line breaks where they were present in the source. var buf bytes.Buffer printer.Fprint(&buf, fset, funcAST.Body)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 16 14:55:02 UTC 2022 - 1.7K bytes - Viewed (0) -
src/go/doc/doc_test.go
t.Run("AllMethods", func(t *testing.T) { test(t, AllMethods) }) } func TestFuncs(t *testing.T) { fset := token.NewFileSet() file, err := parser.ParseFile(fset, "funcs.go", strings.NewReader(funcsTestFile), parser.ParseComments) if err != nil { t.Fatal(err) } doc, err := NewFromFiles(fset, []*ast.File{file}, "importPath", Mode(0)) if err != nil { t.Fatal(err) } for _, f := range doc.Funcs {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Apr 11 16:31:52 UTC 2022 - 6.7K bytes - Viewed (0)