Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DoubleSlash = CommentType{ Regex: `(?m)^\s*//.*?$`, Replace: []string{"//"}, } DoubleSlashMultiLine = CommentType{ Regex: `(?s)/\*.*?\*/`, Replace: []string{"/*", "*/"}, } Hash = CommentType{ Regex: `(?m)^\s*#.*?$`, Replace: []string{"#"}, } )
View Source
var Langs map[string][]CommentType = map[string][]CommentType{ "python": {Hash}, "go": {DoubleSlash, DoubleSlashMultiLine}, "js": {DoubleSlash, DoubleSlashMultiLine}, }
Functions ¶
func DetectLanguage ¶
func ExtractComments ¶
func ExtractComments(code string, commentType ...CommentType) []string
Types ¶
type AnalyzedComment ¶
func AnalyzeCode ¶
func AnalyzeCode(code string, lang string) []AnalyzedComment
type CommentType ¶
type Lang ¶
type Lang []CommentType
Click to show internal directories.
Click to hide internal directories.