Skip to content

Commit

Permalink
Raku: Fix incorrectly matching closing brackets as opening
Browse files Browse the repository at this point in the history
  • Loading branch information
CIAvash authored and alecthomas committed Aug 15, 2021
1 parent 7966c29 commit b71f4c6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lexers/r/raku.go
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,11 @@ func rakuRules() Rules {
}
}

// Joins keys and values of rune map
// Joins keys of rune map
func joinRuneMap(m map[rune]rune) string {
runes := make([]rune, 0, len(m)*2)
for k, v := range m {
runes := make([]rune, 0, len(m))
for k := range m {
runes = append(runes, k)
runes = append(runes, v)
}

return string(runes)
Expand Down
2 changes: 1 addition & 1 deletion lexers/testdata/raku.actual
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fmt.Println("Hello from Go")
say $=pod[0].config<numbered>;

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

2.&f1;
Expand Down
2 changes: 2 additions & 0 deletions lexers/testdata/raku.expected
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
{"type":"Operator","value":"+"},
{"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":";"},
{"type":"Text","value":" "},
{"type":"CommentSingle","value":"#=\u003e Comment looking like a pod declaration, but with a closing bracket!"},
{"type":"Text","value":"\n"},
{"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n"},
Expand Down

0 comments on commit b71f4c6

Please sign in to comment.