1 line
4.1 KiB
JavaScript
Vendored
1 line
4.1 KiB
JavaScript
Vendored
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9558],{29558:function(e,n,t){t.r(n),t.d(n,{coffeeScript:function(){return m}});var o="error";function wordRegexp(e){return RegExp("^(("+e.join(")|(")+"))\\b")}var r=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,c=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,i=/^[_A-Za-z$][_A-Za-z$0-9]*/,a=/^@[_A-Za-z$][_A-Za-z$0-9]*/,f=wordRegexp(["and","or","not","is","isnt","in","instanceof","typeof"]),p=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],s=wordRegexp(p.concat(["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"]));p=wordRegexp(p);var u=/^('{3}|\"{3}|['\"])/,l=/^(\/{3}|\/)/,d=wordRegexp(["Infinity","NaN","undefined","null","true","false","on","off","yes","no"]);function tokenBase(e,n){if(e.sol()){null===n.scope.align&&(n.scope.align=!1);var t=n.scope.offset;if(e.eatSpace()){var p=e.indentation();return p>t&&"coffee"==n.scope.type?"indent":p<t?"dedent":null}t>0&&dedent(e,n)}if(e.eatSpace())return null;var m=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return n.tokenize=longComment,n.tokenize(e,n);if("#"===m)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var h=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(h=!0),e.match(/^-?\d+\.\d*/)&&(h=!0),e.match(/^-?\.\d+/)&&(h=!0),h)return"."==e.peek()&&e.backUp(1),"number";var k=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(k=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(k=!0),e.match(/^-?0(?![\dx])/i)&&(k=!0),k)return"number"}if(e.match(u))return n.tokenize=tokenFactory(e.current(),!1,"string"),n.tokenize(e,n);if(e.match(l)){if("/"!=e.current()||e.match(/^.*\//,!1))return n.tokenize=tokenFactory(e.current(),!0,"string.special"),n.tokenize(e,n);e.backUp(1)}return e.match(r)||e.match(f)?"operator":e.match(c)?"punctuation":e.match(d)?"atom":e.match(a)||n.prop&&e.match(i)?"property":e.match(s)?"keyword":e.match(i)?"variable":(e.next(),o)}function tokenFactory(e,n,t){return function(o,r){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),n&&o.eol())return t}else{if(o.match(e))return r.tokenize=tokenBase,t;o.eat(/['"\/]/)}return n&&(r.tokenize=tokenBase),t}}function longComment(e,n){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){n.tokenize=tokenBase;break}e.eatWhile("#")}return"comment"}function indent(e,n,t="coffee"){for(var o=0,r=!1,c=null,i=n.scope;i;i=i.prev)if("coffee"===i.type||"}"==i.type){o=i.offset+e.indentUnit;break}"coffee"!==t?(r=null,c=e.column()+e.current().length):n.scope.align&&(n.scope.align=!1),n.scope={offset:o,type:t,prev:n.scope,align:r,alignOffset:c}}function dedent(e,n){if(n.scope.prev){if("coffee"!==n.scope.type)return n.scope=n.scope.prev,!1;for(var t=e.indentation(),o=!1,r=n.scope;r;r=r.prev)if(t===r.offset){o=!0;break}if(!o)return!0;for(;n.scope.prev&&n.scope.offset!==t;)n.scope=n.scope.prev;return!1}}let m={name:"coffeescript",startState:function(){return{tokenize:tokenBase,scope:{offset:0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,n){var t=null===n.scope.align&&n.scope;t&&e.sol()&&(t.align=!1);var r=function(e,n){var t=n.tokenize(e,n),r=e.current();"return"===r&&(n.dedent=!0),(("->"===r||"=>"===r)&&e.eol()||"indent"===t)&&indent(e,n);var c="[({".indexOf(r);if(-1!==c&&indent(e,n,"])}".slice(c,c+1)),p.exec(r)&&indent(e,n),"then"==r&&dedent(e,n),"dedent"===t&&dedent(e,n))return o;if(-1!==(c="])}".indexOf(r))){for(;"coffee"==n.scope.type&&n.scope.prev;)n.scope=n.scope.prev;n.scope.type==r&&(n.scope=n.scope.prev)}return n.dedent&&e.eol()&&("coffee"==n.scope.type&&n.scope.prev&&(n.scope=n.scope.prev),n.dedent=!1),"indent"==t||"dedent"==t?null:t}(e,n);return r&&"comment"!=r&&(t&&(t.align=!0),n.prop="punctuation"==r&&"."==e.current()),r},indent:function(e,n){if(e.tokenize!=tokenBase)return 0;var t=e.scope,o=n&&"])}".indexOf(n.charAt(0))>-1;if(o)for(;"coffee"==t.type&&t.prev;)t=t.prev;var r=o&&t.type===n.charAt(0);return t.align?t.alignOffset-(r?1:0):(r?t.prev:t).offset},languageData:{commentTokens:{line:"#"}}}}}]); |