Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for commentMap (0.14 sec)

  1. src/go/ast/commentmap.go

    	slices.SortFunc(list, func(a, b *CommentGroup) int {
    		return cmp.Compare(a.Pos(), b.Pos())
    	})
    }
    
    // A CommentMap maps an AST node to a list of comment groups
    // associated with it. See [NewCommentMap] for a description of
    // the association.
    type CommentMap map[Node][]*CommentGroup
    
    func (cmap CommentMap) addComment(n Node, c *CommentGroup) {
    	list := cmap[n]
    	if len(list) == 0 {
    		list = []*CommentGroup{c}
    	} else {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/syntax/testing_test.go

    /* ERROR "5:24" */                 // position of ; on previous line
    	package /* ERROR "7:2" */  // indented with tab
            import  /* ERROR "8:9" */  // indented with blanks
    `
    	m := CommentMap(strings.NewReader(src), regexp.MustCompile("^ ERROR "))
    	found := 0 // number of errors found
    	for line, errlist := range m {
    		for _, err := range errlist {
    			if err.Pos.Line() != line {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:53:18 UTC 2023
    - 1.4K bytes
    - Viewed (0)
  3. src/go/types/commentMap_test.go

    	"go/scanner"
    	"go/token"
    	"regexp"
    	"strings"
    	"testing"
    )
    
    type comment struct {
    	line, col int    // comment position
    	text      string // comment text, excluding "//", "/*", or "*/"
    }
    
    // commentMap collects all comments in the given src with comment text
    // that matches the supplied regular expression rx and returns them as
    // []comment lists in a map indexed by line number. The comment text is
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:27 UTC 2023
    - 3K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/testing.go

    func CommentsDo(src io.Reader, handler func(line, col uint, text string)) {
    	var s scanner
    	s.init(src, handler, comments)
    	for s.tok != _EOF {
    		s.next()
    	}
    }
    
    // CommentMap collects all comments in the given src with comment text
    // that matches the supplied regular expression rx and returns them as
    // []Error lists in a map indexed by line number. The comment text is
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:53:18 UTC 2023
    - 2.1K bytes
    - Viewed (0)
  5. src/go/ast/example_test.go

    	// x
    	// y
    	// int
    	// print
    	// x
    	// y
    }
    
    // This example illustrates how to remove a variable declaration
    // in a Go program while maintaining correct comment association
    // using an ast.CommentMap.
    func ExampleCommentMap() {
    	// src is the input for which we create the AST that we
    	// are going to manipulate.
    	src := `
    // This is the package comment.
    package main
    
    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/cmd/internal/dwarf/putvarabbrevgen_test.go

    }
    
    // pvacfgbody generates a simplified CFG for a slice of statements,
    // containing only calls to putattr and the if statements affecting them.
    func pvacfgbody(t *testing.T, fset *token.FileSet, cm ast.CommentMap, body []ast.Stmt) (start, end *pvacfgnode) {
    	add := func(n *pvacfgnode) {
    		if start == nil || end == nil {
    			start = n
    			end = n
    		} else {
    			end.then = n
    			end = n
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Feb 26 20:45:07 UTC 2024
    - 8.9K bytes
    - Viewed (0)
Back to top