Skip to content

Commit 2308bc5

Browse files
jmcoreyJames Corey
andauthored
Fix rust syntax file to recognize byte strings and c strings. (zyedidia#3452)
In rust, there are some prefixes that may be part of the string literal. String literals of the form b"test" (and br##"test"## etc) are byte strings (as opposed to unicode strings), and similarly, string literals of the form c"test" are C zero-terminated strings. Hence, added optional prefixes to each of the string regular expressions so the prefix will be recognized as part of the string. Built and tested after fix. Co-authored-by: James Corey <[email protected]>
1 parent d8f7928 commit 2308bc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

runtime/syntax/rust.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@ rules:
2222
- type: "\\b(bool|str|isize|usize|((i|u)(8|16|32|64))|f32|f64)\\b"
2323

2424
- constant.string:
25-
start: "\""
25+
start: "[bc]?\""
2626
end: "\""
2727
skip: '\\.'
2828
rules:
2929
- constant.specialChar: '\\.'
3030

3131
- constant.string:
32-
start: "r#\""
32+
start: "[bc]?r#\""
3333
end: "\"#"
3434
rules: []
3535

3636
- constant.string:
37-
start: "r##\""
37+
start: "[bc]?r##\""
3838
end: "\"##"
3939
rules: []
4040

4141
- constant.string:
42-
start: "r###\""
42+
start: "[bc]?r###\""
4343
end: "\"###"
4444
rules: []
4545

4646
- constant.string:
47-
start: "r####+\""
47+
start: "[bc]?r####+\""
4848
end: "\"####+"
4949
rules: []
5050

0 commit comments

Comments
 (0)