Skip to content

Commit 4dea084

Browse files
committed
add Red language
1 parent 65b1f8b commit 4dea084

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

lib/languages/red.txt

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
!e
2+
;\p
3+
Red [\p-->>]\pj
4+
Red +[\p-->>]\pj
5+
comment [\p-->>]\pj
6+
comment +[\p-->>]\pj
7+
comment {\p-->>}\pj
8+
comment +{\p-->>}\pj

test/languages/red_test.rb

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
require "test_helper"
2+
3+
module SnippetExtractor
4+
module Languages
5+
class RedTest < Minitest::Test
6+
def test_full_example
7+
code = <<~CODE
8+
Red [] ; a comment
9+
10+
; single line comment
11+
x: 1 ; line comment 1
12+
x: 2 ;-- line comment 2
13+
x: 3 ;@@ line comment 3
14+
15+
comment ['this
16+
'is 'multiline
17+
'comment]
18+
comment {and this
19+
as well}
20+
21+
function add100 [x [integer!]] [
22+
"; this should not count as comment "
23+
{ comment [and neither
24+
this] }
25+
]
26+
CODE
27+
28+
expected = <<~CODE
29+
x: 1
30+
x: 2
31+
x: 3
32+
function add100 [x [integer!]] [
33+
"; this should not count as comment "
34+
{ comment [and neither
35+
this] }
36+
]
37+
CODE
38+
39+
assert_equal expected, ExtractSnippet.(code, :red)
40+
end
41+
end
42+
end
43+
end

0 commit comments

Comments
 (0)