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

Unified Diff: polymer_1.0.4/bower_components/prism/components/prism-scss.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-scss.js
diff --git a/polymer_1.0.4/bower_components/prism/components/prism-scss.js b/polymer_1.0.4/bower_components/prism/components/prism-scss.js
new file mode 100644
index 0000000000000000000000000000000000000000..69ea3c79f3adf27e1dee4640c486116612422ff5
--- /dev/null
+++ b/polymer_1.0.4/bower_components/prism/components/prism-scss.js
@@ -0,0 +1,36 @@
+Prism.languages.scss = Prism.languages.extend('css', {
+ 'comment': {
+ pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/,
+ lookbehind: true
+ },
+ // aturle is just the @***, not the entire rule (to highlight var & stuffs)
+ // + add ability to highlight number & unit for media queries
+ 'atrule': /@[\w-]+(?=\s+(\(|\{|;))/i,
+ // url, compassified
+ 'url': /([-a-z]+-)*url(?=\()/i,
+ // CSS selector regex is not appropriate for Sass
+ // since there can be lot more things (var, @ directive, nesting..)
+ // a selector must start at the end of a property or after a brace (end of other rules or nesting)
+ // it can contain some caracters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
+ // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var
+ // can "pass" as a selector- e.g: proper#{$erty})
+ // this one was ard to do, so please be careful if you edit this one :)
+ 'selector': /([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m
+});
+
+Prism.languages.insertBefore('scss', 'atrule', {
+ 'keyword': /@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)|(?=@for\s+\$[-_\w]+\s)+from/i
+});
+
+Prism.languages.insertBefore('scss', 'property', {
+ // var and interpolated vars
+ 'variable': /((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i
+});
+
+Prism.languages.insertBefore('scss', 'function', {
+ 'placeholder': /%[-_\w]+/i,
+ 'statement': /\B!(default|optional)\b/i,
+ 'boolean': /\b(true|false)\b/,
+ 'null': /\b(null)\b/,
+ 'operator': /\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|%)\s+/
+});

Powered by Google App Engine
This is Rietveld 408576698