Skip to content

Commit b71f4c6

Browse files
CIAvashalecthomas
authored andcommitted
Raku: Fix incorrectly matching closing brackets as opening
1 parent 7966c29 commit b71f4c6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Diff for: lexers/r/raku.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -1156,12 +1156,11 @@ func rakuRules() Rules {
11561156
}
11571157
}
11581158

1159-
// Joins keys and values of rune map
1159+
// Joins keys of rune map
11601160
func joinRuneMap(m map[rune]rune) string {
1161-
runes := make([]rune, 0, len(m)*2)
1162-
for k, v := range m {
1161+
runes := make([]rune, 0, len(m))
1162+
for k := range m {
11631163
runes = append(runes, k)
1164-
runes = append(runes, v)
11651164
}
11661165

11671166
return string(runes)

Diff for: lexers/testdata/raku.actual

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fmt.Println("Hello from Go")
2121
say $=pod[0].config<numbered>;
2222

2323
sub f1($a) {
24-
$a+1;
24+
$a+1; #=> Comment looking like a pod declaration, but with a closing bracket!
2525
}
2626

2727
2.&f1;

Diff for: lexers/testdata/raku.expected

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
{"type":"Operator","value":"+"},
6868
{"type":"LiteralNumberInteger","value":"1"},
6969
{"type":"Punctuation","value":";"},
70+
{"type":"Text","value":" "},
71+
{"type":"CommentSingle","value":"#=\u003e Comment looking like a pod declaration, but with a closing bracket!"},
7072
{"type":"Text","value":"\n"},
7173
{"type":"Punctuation","value":"}"},
7274
{"type":"Text","value":"\n\n"},

0 commit comments

Comments
 (0)