Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 274 for Fset (0.08 sec)

  1. 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)
  2. 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)
  3. src/go/scanner/scanner_test.go

    		if tokenclass(got) == literal && lit == "" {
    			t.Errorf("%s: for %s got empty literal string", fset.Position(pos), got)
    		}
    	}
    }
    
    func BenchmarkScan(b *testing.B) {
    	b.StopTimer()
    	fset := token.NewFileSet()
    	file := fset.AddFile("", fset.Base(), len(source))
    	var s Scanner
    	b.StartTimer()
    	for i := 0; i < b.N; i++ {
    		s.Init(file, source, nil, ScanComments)
    		for {
    			_, tok, _ := s.Scan()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 28 15:38:31 UTC 2023
    - 34.6K bytes
    - Viewed (0)
  4. 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)
  5. src/go/types/errorcalls_test.go

    // errorfMinArgCount arguments (otherwise we should use check.error)
    // and use balanced parentheses/brackets.
    func TestErrorCalls(t *testing.T) {
    	fset := token.NewFileSet()
    	files, err := pkgFiles(fset, ".")
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	for _, file := range files {
    		ast.Inspect(file, func(n ast.Node) bool {
    			call, _ := n.(*ast.CallExpr)
    			if call == nil {
    				return true
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 15 21:57:36 UTC 2023
    - 2.2K bytes
    - Viewed (0)
  6. src/cmd/gofmt/internal.go

    // as a Go source file, declaration, or statement list.
    func parse(fset *token.FileSet, filename string, src []byte, fragmentOk bool) (
    	file *ast.File,
    	sourceAdj func(src []byte, indent int) []byte,
    	indentAdj int,
    	err error,
    ) {
    	// Try as whole source file.
    	file, err = parser.ParseFile(fset, filename, src, parserMode)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 28 14:23:08 UTC 2020
    - 5K bytes
    - Viewed (0)
  7. src/go/format/internal.go

    // as a Go source file, declaration, or statement list.
    func parse(fset *token.FileSet, filename string, src []byte, fragmentOk bool) (
    	file *ast.File,
    	sourceAdj func(src []byte, indent int) []byte,
    	indentAdj int,
    	err error,
    ) {
    	// Try as whole source file.
    	file, err = parser.ParseFile(fset, filename, src, parserMode)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 28 14:23:08 UTC 2020
    - 5K bytes
    - Viewed (0)
  8. src/go/format/format.go

    func Source(src []byte) ([]byte, error) {
    	fset := token.NewFileSet()
    	file, sourceAdj, indentAdj, err := parse(fset, "", src, true)
    	if err != nil {
    		return nil, err
    	}
    
    	if sourceAdj == nil {
    		// Complete source file.
    		// TODO(gri) consider doing this always.
    		ast.SortImports(fset, file)
    	}
    
    	return format(fset, file, sourceAdj, indentAdj, src, config)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  9. src/go/scanner/example_test.go

    	// src is the input that we want to tokenize.
    	src := []byte("cos(x) + 1i*sin(x) // Euler")
    
    	// Initialize the scanner.
    	var s scanner.Scanner
    	fset := token.NewFileSet()                      // positions are relative to fset
    	file := fset.AddFile("", fset.Base(), len(src)) // register input "file"
    	s.Init(file, src, nil /* no error handler */, scanner.ScanComments)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 27 19:47:49 UTC 2022
    - 1K bytes
    - Viewed (0)
  10. src/cmd/cgo/internal/testerrors/argposition_test.go

    	identPosInfo IdentPositionInfo
    	fset         *token.FileSet
    	t            *testing.T
    }
    
    func (v *Visitor) Visit(node ast.Node) ast.Visitor {
    	if ident, ok := node.(*ast.Ident); ok {
    		if expectedPositions, ok := v.identPosInfo[ident.Name]; ok {
    			gotMatch := false
    			var errorMessage strings.Builder
    			for caseIndex, expectedPos := range expectedPositions {
    				actualPosition := v.fset.PositionFor(ident.Pos(), true)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 19 01:37:31 UTC 2023
    - 3.1K bytes
    - Viewed (0)
Back to top