1(function(a){if(typeof exports=="object"&&typeof module=="object")a(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../ruby/ruby"));else if(typeof define=="function"&&define.amd)define(["../../lib/codemirror","../htmlmixed/htmlmixed","../ruby/ruby"],a);else a(CodeMirror)})(function(a){"use strict";a.defineMode("slim",function(b){var c=a.getMode(b,{name:"htmlmixed"});var d=a.getMode(b,"ruby");var e={html:c,ruby:d};var f={ruby:"ruby",javascript:"javascript",css:"text/css",sass:"text/x-sass",scss:"text/x-scss",less:"text/x-less",styl:"text/x-styl",coffee:"coffeescript",asciidoc:"text/x-asciidoc",markdown:"text/x-markdown",textile:"text/x-textile",creole:"text/x-creole",wiki:"text/x-wiki",mediawiki:"text/x-mediawiki",rdoc:"text/x-rdoc",builder:"text/x-builder",nokogiri:"text/x-nokogiri",erb:"application/x-erb"};var g=function(a){var b=[];for(var c in a)b.push(c);return new RegExp("^("+b.join("|")+"):")}(f);var h={commentLine:"comment",slimSwitch:"operator special",slimTag:"tag",slimId:"attribute def",slimClass:"attribute qualifier",slimAttribute:"attribute",slimSubmode:"keyword special",closeAttributeTag:null,slimDoctype:null,lineContinuation:null};var i={"{":"}","[":"]","(":")"};var j="_a-zA-ZÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�";var k=j+"\\-0-9·̀-ͯ‿-⁀";var l=new RegExp("^[:"+j+"](?::["+k+"]|["+k+"]*)");var m=new RegExp("^[:"+j+"][:\\."+k+"]*(?=\\s*=)");var n=new RegExp("^[:"+j+"][:\\."+k+"]*");var o=/^\.-?[_a-zA-Z]+[\w\-]*/;var p=/^#[_a-zA-Z]+[\w\-]*/;function q(a,b,c){var d=function(d,e){e.tokenize=b;if(d.pos<a){d.pos=a;return c}return e.tokenize(d,e)};return function(a,c){c.tokenize=d;return b(a,c)}}function r(a,b,c,d,e){var f=a.current();var g=f.search(c);if(g>-1){b.tokenize=q(a.pos,b.tokenize,e);a.backUp(f.length-g-d)}return e}function s(a,b){a.stack={parent:a.stack,style:"continuation",indented:b,tokenize:a.line};a.line=a.tokenize}function t(a){if(a.line==a.tokenize){a.line=a.stack.tokenize;a.stack=a.stack.parent}}function u(a,b){return function(c,d){t(d);if(c.match(/^\\$/)){s(d,a);return"lineContinuation"}var e=b(c,d);if(c.eol()&&c.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)){c.backUp(1)}return e}}function v(a,b){return function(c,d){t(d);var e=b(c,d);if(c.eol()&&c.current().match(/,$/)){s(d,a)}return e}}function w(a,b){return function(c,d){var e=c.peek();if(e==a&&d.rubyState.tokenize.length==1){c.next();d.tokenize=b;return"closeAttributeTag"}else{return y(c,d)}}}function x(b){var c;var e=function(a,d){if(d.rubyState.tokenize.length==1&&!d.rubyState.context.prev){a.backUp(1);if(a.eatSpace()){d.rubyState=c;d.tokenize=b;return b(a,d)}a.next()}return y(a,d)};return function(b,f){c=f.rubyState;f.rubyState=a.startState(d);f.tokenize=e;return y(b,f)}}function y(a,b){return d.token(a,b.rubyState)}function z(a,b){if(a.match(/^\\$/)){return"lineContinuation"}return A(a,b)}function A(a,b){if(a.match(/^#\{/)){b.tokenize=w("}",b.tokenize);return null}return r(a,b,/[^\\]#\{/,1,c.token(a,b.htmlState))}function B(a){return function(b,c){var d=z(b,c);if(b.eol())c.tokenize=a;return d}}function C(a,b,c){b.stack={parent:b.stack,style:"html",indented:a.column()+c,tokenize:b.line};b.line=b.tokenize=A;return null}function D(a,b){a.skipToEnd();return b.stack.style}function E(a,b){b.stack={parent:b.stack,style:"comment",indented:b.indented+1,tokenize:b.line};b.line=D;return D(a,b)}function F(a,b){if(a.eat(b.stack.endQuote)){b.line=b.stack.line;b.tokenize=b.stack.tokenize;b.stack=b.stack.parent;return null}if(a.match(n)){b.tokenize=G;return"slimAttribute"}a.next();return null}function G(a,b){if(a.match(/^==?/)){b.tokenize=H;return null}return F(a,b)}function H(a,b){var c=a.peek();if(c=='"'||c=="'"){b.tokenize=Y(c,"string",true,false,F);a.next();return b.tokenize(a,b)}if(c=="["){return x(F)(a,b)}if(a.match(/^(true|false|nil)\b/)){b.tokenize=F;return"keyword"}return x(F)(a,b)}function I(a,b,c){a.stack={parent:a.stack,style:"wrapper",indented:a.indented+1,tokenize:c,line:a.line,endQuote:b};a.line=a.tokenize=F;return null}function J(b,c){if(b.match(/^#\{/)){c.tokenize=w("}",c.tokenize);return null}var d=new a.StringStream(b.string.slice(c.stack.indented),b.tabSize);d.pos=b.pos-c.stack.indented;d.start=b.start-c.stack.indented;d.lastColumnPos=b.lastColumnPos-c.stack.indented;d.lastColumnValue=b.lastColumnValue-c.stack.indented;var e=c.subMode.token(d,c.subState);b.pos=d.pos+c.stack.indented;return e}function K(a,b){b.stack.indented=a.column();b.line=b.tokenize=J;return b.tokenize(a,b)}function L(c){var d=f[c];var e=a.mimeModes[d];if(e){return a.getMode(b,e)}var g=a.modes[d];if(g){return g(b,{name:d})}return a.getMode(b,"null")}function M(a){if(!e.hasOwnProperty(a)){return e[a]=L(a)}return e[a]}function N(b,c){var d=M(b);var e=a.startState(d);c.subMode=d;c.subState=e;c.stack={parent:c.stack,style:"sub",indented:c.indented+1,tokenize:c.line};c.line=c.tokenize=K;return"slimSubmode"}function O(a,b){a.skipToEnd();return"slimDoctype"}function P(a,b){var c=a.peek();if(c=="<"){return(b.tokenize=B(b.tokenize))(a,b)}if(a.match(/^[|']/)){return C(a,b,1)}if(a.match(/^\/(!|\[\w+])?/)){return E(a,b)}if(a.match(/^(-|==?[<>]?)/)){b.tokenize=u(a.column(),v(a.column(),y));return"slimSwitch"}if(a.match(/^doctype\b/)){b.tokenize=O;return"keyword"}var d=a.match(g);if(d){return N(d[1],b)}return R(a,b)}function Q(a,b){if(b.startOfLine){return P(a,b)}return R(a,b)}function R(a,b){if(a.eat("*")){b.tokenize=x(S);return null}if(a.match(l)){b.tokenize=S;return"slimTag"}return T(a,b)}function S(a,b){if(a.match(/^(<>?|><?)/)){b.tokenize=T;return null}return T(a,b)}function T(a,b){if(a.match(p)){b.tokenize=T;return"slimId"}if(a.match(o)){b.tokenize=T;return"slimClass"}return U(a,b)}function U(a,b){if(a.match(/^([\[\{\(])/)){return I(b,i[RegExp.$1],U)}if(a.match(m)){b.tokenize=V;return"slimAttribute"}if(a.peek()=="*"){a.next();b.tokenize=x(Z);return null}return Z(a,b)}function V(a,b){if(a.match(/^==?/)){b.tokenize=W;return null}return U(a,b)}function W(a,b){var c=a.peek();if(c=='"'||c=="'"){b.tokenize=Y(c,"string",true,false,U);a.next();return b.tokenize(a,b)}if(c=="["){return x(U)(a,b)}if(c==":"){return x(X)(a,b)}if(a.match(/^(true|false|nil)\b/)){b.tokenize=U;return"keyword"}return x(U)(a,b)}function X(a,b){a.backUp(1);if(a.match(/^[^\s],(?=:)/)){b.tokenize=x(X);return null}a.next();return U(a,b)}function Y(a,b,c,d,e){return function(f,g){t(g);var h=f.current().length==0;if(f.match(/^\\$/,h)){if(!h)return b;s(g,g.indented);return"lineContinuation"}if(f.match(/^#\{/,h)){if(!h)return b;g.tokenize=w("}",g.tokenize);return null}var i=false,j;while((j=f.next())!=null){if(j==a&&(d||!i)){g.tokenize=e;break}if(c&&j=="#"&&!i){if(f.eat("{")){f.backUp(2);break}}i=!i&&j=="\\"}if(f.eol()&&i){f.backUp(1)}return b}}function Z(a,b){if(a.match(/^==?/)){b.tokenize=y;return"slimSwitch"}if(a.match(/^\/$/)){b.tokenize=Q;return null}if(a.match(/^:/)){b.tokenize=R;return"slimSwitch"}C(a,b,0);return b.tokenize(a,b)}var $={startState:function(){var b=a.startState(c);var e=a.startState(d);return{htmlState:b,rubyState:e,stack:null,last:null,tokenize:Q,line:Q,indented:0}},copyState:function(b){return{htmlState:a.copyState(c,b.htmlState),rubyState:a.copyState(d,b.rubyState),subMode:b.subMode,subState:b.subMode&&a.copyState(b.subMode,b.subState),stack:b.stack,last:b.last,tokenize:b.tokenize,line:b.line}},token:function(a,b){if(a.sol()){b.indented=a.indentation();b.startOfLine=true;b.tokenize=b.line;while(b.stack&&b.stack.indented>b.indented&&b.last!="slimSubmode"){b.line=b.tokenize=b.stack.tokenize;b.stack=b.stack.parent;b.subMode=null;b.subState=null}}if(a.eatSpace())return null;var c=b.tokenize(a,b);b.startOfLine=false;if(c)b.last=c;return h.hasOwnProperty(c)?h[c]:c},blankLine:function(a){if(a.subMode&&a.subMode.blankLine){return a.subMode.blankLine(a.subState)}},innerMode:function(a){if(a.subMode)return{state:a.subState,mode:a.subMode};return{state:a,mode:$}}};return $},"htmlmixed","ruby");a.defineMIME("text/x-slim","slim");a.defineMIME("application/x-slim","slim")}); 2//# sourceMappingURL=slim.min.js.map