From 243d03ecc2b9258819679aaf300bc7109f8f92b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=81ozi=C5=84ski?= Date: Wed, 14 Feb 2024 15:12:15 +0100 Subject: [PATCH] Add support for Red (exercism fork) (#12) * Add support for Red * Disable Red/System files, conflict with Redscript language --- languages.json | 6 ++++++ tests/data/red.red | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/data/red.red diff --git a/languages.json b/languages.json index cc1f7d143..a666a52da 100644 --- a/languages.json +++ b/languages.json @@ -1251,6 +1251,12 @@ "multi_line_comments": [[""], ["@*", "*@"]], "extensions": ["cshtml"] }, + "Red": { + "line_comment": [";"], + "multi_line_comments": [["comment [", "]"], ["comment {", "}"]], + "quotes": [["\\\"", "\\\""], ["{", "}"]], + "extensions": ["red"] + }, "Redscript": { "name": "Redscript", "line_comment": ["//", "///"], diff --git a/tests/data/red.red b/tests/data/red.red new file mode 100644 index 000000000..f1b94eda2 --- /dev/null +++ b/tests/data/red.red @@ -0,0 +1,20 @@ +Red [] ; 20 lines 10 code 6 comments 4 blanks + +x: 1 ; line comment 1 +x: 2 ;-- line comment 2 +x: 3 ;@@ line comment 3 + +comment ['this + 'is 'multiline + 'comment] +comment {and this + as well} + +function add100 [x [integer!]] [ + "; this should not count as comment " + { comment [and neither + this] } +] + +comment {unfortunately, tokei does not allow regexp in comment prefix} +; so probably previous block comment is not parsed properly