Current File : /home/pacjaorg/public_html/kmm/media/vendor/codemirror/mode/sass/sass.min.js |
(function(t){typeof exports=="object"&&typeof module=="object"?t(require("../../lib/codemirror"),require("../css/css")):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../css/css"],t):t(CodeMirror)})(function(t){"use strict";t.defineMode("sass",function(y){var k=t.mimeModes["text/css"],v=k.propertyKeywords||{},a=k.colorKeywords||{},E=k.valueKeywords||{},T=k.fontProperties||{};function s(n){return new RegExp("^"+n.join("|"))}var K=["true","false","null","auto"],g=new RegExp("^"+K.join("|")),L=["\\(","\\)","=",">","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],z=s(L),O=/^::?[a-zA-Z_][\w\-]*/,f;function o(n){return!n.peek()||n.match(/\s+$/,!1)}function b(n,r){var e=n.peek();return e===")"?(n.next(),r.tokenizer=c,"operator"):e==="("?(n.next(),n.eatSpace(),"operator"):e==="'"||e==='"'?(r.tokenizer=x(n.next()),"string"):(r.tokenizer=x(")",!1),"string")}function H(n,r){return function(e,i){return e.sol()&&e.indentation()<=n?(i.tokenizer=c,c(e,i)):(r&&e.skipTo("*/")?(e.next(),e.next(),i.tokenizer=c):e.skipToEnd(),"comment")}}function x(n,r){r==null&&(r=!0);function e(i,p){var l=i.next(),h=i.peek(),d=i.string.charAt(i.pos-2),w=l!=="\\"&&h===n||l===n&&d!=="\\";return w?(l!==n&&r&&i.next(),o(i)&&(p.cursorHalf=0),p.tokenizer=c,"string"):l==="#"&&h==="{"?(p.tokenizer=C(e),i.next(),"operator"):"string"}return e}function C(n){return function(r,e){return r.peek()==="}"?(r.next(),e.tokenizer=n,"operator"):c(r,e)}}function u(n){if(n.indentCount==0){n.indentCount++;var r=n.scopes[0].offset,e=r+y.indentUnit;n.scopes.unshift({offset:e})}}function P(n){n.scopes.length!=1&&n.scopes.shift()}function c(n,r){var e=n.peek();if(n.match("/*"))return r.tokenizer=H(n.indentation(),!0),r.tokenizer(n,r);if(n.match("//"))return r.tokenizer=H(n.indentation(),!1),r.tokenizer(n,r);if(n.match("#{"))return r.tokenizer=C(c),"operator";if(e==='"'||e==="'")return n.next(),r.tokenizer=x(e),"string";if(r.cursorHalf){if(e==="#"&&(n.next(),n.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/))||n.match(/^-?[0-9\.]+/))return o(n)&&(r.cursorHalf=0),"number";if(n.match(/^(px|em|in)\b/))return o(n)&&(r.cursorHalf=0),"unit";if(n.match(g))return o(n)&&(r.cursorHalf=0),"keyword";if(n.match(/^url/)&&n.peek()==="(")return r.tokenizer=b,o(n)&&(r.cursorHalf=0),"atom";if(e==="$")return n.next(),n.eatWhile(/[\w-]/),o(n)&&(r.cursorHalf=0),"variable-2";if(e==="!")return n.next(),r.cursorHalf=0,n.match(/^[\w]+/)?"keyword":"operator";if(n.match(z))return o(n)&&(r.cursorHalf=0),"operator";if(n.eatWhile(/[\w-]/))return o(n)&&(r.cursorHalf=0),f=n.current().toLowerCase(),E.hasOwnProperty(f)?"atom":a.hasOwnProperty(f)?"keyword":v.hasOwnProperty(f)?(r.prevProp=n.current().toLowerCase(),"property"):"tag";if(o(n))return r.cursorHalf=0,null}else{if(e==="-"&&n.match(/^-\w+-/))return"meta";if(e==="."){if(n.next(),n.match(/^[\w-]+/))return u(r),"qualifier";if(n.peek()==="#")return u(r),"tag"}if(e==="#"){if(n.next(),n.match(/^[\w-]+/))return u(r),"builtin";if(n.peek()==="#")return u(r),"tag"}if(e==="$")return n.next(),n.eatWhile(/[\w-]/),"variable-2";if(n.match(/^-?[0-9\.]+/))return"number";if(n.match(/^(px|em|in)\b/))return"unit";if(n.match(g))return"keyword";if(n.match(/^url/)&&n.peek()==="(")return r.tokenizer=b,"atom";if(e==="="&&n.match(/^=[\w-]+/))return u(r),"meta";if(e==="+"&&n.match(/^\+[\w-]+/))return"variable-3";if(e==="@"&&n.match("@extend")&&(n.match(/\s*[\w]/)||P(r)),n.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return u(r),"def";if(e==="@")return n.next(),n.eatWhile(/[\w-]/),"def";if(n.eatWhile(/[\w-]/))if(n.match(/ *: *[\w-\+\$#!\("']/,!1)){f=n.current().toLowerCase();var i=r.prevProp+"-"+f;return v.hasOwnProperty(i)?"property":v.hasOwnProperty(f)?(r.prevProp=f,"property"):T.hasOwnProperty(f)?"property":"tag"}else return n.match(/ *:/,!1)?(u(r),r.cursorHalf=1,r.prevProp=n.current().toLowerCase(),"property"):(n.match(/ *,/,!1)||u(r),"tag");if(e===":")return n.match(O)?"variable-3":(n.next(),r.cursorHalf=1,"operator")}return n.match(z)?"operator":(n.next(),null)}function R(n,r){n.sol()&&(r.indentCount=0);var e=r.tokenizer(n,r),i=n.current();if((i==="@return"||i==="}")&&P(r),e!==null){for(var p=n.pos-i.length,l=p+y.indentUnit*r.indentCount,h=[],d=0;d<r.scopes.length;d++){var w=r.scopes[d];w.offset<=l&&h.push(w)}r.scopes=h}return e}return{startState:function(){return{tokenizer:c,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(n,r){var e=R(n,r);return r.lastToken={style:e,content:n.current()},e},indent:function(n){return n.scopes[0].offset},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"indent"}},"css"),t.defineMIME("text/x-sass","sass")});