Skip to content

Instantly share code, notes, and snippets.

@tajmone tajmone/haskell.lang
Created Jan 14, 2018

Embed
What would you like to do?
Highlight Haskell Syntax Fix
--[[ Answering @17dec on Issue #48:
https://github.com/andre-simon/highlight/issues/48
A working fix to his request...
--]]
Description="Haskell"
Keywords={
{ Id=1, -- You could use (or reuse) any Group ID (eg: 3, 4, 7, etc)
Regex=[=[ ([a-zA-Z][a-zA-Z0-9_']*) ]=], -- Capture Identifers as `.hl .kwa`
Group=1
},
{ Id=1,
List={"absolute", "value", "addition", "and", "array", "boolean", "ceiling",
"character", "concatenate", "concatenation", "constant", "continuation",
"passing", "style", "cosine", "cosine", "hyperbolic", "cosine", "hyperbolic",
"inverse", "cosine", "inverse", "division", "empty", "equality", "even",
"floor", "function", "composition", "index", "lazy", "evaluation", "length",
"list", "list", "calculation", "list", "construction", "list", "insertion",
"list", "item", "modulo", "monad", "multiplication", "nint", "odd", "or",
"order", "power", "round", "sine", "sine", "hyperbolic", "sine", "hyperbolic",
"inverse", "sine", "inverse", "split", "string", "subtraction", "sum",
"tangent", "tangent", "hyperbolic", "tangent", "hyperbolic", "inverse",
"tangent", "inverse", "trigonometry", "truncation", "tuple", "True", "False"},
},
{ Id=2,
List={"Array", "Bool", "BufferMode", "CalendarTime", "Char", "ClockTime",
"Complex", "Complex", "Day", "Double", "Either", "ExitCode", "FilePath",
"Float", "Handle", "HandlePosn", "Int", "Integer", "IO", "IOError", "IOMode",
"Maybe", "Month", "Ordering", "Permissions", "Ratio", "Rational", "Rational",
"Read", "ReadS", "SeekMode", "Show", "ShowS", "StdGen", "String", "TimeDiff",
"TimeLocale"},
},
{ Id=3,
List={"abs", "accum", "accumArray", "acos", "acosh", "addToClockTime",
"all", "and", "any", "ap", "appendFile", "approxRational", "array", "asin",
"asinh", "assocs", "asTypeOf", "atan", "atan2", "atanh", "bounds", "bracket",
"bracket_", "break", "calendarTimeToString", "catch", "catMaybes", "ceiling",
"chr", "cis", "compare", "concat", "concatMap", "conjugate", "const", "cos",
"cosh", "cpuTimePrecision", "createDirectory", "curry", "cycle", "decodeFloat",
"defaultTimeLocale", "delete", "deleteBy", "denominator", "diffClockTimes",
"digitToInt", "div", "divMod", "doesDirectoryExist", "doesFileExist", "drop",
"dropWhile", "either", "elem", "elemIndex", "elemIndices", "elems",
"encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo", "enumFromTo",
"error", "even", "executable", "exitFailure", "exitWith", "exp", "exponent",
"fail", "filter", "filterM", "find", "findIndex", "findIndices", "flip",
"floatDigits", "floatRadix", "floatRange", "floatToDigits", "floor", "fmap",
"foldl", "foldl1", "foldM", "foldr",
"foldr1", "formatCalendarTime", "fromEnum", "fromInteger", "fromIntegral",
"fromJust", "fromMaybe", "fromRat", "fromRational", "fst", "gcd", "genericDrop",
"genericIndex", "genericLength", "genericReplicate", "genericSplitAt",
"genericTake", "getArgs", "getChar", "getClockTime", "getContents",
"getCPUTime", "getCurrentDirectory", "getDirectoryContents", "getEnv",
"getLine", "getModificationTime", "getPermissions", "getProgName", "getStdGen",
"getStdRandom", "group", "groupBy", "guard", "hClose", "head", "hFileSize",
"hFlush", "hGetBuffering", "hGetChar", "hGetContents", "hGetLine", "hGetPosn",
"hIsClosed", "hIsEOF", "hIsOpen", "hIsReadable", "hIsSeekable", "hIsWritable",
"hLookAhead", "hPrint", "hPutChar", "hPutStr", "hPutStrLn", "hReady", "hSeek",
"hSetBuffering", "hSetPosn", "hWaitForInput", "id", "imagPart", "index",
"indices", "init", "inits", "inRange", "insert", "insertBy", "interact",
"intersect", "intersectBy", "intersperse", "intToDigit", "ioeGetErrorString",
"ioeGetFileName", "ioeGetHandle", "ioError", "isAlpha", "isAlphaNum", "isAlreadyExistsError",
"isAlreadyInUseError", "isAscii", "isControl", "isDenormalized", "isDigit",
"isDoesNotExistError", "isEOF", "isEOFError", "isFullError", "isHexDigit",
"isIEEE", "isIllegalOperation", "isInfinite", "isJust", "isLatin1", "isLower",
"isNaN", "isNegativeZero", "isNothing", "isOctDigit", "isPermissionError",
"isPrefixOf", "isPrint", "isSpace", "isSuffixOf", "isUpper", "isUserError",
"iterate", "ixmap", "join", "last", "lcm", "length", "lex", "lexDigits",
"lexLitChar", "liftM", "liftM2", "liftM3", "liftM4", "liftM5", "lines",
"listArray", "listToMaybe", "log", "logBase", "lookup", "magnitude", "map",
"mapAccumL", "mapAccumR", "mapAndUnzipM", "mapM", "mapM_", "mapMaybe", "max",
"maxBound", "maximum", "maximumBy", "maybe", "maybeToList", "min", "minBound",
"minimum", "minimumBy", "mkPolar", "mkStdGen", "mod", "msum", "negate",
"newStdGen", "next", "not", "notElem", "nub", "nubBy", "null", "numerator",
"odd", "openFile", "or", "ord", "otherwise", "partition",
"phase", "pi", "polar", "pred", "print", "product", "properFraction", "putChar",
"putStr", "putStrLn", "quot", "quotRem", "random", "randomIO", "randomR",
"randomRIO", "randomRs", "randoms", "range", "rangeSize", "read", "readable",
"readDec", "readFile", "readFloat", "readHex", "readInt", "readIO", "readList",
"readLitChar", "readLn", "readOct", "readParen", "reads", "readSigned",
"readsPrec", "realPart", "realToFrac", "recip", "rem", "removeDirectory",
"removeFile", "renameDirectory", "renameFile", "repeat", "replicate", "return",
"reverse", "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1",
"searchable", "seq", "sequence", "sequence_", "setCurrentDirectory",
"setPermissions", "setStdGen", "show", "showChar", "showEFloat", "showFFloat",
"showFloat", "showGFloat", "showInt", "showList", "showLitChar", "showParen",
"shows", "showSigned", "showsPrec", "showString", "significand", "signum",
"sin", "sinh", "snd", "sort", "sortBy", "split", "splitAt", "sqrt", "stderr",
"stdin", "stdout", "subtract", "succ", "sum", "system", "tail", "tails", "take", "takeWhile", "tan", "tanh",
"toCalendarTime", "toClockTime", "toEnum", "toInteger", "toLower", "toRational",
"toUpper", "toUTCTime", "transpose", "truncate", "try", "uncurry", "undefined",
"unfoldr", "union", "unionBy", "unless", "unlines", "until", "unwords", "unzip",
"unzip3", "unzip4", "unzip5", "unzip6", "unzip7", "userError", "when", "words",
"writable", "writeFile", "zip", "zip3", "zip4", "zip5", "zip6", "zip7",
"zipWith", "zipWith3", "zipWith4", "zipWith5", "zipWith6", "zipWith7",
"zipWithM", "zipWithM_"},
},
{ Id=4,
List={"as", "case", "of", "class", "data", "default", "deriving", "do",
"forall", "foreign", "hiding", "if", "then", "else", "import", "infix",
"infixl", "infixr", "instance", "let", "in", "mdo", "module", "newtype",
"qualified", "type", "where"},
},
}
Strings={
Delimiter=[=[ "|' ]=],
-- There is no string interpolation in Haskell
}
IgnoreCase=false
Comments={
{ Block=false,
Delimiter= { [[--]] },
},
{ Block=true,
Nested=false,
Delimiter= { [[\{\-]],[[\-\}]],}
}
}
Operators=[[\(|\)|\[|\]|\{|\}|\,|\;|\:|\&|<|>|\!|\=|\/|\*|\%|\+|\-|\.|\'|\#|\@|\$|\\]]
function OnStateChange(oldState, newState, token, kwgroup)
if newState==HL_ESC_SEQ and oldState~=HL_STRING then
return HL_REJECT
-- return HL_STANDARD
end
return newState
end
@tajmone

This comment has been minimized.

Copy link
Owner Author

tajmone commented Jan 14, 2018

This Gist answers to an Issue for the Haskell syntax definition for Highlight, the syntax highlighting tool:

andre-simon/highlight#48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.