Warning, /frameworks/syntax-highlighting/autotests/input/highlight.hs is written in an unsupported language. File is not indexed.
0001 -- test file for Haskell syntax highlighting in KDE's Kate
0002
0003 -- The test file for literate Haskell can be easily created like this:
0004 -- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
0005 -- You only have to manually edit the multi-line comment below.
0006
0007 -- this is a single-line comment
0008
0009 {- this is a multi-line comment
0010
0011 Things like "a string" or a 'c' character shouldn't be highlighted in here.
0012
0013 -- I could even start a new
0014 -- one-line comment.
0015
0016 -}
0017
0018 import Prelude --
0019 import Prelude ---
0020
0021 -- a data definition
0022
0023 data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
0024
0025
0026 -- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
0027
0028 funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
0029
0030
0031 -- strings and chars
0032 -- first line of function definitions (type declaration) should be highlighted
0033
0034 strangefunction::Int->String
0035 strangefunction 1 = "hello"
0036 strangefunction 2 = "what's up"
0037 strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
0038 strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
0039 strangefunction 5 = '\n':[]
0040 strangefunction 6 = '\invalidhaskell':[]
0041
0042 -- function name including the single quote character
0043 -- and infix operator (`div`)
0044
0045 justtesting'::Int->Int
0046 justtesting' 2 = 2+1
0047 justtesting' 9 = 7 `div` 2
0048
0049 -- same definition as above, slightly different function name and a couple more whitespaces
0050
0051 justtesting'' :: Int -> Int
0052 justtesting'' 2 = 3
0053 justtesting'' 9 = 3 + 9 - 9
0054
0055 -- the following lines are copied out of Haskell's "Prelude.hs"
0056
0057 infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %
0058
0059
0060 -- everything highlighted except the "a"
0061
0062 class Bounded a where
0063 minBound, maxBound :: a
0064
0065 class (Num a, Ord a) => Real a where
0066 toRational :: a -> Rational
0067
0068 -- finally, some keyword lists
0069
0070 -- keywords
0071
0072 case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr,
0073 instance, let, module, of, pattern, primitive,
0074 then, type, where
0075
0076 -- infix operators
0077
0078 quot, rem, div, mod, elem, notElem, seq
0079
0080 -- this stuff is not handled yet
0081
0082 !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
0083
0084 -- functions
0085
0086 abs, acos, acosh, all, and, any, appendFile,
0087 approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
0088 break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
0089 curry, cycle, decodeFloat, denominator, digitToInt, div, divMod, drop,
0090 dropWhile, either, elem, encodeFloat, enumFrom, enumFromThen,
0091 enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip,
0092 floatDigits, floatRadix, floatRange, floor, fmap, foldl, foldl1, foldr,
0093 foldr1, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
0094 fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
0095 index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
0096 isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
0097 isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
0098 lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
0099 mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
0100 negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
0101 primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
0102 quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
0103 readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
0104 readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
0105 return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
0106 sequence, sequence_, show, showChar, showInt, showList, showLitChar,
0107 showParen, showSigned, showString, shows, showsPrec, significand, signum,
0108 sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
0109 either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
0110 enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
0111 floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
0112 toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
0113 undefined, unlines, until, unwords, unzip, unzip3, userError, words,
0114 writeFile, zip, zip3, zipWith, zipWith3
0115
0116 -- type constructors
0117
0118 Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe,
0119 Ordering, Rational, Ratio, ReadS, ShowS, String
0120
0121 -- classes
0122
0123 Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
0124 RealFrac, Real, Show
0125
0126 -- data constructors
0127
0128 EQ, False, GT, Just, LT, Left, Nothing, Right, True
0129
0130 -- promoted data constructors
0131
0132 'True
0133
0134 -- pragma with compiler flags
0135
0136 {-# OPTIONS_GHC -fno-warn-orphans #-}
0137
0138 -- multiline pragma with language extensions
0139
0140 {-# LANGUAGE OverlappingInstances,
0141 BangPatterns
0142 #-}