Skip to content

Commit 6c8494f

Browse files
committed
Rust: Simplified patterns and fixed operators
1 parent 1093f7d commit 6c8494f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/prism-rust.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Prism.languages.rust = {
1212
lookbehind: true
1313
},
1414
{
15-
pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/,
15+
pattern: /(^|[^\\:])\/\/.*/,
1616
lookbehind: true
1717
}
1818
],
@@ -38,7 +38,7 @@ Prism.languages.rust = {
3838
},
3939

4040
// Hex, oct, bin, dec numbers with visual separators and type suffix
41-
'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32)?|f32|f64))?\b/,
41+
'number': /\b-?(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(\d(_?\d)*)?\.?\d(_?\d)*([Ee][+-]?\d+)?)(?:_?(?:[iu](?:8|16|32|64)?|f32|f64))?\b/,
4242

4343
// Closure params should not be confused with bitwise OR |
4444
'closure-params': {
@@ -48,6 +48,6 @@ Prism.languages.rust = {
4848
'operator': /[&*]/
4949
}
5050
},
51-
'punctuation': /[{}[\];(),.:]|->/,
52-
'operator': /[-+]{1,2}|!=?|<=?|>=?|={1,3}|&&?|\|\|?|\*|\/|\^|%|<<|>>@/
51+
'punctuation': /[{}[\];(),:]|\.+|->/,
52+
'operator': /[-+*\/%!^=]=?|@|&[&=]?|\|[|=]?|<<?=?|>>?=?/
5353
};

components/prism-rust.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)