Documentation
¶
Overview ¶
Package sloc provides function for counting source lines of code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CStyleComments = CommentStyle{ LinePre("\\/\\/"), []string{LinePre("\\/\\*"), "\\*\\/"}, }
View Source
var Languages = []*Language{ &Language{"C", []string{"c", "h"}, &CStyleComments}, &Language{"C++", []string{"cpp", "cc", "hh", "hpp"}, &CStyleComments}, &Language{"Java", []string{"java"}, &CStyleComments}, &Language{"JavaScript", []string{"js"}, &CStyleComments}, &Language{"Go", []string{"go"}, &CStyleComments}, &Language{"Ruby", []string{"rb"}, &CommentStyle{LinePre("#"), []string{"^=begin", "^=end"}}}, &Language{"Python", []string{"py"}, &CommentStyle{LinePre("#"), []string{"^=begin", "^=end"}}}, &Language{"Lua", []string{"lua"}, &CommentStyle{LinePre("--"), []string{"--[[", "]]--"}}}, &Language{"Lisp", []string{"el", "lsp", "scm"}, &CommentStyle{LinePre(";"), nil}}, &Language{"Shell", []string{"sh"}, &CommentStyle{LinePre("#"), nil}}, }
Functions ¶
func CountLines ¶
Counts the lines of code from a Reader stream.
Types ¶
type CommentStyle ¶
A CommentStyle for a Language describing how to match a comment so it can be ignored in the sloc count.
type Language ¶
type Language struct { Name string Ext []string CommentStyle *CommentStyle }
A Language is used for matching an extension and describing how to name a languge and match a comment
func GetLanguage ¶
Click to show internal directories.
Click to hide internal directories.