function switchState(e,t,r){return t(r),r(e,t)}var smallRE=/[a-z_]/,largeRE=/[A-Z]/,digitRE=/\d/,hexitRE=/[0-9A-Fa-f]/,octitRE=/[0-7]/,idRE=/[a-z_A-Z0-9'\xa1-\uffff]/,symbolRE=/[-!#$%&*+.\/<=>?@\\^|~:]/,specialRE=/[(),;[\]`{}]/,whiteCharRE=/[ \t\v\f]/;function normal(e,t){if(e.eatWhile(whiteCharRE))return null;var r=e.next();if(specialRE.test(r)){if("{"==r&&e.eat("-")){var n="comment";return e.eat("#")&&(n="meta"),switchState(e,t,ncomment(n,1))}return null}if("'"==r)return e.eat("\\"),e.next(),e.eat("'")?"string":"error";if('"'==r)return switchState(e,t,stringLiteral);if(largeRE.test(r))return e.eatWhile(idRE),e.eat(".")?"qualifier":"type";if(smallRE.test(r))return e.eatWhile(idRE),"variable";if(digitRE.test(r)){if("0"==r){if(e.eat(/[xX]/))return e.eatWhile(hexitRE),"integer";if(e.eat(/[oO]/))return e.eatWhile(octitRE),"number"}e.eatWhile(digitRE);n="number";return e.match(/^\.\d+/)&&(n="number"),e.eat(/[eE]/)&&(n="number",e.eat(/[-+]/),e.eatWhile(digitRE)),n}return "."==r&&e.eat(".")?"keyword":symbolRE.test(r)?"-"==r&&e.eat(/-/)&&(e.eatWhile(/-/),!e.eat(symbolRE))?(e.skipToEnd(),"comment"):(e.eatWhile(symbolRE),"variable"):"error"}function ncomment(e,t){return 0==t?normal:function(r,n){for(var a=t;!r.eol();){var i=r.next();if("{"==i&&r.eat("-"))++a;else if("-"==i&&r.eat("}")&&0==--a)return n(normal),e}return n(ncomment(e,a)),e}}function stringLiteral(e,t){for(;!e.eol();){var r=e.next();if('"'==r)return t(normal),"string";if("\\"==r){if(e.eol()||e.eat(whiteCharRE))return t(stringGap),"string";e.eat("&")||e.next();}}return t(normal),"error"}function stringGap(e,t){return e.eat("\\")?switchState(e,t,stringLiteral):(e.next(),t(normal),"error")}var wellKnownWords=function(){var e={};function t(t){return function(){for(var r=0;r<arguments.length;r++)e[arguments[r]]=t;}}return t("keyword")("case","class","data","default","deriving","do","else","foreign","if","import","in","infix","infixl","infixr","instance","let","module","newtype","of","then","type","where","_"),t("keyword")("..",":","::","=","\\","<-","->","@","~","=>"),t("builtin")("!!","$!","$","&&","+","++","-",".","/","/=","<","<*","<=","<$>","<*>","=<<","==",">",">=",">>",">>=","^","^^","||","*","*>","**"),t("builtin")("Applicative","Bool","Bounded","Char","Double","EQ","Either","Enum","Eq","False","FilePath","Float","Floating","Fractional","Functor","GT","IO","IOError","Int","Integer","Integral","Just","LT","Left","Maybe","Monad","Nothing","Num","Ord","Ordering","Rational","Read","ReadS","Real","RealFloat","RealFrac","Right","Show","ShowS","String","True"),t("builtin")("abs","acos","acosh","all","and","any","appendFile","asTypeOf","asin","asinh","atan","atan2","atanh","break","catch","ceiling","compare","concat","concatMap","const","cos","cosh","curry","cycle","decodeFloat","div","divMod","drop","dropWhile","either","elem","encodeFloat","enumFrom","enumFromThen","enumFromThenTo","enumFromTo","error","even","exp","exponent","fail","filter","flip","floatDigits","floatRadix","floatRange","floor","fmap","foldl","foldl1","foldr","foldr1","fromEnum","fromInteger","fromIntegral","fromRational","fst","gcd","getChar","getContents","getLine","head","id","init","interact","ioError","isDenormalized","isIEEE","isInfinite","isNaN","isNegativeZero","iterate","last","lcm","length","lex","lines","log","logBase","lookup","map","mapM","mapM_","max","maxBound","maximum","maybe","min","minBound","minimum","mod","negate","not","notElem","null","odd","or","otherwise","pi","pred","print","product","properFraction","pure","putChar","putStr","putStrLn","quot","quotRem","read","readFile","readIO","readList","readLn","readParen","reads","readsPrec","realToFrac","recip","rem","repeat","replicate","return","reverse","round","scaleFloat","scanl","scanl1","scanr","scanr1","seq","sequence","sequence_","show","showChar","showList","showParen","showString","shows","showsPrec","significand","signum","sin","sinh","snd","span","splitAt","sqrt","subtract","succ","sum","tail","take","takeWhile","tan","tanh","toEnum","toInteger","toRational","truncate","uncurry","undefined","unlines","until","unwords","unzip","unzip3","userError","words","writeFile","zip","zip3","zipWith","zipWith3"),e}();const haskell={startState:function(){return {f:normal}},copyState:function(e){return {f:e.f}},token:function(e,t){var r=t.f(e,(function(e){t.f=e;})),n=e.current();return wellKnownWords.hasOwnProperty(n)?wellKnownWords[n]:r},languageData:{commentTokens:{line:"--",block:{open:"{-",close:"-}"}}}};

export { haskell };
