var i=/^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/,c=/^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/,s=/^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/,u=/[^\s'`,@()\[\]";]/,o;function l(t){for(var e;e=t.next();)if(e=="\\")t.next();else if(!u.test(e)){t.backUp(1);break}return t.current()}function a(t,e){if(t.eatSpace())return o="ws",null;if(t.match(s))return"number";var n=t.next();if(n=="\\"&&(n=t.next()),n=='"')return(e.tokenize=d)(t,e);if(n=="(")return o="open","bracket";if(n==")")return o="close","bracket";if(n==";")return t.skipToEnd(),o="ws","comment";if(/['`,@]/.test(n))return null;if(n=="|")return t.skipTo("|")?(t.next(),"variableName"):(t.skipToEnd(),"error");if(n=="#"){var n=t.next();return n=="("?(o="open","bracket"):/[+\-=\.']/.test(n)||/\d/.test(n)&&t.match(/^\d*#/)?null:n=="|"?(e.tokenize=f)(t,e):n==":"?(l(t),"meta"):n=="\\"?(t.next(),l(t),"string.special"):"error"}else{var r=l(t);return r=="."?null:(o="symbol",r=="nil"||r=="t"||r.charAt(0)==":"?"atom":e.lastType=="open"&&(i.test(r)||c.test(r))?"keyword":r.charAt(0)=="&"?"variableName.special":"variableName")}}function d(t,e){for(var n=!1,r;r=t.next();){if(r=='"'&&!n){e.tokenize=a;break}n=!n&&r=="\\"}return"string"}function f(t,e){for(var n,r;n=t.next();){if(n=="#"&&r=="|"){e.tokenize=a;break}r=n}return o="ws","comment"}const m={name:"commonlisp",startState:function(){return{ctx:{prev:null,start:0,indentTo:0},lastType:null,tokenize:a}},token:function(t,e){t.sol()&&typeof e.ctx.indentTo!="number"&&(e.ctx.indentTo=e.ctx.start+1),o=null;var n=e.tokenize(t,e);return o!="ws"&&(e.ctx.indentTo==null?o=="symbol"&&c.test(t.current())?e.ctx.indentTo=e.ctx.start+t.indentUnit:e.ctx.indentTo="next":e.ctx.indentTo=="next"&&(e.ctx.indentTo=t.column()),e.lastType=o),o=="open"?e.ctx={prev:e.ctx,start:t.column(),indentTo:null}:o=="close"&&(e.ctx=e.ctx.prev||e.ctx),n},indent:function(t){var e=t.ctx.indentTo;return typeof e=="number"?e:t.ctx.start+1},languageData:{commentTokens:{line:";;",block:{open:"#|",close:"|#"}},closeBrackets:{brackets:["(","[","{",'"']}}};export{m as t};
