Blame view

bower_components/prism/components/prism-scss.js 1.92 KB
73bcce88   luigser   COMPONENTS
1
2
  Prism.languages.scss = Prism.languages.extend('css', {
  	'comment': {
eb240478   Luigi Serra   public room cards...
3
  		pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/,
73bcce88   luigser   COMPONENTS
4
5
6
  		lookbehind: true
  	},
  	'atrule': {
eb240478   Luigi Serra   public room cards...
7
  		pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/,
73bcce88   luigser   COMPONENTS
8
9
10
11
12
13
  		inside: {
  			'rule': /@[\w-]+/
  			// See rest below
  		}
  	},
  	// url, compassified
eb240478   Luigi Serra   public room cards...
14
  	'url': /(?:[-a-z]+-)*url(?=\()/i,
73bcce88   luigser   COMPONENTS
15
16
17
  	// 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)
eb240478   Luigi Serra   public room cards...
18
  	// it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable
73bcce88   luigser   COMPONENTS
19
20
  	// 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})
eb240478   Luigi Serra   public room cards...
21
  	// this one was hard to do, so please be careful if you edit this one :)
73bcce88   luigser   COMPONENTS
22
  	'selector': {
eb240478   Luigi Serra   public room cards...
23
24
  		// Initial look-ahead is used to prevent matching of blank selectors
  		pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m,
73bcce88   luigser   COMPONENTS
25
  		inside: {
eb240478   Luigi Serra   public room cards...
26
  			'placeholder': /%[-_\w]+/
73bcce88   luigser   COMPONENTS
27
28
29
30
31
  		}
  	}
  });
  
  Prism.languages.insertBefore('scss', 'atrule', {
eb240478   Luigi Serra   public room cards...
32
33
34
35
36
37
38
  	'keyword': [
  		/@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i,
  		{
  			pattern: /( +)(?:from|through)(?= )/,
  			lookbehind: true
  		}
  	]
73bcce88   luigser   COMPONENTS
39
40
41
42
  });
  
  Prism.languages.insertBefore('scss', 'property', {
  	// var and interpolated vars
eb240478   Luigi Serra   public room cards...
43
  	'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/
73bcce88   luigser   COMPONENTS
44
45
46
47
  });
  
  Prism.languages.insertBefore('scss', 'function', {
  	'placeholder': {
eb240478   Luigi Serra   public room cards...
48
  		pattern: /%[-_\w]+/,
73bcce88   luigser   COMPONENTS
49
50
  		alias: 'selector'
  	},
eb240478   Luigi Serra   public room cards...
51
52
53
54
55
56
57
  	'statement': /\B!(?:default|optional)\b/i,
  	'boolean': /\b(?:true|false)\b/,
  	'null': /\bnull\b/,
  	'operator': {
  		pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/,
  		lookbehind: true
  	}
73bcce88   luigser   COMPONENTS
58
59
60
  });
  
  Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.scss);