// Counts the lines of code from a Reader stream.
Counts the lines of code from a Reader stream.
// Counts the lines of code from a Reader stream .
func CountLines(i io.Reader, l *Language) int {
	s := bufio.NewScanner(i)
	sourceLines := 0
	var shouldSkipLine func(b string) bool
	if l == nil {
		shouldSkipLine = isBlankLine 
	} else {
		shouldSkipLine = func(b string) bool {
			return isBlankLine(b) ||
				rmatch([]byte(b), l.CommentStyle.SingleComment) ||
				skipMultilineComment(s, l.CommentStyle) != 0
		}
	}
	for s.Scan() {
		if !shouldSkipLine(s.Text()) {
			sourceLines++
		}
	}
	return sourceLines
}
func CountLines ( i io . Reader , l * Language ) int { s := bufio . NewScanner ( i ) sourceLines := 0 var shouldSkipLine func ( b string ) bool if l == nil { shouldSkipLine = isBlankLine } else { shouldSkipLine = func ( b string ) bool { return isBlankLine ( b ) || rmatch ( [ ] byte ( b ) , l . CommentStyle . SingleComment ) || skipMultilineComment ( s , l . CommentStyle ) != 0 } } for s . Scan ( ) { if ! shouldSkipLine ( s . Text ( ) ) { sourceLines ++ } } return sourceLines }
Counts the lines of code from a Reader stream.
Counts the lines of code from a Reader stream .
// skip blank lines