Skip to content

Commit bf83c0a

Browse files
Add support for Roc language (#1197)
1 parent 0649961 commit bf83c0a

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

languages.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,15 @@
14981498
"blank": true,
14991499
"extensions": ["rst"]
15001500
},
1501+
"Roc": {
1502+
"line_comment": ["#"],
1503+
"quotes": [
1504+
["\\\"", "\\\""],
1505+
["'", "'"]
1506+
],
1507+
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""]],
1508+
"extensions": ["roc"]
1509+
},
15011510
"RON": {
15021511
"name": "Rusty Object Notation",
15031512
"line_comment": ["//"],

tests/data/roc.roc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# 36 lines 18 code 10 comments 8 blanks
2+
module [square]
3+
# this is a comment
4+
# this is another comment
5+
6+
a1 = 1
7+
a2 = 3.14159 # pi
8+
9+
expect
10+
# simple check
11+
a1 == 1
12+
13+
expect
14+
a2 |> Num.toStr == "3.14159"
15+
16+
## Compute the square
17+
square = \x ->
18+
s = x * x
19+
20+
# the line above is blank
21+
s
22+
23+
expect square 3 == 9
24+
25+
## """
26+
## this is not a multiline string,
27+
## it's a doc comment
28+
## """
29+
multilineString =
30+
"""
31+
# this line is not a comment, it's actually code
32+
33+
The line above is not blank, it's actually code
34+
"""
35+
36+
expect multilineString |> Str.toUtf8 |> List.first == Ok '#'

0 commit comments

Comments
 (0)