5
5
import Text.Highlighting.Kate.Definitions
6
6
import Text.Highlighting.Kate.Common
7
7
import Text.ParserCombinators.Parsec
8
import Control.Monad (when)
9
import Data.Map (fromList)
10
import Data.Maybe (fromMaybe, maybeToList)
9
12
import qualified Data.Set as Set
10
import Data.Map (fromList)
11
import Data.Maybe (fromMaybe)
13
13
-- | Full name of language.
14
14
syntaxName :: String
15
15
syntaxName = "Pascal"
62
62
updateState $ \st -> st { synStCurrentLine = lineContents, synStCharsParsedInLine = 0, synStPrevChar = '\n' }
64
64
withAttribute attr txt = do
66
then fail "Parser matched no text"
68
let style = fromMaybe "" $ lookup attr styles
65
when (null txt) $ fail "Parser matched no text"
66
let labs = attr : maybeToList (lookup attr styles)
70
68
let oldCharsParsed = synStCharsParsedInLine st
71
69
let prevchar = if null txt then '\n' else last txt
72
70
updateState $ \st -> st { synStCharsParsedInLine = oldCharsParsed + length txt, synStPrevChar = prevchar }
73
return (nub [style, attr], txt)
75
styles = [("Normal Text","Normal"),("Keyword","Keyword"),("ISO/Delphi Extended","Keyword"),("Type","DataType"),("Number","DecVal"),("String","String"),("Directive","Others"),("Comment","Comment"),("Alert","Alert")]
73
styles = [("Keyword","kw"),("ISO/Delphi Extended","kw"),("Type","dt"),("Number","dv"),("String","st"),("Directive","ot"),("Comment","co"),("Alert","al")]
77
75
parseExpressionInternal = do
78
76
context <- currentContext