This commit is contained in:
Iaatw
2026-05-08 13:39:01 +08:00
commit 6901a2071a
145 changed files with 420 additions and 0 deletions

View File

@@ -0,0 +1 @@
function e(e){t(e,`start`);var n={},r=e.languageData||{},s=!1;for(var c in e)if(c!=r&&e.hasOwnProperty(c))for(var l=n[c]=[],u=e[c],d=0;d<u.length;d++){var f=u[d];l.push(new i(f,e)),(f.indent||f.dedent)&&(s=!0)}return{name:r.name,startState:function(){return{state:`start`,pending:null,indent:s?[]:null}},copyState:function(e){var t={state:e.state,pending:e.pending,indent:e.indent&&e.indent.slice(0)};return e.stack&&(t.stack=e.stack.slice(0)),t},token:a(n),indent:o(n,r),mergeTokens:r.mergeTokens,languageData:r}}function t(e,t){if(!e.hasOwnProperty(t))throw Error(`Undefined state `+t+` in simple mode`)}function n(e,t){if(!e)return/(?:)/;var n=``;return e instanceof RegExp?(e.ignoreCase&&(n=`i`),e.unicode&&(n+=`u`),e=e.source):e=String(e),RegExp((t===!1?``:`^`)+`(?:`+e+`)`,n)}function r(e){if(!e)return null;if(e.apply)return e;if(typeof e==`string`)return e.replace(/\./g,` `);for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g,` `));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function a(e){return function(t,n){if(n.pending){var r=n.pending.shift();return n.pending.length==0&&(n.pending=null),t.pos+=r.text.length,r.token}for(var i=e[n.state],a=0;a<i.length;a++){var o=i[a],s=(!o.data.sol||t.sol())&&t.match(o.regex);if(s){o.data.next?n.state=o.data.next:o.data.push?((n.stack||=[]).push(n.state),n.state=o.data.push):o.data.pop&&n.stack&&n.stack.length&&(n.state=n.stack.pop()),o.data.indent&&n.indent.push(t.indentation()+t.indentUnit),o.data.dedent&&n.indent.pop();var c=o.token;if(c&&c.apply&&(c=c(s)),s.length>2&&o.token&&typeof o.token!=`string`){n.pending=[];for(var l=2;l<s.length;l++)s[l]&&n.pending.push({text:s[l],token:o.token[l-1]});return t.backUp(s[0].length-(s[1]?s[1].length:0)),c[0]}else if(c&&c.join)return c[0];else return c}}return t.next(),null}}function o(e,t){return function(n,r){if(n.indent==null||t.dontIndentStates&&t.dontIndentStates.indexOf(n.state)>-1)return null;var i=n.indent.length-1,a=e[n.state];scan:for(;;){for(var o=0;o<a.length;o++){var s=a[o];if(s.data.dedent&&s.data.dedentIfLineStart!==!1){var c=s.regex.exec(r);if(c&&c[0]){i--,(s.next||s.push)&&(a=e[s.next||s.push]),r=r.slice(c[0].length);continue scan}}}break}return i<0?0:n.indent[i]}}export{e as t};