forked from cory/tildefriends
1 line
26 KiB
JavaScript
1 line
26 KiB
JavaScript
|
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(_){"use strict";function e(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0;return t}_.defineMode("css",function(e,t){var r=t.inline;t.propertyKeywords||(t=_.resolveMode("text/css"));var a,i,n=e.indentUnit,l=t.tokenHooks,o=t.documentTypes||{},s=t.mediaTypes||{},d=t.mediaFeatures||{},c=t.mediaValueKeywords||{},p=t.propertyKeywords||{},u=t.nonStandardPropertyKeywords||{},m=t.fontProperties||{},b=t.counterDescriptors||{},g=t.colorKeywords||{},h=t.valueKeywords||{},f=t.allowNested,k=t.lineComment,y=!0===t.supportsAtComponent;function w(e,t){return a=t,e}function v(i){return function(e,t){for(var r,o=!1;null!=(r=e.next());){if(r==i&&!o){")"==i&&e.backUp(1);break}o=!o&&"\\"==r}return r!=i&&(o||")"==i)||(t.tokenize=null),a="string"}}function x(e,t){return e.next(),e.match(/\s*[\"\')]/,!1)?t.tokenize=null:t.tokenize=v(")"),a="(",null}function z(e,t,r){this.type=e,this.indent=t,this.prev=r}function j(e,t,r,o){return e.context=new z(r,t.indentation()+(!1===o?0:n),e.context),r}function P(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function q(e,t,r){return B[r.context.type](e,t,r)}function K(e,t,r,o){for(var i=o||1;0<i;i--)r.context=r.context.prev;return q(e,t,r)}function C(e){var t=e.current().toLowerCase();i=h.hasOwnProperty(t)?"atom":g.hasOwnProperty(t)?"keyword":"variable"}var B={top:function(e,t,r){if("{"==e)return j(r,t,"block");if("}"==e&&r.context.prev)return P(r);if(y&&/@component/i.test(e))return j(r,t,"atComponentBlock");if(/^@(-moz-)?document$/i.test(e))return j(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/i.test(e))return j(r,t,"atBlock");if(/^@(font-face|counter-style)/i.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return j(r,t,"at");if("hash"==e)i="builtin";else if("word"==e)i="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return j(r,t,"interpolation");if(":"==e)return"pseudo";if(f&&"("==e)return j(r,t,"parens")}return r.context.type},block:function(e,t,r){if("word"!=e)return"meta"==e?"block":f||"hash"!=e&&"qualifier"!=e?B.top(e,t,r):(i="error","block");var o=t.current().toLowerCase();return p.hasOwnProperty(o)?(i="property","maybeprop"):u.hasOwnProperty(o)?(i="string-2","maybeprop"):f?(i=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(i+=" error","maybeprop")},maybeprop:function(e,t,r){return":"==e?j(r,t,"prop"):q(e,t,r)},prop:function(e,t,r){if(";"==e)return P(r);if("{"==e&&f)return j(r,t,"propBlock");if("}"==e||"{"==e)return K(e,t,r);if("("==e)return j(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)C(t);else if("interpolation"==e)return j(r,t,"interpolation")}else i+=" error";return"prop"},propBlock:function(e,t,r){return"}"==e?P(r):"word"==e?(i="property","maybeprop"):r.context.type},parens:function(e,t,r){return"{"==e||"}"==e?K(e,t,r):")"==e?P(r):"("==e?j(r,t,"parens"):"interpolation"==e?j(r,t,"interpolation"):("word"==e&&C(t),"parens")},pseudo:function(e,t,r){return"meta"==e?"pseudo":"word"==e?(i="variable-3",r.context.type):q(e,t,r)},documentTypes:function(e,t,r){return"word"==e&&o.hasOwnProperty(t.current())?(i="tag",r.context.type):B.atBlock(e,t,r)},atBlock:function(e,t,r){return"("==e?j(r,t,"atBlock_parens"):"}"==e||";"==e?K(e,t,r):"{"==e?P(r)&&j(r,t,f?"block":"top"):"interpolation"==e?j(r,t,"interpolation"):("word"==e&&(o=t.current().toLowerCase(),i="only"==o||"not"==o||"and"==o||"or"==o?"keyword":s.hasOwnProperty(o)?"attribute":d.hasOwnProperty(o)?"property":c.hasOwnProperty(o)?"keyword":p.hasOwnProperty(o)?"property":u.hasOwnProperty(o)?"string-2":h.hasOwnProperty(o)?"atom":g.hasOwnProperty(o)?"keyword":"error"),r.context.type);var o},atComponentBlock:function(e,t,r){return"}"==e?K(e,t,r):"{"==e?P(r)&&j(r,t,f?"block":"top",!1):("word"==e&&(i="error"),r
|