Add support for `Roc` language (#1197)

This commit is contained in:
Erik Schierboom 2024-11-18 11:18:19 +01:00 committed by GitHub
parent 06499611c8
commit bf83c0a01a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 45 additions and 0 deletions

View File

@ -1498,6 +1498,15 @@
"blank": true,
"extensions": ["rst"]
},
"Roc": {
"line_comment": ["#"],
"quotes": [
["\\\"", "\\\""],
["'", "'"]
],
"doc_quotes": [["\\\"\\\"\\\"", "\\\"\\\"\\\""]],
"extensions": ["roc"]
},
"RON": {
"name": "Rusty Object Notation",
"line_comment": ["//"],

36
tests/data/roc.roc Normal file
View File

@ -0,0 +1,36 @@
# 36 lines 18 code 10 comments 8 blanks
module [square]
# this is a comment
# this is another comment
a1 = 1
a2 = 3.14159 # pi
expect
# simple check
a1 == 1
expect
a2 |> Num.toStr == "3.14159"
## Compute the square
square = \x ->
s = x * x
# the line above is blank
s
expect square 3 == 9
## """
## this is not a multiline string,
## it's a doc comment
## """
multilineString =
"""
# this line is not a comment, it's actually code
The line above is not blank, it's actually code
"""
expect multilineString |> Str.toUtf8 |> List.first == Ok '#'