2023-08-30 07:38:48 -04:00
|
|
|
function Ve(e,n,t,r,o,i){this.indented=e,this.column=n,this.type=t,this.info=r,this.align=o,this.prev=i}function Te(e,n,t,r){var o=e.indented;return e.context&&e.context.type=="statement"&&t!="statement"&&(o=e.context.indented),e.context=new Ve(o,n,t,r,null,e.context)}function ge(e){var n=e.context.type;return(n==")"||n=="]"||n=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}function En(e,n,t){if(n.prevToken=="variable"||n.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,t))||n.typeAtEndOfLine&&e.column()==e.indentation())return!0}function Ze(e){for(;;){if(!e||e.type=="top")return!0;if(e.type=="}"&&e.prev.info!="namespace")return!1;e=e.prev}}function U(e){var n=e.statementIndentUnit,t=e.dontAlignCalls,r=e.keywords||{},o=e.types||{},i=e.builtin||{},a=e.blockKeywords||{},p=e.defKeywords||{},S=e.atoms||{},E=e.hooks||{},x=e.multiLineStrings,c=e.indentStatements!==!1,d=e.indentSwitch!==!1,k=e.namespaceSeparator,A=e.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,W=e.numberStart||/[\d\.]/,N=e.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,u=e.isOperatorChar||/[+\-*&%=<>!?|\/]/,T=e.isIdentifierChar||/[\w\$_\xa1-\uffff]/,w=e.isReservedIdentifier||!1,C,l;function s(h,f){var z=h.next();if(E[z]){var y=E[z](h,f);if(y!==!1)return y}if(z=='"'||z=="'")return f.tokenize=I(z),f.tokenize(h,f);if(W.test(z)){if(h.backUp(1),h.match(N))return"number";h.next()}if(A.test(z))return C=z,null;if(z=="/"){if(h.eat("*"))return f.tokenize=v,v(h,f);if(h.eat("/"))return h.skipToEnd(),"comment"}if(u.test(z)){for(;!h.match(/^\/[\/*]/,!1)&&h.eat(u););return"operator"}if(h.eatWhile(T),k)for(;h.match(k);)h.eatWhile(T);var D=h.current();return J(r,D)?(J(a,D)&&(C="newstatement"),J(p,D)&&(l=!0),"keyword"):J(o,D)?"type":J(i,D)||w&&w(D)?(J(a,D)&&(C="newstatement"),"builtin"):J(S,D)?"atom":"variable"}function I(h){return function(f,z){for(var y=!1,D,V=!1;(D=f.next())!=null;){if(D==h&&!y){V=!0;break}y=!y&&D=="\\"}return(V||!(y||x))&&(z.tokenize=null),"string"}}function v(h,f){for(var z=!1,y;y=h.next();){if(y=="/"&&z){f.tokenize=null;break}z=y=="*"}return"comment"}function O(h,f){e.typeFirstDefinitions&&h.eol()&&Ze(f.context)&&(f.typeAtEndOfLine=En(h,f,h.pos))}return{name:e.name,startState:function(h){return{tokenize:null,context:new Ve(-h,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(h,f){var z=f.context;if(h.sol()&&(z.align==null&&(z.align=!1),f.indented=h.indentation(),f.startOfLine=!0),h.eatSpace())return O(h,f),null;C=l=null;var y=(f.tokenize||s)(h,f);if(y=="comment"||y=="meta")return y;if(z.align==null&&(z.align=!0),C==";"||C==":"||C==","&&h.match(/^\s*(?:\/\/.*)?$/,!1))for(;f.context.type=="statement";)ge(f);else if(C=="{")Te(f,h.column(),"}");else if(C=="[")Te(f,h.column(),"]");else if(C=="(")Te(f,h.column(),")");else if(C=="}"){for(;z.type=="statement";)z=ge(f);for(z.type=="}"&&(z=ge(f));z.type=="statement";)z=ge(f)}else C==z.type?ge(f):c&&((z.type=="}"||z.type=="top")&&C!=";"||z.type=="statement"&&C=="newstatement")&&Te(f,h.column(),"statement",h.current());if(y=="variable"&&(f.prevToken=="def"||e.typeFirstDefinitions&&En(h,f,h.start)&&Ze(f.context)&&h.match(/^\s*\(/,!1))&&(y="def"),E.token){var D=E.token(h,f,y);D!==void 0&&(y=D)}return y=="def"&&e.styleDefs===!1&&(y="variable"),f.startOfLine=!1,f.prevToken=l?"def":y||C,O(h,f),y},indent:function(h,f,z){if(h.tokenize!=s&&h.tokenize!=null||h.typeAtEndOfLine&&Ze(h.context))return null;var y=h.context,D=f&&f.charAt(0),V=D==y.type;if(y.type=="statement"&&D=="}"&&(y=y.prev),e.dontIndentStatements)for(;y.type=="statement"&&e.dontIndentStatements.test(y.info);)y=y.prev;if(E.indent){var me=E.indent(h,y,f,z.unit);if(typeof me=="number")return me}var Ue=y.prev&&y.prev.info=="switch";if(e.allmanIndentation&&/[{(]/.test(D)){for(;y.type!="top"&&y.type!="}";)y=y.prev;return y.indented}return y.type=="statement"?y.indented+(D=="{"?0:n||z.unit):y.align&&(!t||y.type!=")")?y.column+(V?0:1):y.type==")"&&!V?y.indented+(n||z.unit):y.indented+(V?0:z.unit)+(!V&&Ue&&!/^(?:case|default)\b/.test(f)?z.unit:0)},languageData:{indentOnInput:d?/^
|