Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: polymer_1.0.4/bower_components/prism/components/prism-rust.js

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_1.0.4/bower_components/prism/components/prism-rust.js
diff --git a/polymer_1.0.4/bower_components/prism/components/prism-rust.js b/polymer_1.0.4/bower_components/prism/components/prism-rust.js
new file mode 100644
index 0000000000000000000000000000000000000000..0c320d21d5300428bff59488c8cd8c0463dd7eb5
--- /dev/null
+++ b/polymer_1.0.4/bower_components/prism/components/prism-rust.js
@@ -0,0 +1,53 @@
+/* TODO
+ Add support for Markdown notation inside doc comments
+ Add support for nested block comments...
+ Match closure params even when not followed by dash or brace
+ Add better support for macro definition
+*/
+
+Prism.languages.rust = {
+ 'comment': [
+ {
+ pattern: /(^|[^\\])\/\*[\w\W]*?\*\//,
+ lookbehind: true
+ },
+ {
+ pattern: /(^|[^\\:])\/\/.*?(\r?\n|$)/,
+ lookbehind: true
+ }
+ ],
+ 'string': [
+ /b?r(#*)"(?:\\?.)*?"\1/,
+ /b?("|')(?:\\?.)*?\1/
+ ],
+ 'keyword': /\b(?:abstract|alignof|as|be|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|match|mod|move|mut|offsetof|once|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\b/,
+
+ 'attribute': {
+ pattern: /#!?\[.+?\]/,
+ alias: 'attr-name'
+ },
+
+ 'function': [
+ /[a-z0-9_]+(?=\s*\()/i,
+ // Macros can use parens or brackets
+ /[a-z0-9_]+!(?=\s*\(|\[)/i
+ ],
+ 'macro-rules': {
+ pattern: /[a-z0-9_]+!/i,
+ alias: 'function'
+ },
+
+ // Hex, oct, bin, dec numbers with visual separators and type suffix
+ '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/,
+
+ // Closure params should not be confused with bitwise OR |
+ 'closure-params': {
+ pattern: /\|[^|]*\|(?=\s*[{-])/,
+ inside: {
+ 'punctuation': /[\|:,]/,
+ 'operator': /[&*]/
+ }
+ },
+ 'punctuation': /[{}[\];(),.:]|->/,
+ 'operator': /[-+]{1,2}|!=?|<=?|>=?|={1,3}|&&?|\|\|?|\*|\/|\^|%|<<|>>@/
+};

Powered by Google App Engine
This is Rietveld 408576698