Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 646 for comment2 (0.18 sec)

  1. src/go/printer/printer_test.go

    	comment := f.Comments[0].List[0]
    	pos := comment.Pos()
    	if fset.PositionFor(pos, false /* absolute position */).Offset != 1 {
    		t.Error("expected offset 1") // error in test
    	}
    
    	testComment(t, f, len(src), &ast.Comment{Slash: pos, Text: "//-style comment"})
    	testComment(t, f, len(src), &ast.Comment{Slash: pos, Text: "/*-style comment */"})
    	testComment(t, f, len(src), &ast.Comment{Slash: pos, Text: "/*-style \n comment */"})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  2. src/text/template/parse/parse_test.go

    	// Specific errors.
    	{"function",
    		"{{foo}}",
    		hasError, `function "foo" not defined`},
    	{"comment1",
    		"{{/*}}",
    		hasError, `comment1:1: unclosed comment`},
    	{"comment2",
    		"{{/*\nhello\n}}",
    		hasError, `comment2:1: unclosed comment`},
    	{"lparen",
    		"{{.X (1 2 3}}",
    		hasError, `unclosed left paren`},
    	{"rparen",
    		"{{.X 1 2 3 ) }}",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 24 21:59:12 UTC 2024
    - 24K bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/mod/modfile/read.go

    }
    
    // Comments collects the comments associated with an expression.
    type Comments struct {
    	Before []Comment // whole-line comments before this expression
    	Suffix []Comment // end-of-line comments after this expression
    
    	// For top-level expressions only, After lists whole-line
    	// comments following the expression.
    	After []Comment
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 23.1K bytes
    - Viewed (0)
  4. src/go/ast/commentmap.go

    //
    // NewCommentMap tries to associate a comment group to the "largest"
    // node possible: For instance, if the comment is a line comment
    // trailing an assignment, the comment is associated with the entire
    // assignment rather than just the last operand in the assignment.
    func NewCommentMap(fset *token.FileSet, node Node, comments []*CommentGroup) CommentMap {
    	if len(comments) == 0 {
    		return nil // no comments to map
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  5. src/go/ast/example_test.go

    	// (the comments associated with the variable declaration), and create
    	// the new comments list.
    	f.Comments = cmap.Filter(f).Comments()
    
    	// Print the modified AST.
    	var buf strings.Builder
    	if err := format.Node(&buf, fset, f); err != nil {
    		panic(err)
    	}
    	fmt.Printf("%s", buf.String())
    
    	// Output:
    	// // This is the package comment.
    	// package main
    	//
    	// // This comment is associated with the hello constant.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 21:44:50 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  6. src/go/ast/import.go

    				} else {
    					// An import spec can have both block comment and a line comment
    					// to its right. In that case, both of them will have the same pos.
    					// But while formatting the AST, the line comment gets moved to
    					// after the block comment.
    					c.Slash = pos[i].End
    				}
    			}
    		}
    	}
    
    	slices.SortFunc(comments, func(a, b *CommentGroup) int {
    		return cmp.Compare(a.Pos(), b.Pos())
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  7. src/go/ast/ast.go

    	if g == nil {
    		return ""
    	}
    	comments := make([]string, len(g.List))
    	for i, c := range g.List {
    		comments[i] = c.Text
    	}
    
    	lines := make([]string, 0, 10) // most comments are less than 10 lines
    	for _, c := range comments {
    		// Remove comment markers.
    		// The parser has given us exactly the comment text.
    		switch c[1] {
    		case '/':
    			//-style comment (no newline at the end)
    			c = c[2:]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go

    	check.init(pass)
    	defer check.finish()
    
    	for _, group := range f.Comments {
    		// A +build comment is ignored after or adjoining the package declaration.
    		if group.End()+1 >= f.Package {
    			check.plusBuildOK = false
    		}
    		// A //go:build comment is ignored after the package declaration
    		// (but adjoining it is OK, in contrast to +build comments).
    		if group.Pos() >= f.Package {
    			check.goBuildOK = false
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/directive/directive.go

    	for _, group := range f.Comments {
    		// A //go:build or a //go:debug comment is ignored after the package declaration
    		// (but adjoining it is OK, in contrast to +build comments).
    		if group.Pos() >= f.Package {
    			check.inHeader = false
    		}
    
    		// Check each line of a //-comment.
    		for _, c := range group.List {
    			check.comment(c.Slash, c.Text)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 5.4K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_old.go

    	pastCutoff := false
    	for _, group := range f.Comments {
    		// A +build comment is ignored after or adjoining the package declaration.
    		if group.End()+1 >= f.Package {
    			pastCutoff = true
    		}
    
    		// "+build" is ignored within or after a /*...*/ comment.
    		if !strings.HasPrefix(group.List[0].Text, "//") {
    			pastCutoff = true
    			continue
    		}
    
    		// Check each line of a //-comment.
    		for _, c := range group.List {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 4.3K bytes
    - Viewed (0)
Back to top