PluginProbe ʕ •ᴥ•ʔ
SiteOrigin CSS / 1.0.2
SiteOrigin CSS v1.0.2
1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0
so-css / lib / codemirror / mode / sass / sass.min.js
so-css / lib / codemirror / mode / sass Last commit date
index.html 11 years ago sass.js 11 years ago sass.min.js 11 years ago
sass.min.js
67 lines
1
2 (function(mod){if(typeof exports=="object"&&typeof module=="object")
3 mod(require("../../lib/codemirror"));else if(typeof define=="function"&&define.amd)
4 define(["../../lib/codemirror"],mod);else
5 mod(CodeMirror);})(function(CodeMirror){"use strict";CodeMirror.defineMode("sass",function(config){function tokenRegexp(words){return new RegExp("^"+words.join("|"));}
6 var keywords=["true","false","null","auto"];var keywordsRegexp=new RegExp("^"+keywords.join("|"));var operators=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"];var opRegexp=tokenRegexp(operators);var pseudoElementsRegexp=/^::?[a-zA-Z_][\w\-]*/;function urlTokens(stream,state){var ch=stream.peek();if(ch===")"){stream.next();state.tokenizer=tokenBase;return"operator";}else if(ch==="("){stream.next();stream.eatSpace();return"operator";}else if(ch==="'"||ch==='"'){state.tokenizer=buildStringTokenizer(stream.next());return"string";}else{state.tokenizer=buildStringTokenizer(")",false);return"string";}}
7 function comment(indentation,multiLine){return function(stream,state){if(stream.sol()&&stream.indentation()<=indentation){state.tokenizer=tokenBase;return tokenBase(stream,state);}
8 if(multiLine&&stream.skipTo("*/")){stream.next();stream.next();state.tokenizer=tokenBase;}else{stream.skipToEnd();}
9 return"comment";};}
10 function buildStringTokenizer(quote,greedy){if(greedy==null){greedy=true;}
11 function stringTokenizer(stream,state){var nextChar=stream.next();var peekChar=stream.peek();var previousChar=stream.string.charAt(stream.pos-2);var endingString=((nextChar!=="\\"&&peekChar===quote)||(nextChar===quote&&previousChar!=="\\"));if(endingString){if(nextChar!==quote&&greedy){stream.next();}
12 state.tokenizer=tokenBase;return"string";}else if(nextChar==="#"&&peekChar==="{"){state.tokenizer=buildInterpolationTokenizer(stringTokenizer);stream.next();return"operator";}else{return"string";}}
13 return stringTokenizer;}
14 function buildInterpolationTokenizer(currentTokenizer){return function(stream,state){if(stream.peek()==="}"){stream.next();state.tokenizer=currentTokenizer;return"operator";}else{return tokenBase(stream,state);}};}
15 function indent(state){if(state.indentCount==0){state.indentCount++;var lastScopeOffset=state.scopes[0].offset;var currentOffset=lastScopeOffset+config.indentUnit;state.scopes.unshift({offset:currentOffset});}}
16 function dedent(state){if(state.scopes.length==1)return;state.scopes.shift();}
17 function tokenBase(stream,state){var ch=stream.peek();if(stream.match("/*")){state.tokenizer=comment(stream.indentation(),true);return state.tokenizer(stream,state);}
18 if(stream.match("//")){state.tokenizer=comment(stream.indentation(),false);return state.tokenizer(stream,state);}
19 if(stream.match("#{")){state.tokenizer=buildInterpolationTokenizer(tokenBase);return"operator";}
20 if(ch==='"'||ch==="'"){stream.next();state.tokenizer=buildStringTokenizer(ch);return"string";}
21 if(!state.cursorHalf){if(ch==="."){stream.next();if(stream.match(/^[\w-]+/)){indent(state);return"atom";}else if(stream.peek()==="#"){indent(state);return"atom";}}
22 if(ch==="#"){stream.next();if(stream.match(/^[\w-]+/)){indent(state);return"atom";}
23 if(stream.peek()==="#"){indent(state);return"atom";}}
24 if(ch==="$"){stream.next();stream.eatWhile(/[\w-]/);return"variable-2";}
25 if(stream.match(/^-?[0-9\.]+/))
26 return"number";if(stream.match(/^(px|em|in)\b/))
27 return"unit";if(stream.match(keywordsRegexp))
28 return"keyword";if(stream.match(/^url/)&&stream.peek()==="("){state.tokenizer=urlTokens;return"atom";}
29 if(ch==="="){if(stream.match(/^=[\w-]+/)){indent(state);return"meta";}}
30 if(ch==="+"){if(stream.match(/^\+[\w-]+/)){return"variable-3";}}
31 if(ch==="@"){if(stream.match(/@extend/)){if(!stream.match(/\s*[\w]/))
32 dedent(state);}}
33 if(stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)){indent(state);return"meta";}
34 if(ch==="@"){stream.next();stream.eatWhile(/[\w-]/);return"meta";}
35 if(stream.eatWhile(/[\w-]/)){if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){return"property";}
36 else if(stream.match(/ *:/,false)){indent(state);state.cursorHalf=1;return"atom";}
37 else if(stream.match(/ *,/,false)){return"atom";}
38 else{indent(state);return"atom";}}
39 if(ch===":"){if(stream.match(pseudoElementsRegexp)){return"keyword";}
40 stream.next();state.cursorHalf=1;return"operator";}}
41 else{if(ch==="#"){stream.next();if(stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){if(!stream.peek()){state.cursorHalf=0;}
42 return"number";}}
43 if(stream.match(/^-?[0-9\.]+/)){if(!stream.peek()){state.cursorHalf=0;}
44 return"number";}
45 if(stream.match(/^(px|em|in)\b/)){if(!stream.peek()){state.cursorHalf=0;}
46 return"unit";}
47 if(stream.match(keywordsRegexp)){if(!stream.peek()){state.cursorHalf=0;}
48 return"keyword";}
49 if(stream.match(/^url/)&&stream.peek()==="("){state.tokenizer=urlTokens;if(!stream.peek()){state.cursorHalf=0;}
50 return"atom";}
51 if(ch==="$"){stream.next();stream.eatWhile(/[\w-]/);if(!stream.peek()){state.cursorHalf=0;}
52 return"variable-3";}
53 if(ch==="!"){stream.next();if(!stream.peek()){state.cursorHalf=0;}
54 return stream.match(/^[\w]+/)?"keyword":"operator";}
55 if(stream.match(opRegexp)){if(!stream.peek()){state.cursorHalf=0;}
56 return"operator";}
57 if(stream.eatWhile(/[\w-]/)){if(!stream.peek()){state.cursorHalf=0;}
58 return"attribute";}
59 if(!stream.peek()){state.cursorHalf=0;return null;}}
60 if(stream.match(opRegexp))
61 return"operator";stream.next();return null;}
62 function tokenLexer(stream,state){if(stream.sol())state.indentCount=0;var style=state.tokenizer(stream,state);var current=stream.current();if(current==="@return"||current==="}"){dedent(state);}
63 if(style!==null){var startOfToken=stream.pos-current.length;var withCurrentIndent=startOfToken+(config.indentUnit*state.indentCount);var newScopes=[];for(var i=0;i<state.scopes.length;i++){var scope=state.scopes[i];if(scope.offset<=withCurrentIndent)
64 newScopes.push(scope);}
65 state.scopes=newScopes;}
66 return style;}
67 return{startState:function(){return{tokenizer:tokenBase,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]};},token:function(stream,state){var style=tokenLexer(stream,state);state.lastToken={style:style,content:stream.current()};return style;},indent:function(state){return state.scopes[0].offset;}};});CodeMirror.defineMIME("text/x-sass","sass");});