var e=/^(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)$/,t=/^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/,n=/^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/,r=/[^\s'`,@()\[\]";]/,i;function a(e){for(var t;t=e.next();)if(t==`\\`)e.next();else if(!r.test(t)){e.backUp(1);break}return e.current()}function o(r,o){if(r.eatSpace())return i=`ws`,null;if(r.match(n))return`number`;var l=r.next();if(l==`\\`&&(l=r.next()),l==`"`)return(o.tokenize=s)(r,o);if(l==`(`)return i=`open`,`bracket`;if(l==`)`)return i=`close`,`bracket`;if(l==`;`)return r.skipToEnd(),i=`ws`,`comment`;if(/['`,@]/.test(l))return null;if(l==`|`)return r.skipTo(`|`)?(r.next(),`variableName`):(r.skipToEnd(),`error`);if(l==`#`){var l=r.next();return l==`(`?(i=`open`,`bracket`):/[+\-=\.']/.test(l)||/\d/.test(l)&&r.match(/^\d*#/)?null:l==`|`?(o.tokenize=c)(r,o):l==`:`?(a(r),`meta`):l==`\\`?(r.next(),a(r),`string.special`):`error`}else{var u=a(r);return u==`.`?null:(i=`symbol`,u==`nil`||u==`t`||u.charAt(0)==`:`?`atom`:o.lastType==`open`&&(e.test(u)||t.test(u))?`keyword`:u.charAt(0)==`&`?`variableName.special`:`variableName`)}}function s(e,t){for(var n=!1,r;r=e.next();){if(r==`"`&&!n){t.tokenize=o;break}n=!n&&r==`\\`}return`string`}function c(e,t){for(var n,r;n=e.next();){if(n==`#`&&r==`|`){t.tokenize=o;break}r=n}return i=`ws`,`comment`}const l={name:`commonlisp`,startState:function(){return{ctx:{prev:null,start:0,indentTo:0},lastType:null,tokenize:o}},token:function(e,n){e.sol()&&typeof n.ctx.indentTo!=`number`&&(n.ctx.indentTo=n.ctx.start+1),i=null;var r=n.tokenize(e,n);return i!=`ws`&&(n.ctx.indentTo==null?i==`symbol`&&t.test(e.current())?n.ctx.indentTo=n.ctx.start+e.indentUnit:n.ctx.indentTo=`next`:n.ctx.indentTo==`next`&&(n.ctx.indentTo=e.column()),n.lastType=i),i==`open`?n.ctx={prev:n.ctx,start:e.column(),indentTo:null}:i==`close`&&(n.ctx=n.ctx.prev||n.ctx),r},indent:function(e){var t=e.ctx.indentTo;return typeof t==`number`?t:e.ctx.start+1},languageData:{commentTokens:{line:`;;`,block:{open:`#|`,close:`|#`}},closeBrackets:{brackets:[`(`,`[`,`{`,`"`]}}};export{l as commonLisp};