function forEach(e,t){for(var n=0;n<e.length;n++)t(e[n],n);}function some(e,t){for(var n=0;n<e.length;n++)if(t(e[n],n))return !0;return !1}var words={unnamedDefinition:["interface"],namedDefinition:["module","library","macro","C-struct","C-union","C-function","C-callable-wrapper"],typeParameterizedDefinition:["class","C-subtype","C-mapped-subtype"],otherParameterizedDefinition:["method","function","C-variable","C-address"],constantSimpleDefinition:["constant"],variableSimpleDefinition:["variable"],otherSimpleDefinition:["generic","domain","C-pointer-type","table"],statement:["if","block","begin","method","case","for","select","when","unless","until","while","iterate","profiling","dynamic-bind"],separator:["finally","exception","cleanup","else","elseif","afterwards"],other:["above","below","by","from","handler","in","instance","let","local","otherwise","slot","subclass","then","to","keyed-by","virtual"],signalingCalls:["signal","error","cerror","break","check-type","abort"]};words.otherDefinition=words.unnamedDefinition.concat(words.namedDefinition).concat(words.otherParameterizedDefinition),words.definition=words.typeParameterizedDefinition.concat(words.otherDefinition),words.parameterizedDefinition=words.typeParameterizedDefinition.concat(words.otherParameterizedDefinition),words.simpleDefinition=words.constantSimpleDefinition.concat(words.variableSimpleDefinition).concat(words.otherSimpleDefinition),words.keyword=words.statement.concat(words.separator).concat(words.other);var symbolPattern="[-_a-zA-Z?!*@<>$%]+",symbol=new RegExp("^"+symbolPattern),patterns={symbolKeyword:symbolPattern+":",symbolClass:"<"+symbolPattern+">",symbolGlobal:"\\*"+symbolPattern+"\\*",symbolConstant:"\\$"+symbolPattern},patternStyles={symbolKeyword:"atom",symbolClass:"tag",symbolGlobal:"variableName.standard",symbolConstant:"variableName.constant"};for(var patternName in patterns)patterns.hasOwnProperty(patternName)&&(patterns[patternName]=new RegExp("^"+patterns[patternName]));patterns.keyword=[/^with(?:out)?-[-_a-zA-Z?!*@<>$%]+/];var styles={keyword:"keyword",definition:"def",simpleDefinition:"def",signalingCalls:"builtin"},wordLookup={},styleLookup={};function chain(e,t,n){return t.tokenize=n,n(e,t)}function tokenBase(e,t){var n=e.peek();if("'"==n||'"'==n)return e.next(),chain(e,t,tokenString(n,"string"));if("/"==n){if(e.next(),e.eat("*"))return chain(e,t,tokenComment);if(e.eat("/"))return e.skipToEnd(),"comment";e.backUp(1);}else if(/[+\-\d\.]/.test(n)){if(e.match(/^[+-]?[0-9]*\.[0-9]*([esdx][+-]?[0-9]+)?/i)||e.match(/^[+-]?[0-9]+([esdx][+-]?[0-9]+)/i)||e.match(/^[+-]?\d+/))return "number"}else {if("#"==n)return e.next(),'"'==(n=e.peek())?(e.next(),chain(e,t,tokenString('"',"string"))):"b"==n?(e.next(),e.eatWhile(/[01]/),"number"):"x"==n?(e.next(),e.eatWhile(/[\da-f]/i),"number"):"o"==n?(e.next(),e.eatWhile(/[0-7]/),"number"):"#"==n?(e.next(),"punctuation"):"["==n||"("==n?(e.next(),"bracket"):e.match(/f|t|all-keys|include|key|next|rest/i)?"atom":(e.eatWhile(/[-a-zA-Z]/),"error");if("~"==n)return e.next(),"="==(n=e.peek())?(e.next(),"="==(n=e.peek())?(e.next(),"operator"):"operator"):"operator";if(":"==n){if(e.next(),"="==(n=e.peek()))return e.next(),"operator";if(":"==n)return e.next(),"punctuation"}else {if(-1!="[](){}".indexOf(n))return e.next(),"bracket";if(-1!=".,".indexOf(n))return e.next(),"punctuation";if(e.match("end"))return "keyword"}}for(var r in patterns)if(patterns.hasOwnProperty(r)){var o=patterns[r];if(o instanceof Array&&some(o,(function(t){return e.match(t)}))||e.match(o))return patternStyles[r]}return /[+\-*\/^=<>&|]/.test(n)?(e.next(),"operator"):e.match("define")?"def":(e.eatWhile(/[\w\-]/),wordLookup.hasOwnProperty(e.current())?styleLookup[e.current()]:e.current().match(symbol)?"variable":(e.next(),"variableName.standard"))}function tokenComment(e,t){for(var n,r=!1,o=!1,i=0;n=e.next();){if("/"==n&&r){if(!(i>0)){t.tokenize=tokenBase;break}i--;}else "*"==n&&o&&i++;r="*"==n,o="/"==n;}return "comment"}function tokenString(e,t){return function(n,r){for(var o,i=!1,a=!1;null!=(o=n.next());){if(o==e&&!i){a=!0;break}i=!i&&"\\"==o;}return !a&&i||(r.tokenize=tokenBase),t}}forEach(["keyword","definition","simpleDefinition","signalingCalls"],(function(e){forEach(words[e],(function(t){wordLookup[t]=e,styleLookup[t]=styles[e];}));}));const dylan={startState:function(){return {tokenize:tokenBase,currentIndent:0}},token:function(e,t){return e.eatSpace()?null:t.tokenize(e,t)},languageData:{commentTokens:{block:{open:"/*",close:"*/"}}}};

export { dylan };
