Blame view

bower_components/prism/components/prism-stylus.js 2.64 KB
eb240478   Luigi Serra   public room cards...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  (function (Prism) {
  	var inside = {
  		'url': /url\((["']?).*?\1\)/i,
  		'string': /("|')(?:[^\\\r\n]|\\(?:\r\n|[\s\S]))*?\1/,
  		'interpolation': null, // See below
  		'func': null, // See below
  		'important': /\B!(?:important|optional)\b/i,
  		'keyword': {
  			pattern: /(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,
  			lookbehind: true
  		},
  		'hexcode': /#[\da-f]{3,6}/i,
  		'number': /\b\d+(?:\.\d+)?%?/,
  		'boolean': /\b(?:true|false)\b/,
  		'operator': [
  			// We want non-word chars around "-" because it is
  			// accepted in property names.
  			/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/
  		],
  		'punctuation': /[{}()\[\];:,]/
  	};
  
  	inside['interpolation'] = {
  		pattern: /\{[^\r\n}:]+\}/,
  		alias: 'variable',
  		inside: Prism.util.clone(inside)
  	};
  	inside['func'] = {
  		pattern: /[\w-]+\([^)]*\).*/,
  		inside: {
  			'function': /^[^(]+/,
  			rest: Prism.util.clone(inside)
  		}
  	};
  
  	Prism.languages.stylus = {
  		'comment': {
  			pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*)/,
  			lookbehind: true
  		},
  		'atrule-declaration': {
  			pattern: /(^\s*)@.+/m,
  			lookbehind: true,
73bcce88   luigser   COMPONENTS
44
  			inside: {
eb240478   Luigi Serra   public room cards...
45
46
47
  				'atrule': /^@[\w-]+/,
  				rest: inside
  			}
73bcce88   luigser   COMPONENTS
48
  		},
eb240478   Luigi Serra   public room cards...
49
50
51
52
53
54
55
  		'variable-declaration': {
  			pattern: /(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,
  			lookbehind: true,
  			inside: {
  				'variable': /^\S+/,
  				rest: inside
  			}
73bcce88   luigser   COMPONENTS
56
  		},
eb240478   Luigi Serra   public room cards...
57
58
59
60
61
62
63
64
  
  		'statement': {
  			pattern: /(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,
  			lookbehind: true,
  			inside: {
  				keyword: /^\S+/,
  				rest: inside
  			}
73bcce88   luigser   COMPONENTS
65
  		},
eb240478   Luigi Serra   public room cards...
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  
  		// A property/value pair cannot end with a comma or a brace
  		// It cannot have indented content unless it ended with a semicolon
  		'property-declaration': {
  			pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(\r?\n|\r)(?:\{|\2[ \t]+)))/m,
  			lookbehind: true,
  			inside: {
  				'property': {
  					pattern: /^[^\s:]+/,
  					inside: {
  						'interpolation': inside.interpolation
  					}
  				},
  				rest: inside
  			}
73bcce88   luigser   COMPONENTS
81
  		},
eb240478   Luigi Serra   public room cards...
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
  
  
  
  		// A selector can contain parentheses only as part of a pseudo-element
  		// It can span multiple lines.
  		// It must end with a comma or an accolade or have indented content.
  		'selector': {
  			pattern: /(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,
  			lookbehind: true,
  			inside: {
  				'interpolation': inside.interpolation,
  				'punctuation': /[{},]/
  			}
  		},
  
  		'func': inside.func,
  		'string': inside.string,
  		'interpolation': inside.interpolation,
  		'punctuation': /[{}()\[\];:.]/
  	};
  }(Prism));