diff --git a/autotests/folding/highlight.hs.fold b/autotests/folding/highlight.hs.fold index 71ee81f..3368627 100644 --- a/autotests/folding/highlight.hs.fold +++ b/autotests/folding/highlight.hs.fold @@ -1,139 +1,141 @@ -- test file for Haskell syntax highlighting in KDE's Kate -- The test file for literate Haskell can be easily created like this: -- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs -- You only have to manually edit the multi-line comment below. -- this is a single-line comment {- this is a multi-line comment Things like "a string" or a 'c' character shouldn't be highlighted in here. -- I could even start a new -- one-line comment. -} +import Prelude -- + -- a data definition data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq) -- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted funnyfunction::(Tree a)=>[a]->Integer->Int->Bool -- strings and chars -- first line of function definitions (type declaration) should be highlighted strangefunction::Int->String strangefunction 1 = "hello" strangefunction 2 = "what's up" strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2) strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc" strangefunction 5 = '\n':[] strangefunction 6 = '\invalidhaskell':[] -- function name including the single quote character -- and infix operator (`div`) justtesting'::Int->Int justtesting' 2 = 2+1 justtesting' 9 = 7 `div` 2 -- same definition as above, slightly different function name and a couple more whitespaces justtesting'' :: Int -> Int justtesting'' 2 = 3 justtesting'' 9 = 3 + 9 - 9 -- the following lines are copied out of Haskell's "Prelude.hs" infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, % -- everything highlighted except the "a" class Bounded a where minBound, maxBound :: a class (Num a, Ord a) => Real a where toRational :: a -> Rational -- finally, some keyword lists -- keywords case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr, instance, let, module, of, pattern, primitive, then, type, where -- infix operators quot, rem, div, mod, elem, notElem, seq -- this stuff is not handled yet !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, || -- functions abs, acos, acosh, all, and, any, appendFile, approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun, break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh, curry, cycle, decodeFloat, denominator, digitToInt, 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, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral, fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange, index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii, isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower, isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last, lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map, mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod, negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred, primExitWith, print, product, properFraction, putChar, putStr, putStrLn, quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat, readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen, readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate, return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq, sequence, sequence_, show, showChar, showInt, showList, showLitChar, showParen, showSigned, showString, shows, showsPrec, significand, signum, sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take, either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits, floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult, toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry, undefined, unlines, until, unwords, unzip, unzip3, userError, words, writeFile, zip, zip3, zipWith, zipWith3 -- type constructors Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS, ShowS, String -- classes Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat, RealFrac, Real, Show -- data constructors EQ, False, GT, Just, LT, Left, Nothing, Right, True -- promoted data constructors 'True -- pragma with compiler flags {-# OPTIONS_GHC -fno-warn-orphans #-} -- multiline pragma with language extensions {-# LANGUAGE OverlappingInstances, BangPatterns #-} diff --git a/autotests/html/highlight.hs.html b/autotests/html/highlight.hs.html index b0ae90c..f7c74f9 100644 --- a/autotests/html/highlight.hs.html +++ b/autotests/html/highlight.hs.html @@ -1,146 +1,148 @@ highlight.hs
 -- test file for Haskell syntax highlighting in KDE's Kate
 
 -- The test file for literate Haskell can be easily created like this:
 --  cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
 -- You only have to manually edit the multi-line comment below.
 
 -- this is a single-line comment
 
 {- this is a multi-line comment
 
 Things like "a string" or a 'c' character shouldn't be highlighted in here.
 
 -- I could even start a new
 -- one-line comment.
 
 -}
 
+import Prelude --
+
 -- a data definition
 
-data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
+data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
 
 
 -- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
 
 funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
 
 
 -- strings and chars
 -- first line of function definitions (type declaration) should be highlighted
 
 strangefunction::Int->String
-strangefunction 1 = "hello"
-strangefunction 2 = "what's up"
-strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
-strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
-strangefunction 5 = '\n':[]
-strangefunction 6 = '\invalidhaskell':[]
+strangefunction 1 = "hello"
+strangefunction 2 = "what's up"
+strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
+strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
+strangefunction 5 = '\n':[]
+strangefunction 6 = '\invalidhaskell':[]
 
 -- function name including the single quote character
 -- and infix operator (`div`)
 
 justtesting'::Int->Int
-justtesting' 2 = 2+1
-justtesting' 9 = 7 `div` 2
+justtesting' 2 = 2+1
+justtesting' 9 = 7 `div` 2
 
 -- same definition as above, slightly different function name and a couple more whitespaces
 
 justtesting''	::	Int -> Int
-justtesting''   2 = 3
-justtesting''	9	=   3 + 9 - 9
+justtesting''   2 = 3
+justtesting''	9	=   3 + 9 - 9
 
 -- the following lines are copied out of Haskell's "Prelude.hs"
 
-infixl 7  *, /, `quot`, `rem`, `div`, `mod`, :%, %
+infixl 7  *, /, `quot`, `rem`, `div`, `mod`, :%, %
 
 
 -- everything highlighted except the "a"
 
 class Bounded a where
     minBound, maxBound :: a
 
 class (Num a, Ord a) => Real a where
     toRational     :: a -> Rational
 
 -- finally, some keyword lists
 
 -- keywords
 
 case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr,
 instance, let, module, of, pattern, primitive,
 then, type, where
 
 -- infix operators
 
 quot, rem, div, mod, elem, notElem, seq
 
 -- this stuff is not handled yet
 
-!!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
+!!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
 
 -- functions
 
 abs, acos, acosh, all, and, any, appendFile,
 approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
 break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
 curry, cycle, decodeFloat, denominator, digitToInt, 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, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
 fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
 index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
 isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
 isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
 lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
 mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
 negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
 primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
 quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
 readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
 readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
 return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
 sequence, sequence_, show, showChar, showInt, showList, showLitChar,
 showParen, showSigned, showString, shows, showsPrec, significand, signum,
 sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
 either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
 enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
 floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
 toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
 undefined, unlines, until, unwords, unzip, unzip3, userError, words,
 writeFile, zip, zip3, zipWith, zipWith3
 
 -- type constructors
 
 Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe,
 Ordering, Rational, Ratio, ReadS, ShowS, String
 
 -- classes
 
 Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
 RealFrac, Real, Show
 
 -- data constructors
 
 EQ, False, GT, Just, LT, Left, Nothing, Right, True
 
 -- promoted data constructors
 
 'True
 
 -- pragma with compiler flags
 
 {-# OPTIONS_GHC -fno-warn-orphans #-}
 
 -- multiline pragma with language extensions
 
 {-# LANGUAGE OverlappingInstances,
              BangPatterns
 #-}
 
diff --git a/autotests/html/highlight.lhs.html b/autotests/html/highlight.lhs.html index 086360e..4404202 100644 --- a/autotests/html/highlight.lhs.html +++ b/autotests/html/highlight.lhs.html @@ -1,131 +1,131 @@ highlight.lhs
 test file for Haskell syntax highlighting in KDE's Kate
 
 The test file for literate Haskell can be easily created like this:
  cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
 You only have to manually edit the multi-line comment below.
 
 this is a single-line comment
 
 {- this is a multi-line comment
 
 Things like "a string" or a 'c' character shouldn't be highlighted in here.
 
 I could even start a new
 one-line comment.
 
 -}
 
 a data definition
 
-> data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
+> data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)
 
 
 function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted
 
 > funnyfunction::(Tree a)=>[a]->Integer->Int->Bool
 
 
 strings and chars
 first line of function definitions (type declaration) should be highlighted
 
 > strangefunction::Int->String
-> strangefunction 1 = "hello"
-> strangefunction 2 = "what's up"
-> strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
-> strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
-> strangefunction 5 = '\n':[]
-> strangefunction 6 = '\invalidhaskell':[]
+> strangefunction 1 = "hello"
+> strangefunction 2 = "what's up"
+> strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
+> strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
+> strangefunction 5 = '\n':[]
+> strangefunction 6 = '\invalidhaskell':[]
 
 function name including the single quote character
 and infix operator (`div`)
 
 > justtesting'::Int->Int
-> justtesting' 2 = 2+1
-> justtesting' 9 = 7 `div` 2
+> justtesting' 2 = 2+1
+> justtesting' 9 = 7 `div` 2
 
 same definition as above, slightly different function name and a couple more whitespaces
 
 > justtesting''	::	Int -> Int
-> justtesting''   2 = 3
-> justtesting''	9	=   3 + 9 - 9
+> justtesting''   2 = 3
+> justtesting''	9	=   3 + 9 - 9
 
 the following lines are copied out of Haskell's "Prelude.hs"
 
-> infixl 7  *, /, `quot`, `rem`, `div`, `mod`, :%, %
+> infixl 7  *, /, `quot`, `rem`, `div`, `mod`, :%, %
 
 
 everything highlighted except the "a"
 
 > class Bounded a where
 >     minBound, maxBound :: a
 
 > class (Num a, Ord a) => Real a where
 >     toRational     :: a -> Rational
 
 finally, some keyword lists
 
 keywords
 
 > case, class, data, deriving, do, else, if, in, infixl, infixr, instance, let, module, of, primitive,
 > then, type, where
 
 infix operators
 
 > quot, rem, div, mod, elem, notElem, seq
 
 this stuff is not handled yet
 
-> !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
+> !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||
 
 functions
 
 > FilePath, IOError, abs, acos, acosh, all, and, any, appendFile,
 > approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
 > break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
 > curry, cycle, decodeFloat, denominator, digitToInt, 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, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
 > fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
 > index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
 > isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
 > isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
 > lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
 > mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
 > negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
 > primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
 > quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
 > readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
 > readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
 > return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
 > sequence, sequence_, show, showChar, showInt, showList, showLitChar,
 > showParen, showSigned, showString, shows, showsPrec, significand, signum,
 > sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
 > either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
 > enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
 > floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
 > toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
 > undefined, unlines, until, unwords, unzip, unzip3, userError, words,
 > writeFile, zip, zip3, zipWith, zipWith3
 
 type constructors
 
 > Bool, Char, Double, Either, Float, IO, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS,
 > ShowS, String
 
 classes
 
 > Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
 > RealFrac, Real, Show
 
 data constructors
 
 > EQ, False, GT, Just, LT, Left, Nothing, Right, True
 
diff --git a/autotests/input/highlight.hs b/autotests/input/highlight.hs index 8c0b145..b04cdd0 100644 --- a/autotests/input/highlight.hs +++ b/autotests/input/highlight.hs @@ -1,139 +1,141 @@ -- test file for Haskell syntax highlighting in KDE's Kate -- The test file for literate Haskell can be easily created like this: -- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs -- You only have to manually edit the multi-line comment below. -- this is a single-line comment {- this is a multi-line comment Things like "a string" or a 'c' character shouldn't be highlighted in here. -- I could even start a new -- one-line comment. -} +import Prelude -- + -- a data definition data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq) -- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted funnyfunction::(Tree a)=>[a]->Integer->Int->Bool -- strings and chars -- first line of function definitions (type declaration) should be highlighted strangefunction::Int->String strangefunction 1 = "hello" strangefunction 2 = "what's up" strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2) strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc" strangefunction 5 = '\n':[] strangefunction 6 = '\invalidhaskell':[] -- function name including the single quote character -- and infix operator (`div`) justtesting'::Int->Int justtesting' 2 = 2+1 justtesting' 9 = 7 `div` 2 -- same definition as above, slightly different function name and a couple more whitespaces justtesting'' :: Int -> Int justtesting'' 2 = 3 justtesting'' 9 = 3 + 9 - 9 -- the following lines are copied out of Haskell's "Prelude.hs" infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, % -- everything highlighted except the "a" class Bounded a where minBound, maxBound :: a class (Num a, Ord a) => Real a where toRational :: a -> Rational -- finally, some keyword lists -- keywords case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr, instance, let, module, of, pattern, primitive, then, type, where -- infix operators quot, rem, div, mod, elem, notElem, seq -- this stuff is not handled yet !!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, || -- functions abs, acos, acosh, all, and, any, appendFile, approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun, break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh, curry, cycle, decodeFloat, denominator, digitToInt, 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, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral, fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange, index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii, isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower, isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last, lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map, mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod, negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred, primExitWith, print, product, properFraction, putChar, putStr, putStrLn, quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat, readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen, readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate, return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq, sequence, sequence_, show, showChar, showInt, showList, showLitChar, showParen, showSigned, showString, shows, showsPrec, significand, signum, sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take, either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo, enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits, floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult, toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry, undefined, unlines, until, unwords, unzip, unzip3, userError, words, writeFile, zip, zip3, zipWith, zipWith3 -- type constructors Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe, Ordering, Rational, Ratio, ReadS, ShowS, String -- classes Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat, RealFrac, Real, Show -- data constructors EQ, False, GT, Just, LT, Left, Nothing, Right, True -- promoted data constructors 'True -- pragma with compiler flags {-# OPTIONS_GHC -fno-warn-orphans #-} -- multiline pragma with language extensions {-# LANGUAGE OverlappingInstances, BangPatterns #-} diff --git a/autotests/reference/highlight.hs.ref b/autotests/reference/highlight.hs.ref index e59f9d3..070a5ca 100644 --- a/autotests/reference/highlight.hs.ref +++ b/autotests/reference/highlight.hs.ref @@ -1,139 +1,141 @@ -- test file for Haskell syntax highlighting in KDE's Kate

-- The test file for literate Haskell can be easily created like this:
-- cat highlight.hs | sed -e "s|^|> |" -e "s|> -- ||" -e "s|^> $||" > highlight.lhs
-- You only have to manually edit the multi-line comment below.

-- this is a single-line comment

{- this is a multi-line comment

Things like "a string" or a 'c' character shouldn't be highlighted in here.

-- I could even start a new
-- one-line comment.

-}

+import Prelude --
+
-- a data definition

data Tree a = Br (Tree a) (Tree a) | Leaf a | Nil deriving (Show, Eq)


-- function definition, "funnyfunction::", "Integer", "Int", "Bool" should be highlighted

funnyfunction::(Tree a)=>[a]->Integer->Int->Bool


-- strings and chars
-- first line of function definitions (type declaration) should be highlighted

strangefunction::Int->String
strangefunction 1 = "hello"
strangefunction 2 = "what's up"
strangefunction 3 = (strangefunction 1) ++ ", " ++ (strangefunction 2)
strangefunction 4 = 'a':'b':'c':'"':[] -- will return "abc"
strangefunction 5 = '\n':[]
strangefunction 6 = '\invalidhaskell':[]

-- function name including the single quote character
-- and infix operator (`div`)

justtesting'::Int->Int
justtesting' 2 = 2+1
justtesting' 9 = 7 `div` 2

-- same definition as above, slightly different function name and a couple more whitespaces

justtesting'' :: Int -> Int
justtesting'' 2 = 3
justtesting'' 9 = 3 + 9 - 9

-- the following lines are copied out of Haskell's "Prelude.hs"

infixl 7 *, /, `quot`, `rem`, `div`, `mod`, :%, %


-- everything highlighted except the "a"

class Bounded a where
minBound, maxBound :: a

class (Num a, Ord a) => Real a where
toRational :: a -> Rational

-- finally, some keyword lists

-- keywords

case, class, data, deriving, do, else, family, forall, if, in, infixl, infixr,
instance, let, module, of, pattern, primitive,
then, type, where

-- infix operators

quot, rem, div, mod, elem, notElem, seq

-- this stuff is not handled yet

!!, %, &&, $!, $, *, **, -,., /=, <, <=, =<<, ==, >, >=, >>, >>=, ^, ^^, ++, ||

-- functions

abs, acos, acosh, all, and, any, appendFile,
approxRational, asTypeOf, asin, asinh, atan, atan2, atanh, basicIORun,
break, catch, ceiling, chr, compare, concat, concatMap, const, cos, cosh,
curry, cycle, decodeFloat, denominator, digitToInt, 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, fromDouble, fromEnum, fromInt, fromInteger, fromIntegral,
fromRational, fst, gcd, getChar, getContents, getLine, head, id, inRange,
index, init, intToDigit, interact, ioError, isAlpha, isAlphaNum, isAscii,
isControl, isDenormalized, isDigit, isHexDigit, isIEEE, isInfinite, isLower,
isNaN, isNegativeZero, isOctDigit, isPrint, isSpace, isUpper, iterate, last,
lcm, length, lex, lexDigits, lexLitChar, lines, log, logBase, lookup, map,
mapM, mapM_, max, maxBound, maximum, maybe, min, minBound, minimum, mod,
negate, not, notElem, null, numerator, odd, or, ord, otherwise, pi, pred,
primExitWith, print, product, properFraction, putChar, putStr, putStrLn,
quot, quotRem, range, rangeSize, read, readDec, readFile, readFloat,
readHex, readIO, readInt, readList, readLitChar, readLn, readOct, readParen,
readSigned, reads, readsPrec, realToFrac, recip, rem, repeat, replicate,
return, reverse, round, scaleFloat, scanl, scanl1, scanr, scanr1, seq,
sequence, sequence_, show, showChar, showInt, showList, showLitChar,
showParen, showSigned, showString, shows, showsPrec, significand, signum,
sin, sinh, snd, span, splitAt, sqrt, subtract, succ, sum, tail, take,
either, elem, encodeFloat, enumFrom, enumFromThen, enumFromThenTo,
enumFromTo, error, even, exp, exponent, fail, filter, flip, floatDigits,
floatRadix, floatRange, floor, fmap, takeWhile, tan, tanh, threadToIOResult,
toEnum, toInt, toInteger, toLower, toRational, toUpper, truncate, uncurry,
undefined, unlines, until, unwords, unzip, unzip3, userError, words,
writeFile, zip, zip3, zipWith, zipWith3

-- type constructors

Bool, Char, Double, Either, FilePath, Float, IO, IOError, Integer, Int, Maybe,
Ordering, Rational, Ratio, ReadS, ShowS, String

-- classes

Bounded, Enum, Eq, Floating, Fractional, Functor, Integral, Ix, Monad, Num, Ord, Read, RealFloat,
RealFrac, Real, Show

-- data constructors

EQ, False, GT, Just, LT, Left, Nothing, Right, True

-- promoted data constructors

'True

-- pragma with compiler flags

{-# OPTIONS_GHC -fno-warn-orphans #-}

-- multiline pragma with language extensions

{-# LANGUAGE OverlappingInstances,
BangPatterns
#-}
diff --git a/data/syntax/haskell.xml b/data/syntax/haskell.xml index c105be9..81fa7e2 100644 --- a/data/syntax/haskell.xml +++ b/data/syntax/haskell.xml @@ -1,649 +1,649 @@ - + case class data deriving do else family forall if in infixl infixr instance let module newtype of pattern primitive then type where abs acos acosh all and any appendFile approxRational asTypeOf asin asinh atan atan2 atanh basicIORun break catch ceiling chr compare concat concatMap const cos cosh curry cycle decodeFloat denominator digitToInt 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 foldMap foldr foldr1 fromDouble fromEnum fromInt fromInteger fromIntegral fromRational fst gcd getChar getContents getLine group head id inRange index init intToDigit interact ioError isAlpha isAlphaNum isAscii isControl isDenormalized isDigit isHexDigit isIEEE isInfinite isLower isNaN isNegativeZero isOctDigit isPrint isSpace isUpper iterate last lcm length lex lexDigits lexLitChar lines log logBase lookup map mappend mapM mapM_ max maxBound maximum maybe mconcat mempty min minBound minimum mod negate not notElem null numerator odd or ord otherwise pack pi pred primExitWith print product properFraction pure putChar putStr putStrLn quot quotRem range rangeSize read readDec readFile readFloat readHex readIO readInt readList readLitChar readLn readOct readParen readSigned reads readsPrec realToFrac recip rem repeat replicate return reverse round scaleFloat scanl scanl1 scanr scanr1 seq sequence sequenceA sequence_ show showChar showInt showList showLitChar showParen showSigned showString shows showsPrec significand signum sin sinh snd sort span splitAt sqrt subtract succ sum tail take takeWhile tan tanh threadToIOResult toEnum toInt toInteger toLower toRational toUpper traverse truncate uncurry undefined unlines until unwords unzip unzip3 userError words writeFile zip zip3 zipWith zipWith3 Applicative Bounded Enum Eq Floating Foldable Fractional Functor Integral Ix Monad Monoid Num Ord Read Real RealFloat RealFrac Show Traversable Bool ByteString Char Double Either FilePath Float Int Integer IO IOError Maybe Ordering Ratio Rational ReadS ShowS String Word False True Left Right Just Nothing EQ LT GT defined if ifdef ifndef include undef qualified lib prefix as with call pure unsafe get set foreign stable nocode as qualified hiding AllowAmbiguousTypes ApplicativeDo Arrows AutoDeriveTypeable BangPatterns BinaryLiterals CApiFFI CPP ConstrainedClassMethods ConstraintKinds DataKinds DatatypeContexts DefaultSignatures DeriveAnyClass DeriveDataTypeable DeriveFoldable DeriveFunctor DeriveGeneric DeriveLift DeriveTraversable DisambiguateRecordFields DoAndIfThenElse DoRec DuplicateRecordFields EmptyCase EmptyDataDecls ExistentialQuantification ExplicitForAll ExplicitNamespaces ExtendedDefaultRules ExtensibleRecords FlexibleContexts FlexibleInstances ForeignFunctionInterface FunctionalDependencies GADTSyntax GADTs GHCForeignImportPrim GeneralizedNewtypeDeriving Generics HereDocuments ImplicitParams ImplicitPrelude ImpredicativeTypes IncoherentInstances InstanceSigs InterruptibleFFI JavaScriptFFI KindSignatures LambdaCase LiberalTypeSynonyms MagicHash MonadComprehensions MonadFailDesugaring MonoLocalBinds MonoPatBinds MonomorphismRestriction MultiParamTypeClasses MultiWayIf NPlusKPatterns NamedFieldPuns NamedWildCards NegativeLiterals NewQualifiedOperators NondecreasingIndentation NullaryTypeClasses NumDecimals OverlappingInstances OverloadedLabels OverloadedLists OverloadedStrings PackageImports ParallelArrays ParallelListComp PartialTypeSignatures PatternGuards PatternSignatures PatternSynonyms PolyKinds PolymorphicComponents PostfixOperators QuasiQuotes Rank2Types RankNTypes RebindableSyntax RecordPuns RecordWildCards RecursiveDo RegularPatterns RelaxedPolyRec RestrictedTypeSynonyms RoleAnnotations Safe SafeImports ScopedTypeVariables StandaloneDeriving StaticPointers Strict StrictData TemplateHaskell TemplateHaskellQuotes TraditionalRecordSyntax TransformListComp Trustworthy TupleSections TypeApplications TypeFamilies TypeInType TypeOperators TypeSynonymInstances UnboxedTuples UndecidableInstances UndecidableSuperClasses UnicodeSyntax UnliftedFFITypes Unsafe ViewPatterns XmlSyntax - + - + - - + +