Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for ImportsOnly (0.34 sec)

  1. src/go/parser/example_test.go

    	src := `package foo
    
    import (
    	"fmt"
    	"time"
    )
    
    func bar() {
    	fmt.Println(time.Now())
    }`
    
    	// Parse src but stop after processing the imports.
    	f, err := parser.ParseFile(fset, "", src, parser.ImportsOnly)
    	if err != nil {
    		fmt.Println(err)
    		return
    	}
    
    	// Print the imports from the file's AST.
    	for _, s := range f.Imports {
    		fmt.Println(s.Path.Value)
    	}
    
    	// output:
    	//
    	// "fmt"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 03 16:07:09 UTC 2017
    - 715 bytes
    - Viewed (0)
  2. src/go/types/resolver_test.go

    		func f() string {
    			_ = "foo"
    			return fmt.Sprintf("%d", g())
    		}
    		func g() (x int) { return }
    		`,
    		`
    		package p
    		import . "go/parser"
    		import "sync"
    		func h() Mode { return ImportsOnly }
    		var _, x int = 1, 2
    		func init() {}
    		type T struct{ *sync.Mutex; a, b, c int}
    		type I interface{ m() }
    		var _ = T{a: 1, b: 2, c: 3}
    		func (_ T) m() {}
    		func (T) _() {}
    		var i I
    		var _ = i.m
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 4.5K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/resolver_test.go

    		func f() string {
    			_ = "foo"
    			return fmt.Sprintf("%d", g())
    		}
    		func g() (x int) { return }
    		`,
    		`
    		package p
    		import . "go/parser"
    		import "sync"
    		func h() Mode { return ImportsOnly }
    		var _, x int = 1, 2
    		func init() {}
    		type T struct{ *sync.Mutex; a, b, c int}
    		type I interface{ m() }
    		var _ = T{a: 1, b: 2, c: 3}
    		func (_ T) m() {}
    		func (T) _() {}
    		var i I
    		var _ = i.m
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 10 12:59:20 UTC 2023
    - 4.7K bytes
    - Viewed (0)
  4. src/go/parser/interface.go

    // They control the amount of source code parsed and other optional
    // parser functionality.
    type Mode uint
    
    const (
    	PackageClauseOnly    Mode             = 1 << iota // stop parsing after package clause
    	ImportsOnly                                       // stop parsing after import declarations
    	ParseComments                                     // parse comments and add them to AST
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 7.5K bytes
    - Viewed (0)
  5. src/cmd/go/internal/modindex/build_read.go

    		return r.err
    	}
    
    	if info.fset == nil {
    		return nil
    	}
    
    	// Parse file header & record imports.
    	info.parsed, info.parseErr = parser.ParseFile(info.fset, info.name, info.header, parser.ImportsOnly|parser.ParseComments)
    	if info.parseErr != nil {
    		return nil
    	}
    
    	hasEmbed := false
    	for _, decl := range info.parsed.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if !ok {
    			continue
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 23 10:10:21 UTC 2023
    - 13K bytes
    - Viewed (0)
  6. src/go/build/read.go

    		return r.err
    	}
    
    	if info.fset == nil {
    		return nil
    	}
    
    	// Parse file header & record imports.
    	info.parsed, info.parseErr = parser.ParseFile(info.fset, info.name, info.header, parser.ImportsOnly|parser.ParseComments)
    	if info.parseErr != nil {
    		return nil
    	}
    
    	hasEmbed := false
    	for _, decl := range info.parsed.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if !ok {
    			continue
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  7. src/go/printer/testdata/parser.go

    // They control the amount of source code parsed and other optional
    // parser functionality.
    const (
    	PackageClauseOnly uint = 1 << iota // parsing stops after package clause
    	ImportsOnly                        // parsing stops after import declarations
    	ParseComments                      // parse comments and add them to AST
    	Trace                              // print a trace of parsed productions
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 20 20:19:51 UTC 2023
    - 50.5K bytes
    - Viewed (0)
  8. src/go/parser/parser.go

    	var decls []ast.Decl
    	if p.mode&PackageClauseOnly == 0 {
    		// import decls
    		for p.tok == token.IMPORT {
    			decls = append(decls, p.parseGenDecl(token.IMPORT, p.parseImportSpec))
    		}
    
    		if p.mode&ImportsOnly == 0 {
    			// rest of package body
    			prev := token.IMPORT
    			for p.tok != token.EOF {
    				// Continue to accept import declarations for error tolerance, but complain.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"Default", Func, 5},
    		{"For", Func, 5},
    		{"ForCompiler", Func, 12},
    		{"Lookup", Type, 5},
    	},
    	"go/parser": {
    		{"AllErrors", Const, 1},
    		{"DeclarationErrors", Const, 0},
    		{"ImportsOnly", Const, 0},
    		{"Mode", Type, 0},
    		{"PackageClauseOnly", Const, 0},
    		{"ParseComments", Const, 0},
    		{"ParseDir", Func, 0},
    		{"ParseExpr", Func, 0},
    		{"ParseExprFrom", Func, 5},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
  10. api/go1.txt

    pkg go/doc, type Value struct, Decl *ast.GenDecl
    pkg go/doc, type Value struct, Doc string
    pkg go/doc, type Value struct, Names []string
    pkg go/parser, const DeclarationErrors Mode
    pkg go/parser, const ImportsOnly Mode
    pkg go/parser, const PackageClauseOnly Mode
    pkg go/parser, const ParseComments Mode
    pkg go/parser, const SpuriousErrors Mode
    pkg go/parser, const Trace Mode
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 14 18:58:28 UTC 2013
    - 1.7M bytes
    - Viewed (0)
Back to top