Search Options

Results per page
Sort
Preferred Languages
Advance

Results 91 - 100 of 121 for Tok (0.02 sec)

  1. src/go/format/format.go

    	}
    
    	return format(fset, file, sourceAdj, indentAdj, src, config)
    }
    
    func hasUnsortedImports(file *ast.File) bool {
    	for _, d := range file.Decls {
    		d, ok := d.(*ast.GenDecl)
    		if !ok || d.Tok != token.IMPORT {
    			// Not an import declaration, so we're done.
    			// Imports are always first.
    			return false
    		}
    		if d.Lparen.IsValid() {
    			// For now assume all grouped imports are unsorted.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 4.3K bytes
    - Viewed (0)
  2. src/internal/types/errors/codes_test.go

    	}
    	_, err = conf.Check("types", fset, []*ast.File{file}, info)
    	if err != nil {
    		t.Fatal(err)
    	}
    	for _, decl := range file.Decls {
    		decl, ok := decl.(*ast.GenDecl)
    		if !ok || decl.Tok != token.CONST {
    			continue
    		}
    		for _, spec := range decl.Specs {
    			spec, ok := spec.(*ast.ValueSpec)
    			if !ok || len(spec.Names) == 0 {
    				continue
    			}
    			obj := info.ObjectOf(spec.Names[0])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 18 20:41:45 UTC 2022
    - 4.9K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/syntax/error_test.go

    		}
    	}, comments)
    
    	// consume file
    	for {
    		s.next()
    		if pattern != "" {
    			declared[position{s.line, s.col}] = pattern
    			pattern = ""
    		}
    		if s.tok == _EOF {
    			break
    		}
    	}
    
    	return declared
    }
    
    func testSyntaxErrors(t *testing.T, filename string) {
    	declared := declaredErrors(t, filename)
    	if *print {
    		fmt.Println("Declared errors:")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 20 02:13:02 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  4. src/encoding/xml/marshal_test.go

    <?Target Instruction?>
    <root>
    </root>
    `)
    	dec := NewDecoder(&in)
    	enc := NewEncoder(&out)
    	for tok, err := dec.Token(); err == nil; tok, err = dec.Token() {
    		err = enc.EncodeToken(tok)
    		if err != nil {
    			t.Fatalf("enc.EncodeToken: Unable to encode token (%#v), %v", tok, err)
    		}
    	}
    }
    
    // Issue 9796. Used to fail with GORACE="halt_on_error=1" -race.
    func TestRace9796(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Mar 08 18:46:41 UTC 2024
    - 66K bytes
    - Viewed (0)
  5. src/go/types/stdlib_test.go

    	n, _ := f.Read(src[:])
    
    	var first string
    	var s scanner.Scanner
    	s.Init(fset.AddFile("", fset.Base(), n), src[:n], nil /* ignore errors */, scanner.ScanComments)
    	for {
    		_, tok, lit := s.Scan()
    		switch tok {
    		case token.COMMENT:
    			// remove trailing */ of multi-line comment
    			if lit[1] == '*' {
    				lit = lit[:len(lit)-2]
    			}
    			contents := strings.TrimSpace(lit[2:])
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Dec 19 04:39:56 UTC 2023
    - 13.7K bytes
    - Viewed (0)
  6. src/go/ast/example_test.go

    	// and AST nodes.
    	cmap := ast.NewCommentMap(fset, f, f.Comments)
    
    	// Remove the first variable declaration from the list of declarations.
    	for i, decl := range f.Decls {
    		if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.VAR {
    			copy(f.Decls[i:], f.Decls[i+1:])
    			f.Decls = f.Decls[:len(f.Decls)-1]
    			break
    		}
    	}
    
    	// Use the comment map to filter comments that don't belong anymore
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 21:44:50 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  7. src/cmd/fix/typecheck.go

    					key, value = k, v
    				}
    			}
    			changed := false
    			if n.Key != nil && key != "" {
    				changed = true
    				set(n.Key, key, n.Tok == token.DEFINE)
    			}
    			if n.Value != nil && value != "" {
    				changed = true
    				set(n.Value, value, n.Tok == token.DEFINE)
    			}
    			// Ugly failure of vision: already type-checked body.
    			// Do it again now that we have that type info.
    			if changed {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 16 22:02:42 UTC 2022
    - 20.1K bytes
    - Viewed (0)
  8. src/go/doc/example.go

    		numDecl := 0      // number of non-import declarations in the file
    		var flist []*Example
    		for _, decl := range file.Decls {
    			if g, ok := decl.(*ast.GenDecl); ok && g.Tok != token.IMPORT {
    				numDecl++
    				continue
    			}
    			f, ok := decl.(*ast.FuncDecl)
    			if !ok || f.Recv != nil {
    				continue
    			}
    			numDecl++
    			name := f.Name.Name
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  9. src/math/big/ratconv.go

    // 'e', 'E', 'f', 'F', 'g', 'G', and 'v'. All formats are equivalent.
    func (z *Rat) Scan(s fmt.ScanState, ch rune) error {
    	tok, err := s.Token(true, ratTok)
    	if err != nil {
    		return err
    	}
    	if !strings.ContainsRune("efgEFGv", ch) {
    		return errors.New("Rat.Scan: invalid verb")
    	}
    	if _, ok := z.SetString(string(tok)); !ok {
    		return errors.New("Rat.Scan: invalid syntax")
    	}
    	return nil
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 15 22:16:34 UTC 2023
    - 12.3K bytes
    - Viewed (0)
  10. src/go/ast/import.go

    // It also removes duplicate imports when it is possible to do so without data loss.
    func SortImports(fset *token.FileSet, f *File) {
    	for _, d := range f.Decls {
    		d, ok := d.(*GenDecl)
    		if !ok || d.Tok != token.IMPORT {
    			// Not an import declaration, so we're done.
    			// Imports are always first.
    			break
    		}
    
    		if !d.Lparen.IsValid() {
    			// Not a block: sorted by default.
    			continue
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.7K bytes
    - Viewed (0)
Back to top