File tree Expand file tree Collapse file tree 4 files changed +56
-0
lines changed
Expand file tree Collapse file tree 4 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ var HashStyleCommentOptions *lege.ParseOptions = &lege.ParseOptions{
3737 },
3838}
3939
40+ // LispStyleCommentOptions ..
41+ var LispStyleCommentOptions * lege.ParseOptions = & lege.ParseOptions {
42+ Boundaries : []lege.Boundary {
43+ {
44+ Start : ";" ,
45+ End : "\n " ,
46+ },
47+ },
48+ }
49+
4050// Language is a source language (i.e. "Go")
4151type Language string
4252
@@ -57,6 +67,8 @@ var LanguageParseOptions map[Language]*lege.ParseOptions = map[Language]*lege.Pa
5767 "Objective-C" : CStyleCommentOptions ,
5868 "Groovy" : CStyleCommentOptions ,
5969 "Swift" : CStyleCommentOptions ,
70+ "Common Lisp" : LispStyleCommentOptions ,
71+ "Emacs Lisp" : LispStyleCommentOptions ,
6072}
6173
6274// Comments is a list of comments
Original file line number Diff line number Diff line change 1+ package comments
2+
3+ import (
4+ "testing"
5+ )
6+
7+ func TestJSFiles (t * testing.T ) {
8+ var comments Comments
9+ err := SearchDir ("testdata/javascript" , func (comment * Comment ) {
10+ comments = append (comments , comment )
11+ })
12+ if err != nil {
13+ t .Fatal (err )
14+ }
15+
16+ if len (comments ) != 2 {
17+ t .Fail ()
18+ }
19+ }
20+
21+ func TestLispFiles (t * testing.T ) {
22+ var comments Comments
23+ err := SearchDir ("testdata/lisp" , func (comment * Comment ) {
24+ comments = append (comments , comment )
25+ })
26+ if err != nil {
27+ t .Fatal (err )
28+ }
29+
30+ if len (comments ) != 1 {
31+ t .Fail ()
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ // this is a js comment
2+
3+ function helloWorld ( ) {
4+ return "hello world"
5+ }
6+
7+ /* this is a block comment
8+ that spans multiple lines
9+ */
Original file line number Diff line number Diff line change 1+ ; Comment
2+ (+ 1 1 )
You can’t perform that action at this time.
0 commit comments