1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-04-15 11:46:38 +02:00

Raku: Fix incorrectly matching closing brackets as opening

This commit is contained in:
Siavash Askari Nasr 2021-08-15 15:56:48 +04:30 committed by Alec Thomas
parent 7966c29526
commit b71f4c6607
3 changed files with 6 additions and 5 deletions

View File

@ -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 { func joinRuneMap(m map[rune]rune) string {
runes := make([]rune, 0, len(m)*2) runes := make([]rune, 0, len(m))
for k, v := range m { for k := range m {
runes = append(runes, k) runes = append(runes, k)
runes = append(runes, v)
} }
return string(runes) return string(runes)

View File

@ -21,7 +21,7 @@ fmt.Println("Hello from Go")
say $=pod[0].config<numbered>; say $=pod[0].config<numbered>;
sub f1($a) { sub f1($a) {
$a+1; $a+1; #=> Comment looking like a pod declaration, but with a closing bracket!
} }
2.&f1; 2.&f1;

View File

@ -67,6 +67,8 @@
{"type":"Operator","value":"+"}, {"type":"Operator","value":"+"},
{"type":"LiteralNumberInteger","value":"1"}, {"type":"LiteralNumberInteger","value":"1"},
{"type":"Punctuation","value":";"}, {"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":"Text","value":"\n"},
{"type":"Punctuation","value":"}"}, {"type":"Punctuation","value":"}"},
{"type":"Text","value":"\n\n"}, {"type":"Text","value":"\n\n"},