Skip to content

Commit 9ad97e9

Browse files
committed
add basic julia language support
1 parent 7a07a71 commit 9ad97e9

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

pkg/comments/comments_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,17 @@ func TestKotlinFiles(t *testing.T) {
7575
t.Fail()
7676
}
7777
}
78+
79+
func TestJuliaFiles(t *testing.T) {
80+
var comments Comments
81+
err := SearchDir("testdata/julia", func(comment *Comment) {
82+
comments = append(comments, comment)
83+
})
84+
if err != nil {
85+
t.Fatal(err)
86+
}
87+
88+
if len(comments) != 3 {
89+
t.Fail()
90+
}
91+
}

pkg/comments/languages.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ var LanguageParseOptions map[Language]*lege.ParseOptions = map[Language]*lege.Pa
6464
// so lines beginning with /// or //! will be picked up by this start // and include a / or ! preceding the comment
6565
"Rust": {Boundaries: []lege.Boundary{{Start: "///", End: "\n"}, {Start: "//!", End: "\n"}, {Start: "//", End: "\n"}}},
6666
"Kotlin": CStyleCommentOptions,
67+
"Julia": {Boundaries: []lege.Boundary{{Start: "#=", End: "=#"}, {Start: "#", End: "\n"}}},
6768
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# function to calculate the volume of a sphere
3+
function sphere_vol(r)
4+
# julia allows Unicode names (in UTF-8 encoding)
5+
# so either "pi" or the symbol π can be used
6+
7+
return 4/3*pi*r^3
8+
end

0 commit comments

Comments
 (0)