// commentsToText converts a slice of []*ast.CommentGroup to a flat string,
// ensuring whitespace-only comment groups are dropped.
352608
func commentsToText(cgroups []*ast.CommentGroup) (text string) {
	for _, c := range cgroups {
		if strings.TrimSpace(c.Text()) != "" {
			text += c.Text()
		}
	}
	return text
}
575013
func litToString(lit *ast.BasicLit) (v string) {
	if lit.Kind != token.STRING {
		panic("expected string")
	}
	v, err := strconv.Unquote(string(lit.Value))
	if err != nil {
		panic("cannot unquote")
	}
	return v
}
1078446
func lexText(l *lexer) stateFn {
	var r, lastChar rune
	for {
		lastChar = r
		r = l.next()

		// comment / soydoc handling
		if r == '/' {
			switch l.next() {
			case '/':
				// '//' only begins a comment if the previous character is whitespace,
				// or if we are the start of input.
				var lastCharEmitted = lastChar
				if lastChar == 0 && l.lastEmit.val != "" {
					lastCharEmitted = rune(l.lastEmit.val[len(l.lastEmit.val)-1])
				}
				if lastCharEmitted == 0 || isSpaceEOL(lastCharEmitted) {
					maybeEmitText(l, 3)
					if lastChar != 0 {
						l.start++ // ignore the preceeding space, if present.
					}
					return lexLineComment(l)
				}
			case '*':
				maybeEmitText(l, 2)
				if l.next() == '*' {
					return lexSoyDoc(l)
				}
				l.backup()
				return lexBlockComment(l)
			}
			l.backup()
		}

		// eof or entering a tag?
		switch r {
		case '{':
			l.backup()
			maybeEmitText(l, 0)
			return lexLeftDelim
		case '}':
			return l.errorf("unexpected closing delimiter } found in input.")
		case eof:
			l.backup()
			maybeEmitText(l, 0)
			l.emit(itemEOF)
			return nil
		}
	}
}
655361
func (c *CommentService) GetComments(teamName string, postNumber int) (*CommentsResponse, error) {
	var commentsResponse CommentsResponse
	postNumberStr := strconv.Itoa(postNumber)
	commentURL := CommnetURL + "/" + teamName + "/posts" + "/" + postNumberStr + "/comments"

	res, err := c.client.get(commentURL, url.Values{}, &commentsResponse)
	if err != nil {
		return nil, err
	}

	defer res.Body.Close()

	return &commentsResponse, nil
}
724051
func (p *parser) parseComment() (node, error) {
	var comment string
	for {
		t := p.read()
		switch t.typ {
		case tokenEOF:
			return nil, p.errorf(t, "unexpected token %s", t)
		case tokenError:
			return nil, p.errorf(t, t.val)
		case tokenRightDelim:
			return commentNode(comment), nil
		default:
			comment += t.val
		}
	}
}
994115
func (tb *KeyStringValueTreeBuilder) CommentNode(comment string) error {
	if tb.done {
		return errors.New(ErrBuilder, errorMessages, "building is already done")
	}
	return nil
}
341896
func (f *File) commentsReader(path string) *xlsxComments {
	if f.Comments[path] == nil {
		content, ok := f.XLSX[path]
		if ok {
			c := xlsxComments{}
			_ = xml.Unmarshal(namespaceStrictToTransitional(content), &c)
			f.Comments[path] = &c
		}
	}
	return f.Comments[path]
}
229436
func MsgOptionText(text string, escape bool) MsgOption {
	return func(config *sendConfig) error {
		if escape {
			text = slackutilsx.EscapeMessage(text)
		}
		config.values.Add("text", text)
		return nil
	}
}
307685
func (c *Comments) MarkComments(position CommentPosition) {
	for _, comment := range c.Comments {
		if comment.Position == TBD {
			comment.Position = position
		}
	}
	for _, c := range c.future {
		if c.Position == TBD {
			c.Position = position
		}
	}
}
802764
func commentSelection(src []byte) Selection {
	var s scanner.Scanner
	fset := token.NewFileSet()
	file := fset.AddFile("", fset.Base(), len(src))
	s.Init(file, src, nil, scanner.ScanComments)
	return func() (seg []int) {
		for {
			pos, tok, lit := s.Scan()
			if tok == token.EOF {
				break
			}
			offs := file.Offset(pos)
			if tok == token.COMMENT {
				seg = []int{offs, offs + len(lit)}
				break
			}
		}
		return
	}
}
93090
func (post *ProjectPost) Comments(options CommentlistOptions) *[]ExistingComment {
	var comments []ProjectPostComment

	query := Db().Where(&ProjectPostComment{Hpid: post.ID()})
	query = commentlistQueryBuilder(query, options)
	query.Scan(&comments)

	comments = utils.ReverseSlice(comments).([]ProjectPostComment)

	var ret []ExistingComment
	for _, c := range comments {
		comment := c
		ret = append(ret, ExistingComment(&comment))
	}
	return &ret
}
537667
func (cm CommentMap) MoveComments(from, to Node, position CommentPosition) {
	for i, c := range cm[from] {
		if c.Position == position {
			cm.AddComment(to, c)

			// Remove the comment from the "from" slice
			cm[from][i] = cm[from][len(cm[from])-1]
			cm[from][len(cm[from])-1] = nil
			cm[from] = cm[from][:len(cm[from])-1]
		}
	}
}
680975
func (o *OAuthSession) Comments(h *Submission, sort PopularitySort, params ListingOptions) ([]*Comment, error) {
	p, err := query.Values(params)
	if err != nil {
		return nil, err
	}

	if sort != "" {
		p.Set("sort", string(sort))
	}

	var c interface{}
	link := fmt.Sprintf("https://oauth.reddit.com/comments/%s?%s", h.ID, p.Encode())
	err = o.getBody(link, &c)
	if err != nil {
		return nil, err
	}
	helper := new(helper)
	helper.buildComments(c)
	return helper.comments, nil
}
301982
func (s Section) String() string {
	comment := ""
	if s.comment != nil {
		comment = s.comment.String()
	}

	return fmt.Sprintf("[%s]%s%s", s.name, s.ws, comment)
}
1208925
func (tn *tagNode) appendCommentNode(comment string) *commentNode {
	ncn := newCommentNode(comment)
	tn.appendChild(ncn)
	return ncn
}
588573
func multiComment(text string) string {
	lines := strings.Split(text, "\n")
	nl := make([]string, len(lines))
	for i, l := range lines {
		nl[i] = "// " + strings.TrimSpace(l)
	}
	return strings.Join(nl, "\n")
}
1008385
func (c Comment) String() string {
	return fmt.Sprintf("%s%s", c.cs, c.comment)
}