diff --git a/changelog.md b/changelog.md
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,47 @@
 # Revision history for skylighting and skylighting-core
 
+## 0.9
+
+  * Use a pure Haskell regex implementation (in unexported module
+    Text.Regex.KDE) instead of pcre.  The implementation is not
+    as efficient as pcre, but it seems good enough for this
+    application, and it is desirable to avoid depending on a C
+    library.  (Available Haskell libraries weren't up to the
+    task, because they don't do back-references, captures,
+    lookahead/behind.) Some benchmarks (old/new):
+    haskell (4.6/7.9) java (13.4/23.3) c (2.8/3.7) rhtml
+    (4.7/6.1) lua (10.6/13.2) javascript (4.2/6.6).
+    Though this is a significant slowdown, the tradeoff seems
+    worth it to have a pure Haskell implementation.
+
+  * Removed old `system-pcre` flag.
+
+  * More efficient treatment of dynamic regexes.
+    We put something in the Regex itself to represent the `%1`,
+    and modify it later.  This allows us to cache dynamic
+    regexes in a way we couldn't before.
+
+  * Add support for TOML (#105, Shiming Wang),
+    GraphQL, and Nim syntax (#102, Daniel Pozo Escalona).
+
+  * Update xml definitions for actionscript, bash, boo, c,
+    cmake, elm, erlang, glsl, isocpp, java, lua, m4, mediawiki,
+    perl, powershell, scala, tcsh, xul, zsh.
+
+  * Fix fallthrough behavior (don't always consume a token).
+
+  * Fix word boundary detection.
+
+  * Remove RegexException. (API change)
+
+  * Skylighting.Regex now exports `isWordChar` and `testRegex`,
+    as well as the constructors underlying the new `Regex` type.
+
+  * Remove some obsolete xml definition patches.
+
+  * Fix escaped % in dynamic regex.
+
+
 ## 0.8.5
 
   * Respect dynamic flag on StringDetect elements (#99, Albert
diff --git a/skylighting-core.cabal b/skylighting-core.cabal
--- a/skylighting-core.cabal
+++ b/skylighting-core.cabal
@@ -1,5 +1,5 @@
 name:                skylighting-core
-version:             0.8.5
+version:             0.9
 synopsis:            syntax highlighting library
 description:         Skylighting is a syntax highlighting library.
                      It derives its tokenizers from XML syntax
@@ -109,6 +109,10 @@
                        Skylighting.Format.ANSI
                        Skylighting.Format.HTML
                        Skylighting.Format.LaTeX
+  other-modules:       Regex.KDE
+                       Regex.KDE.Regex
+                       Regex.KDE.Compile
+                       Regex.KDE.Match
   other-extensions:    CPP, Arrows
   build-depends:       base >= 4.8 && < 5.0,
                        mtl,
@@ -126,26 +130,21 @@
                        safe,
                        base64-bytestring,
                        blaze-html >= 0.5,
-                       containers,
+                       containers >= 0.5.8.2,
+                       utf8-string,
                        ansi-terminal >= 0.7,
                        colour >= 2.0
-  if flag(system-pcre)
-    build-depends:     regex-pcre
-  else
-    build-depends:     regex-pcre-builtin >= 0.95
   hs-source-dirs:      src
   ghc-prof-options:    -fprof-auto-exported
   default-language:    Haskell2010
   ghc-options:         -Wall
+  if impl(ghc >= 8.4)
+    ghc-options:       -fhide-source-paths
 
 Flag executable
   Description:   Build skylighting-extract tool
   Default:       False
 
-Flag system-pcre
-  Description:   Use regex-pcre instead of regex-pcre-builtin
-  Default:       False
-
 test-suite test-skylighting
   type:           exitcode-stdio-1.0
   main-is:        test-skylighting.hs
@@ -161,6 +160,7 @@
                   random,
                   Diff,
                   text,
+                  utf8-string,
                   pretty-show,
                   aeson >= 1.0,
                   bytestring,
@@ -182,6 +182,8 @@
                    directory,
                    criterion >= 1.0 && < 1.6
   Ghc-Options:   -rtsopts -Wall -fno-warn-unused-do-bind
+  if impl(ghc >= 8.4)
+    ghc-options:       -fhide-source-paths
   Default-Language: Haskell2010
 
 executable skylighting-extract
@@ -201,10 +203,6 @@
                        directory,
                        ansi-terminal >= 0.7,
                        colour >= 2.0
-  if flag(system-pcre)
-    build-depends:     regex-pcre
-  else
-    build-depends:     regex-pcre-builtin
   if flag(executable)
     buildable:         True
   else
@@ -214,3 +212,5 @@
   default-language:    Haskell2010
   other-extensions:    CPP
   ghc-options:         -Wall
+  if impl(ghc >= 8.4)
+    ghc-options:       -fhide-source-paths
diff --git a/src/Regex/KDE.hs b/src/Regex/KDE.hs
new file mode 100644
--- /dev/null
+++ b/src/Regex/KDE.hs
@@ -0,0 +1,24 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Regex.KDE
+ (Regex(..), compileRegex, matchRegex, testRegex, isWordChar)
+  where
+
+import Regex.KDE.Regex
+import Regex.KDE.Compile
+import Regex.KDE.Match
+import qualified Data.ByteString.UTF8 as U
+import qualified Data.IntMap.Strict as M
+import qualified Data.ByteString as B
+import Data.List (sortOn)
+
+testRegex :: Bool -> String -> String -> Maybe (String, [(Int, String)])
+testRegex caseSensitive re s =
+  let bs = U.fromString s
+      toSlice (off,len) = U.toString $ B.take len $ B.drop off bs
+   in case compileRegex caseSensitive (U.fromString re) of
+        Right r ->
+          case matchRegex r bs of
+            Nothing -> Nothing
+            Just (m,cs) -> Just (U.toString m, sortOn fst
+                                  (M.toList (M.map toSlice cs)))
+        Left e  -> error e
diff --git a/src/Regex/KDE/Compile.hs b/src/Regex/KDE/Compile.hs
new file mode 100644
--- /dev/null
+++ b/src/Regex/KDE/Compile.hs
@@ -0,0 +1,250 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE OverloadedStrings #-}
+module Regex.KDE.Compile
+  (compileRegex)
+  where
+
+import Data.Word (Word8)
+import qualified Data.ByteString as B
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.UTF8 as U
+import Safe
+import Data.Attoparsec.ByteString as A hiding (match)
+import Data.Char
+import Control.Applicative
+import Regex.KDE.Regex
+import Control.Monad.State.Strict
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup ((<>))
+#endif
+
+-- | Compile a UTF-8 encoded ByteString as a Regex.  If the first
+-- parameter is True, then the Regex will be case sensitive.
+compileRegex :: Bool -> ByteString -> Either String Regex
+compileRegex caseSensitive bs =
+  let !res = parseOnly (evalStateT parser 0) bs
+   in res
+ where
+   parser = do
+     !re <- pRegex caseSensitive
+     (re <$ lift A.endOfInput) <|>
+       do rest <- lift A.takeByteString
+          fail $ "parse error at byte position " ++
+                 show (B.length bs - B.length rest)
+
+type RParser = StateT Int Parser
+
+pRegex :: Bool -> RParser Regex
+pRegex caseSensitive =
+  foldr MatchAlt
+    <$> (pAltPart caseSensitive)
+    <*> (many $ lift (char '|') *> (pAltPart caseSensitive <|> pure mempty))
+
+pAltPart :: Bool -> RParser Regex
+pAltPart caseSensitive = mconcat <$> many1 (pRegexPart caseSensitive)
+
+char :: Char -> Parser Char
+char c =
+  c <$ satisfy (== fromIntegral (ord c))
+
+pRegexPart :: Bool -> RParser Regex
+pRegexPart caseSensitive =
+  (lift (pRegexChar caseSensitive) <|> pParenthesized caseSensitive) >>=
+     lift . pSuffix
+
+pParenthesized :: Bool -> RParser Regex
+pParenthesized caseSensitive = do
+  _ <- lift (satisfy (== 40))
+  modifier <- lift (satisfy (== 63) *> pGroupModifiers)
+                <|> (MatchCapture <$> (modify (+ 1) *> get))
+  contents <- pRegex caseSensitive
+  _ <- lift (satisfy (== 41))
+  return $ modifier contents
+
+pGroupModifiers :: Parser (Regex -> Regex)
+pGroupModifiers =
+  (id <$ char ':')
+   <|>
+     do dir <- option Forward $ Backward <$ char '<'
+        (AssertPositive dir <$ char '=') <|> (AssertNegative dir <$ char '!')
+
+pSuffix :: Regex -> Parser Regex
+pSuffix re = option re $ do
+  w <- satisfy (\x -> x == 42 || x == 43 || x == 63 || x == 123)
+  (case w of
+    42  -> return $ MatchAlt (MatchSome re) MatchNull
+    43  -> return $ MatchSome re
+    63  -> return $ MatchAlt re MatchNull
+    123 -> do
+      let isDig x = x >= 48 && x < 58
+      minn <- option Nothing $ readMay . U.toString <$> A.takeWhile isDig
+      maxn <- option Nothing $ char ',' *>
+                       (readMay . U.toString <$> A.takeWhile isDig)
+      _ <- char '}'
+      return $!
+        case (minn, maxn) of
+          (Nothing, Nothing) -> atleast 0 re
+          (Just n, Nothing)  -> atleast n re
+          (Nothing, Just n)  -> atmost n re
+          (Just m, Just n)   -> between m n re
+    _   -> fail "pSuffix encountered impossible byte") >>= pSuffix
+ where
+   atmost 0 _ = MatchNull
+   atmost n r = MatchAlt (mconcat (replicate n r)) (atmost (n-1) r)
+
+   between 0 n r = atmost n r
+   between m n r = mconcat (replicate m r) <> atmost (n - m) r
+
+   atleast n r = mconcat (replicate n r) <> MatchAlt (MatchSome r) MatchNull
+
+pRegexChar :: Bool -> Parser Regex
+pRegexChar caseSensitive = do
+  w <- satisfy $ const True
+  case w of
+    46  -> return MatchAnyChar
+    37 -> (do -- dynamic %1 %2
+              ds <- A.takeWhile1 (\x -> x >= 48 && x <= 57)
+              case readMay (U.toString ds) of
+                Just !n -> return $ MatchDynamic n
+                Nothing -> fail "not a number")
+            <|> return (MatchChar (== '%'))
+    92  -> pRegexEscapedChar
+    36  -> return AssertEnd
+    94  -> return AssertBeginning
+    91  -> pRegexCharClass
+    _ | w < 128
+      , not (isSpecial w)
+         -> do let c = chr $ fromIntegral w
+               return $! MatchChar $
+                        if caseSensitive
+                           then (== c)
+                           else (\d -> toLower d == toLower c)
+      | w >= 0xc0 -> do
+          rest <- case w of
+                    _ | w >= 0xf0 -> A.take 3
+                      | w >= 0xe0 -> A.take 2
+                      | otherwise -> A.take 1
+          case U.uncons (B.cons w rest) of
+            Just (d, _) -> return $! MatchChar $
+                             if caseSensitive
+                                then (== d)
+                                else (\e -> toLower e == toLower d)
+            Nothing     -> fail "could not decode as UTF8"
+      | otherwise -> mzero
+
+pRegexEscapedChar :: Parser Regex
+pRegexEscapedChar = do
+  c <- anyChar
+  (case c of
+    'b' -> return AssertWordBoundary
+    '{' -> do -- captured pattern: \1 \2 \{12}
+              ds <- A.takeWhile1 (\x -> x >= 48 && x <= 57)
+              _ <- char '}'
+              case readMay (U.toString ds) of
+                Just !n -> return $ MatchCaptured $ n
+                Nothing -> fail "not a number"
+    'd' -> return $ MatchChar isDigit
+    'D' -> return $ MatchChar (not . isDigit)
+    's' -> return $ MatchChar isSpace
+    'S' -> return $ MatchChar (not . isSpace)
+    'w' -> return $ MatchChar isWordChar
+    'W' -> return $ MatchChar (not . isWordChar)
+    _ | c >= '0' && c <= '9' ->
+       return $! MatchCaptured (ord c - ord '0')
+      | otherwise -> mzero) <|> (MatchChar . (==) <$> pEscaped c)
+
+pEscaped :: Char -> Parser Char
+pEscaped c =
+  case c of
+    '\\' -> return c
+    'a' -> return '\a'
+    'f' -> return '\f'
+    'n' -> return '\n'
+    'r' -> return '\r'
+    't' -> return '\t'
+    'v' -> return '\v'
+    '0' -> do -- \0ooo matches octal ooo
+      ds <- A.take 3
+      case readMay ("'\\o" ++ U.toString ds ++ "'") of
+        Just x  -> return x
+        Nothing -> fail "invalid octal character escape"
+    'z' -> do -- \zhhhh matches unicode hex char hhhh
+      ds <- A.take 4
+      case readMay ("'\\x" ++ U.toString ds ++ "'") of
+        Just x  -> return x
+        Nothing -> fail "invalid hex character escape"
+    _ | c >= '1' && c <= '7' -> do -- \ooo octal undocument form but works
+         ds <- A.take 2
+         case readMay ("'\\o" ++ c : U.toString ds ++ "'") of
+           Just x  -> return x
+           Nothing -> fail "invalid octal character escape"
+      | otherwise -> return c
+
+pRegexCharClass :: Parser Regex
+pRegexCharClass = do
+  negated <- option False $ True <$ satisfy (== 94) -- '^'
+  let getEscapedClass = do
+        _ <- satisfy (== 92) -- backslash
+        (isDigit <$ char 'd')
+         <|> (not . isDigit <$ char 'D')
+         <|> (isSpace <$ char 's')
+         <|> (not . isSpace <$ char 'S')
+         <|> (isWordChar <$ char 'w')
+         <|> (not . isWordChar <$ char 'W')
+  let getPosixClass = do
+        _ <- string "[:"
+        localNegated <- option False $ True <$ satisfy (== 94) -- '^'
+        res <- (isAlphaNum <$ string "alnum")
+             <|> (isAlpha <$ string "alpha")
+             <|> (isAscii <$ string "ascii")
+             <|> ((\c -> isSpace c && c `notElem` ['\n','\r','\f','\v']) <$
+                   string "blank")
+             <|> (isControl <$ string "cntrl")
+             <|> ((\c -> isPrint c || isSpace c) <$ string "graph:")
+             <|> (isLower <$ string "lower")
+             <|> (isUpper <$ string "upper")
+             <|> (isPrint <$ string "print")
+             <|> (isPunctuation <$ string "punct")
+             <|> (isSpace <$ string "space")
+             <|> ((\c -> isAlphaNum c ||
+                         generalCategory c == ConnectorPunctuation)
+                   <$ string "word:")
+             <|> (isHexDigit <$ string "xdigit")
+        _ <- string ":]"
+        return $! if localNegated then not . res else res
+  let getC = (satisfy (== 92) *> anyChar >>= pEscaped) <|>
+       (chr . fromIntegral <$> satisfy (\x -> x /= 92 && x /= 93)) -- \ ]
+  let getCRange = do
+        c <- getC
+        (\d -> (\x -> x >= c && x <= d)) <$> (char '-' *> getC) <|>
+          return (== c)
+  brack <- option [] $ [(==']')] <$ char ']'
+  fs <- many (getEscapedClass <|> getPosixClass <|> getCRange)
+  _ <- satisfy (== 93) -- ]
+  let f c = any ($ c) $ brack ++ fs
+  return $! MatchChar (if negated then (not . f) else f)
+
+anyChar :: Parser Char
+anyChar = do
+  w <- satisfy (const True)
+  return $! chr $ fromIntegral w
+
+isSpecial :: Word8 -> Bool
+isSpecial 92 = True -- '\\'
+isSpecial 63 = True -- '?'
+isSpecial 42 = True -- '*'
+isSpecial 43 = True -- '+'
+isSpecial 123 = True -- '{'
+isSpecial 125 = True -- '}'
+isSpecial 91 = True -- '['
+isSpecial 93 = True -- ']'
+isSpecial 37 = True -- '%'
+isSpecial 40 = True -- '('
+isSpecial 41 = True -- ')'
+isSpecial 124 = True -- '|'
+isSpecial 46 = True -- '.'
+isSpecial 36 = True -- '$'
+isSpecial 94 = True -- '^'
+isSpecial _  = False
+
diff --git a/src/Regex/KDE/Match.hs b/src/Regex/KDE/Match.hs
new file mode 100644
--- /dev/null
+++ b/src/Regex/KDE/Match.hs
@@ -0,0 +1,160 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE BangPatterns #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE BinaryLiterals #-}
+module Regex.KDE.Match
+ ( matchRegex
+ ) where
+
+import qualified Data.ByteString as B
+import Data.ByteString (ByteString)
+import qualified Data.ByteString.UTF8 as U
+import qualified Data.Set as Set
+import Data.Set (Set)
+import Regex.KDE.Regex
+import qualified Data.IntMap.Strict as M
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup ((<>))
+#endif
+
+-- Note that all matches are from the beginning of the string.
+-- The ^ anchor is implicit at the beginning of the regex.
+
+data Match =
+   Match { matchBytes    :: !ByteString
+         , matchOffset   :: !Int
+         , matchCaptures :: !(M.IntMap (Int, Int))
+                       -- starting offset, length in bytes
+         } deriving (Show, Eq)
+
+-- longer matches are <=
+instance Ord Match where
+  m1 <= m2 = matchOffset m1 >= matchOffset m2 &&
+             matchCaptures m1 >= matchCaptures m2
+
+mapMatching :: (Match -> Match) -> Set Match -> Set Match
+mapMatching f = Set.filter ((>= 0) . matchOffset) . Set.map f
+
+-- we take the n longest matches to avoid pathological slowdown
+sizeLimit :: Int
+sizeLimit = 2000
+
+-- prune matches if it gets out of hand
+prune :: Set Match -> Set Match
+prune ms = if Set.size ms > sizeLimit
+              then Set.take sizeLimit ms
+              else ms
+
+exec :: Direction -> Regex -> Set Match -> Set Match
+exec _ MatchNull = id
+exec dir (MatchDynamic n) = -- if this hasn't been replaced, match literal
+  exec dir (MatchChar (== '%') <>
+            mconcat (map (\c -> MatchChar (== c)) (show n)))
+exec _ AssertEnd = Set.filter (\m -> matchOffset m == B.length (matchBytes m))
+exec _ AssertBeginning = Set.filter (\m -> matchOffset m == 0)
+exec _ (AssertPositive dir regex) =
+  Set.filter (\m -> not (null (exec dir regex (Set.singleton m))))
+exec _ (AssertNegative dir regex) =
+  Set.filter (\m -> null (exec dir regex (Set.singleton m)))
+exec _ AssertWordBoundary = Set.filter atWordBoundary
+exec Forward MatchAnyChar = mapMatching $ \m ->
+  case U.decode (B.drop (matchOffset m) (matchBytes m)) of
+    Nothing -> m{ matchOffset = - 1}
+    Just (_,n) -> m{ matchOffset = matchOffset m + n }
+exec Backward MatchAnyChar = mapMatching $ \m ->
+  case lastCharOffset (matchBytes m) (matchOffset m) of
+    Nothing  -> m{ matchOffset = -1 }
+    Just off -> m{ matchOffset = off }
+exec Forward (MatchChar f) = mapMatching $ \m ->
+  case U.decode (B.drop (matchOffset m) (matchBytes m)) of
+    Just (c,n) | f c -> m{ matchOffset = matchOffset m + n }
+    _ -> m{ matchOffset = -1 }
+exec Backward (MatchChar f) = mapMatching $ \m ->
+  case lastCharOffset (matchBytes m) (matchOffset m) of
+    Nothing  -> m{ matchOffset = -1 }
+    Just off ->
+      case U.decode (B.drop off (matchBytes m)) of
+        Just (c,_) | f c -> m{ matchOffset = off }
+        _                -> m{ matchOffset = -1 }
+exec dir (MatchConcat (MatchConcat r1 r2) r3) =
+  exec dir (MatchConcat r1 (MatchConcat r2 r3))
+exec Forward (MatchConcat r1 r2) = -- TODO longest match first
+  exec Forward r2 . prune . exec Forward r1
+exec Backward (MatchConcat r1 r2) = exec Backward r1 . exec Backward r2
+exec dir (MatchAlt r1 r2) = \ms -> exec dir r1 ms <> exec dir r2 ms
+exec dir (MatchSome re) = go
+ where
+  go ms = case exec dir re ms of
+            ms' | Set.null ms' -> Set.empty
+                | ms' == ms    -> ms
+                | otherwise    -> let ms'' = prune ms'
+                                   in ms'' <> go ms''
+exec dir (MatchCapture i re) =
+  Set.foldr Set.union Set.empty .
+   Set.map (\m ->
+     Set.map (captureDifference m) (exec dir re (Set.singleton m)))
+ where
+    captureDifference m m' =
+      let len = matchOffset m' - matchOffset m
+      in  m'{ matchCaptures = M.insert i (matchOffset m, len)
+                                  (matchCaptures m') }
+exec dir (MatchCaptured n) = mapMatching matchCaptured
+ where
+   matchCaptured m =
+     case M.lookup n (matchCaptures m) of
+       Just (offset, len) ->
+              let capture = B.take len $ B.drop offset $ matchBytes m
+              in  case dir of
+                     Forward | B.isPrefixOf capture
+                                 (B.drop (matchOffset m) (matchBytes m))
+                        -> m{ matchOffset = matchOffset m + B.length capture }
+                     Backward | B.isSuffixOf capture
+                                 (B.take (matchOffset m) (matchBytes m))
+                        -> m{ matchOffset = matchOffset m - B.length capture }
+                     _  -> m{ matchOffset = -1 }
+       Nothing -> m{ matchOffset = -1 }
+
+
+atWordBoundary :: Match -> Bool
+atWordBoundary m =
+  case matchOffset m of
+    0 -> True
+    n | n == B.length (matchBytes m) -> True
+      | otherwise ->
+           case lastCharOffset (matchBytes m) (matchOffset m) of
+             Nothing  -> True
+             Just off ->
+               case U.toString (B.drop (off - 1) (matchBytes m)) of
+                 (prev:cur:next:_) ->
+                   (isWordChar cur /= isWordChar next) ||
+                   (isWordChar cur /= isWordChar prev)
+                 _ -> True
+
+lastCharOffset :: ByteString -> Int -> Maybe Int
+lastCharOffset _ 0 = Nothing
+lastCharOffset _ 1 = Nothing
+lastCharOffset bs n =
+  case B.index bs (n - 2) of
+    w | w <  0b10000000 -> Just (n - 1)
+      | w >= 0b11000000 -> Just (n - 1)
+      | otherwise -> lastCharOffset bs (n - 1)
+
+-- | Match a Regex against a (presumed UTF-8 encoded) ByteString,
+-- returning the matched text and a map of (offset, size)
+-- pairs for captures.  Note that all matches are from the
+-- beginning of the string (a @^@ anchor is implicit).  Note
+-- also that to avoid pathological performance in certain cases,
+-- the matcher is limited to considering 2000 possible matches
+-- at a time; when that threshold is reached, it discards
+-- smaller matches.  Hence certain regexes may incorrectly fail to
+-- match: e.g. @a*a{3000}$@ on a string of 3000 @a@s.
+matchRegex :: Regex
+           -> ByteString
+           -> Maybe (ByteString, M.IntMap (Int, Int))
+matchRegex re bs =
+  toResult <$> Set.lookupMin
+               (exec Forward re (Set.singleton (Match bs 0 M.empty)))
+ where
+   toResult m = (B.take (matchOffset m) (matchBytes m), (matchCaptures m))
+
diff --git a/src/Regex/KDE/Regex.hs b/src/Regex/KDE/Regex.hs
new file mode 100644
--- /dev/null
+++ b/src/Regex/KDE/Regex.hs
@@ -0,0 +1,62 @@
+{-# LANGUAGE CPP #-}
+{-# LANGUAGE OverloadedStrings #-}
+module Regex.KDE.Regex
+ ( Direction(..)
+ , Regex(..)
+ , isWordChar
+ ) where
+
+import Data.Char
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup ((<>), Semigroup)
+#endif
+
+data Direction = Forward | Backward
+  deriving (Show, Eq)
+
+data Regex =
+  MatchAnyChar |
+  MatchDynamic !Int |
+  MatchChar (Char -> Bool) |
+  MatchSome !Regex |
+  MatchAlt !Regex !Regex |
+  MatchConcat !Regex !Regex |
+  MatchCapture !Int !Regex |
+  MatchCaptured !Int |
+  AssertWordBoundary |
+  AssertBeginning |
+  AssertEnd |
+  AssertPositive !Direction !Regex |
+  AssertNegative !Direction !Regex |
+  MatchNull
+
+instance Show Regex where
+  show MatchAnyChar = "MatchAnyChar"
+  show (MatchDynamic i) = "MatchDynamic " <> show i
+  show (MatchChar _) = "(MatchChar <fn>)"
+  show (MatchSome re) = "(MatchSome " <> show re <> ")"
+  show (MatchAlt r1 r2) = "(MatchAlt " <> show r1 <> " " <> show r2 <> ")"
+  show (MatchConcat r1 r2) = "(MatchConcat " <> show r1 <> " " <> show r2 <>
+            ")"
+  show (MatchCapture i re) = "(MatchCapture " <> show i <> " " <>
+                show re <> ")"
+  show (MatchCaptured n) = "(MatchCaptured " <> show n <> ")"
+  show AssertWordBoundary = "AssertWordBoundary"
+  show AssertBeginning = "AssertBeginning"
+  show AssertEnd = "AssertEnd"
+  show (AssertPositive dir re) = "(AssertPositive " <> show dir <> " " <>
+                  show re <> ")"
+  show (AssertNegative dir re) = "(AssertNegativeLookahead " <>
+                  show dir <> " " <> show re <> ")"
+  show MatchNull = "MatchNull"
+
+instance Semigroup Regex where
+  (<>) = MatchConcat
+
+instance Monoid Regex where
+  mempty = MatchNull
+  mappend = (<>)
+
+isWordChar :: Char -> Bool
+isWordChar c = isAlphaNum c || generalCategory c == ConnectorPunctuation
+
diff --git a/src/Skylighting/Parser.hs b/src/Skylighting/Parser.hs
--- a/src/Skylighting/Parser.hs
+++ b/src/Skylighting/Parser.hs
@@ -284,7 +284,7 @@
        let column = if tildeRegex
                        then Just (0 :: Int)
                        else readMay column'
-       let re = RegExpr RE{ reString = fromString $ convertOctalEscapes str
+       let re = RegExpr RE{ reString = fromString str
                           , reCaseSensitive = not insensitive }
        let (incsyntax, inccontext) =
                case break (=='#') context of
@@ -293,7 +293,7 @@
        let mbmatcher = case name of
                          "DetectChar" -> Just $ DetectChar char0
                          "Detect2Chars" -> Just $ Detect2Chars char0 char1
-                         "AnyChar" -> Just $ AnyChar str
+                         "AnyChar" -> Just $ AnyChar $ Set.fromList str
                          "RangeDetect" -> Just $ RangeDetect char0 char1
                          "StringDetect" -> Just $ StringDetect $ Text.pack str
                          "WordDetect" -> Just $ WordDetect $ Text.pack str
diff --git a/src/Skylighting/Regex.hs b/src/Skylighting/Regex.hs
--- a/src/Skylighting/Regex.hs
+++ b/src/Skylighting/Regex.hs
@@ -5,36 +5,26 @@
 {-# LANGUAGE ScopedTypeVariables #-}
 
 module Skylighting.Regex (
-                Regex
-              , RegexException
+                Regex(..)
               , RE(..)
               , compileRegex
               , matchRegex
-              , convertOctalEscapes
+              , testRegex
+              , isWordChar
               ) where
 
-import qualified Control.Exception as E
 import Data.Aeson
 import Data.Binary (Binary)
 import qualified Data.ByteString.Base64 as Base64
 import qualified Data.ByteString.Char8 as BS
-import Data.ByteString.UTF8 (toString)
 import Data.Data
 import qualified Data.Text as Text
 import qualified Data.Text.Encoding as TE
 import GHC.Generics (Generic)
-import System.IO.Unsafe (unsafePerformIO)
-import Text.Printf
-import Text.Regex.PCRE.ByteString
 #if !MIN_VERSION_base(4,13,0)
 import Control.Monad.Fail (MonadFail)
 #endif
-
--- | An exception in compiling or executing a regex.
-newtype RegexException = RegexException String
-      deriving (Show, Typeable, Generic)
-
-instance E.Exception RegexException
+import Regex.KDE
 
 -- | A representation of a regular expression.
 data RE = RE{
@@ -51,56 +41,6 @@
   parseJSON = withObject "RE" $ \v ->
     RE <$> ((v .: "reString") >>= decodeFromText)
        <*> v .: "reCaseSensitive"
-
--- | Compile a PCRE regex.  If the first parameter is True, the regex is
--- case-sensitive, otherwise caseless.  The regex is compiled from
--- a bytestring interpreted as UTF-8.  If the regex cannot be compiled,
--- a 'RegexException' is thrown.
-compileRegex :: Bool -> BS.ByteString -> Regex
-compileRegex caseSensitive regexpStr =
-  let opts = compAnchored + compUTF8 +
-               if caseSensitive then 0 else compCaseless
-  in  case unsafePerformIO $ compile opts (execNotEmpty) regexpStr of
-            Left (off,msg) -> E.throw $ RegexException $
-                        "Error compiling regex /" ++ toString regexpStr ++
-                        "/ at offset " ++ show off ++ "\n" ++ msg
-            Right r -> r
-
--- | Convert octal escapes to the form pcre wants.  Note:
--- need at least pcre 8.34 for the form \o{dddd}.
--- So we prefer \ddd or \x{...}.
-convertOctalEscapes :: String -> String
-convertOctalEscapes [] = ""
-convertOctalEscapes ('\\':'0':x:y:z:rest)
-  | all isOctalDigit [x,y,z] = '\\':x:y:z: convertOctalEscapes rest
-convertOctalEscapes ('\\':x:y:z:rest)
-  | all isOctalDigit [x,y,z] ='\\':x:y:z: convertOctalEscapes rest
-convertOctalEscapes ('\\':'o':'{':zs) =
-  case break (=='}') zs of
-       (ds, '}':rest) | all isOctalDigit ds && not (null ds) ->
-            case reads ('0':'o':ds) of
-                 ((n :: Int,[]):_) ->
-                     printf "\\x{%x}" n ++ convertOctalEscapes rest
-                 _          -> E.throw $ RegexException $
-                                   "Unable to read octal number: " ++ ds
-       _  -> '\\':'o':'{': convertOctalEscapes zs
-convertOctalEscapes (x:xs) = x : convertOctalEscapes xs
-
-isOctalDigit :: Char -> Bool
-isOctalDigit c = c >= '0' && c <= '7'
-
--- | Match a 'Regex' against a bytestring.  Returns 'Nothing' if
--- no match, otherwise 'Just' a nonempty list of bytestrings. The first
--- bytestring in the list is the match, the others the captures, if any.
--- If there are errors in executing the regex, a 'RegexException' is
--- thrown.
-matchRegex :: Regex -> BS.ByteString -> Maybe [BS.ByteString]
-matchRegex r s = case unsafePerformIO (regexec r s) of
-                      Right (Just (_, mat, _ , capts)) ->
-                                       Just (mat : capts)
-                      Right Nothing    -> Nothing
-                      -- treat match error as no match, like Kate: #81
-                      Left (_rc, _msg) -> Nothing
 
 -- functions to marshall bytestrings to text
 
diff --git a/src/Skylighting/Tokenizer.hs b/src/Skylighting/Tokenizer.hs
--- a/src/Skylighting/Tokenizer.hs
+++ b/src/Skylighting/Tokenizer.hs
@@ -20,8 +20,9 @@
 import qualified Data.ByteString.Char8 as BS
 import qualified Data.ByteString.UTF8 as UTF8
 import Data.CaseInsensitive (mk)
-import Data.Char (isAlphaNum, isAscii, isDigit, isLetter, isPrint, isSpace, ord)
+import Data.Char (isAlphaNum, isAscii, isDigit, isLetter, isSpace, ord)
 import qualified Data.Map as Map
+import qualified Data.IntMap as IntMap
 import Data.Maybe (catMaybes)
 import qualified Data.Set as Set
 import Data.Text (Text)
@@ -30,7 +31,6 @@
 import Debug.Trace
 import Skylighting.Regex
 import Skylighting.Types
-import Text.Printf (printf)
 #if !MIN_VERSION_base(4,11,0)
 import Data.Semigroup
 #endif
@@ -43,7 +43,7 @@
   , endline             :: Bool
   , prevChar            :: Char
   , contextStack        :: ContextStack
-  , captures            :: [ByteString]
+  , captures            :: IntMap.IntMap ByteString
   , column              :: Int
   , lineContinuation    :: Bool
   , firstNonspaceColumn :: Maybe Int
@@ -211,7 +211,7 @@
                 , endline = True
                 , prevChar = '\n'
                 , contextStack = ContextStack []
-                , captures = []
+                , captures = mempty
                 , column = 0
                 , lineContinuation = False
                 , firstNonspaceColumn = Nothing
@@ -250,18 +250,14 @@
   gets endline >>= guard . not
   context <- currentContext
   msum (map (\r -> tryRule r inp) (cRules context)) <|>
-     if cFallthrough context
-        then do
-          let fallthroughContext = case cFallthroughContext context of
-                                        [] -> [Pop]
-                                        cs -> cs
-          doContextSwitches fallthroughContext
-          getToken
-        else do
-          t <- normalChunk
-          let mbtok = Just (cAttribute context, t)
-          info $ "FALLTHROUGH " ++ show mbtok
-          return mbtok
+     case cFallthroughContext context of
+           [] | cFallthrough context -> Nothing <$ doContextSwitches [Pop]
+              | otherwise -> do
+                  t <- normalChunk
+                  let mbtok = Just (cAttribute context, t)
+                  info $ "FALLTHROUGH " ++ show mbtok
+                  return mbtok
+           cs -> Nothing <$ doContextSwitches cs
 
 takeChars :: Int -> TokenizerM Text
 takeChars 0 = mzero
@@ -512,39 +508,43 @@
        takeChars 1
      else mzero
 
-anyChar :: [Char] -> ByteString -> TokenizerM Text
+anyChar :: Set.Set Char -> ByteString -> TokenizerM Text
 anyChar cs inp = do
   case UTF8.uncons inp of
-     Just (x, _) | x `elem` cs -> takeChars 1
+     Just (x, _) | x `Set.member` cs -> takeChars 1
      _           -> mzero
 
 regExpr :: Bool -> RE -> ByteString -> TokenizerM Text
 regExpr dynamic re inp = do
-  reStr <- if dynamic
-              then do
-                reStr' <- subDynamic (reString re)
-                info $ "Dynamic regex: " ++ show reStr'
-                return reStr'
-              else return (reString re)
+  -- return $! traceShowId $! (reStr, inp)
+  let reStr = reString re
   when (BS.take 2 reStr == "\\b") $ wordBoundary inp
-  regex <- if dynamic
-              then return $ compileRegex (reCaseSensitive re) reStr
-              else do
-                compiledREs <- gets compiledRegexes
-                case Map.lookup re compiledREs of
-                     Nothing -> do
-                       let cre = compileRegex (reCaseSensitive re) reStr
-                       modify $ \st -> st{ compiledRegexes =
-                             Map.insert re cre (compiledRegexes st) }
-                       return cre
-                     Just cre -> return cre
-  case matchRegex regex inp of
-       Just (match:capts) -> do
-         unless (null capts) $
-           modify $ \st -> st{ captures = capts }
-         takeChars (UTF8.length match)
-       _ -> mzero
+  compiledREs <- gets compiledRegexes
+  regex <- case Map.lookup re compiledREs of
+              Nothing -> do
+                cre <- case compileRegex (reCaseSensitive re) reStr of
+                         Right r  -> return r
+                         Left e   -> throwError $
+                           "Error compiling regex " ++
+                            UTF8.toString reStr ++ ": " ++ e
+                modify $ \st -> st{ compiledRegexes =
+                      Map.insert re cre (compiledRegexes st) }
+                return cre
+              Just cre -> return cre
+  regex' <- if dynamic
+               then subDynamic regex
+               else return regex
+  case matchRegex regex' inp of
+        Just (matchedBytes, capts) -> do
+          unless (null capts) $
+             modify $ \st -> st{ captures =
+                                  IntMap.map (toSlice matchedBytes) capts }
+          takeChars (UTF8.length matchedBytes)
+        _ -> mzero
 
+toSlice :: ByteString -> (Int, Int) -> ByteString
+toSlice bs (off, len) = BS.take len $ BS.drop off bs
+
 wordBoundary :: ByteString -> TokenizerM ()
 wordBoundary inp = do
   case UTF8.uncons inp of
@@ -553,14 +553,8 @@
          c <- gets prevChar
          guard $ isWordBoundary c d
 
--- TODO is this right?
 isWordBoundary :: Char -> Char -> Bool
-isWordBoundary c d =
-  (isAlphaNum c && not (isAlphaNum d))
-  || (isAlphaNum d && not (isAlphaNum c))
-  || (isSpace d && not (isSpace c))
-  || (isSpace c && not (isSpace d))
-
+isWordBoundary c d = isWordChar c /= isWordChar d
 
 decodeBS :: ByteString -> TokenizerM Text
 decodeBS bs = case decodeUtf8' bs of
@@ -570,47 +564,30 @@
 
 -- Substitute out %1, %2, etc. in regex string, escaping
 -- appropriately..
-subDynamic :: ByteString -> TokenizerM ByteString
-subDynamic bs =
-  case BS.break (=='%') bs of
-       (y,z)
-         | BS.null z -> return y
-         | otherwise -> (y <>) <$>
-             case BS.unpack (BS.take 2 z) of
-                  ['%',x] | x >= '0' && x <= '9' -> do
-                     let capNum = ord x - ord '0'
-                     replacement <- getCapture capNum
-                     (escapeRegex (encodeUtf8 replacement) <>) <$>
-                         subDynamic (BS.drop 2 z)
-                  _ -> BS.cons '%' <$> (subDynamic (BS.drop 1 z))
-
-escapeRegex :: BS.ByteString -> BS.ByteString
-escapeRegex = BS.concatMap escapeRegexChar
-
-escapeRegexChar :: Char -> BS.ByteString
-escapeRegexChar '^' = "\\^"
-escapeRegexChar '$' = "\\$"
-escapeRegexChar '\\' = "\\\\"
-escapeRegexChar '[' = "\\["
-escapeRegexChar ']' = "\\]"
-escapeRegexChar '(' = "\\("
-escapeRegexChar ')' = "\\)"
-escapeRegexChar '{' = "\\{"
-escapeRegexChar '}' = "\\}"
-escapeRegexChar '*' = "\\*"
-escapeRegexChar '+' = "\\+"
-escapeRegexChar '.' = "\\."
-escapeRegexChar '?' = "\\?"
-escapeRegexChar c
-  | isAscii c && isPrint c = BS.singleton c
-  | otherwise              = BS.pack $ printf "\\x{%x}" (ord c)
+subDynamic :: Regex -> TokenizerM Regex
+subDynamic (MatchDynamic capNum) = do
+  replacement <- getCapture capNum
+  return $ mconcat $ map (MatchChar . (==)) $ Text.unpack replacement
+subDynamic (MatchAlt r1 r2) =
+  MatchAlt <$> subDynamic r1 <*> subDynamic r2
+subDynamic (MatchConcat r1 r2) =
+  MatchConcat <$> subDynamic r1 <*> subDynamic r2
+subDynamic (MatchSome r) =
+  MatchSome <$> subDynamic r
+subDynamic (MatchCapture i r) =
+  MatchCapture i <$> subDynamic r
+subDynamic (AssertPositive dir r) =
+  AssertPositive dir <$> subDynamic r
+subDynamic (AssertNegative dir r) =
+  AssertNegative dir <$> subDynamic r
+subDynamic x = return x
 
 getCapture :: Int -> TokenizerM Text
 getCapture capnum = do
   capts <- gets captures
-  if length capts < capnum
-     then mzero
-     else decodeBS $ capts !! (capnum - 1)
+  case IntMap.lookup capnum capts of
+     Nothing -> mzero
+     Just x  -> decodeBS x
 
 keyword :: KeywordAttr -> WordSet Text -> ByteString -> TokenizerM Text
 keyword kwattr kws inp = do
diff --git a/src/Skylighting/Types.hs b/src/Skylighting/Types.hs
--- a/src/Skylighting/Types.hs
+++ b/src/Skylighting/Types.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE BangPatterns               #-}
 {-# LANGUAGE DeriveDataTypeable         #-}
 {-# LANGUAGE DeriveGeneric              #-}
 {-# LANGUAGE FlexibleInstances          #-}
@@ -70,16 +71,16 @@
 
 -- | Attributes controlling how keywords are interpreted.
 data KeywordAttr =
-  KeywordAttr  { keywordCaseSensitive :: Bool
-               , keywordDelims        :: Set.Set Char
+  KeywordAttr  { keywordCaseSensitive :: !Bool
+               , keywordDelims        :: !(Set.Set Char)
                }
   deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary KeywordAttr
 
 -- | A set of "words," possibly case insensitive.
-data WordSet a = CaseSensitiveWords (Set.Set a)
-               | CaseInsensitiveWords (Set.Set a)
+data WordSet a = CaseSensitiveWords !(Set.Set a)
+               | CaseInsensitiveWords !(Set.Set a)
      deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary a => Binary (WordSet a)
@@ -96,14 +97,14 @@
 
 -- | Matchers correspond to the element types in a context.
 data Matcher =
-    DetectChar Char
-  | Detect2Chars Char Char
-  | AnyChar [Char]
-  | RangeDetect Char Char
-  | StringDetect Text
-  | WordDetect Text
-  | RegExpr RE
-  | Keyword KeywordAttr (WordSet Text)
+    DetectChar !Char
+  | Detect2Chars !Char !Char
+  | AnyChar !(Set.Set Char)
+  | RangeDetect !Char !Char
+  | StringDetect !Text
+  | WordDetect !Text
+  | RegExpr !RE
+  | Keyword KeywordAttr !(WordSet Text)
   | Int
   | Float
   | HlCOct
@@ -111,7 +112,7 @@
   | HlCStringChar
   | HlCChar
   | LineContinue
-  | IncludeRules ContextName
+  | IncludeRules !ContextName
   | DetectSpaces
   | DetectIdentifier
   deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
@@ -120,7 +121,7 @@
 
 -- | A context switch, either pops or pushes a context.
 data ContextSwitch =
-  Pop | Push ContextName
+  Pop | Push !ContextName
   deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary ContextSwitch
@@ -128,16 +129,16 @@
 -- | A rule corresponds to one of the elements of a Kate syntax
 -- highlighting "context."
 data Rule = Rule{
-    rMatcher          :: Matcher
-  , rAttribute        :: TokenType
-  , rIncludeAttribute :: Bool
-  , rDynamic          :: Bool
-  , rCaseSensitive    :: Bool
-  , rChildren         :: [Rule]
-  , rLookahead        :: Bool
-  , rFirstNonspace    :: Bool
-  , rColumn           :: Maybe Int
-  , rContextSwitch    :: [ContextSwitch]
+    rMatcher          :: !Matcher
+  , rAttribute        :: !TokenType
+  , rIncludeAttribute :: !Bool
+  , rDynamic          :: !Bool
+  , rCaseSensitive    :: !Bool
+  , rChildren         :: ![Rule]
+  , rLookahead        :: !Bool
+  , rFirstNonspace    :: !Bool
+  , rColumn           :: !(Maybe Int)
+  , rContextSwitch    :: ![ContextSwitch]
   } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary Rule
@@ -145,15 +146,15 @@
 -- | A syntax corresponds to a complete Kate syntax description.
 -- The 'sShortname' field is derived from the filename.
 data Syntax = Syntax{
-    sName            :: Text
-  , sFilename        :: String
-  , sShortname       :: Text
-  , sContexts        :: Map.Map Text Context
-  , sAuthor          :: Text
-  , sVersion         :: Text
-  , sLicense         :: Text
-  , sExtensions      :: [String]
-  , sStartingContext :: Text
+    sName            :: !Text
+  , sFilename        :: !String
+  , sShortname       :: !Text
+  , sContexts        :: !(Map.Map Text Context)
+  , sAuthor          :: !Text
+  , sVersion         :: !Text
+  , sLicense         :: !Text
+  , sExtensions      :: ![String]
+  , sStartingContext :: !Text
   } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary Syntax
@@ -164,16 +165,16 @@
 -- | A Context corresponds to a context element in a Kate
 -- syntax description.
 data Context = Context{
-    cName               :: Text
-  , cSyntax             :: Text
-  , cRules              :: [Rule]
-  , cAttribute          :: TokenType
-  , cLineEmptyContext   :: [ContextSwitch]
-  , cLineEndContext     :: [ContextSwitch]
-  , cLineBeginContext   :: [ContextSwitch]
-  , cFallthrough        :: Bool
-  , cFallthroughContext :: [ContextSwitch]
-  , cDynamic            :: Bool
+    cName               :: !Text
+  , cSyntax             :: !Text
+  , cRules              :: ![Rule]
+  , cAttribute          :: !TokenType
+  , cLineEmptyContext   :: ![ContextSwitch]
+  , cLineEndContext     :: ![ContextSwitch]
+  , cLineBeginContext   :: ![ContextSwitch]
+  , cFallthrough        :: !Bool
+  , cFallthroughContext :: ![ContextSwitch]
+  , cDynamic            :: !Bool
 } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary Context
@@ -247,11 +248,11 @@
 
 -- | A 'TokenStyle' determines how a token is to be rendered.
 data TokenStyle = TokenStyle {
-    tokenColor      :: Maybe Color
-  , tokenBackground :: Maybe Color
-  , tokenBold       :: Bool
-  , tokenItalic     :: Bool
-  , tokenUnderline  :: Bool
+    tokenColor      :: !(Maybe Color)
+  , tokenBackground :: !(Maybe Color)
+  , tokenBold       :: !Bool
+  , tokenItalic     :: !Bool
+  , tokenUnderline  :: !Bool
   } deriving (Show, Read, Ord, Eq, Data, Typeable, Generic)
 
 instance Binary TokenStyle
@@ -665,11 +666,11 @@
 -- color for normal tokens.  Line numbers can have a different
 -- color and background color.
 data Style = Style {
-    tokenStyles               :: Map.Map TokenType TokenStyle
-  , defaultColor              :: Maybe Color
-  , backgroundColor           :: Maybe Color
-  , lineNumberColor           :: Maybe Color
-  , lineNumberBackgroundColor :: Maybe Color
+    tokenStyles               :: !(Map.Map TokenType TokenStyle)
+  , defaultColor              :: !(Maybe Color)
+  , backgroundColor           :: !(Maybe Color)
+  , lineNumberColor           :: !(Maybe Color)
+  , lineNumberBackgroundColor :: !(Maybe Color)
   } deriving (Read, Show, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary Style
@@ -720,14 +721,14 @@
 
 -- | Options for formatting source code.
 data FormatOptions = FormatOptions{
-         numberLines      :: Bool           -- ^ Number lines
-       , startNumber      :: Int            -- ^ Number of first line
-       , lineAnchors      :: Bool           -- ^ Anchors on each line number
-       , titleAttributes  :: Bool           -- ^ Html titles with token types
-       , codeClasses      :: [Text]         -- ^ Additional classes for Html code tag
-       , containerClasses :: [Text]         -- ^ Additional classes for Html container tag
-       , lineIdPrefix     :: Text           -- ^ Prefix for id attributes on lines
-       , ansiColorLevel   :: ANSIColorLevel -- ^ Level of ANSI color support to use
+         numberLines      :: !Bool           -- ^ Number lines
+       , startNumber      :: !Int            -- ^ Number of first line
+       , lineAnchors      :: !Bool           -- ^ Anchors on each line number
+       , titleAttributes  :: !Bool           -- ^ Html titles with token types
+       , codeClasses      :: ![Text]         -- ^ Additional classes for Html code tag
+       , containerClasses :: ![Text]         -- ^ Additional classes for Html container tag
+       , lineIdPrefix     :: !Text           -- ^ Prefix for id attributes on lines
+       , ansiColorLevel   :: !ANSIColorLevel -- ^ Level of ANSI color support to use
        } deriving (Show, Read, Eq, Ord, Data, Typeable, Generic)
 
 instance Binary FormatOptions
diff --git a/test/expected/abc.javascript.native b/test/expected/abc.javascript.native
--- a/test/expected/abc.javascript.native
+++ b/test/expected/abc.javascript.native
@@ -99,7 +99,8 @@
   , ( NormalTok , " (index " )
   , ( OperatorTok , "!==" )
   , ( NormalTok , " " )
-  , ( DecValTok , "-1" )
+  , ( OperatorTok , "-" )
+  , ( DecValTok , "1" )
   , ( NormalTok , ") {" )
   ]
 , [ ( NormalTok , "        length" ) , ( OperatorTok , "--;" ) ]
diff --git a/test/expected/life.lua.native b/test/expected/life.lua.native
--- a/test/expected/life.lua.native
+++ b/test/expected/life.lua.native
@@ -10,8 +10,7 @@
 , [ ( CommentTok , "-- modified to use for instead of while" ) ]
 , []
 , [ ( KeywordTok , "local" )
-  , ( NormalTok , " " )
-  , ( FunctionTok , "write" )
+  , ( NormalTok , " write" )
   , ( OperatorTok , "=" )
   , ( FunctionTok , "io.write" )
   ]
diff --git a/test/test-skylighting.hs b/test/test-skylighting.hs
--- a/test/test-skylighting.hs
+++ b/test/test-skylighting.hs
@@ -3,7 +3,6 @@
 {-# LANGUAGE OverloadedStrings   #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 module Main where
-import qualified Control.Exception as E
 import Data.Aeson (decode, encode)
 import Data.Algorithm.Diff
 import qualified Data.ByteString.Lazy as BL
@@ -23,7 +22,7 @@
 import Test.Tasty.HUnit
 import Test.Tasty.QuickCheck (testProperty)
 import Text.Show.Pretty
-
+import GHC.IO.Encoding (setLocaleEncoding)
 import Skylighting.Core
 
 readTextFile :: FilePath -> IO Text
@@ -40,6 +39,7 @@
 
 main :: IO ()
 main = do
+  setLocaleEncoding utf8
   sMap <- do
       result <- loadSyntaxesFromDir xmlPath
       case result of
@@ -78,11 +78,6 @@
        , testCase "round trip style -> theme -> style" $
             Just kate @=? decode (encode kate)
        ]
-    , testGroup "Skylighting.Regex" $
-      [ testCase "convertOctalEscapes" $
-            "a\\700b\\700c\\x{800}" @=?
-              convertOctalEscapes "a\\700b\\0700c\\o{4000}"
-      ]
     , testGroup "Skylighting" $
       [ testCase "syntaxesByFilename" $
             ["Perl"] @=?
@@ -93,6 +88,7 @@
     , testGroup "Doesn't hang or drop text on fuzz" $
         map (\syn -> testProperty (Text.unpack (sName syn)) (p_no_drop defConfig syn))
         syntaxes
+    , testGroup "Regex module" $ map regexTest regexTests
     , testGroup "Regression tests" $
       let perl = maybe (error "could not find Perl syntax") id
                              (lookupSyntax "Perl" sMap)
@@ -193,24 +189,21 @@
 
 noDropTest :: TokenizerConfig -> [Text] -> Syntax -> TestTree
 noDropTest cfg inps syntax =
-  localOption (mkTimeout 15000000)
+  localOption (mkTimeout 25000000)
   $ testCase (Text.unpack (sName syntax))
   $ mapM_ go inps
     where go inp =
-            E.catch
-              (case tokenize cfg syntax inp of
+              case tokenize cfg syntax inp of
                     Right ts -> assertBool ("Text has been dropped:\n" ++ diffs)
                                  (inplines == toklines)
                          where inplines = Text.lines inp
                                toklines = map (mconcat . map tokToText) ts
                                diffs = makeDiff "expected" inplines toklines
                     Left  e  ->
-                      assertFailure ("Unexpected error: " ++ e ++ "\ninput = " ++ show inp))
-              (\(e :: RegexException) ->
-                assertFailure (show e ++ "\ninput = " ++ show inp))
+                      assertFailure ("Unexpected error: " ++ e ++ "\ninput = " ++ show inp)
 
 tokenizerTest :: TokenizerConfig -> SyntaxMap -> Bool -> FilePath -> TestTree
-tokenizerTest cfg sMap regen inpFile = localOption (mkTimeout 15000000) $
+tokenizerTest cfg sMap regen inpFile = localOption (mkTimeout 25000000) $
   goldenTest testname getExpected getActual
       (compareValues referenceFile) updateGolden
   where testname = lang ++ " tokenizing of " ++ inpFile
@@ -231,6 +224,55 @@
         casesdir = "test" </> "cases"
         referenceFile = expecteddir </> inpFile <.> "native"
         lang = drop 1 $ takeExtension inpFile
+
+regexTest :: (String, String, Maybe (String, [(Int,String)])) -> TestTree
+regexTest (re, inp, expected) =
+  testCase ("/" ++ re ++ "/ " ++ inp) $
+    expected @=? testRegex True re inp
+
+regexTests :: [(String, String, Maybe (String, [(Int,String)]))]
+regexTests =
+  [ (".", "aab", Just ("a", []))
+  , ("ab", "aab", Nothing)
+  , ("ab", "abb", Just ("ab", []))
+  , ("a(b)", "abb", Just ("ab", [(1,"b")]))
+  , ("a(b.)*", "abbbcb", Just ("abbbc", [(1,"bc")]))
+  , ("a(?:b.)*", "abbbcb", Just ("abbbc", []))
+  , ("a(?=b)", "abb", Just ("a", []))
+  , ("a(?=b)", "acb", Nothing)
+  , ("a(?!b)", "abb", Nothing)
+  , ("a(?!b)", "acb", Just ("a", []))
+  , ("a?b+", "bbb", Just ("bbb", []))
+  , ("a?b+", "abbb", Just ("abbb", []))
+  , ("a?b+", "ac", Nothing)
+  , ("a*", "bbb", Just ("", []))
+  , ("abc|ab$", "ab", Just ("ab", []))
+  , ("abc|ab$", "abcd", Just ("abc", []))
+  , ("abc|ab$", "abd", Nothing)
+  , ("(?:ab)*|a.*", "abababa", Just ("abababa", []))
+  , ("a[b-e]*", "abcdefg", Just ("abcde", []))
+  , ("a[b-e\\n-]*", "abcde\nb-bcfg", Just ("abcde\nb-bc", []))
+  , ("^\\s+\\S+\\s+$", "   abc  ", Just ("   abc  ", []))
+  , ("\\$", "$$", Just ("$", []))
+  , ("[\\z12bb]", "\x12bb", Just ("\x12bb", []))
+  , ("\\bhello\\b|hell", "hello there", Just ("hello", []))
+  , ("\\bhello\\b|hell", "hellothere", Just ("hell", []))
+  , ("[[:space:]]{2,4}.", "  abc", Just ("  a", []))
+  , ("[[:space:]]{2,4}.", " abc", Nothing)
+  , ("[[:space:]]{2,4}.", "     abc", Just ("     ", []))
+  , ("((..)\\+\\2)", "aa+aabb+bbbc+cb",
+          Just ("aa+aa", [(1,"aa+aa"), (2,"aa")]))
+  , ("(\\d+)/(\\d+) == \\{1}", "22/2 == 22",
+         Just ("22/2 == 22", [(1,"22"), (2,"2")]))
+  , ("([a-z]+){2}", "htabc", Just ("htabc", [(1,"c")]))
+  , ("((.+)(.+)(.+))*", (replicate 400 'a'),
+          Just (replicate 400 'a',
+                 [(1, replicate 400 'a')
+                 ,(2,replicate 398 'a')
+                 ,(3,"a")
+                 ,(4,"a")]))
+  ]
+
 
 vividize :: Diff Text -> Text
 vividize (Both s _) = "  " <> s
diff --git a/xml/actionscript.xml b/xml/actionscript.xml
--- a/xml/actionscript.xml
+++ b/xml/actionscript.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd">
-<language name="ActionScript 2.0" version="3" kateversion="5.0" section="Sources" extensions="*.as" mimetype="text/x-actionscript" license="LGPL" author="Aaron Miller (armantic101@gmail.com)">
+<language name="ActionScript 2.0" version="4" kateversion="5.0" section="Sources" extensions="*.as" mimetype="text/x-actionscript" license="LGPL" author="Aaron Miller (armantic101@gmail.com)">
   <highlighting>
     
     <list name="properties">
@@ -269,8 +269,8 @@
         <RegExpr attribute="Keyword" context="StaticImports" String="\b(import\s+static)\b" />
         <RegExpr attribute="Keyword" context="Imports" String="\b(package|import)\b" /> 
         <RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*(/\*\s*\d+\s*\*/\s*)?[(])" />
-        <RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" /> 
-        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
+        <DetectChar attribute="Symbol" context="Member" char="." />
+        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/*&lt;=&gt;?[]|~^&#59;"/>
       </context>
       <context name="Float Suffixes" attribute="Float" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
           <AnyChar String="fF" attribute="Float" context="#pop"/>
diff --git a/xml/bash.xml b/xml/bash.xml
--- a/xml/bash.xml
+++ b/xml/bash.xml
@@ -9,7 +9,7 @@
         <!ENTITY pathpart "([\w_@.&#37;*?+-]|\\ )">     <!-- valid character in a file name -->
         <!ENTITY charbeforecomment "[\s;]">             <!-- character before a comment # -->
 ]>
-<language name="Bash" version="10" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
+<language name="Bash" version="11" kateversion="5.0" section="Scripts" extensions="*.sh;*.bash;*.ebuild;*.eclass;*.nix;.bashrc;.bash_profile;.bash_login;.profile;PKGBUILD;APKBUILD" mimetype="application/x-shellscript" casesensitive="1" author="Wilbert Berendsen (wilbert@kde.nl)" license="LGPL">
 
 <!-- (c) 2004 by Wilbert Berendsen (wilbert@kde.nl)
     Changes by Matthew Woehlke (mw_triad@users.sourceforge.net)
@@ -563,7 +563,8 @@
         <!-- handle here document -->
         <Detect2Chars attribute="Redirection" context="HereDoc" char="&lt;" char1="&lt;" lookAhead="true" />
         <!-- handle process subst -->
-        <RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&lt;" char1="(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&gt;" char1="(" />
         <!-- handle redirection -->
         <RegExpr attribute="Redirection" context="#stay" String="([0-9]*(&gt;{1,2}|&lt;)(&amp;[0-9]+-?)?|&amp;&gt;|&gt;&amp;|[0-9]*&lt;&gt;)" />
         <!-- handle &, &&, | and || -->
@@ -606,7 +607,8 @@
         <!-- handle here document -->
         <Detect2Chars attribute="Redirection" context="HereDoc" char="&lt;" char1="&lt;" lookAhead="true" />
         <!-- handle process subst -->
-        <RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&lt;" char1="(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&gt;" char1="(" />
         <!-- handle redirection -->
         <RegExpr attribute="Redirection" context="#stay" String="([0-9]*(&gt;{1,2}|&lt;)(&amp;[0-9]+-?)?|&amp;&gt;|&gt;&amp;|[0-9]*&lt;&gt;)" />
         <!-- handle &, &&, |, ||, ; and ;; -->
diff --git a/xml/boo.xml b/xml/boo.xml
--- a/xml/boo.xml
+++ b/xml/boo.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE language>
 <!-- Based on Python syntax highlighting v1.99 by Primoz Anzur, Paul Giannaros, Michael Bueker, Per Wigren -->
 <!-- Also based on boo.lang from gtksourceview -->
-<language name="Boo" version="3" kateversion="5.0" section="Sources" extensions="*.boo" mimetype="text/x-boo" casesensitive="1" author="Marc Dassonneville" license="LGPL">
+<language name="Boo" version="4" kateversion="5.0" section="Sources" extensions="*.boo" mimetype="text/x-boo" casesensitive="1" author="Marc Dassonneville" license="LGPL">
 	<highlighting>
 		<list name="namespace">
 			<item>import</item>
@@ -163,11 +163,13 @@
 				<RegExpr attribute="Hex" String="0[Xx][0-9a-fA-F]+" context="#stay"/>
 				<RegExpr attribute="Octal" String="0[1-9][0-9]*" context="#stay"/>
 
-				<RegExpr attribute="Raw String" String="[rR]'''" context="Raw Tripple A-string"/>
-				<RegExpr attribute="Raw String" String="[rR]&quot;&quot;&quot;" context="Raw Tripple Q-string"/>
+				<StringDetect attribute="Raw String" String="r'''" context="Raw Tripple A-string" insensitive="1"/>
+				<StringDetect attribute="Raw String" String="r&quot;&quot;&quot;" context="Raw Tripple Q-string" insensitive="1"/>
 
-				<RegExpr attribute="Raw String" String="[rR]'" context="Raw A-string"/>
-				<RegExpr attribute="Raw String" String="[rR]&quot;" context="Raw Q-string"/>
+				<Detect2Chars attribute="Raw String" char="r" char1="'" context="Raw A-string"/>
+				<Detect2Chars attribute="Raw String" char="R" char1="'" context="Raw A-string"/>
+				<Detect2Chars attribute="Raw String" char="r" char1="&quot;" context="Raw Q-string"/>
+				<Detect2Chars attribute="Raw String" char="R" char1="&quot;" context="Raw Q-string"/>
 
 				<RegExpr attribute="Comment" String="#.*$" context="#stay"/>
 				<RegExpr attribute="Comment" String="^\s*u?'''" context="Tripple A-comment" beginRegion="Tripple A-region"/>
@@ -185,7 +187,7 @@
 				<StringDetect attribute="Operator" String="[|" context="Quasi-Quotation" beginRegion="qq"/>
 				<StringDetect attribute="Operator" String="|]" context="#pop" endRegion="qq"/>
 
-				<RegExpr attribute="Operator" String="[+*/%\|=;\!&lt;&gt;!^&amp;~-]" context="#stay"/>
+				<AnyChar attribute="Operator" String="+*/%|=;!&lt;&gt;!^&amp;~-" context="#stay"/>
 				<RegExpr attribute="String Substitution" String="%[a-zA-Z]" context="#stay"/>
 			</context>
 
diff --git a/xml/c.xml b/xml/c.xml
--- a/xml/c.xml
+++ b/xml/c.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd"
 [
-    <!ENTITY int "(?:[0-9]+)">
-    <!ENTITY hex_int "(?:[0-9A-Fa-f]+)">
+    <!ENTITY int "(?:[0-9]++)">
+    <!ENTITY hex_int "(?:[0-9A-Fa-f]++)">
     <!ENTITY exp_float "(?:[eE][+-]?&int;)">
     <!ENTITY exp_hexfloat "(?:[pP][-+]?&int;)">
 
@@ -10,7 +10,7 @@
     <!ENTITY pphash "&ispphash;\s*">
 ]>
 <language name="C" section="Sources"
-          version="8" kateversion="5.0"
+          version="9" kateversion="5.0"
           indenter="cstyle"
           extensions="*.c;*.C;*.h"
           mimetype="text/x-csrc;text/x-c++src;text/x-chdr"
@@ -226,16 +226,16 @@
       </context>
 
       <context name="Number" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
-        <RegExpr attribute="Float" context="FloatSuffix" String="\.&int;&exp_float;?|&int;(?:&exp_float;|\.&int;?&exp_float;?)|0[xX](?:\.&hex_int;&exp_hexfloat;?|&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))" />
+        <RegExpr attribute="Float" context="FloatSuffix" String="\.&int;&exp_float;?|0[xX](?:\.&hex_int;&exp_hexfloat;?|&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))|&int;(?:&exp_float;|\.&int;?&exp_float;?)" />
         <IncludeRules context="Integer" />
       </context>
 
       <context name="Integer" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
         <RegExpr attribute="Hex" context="IntSuffix" String="0[xX]&hex_int;" />
-        <RegExpr attribute="Binary" context="IntSuffix" String="0[Bb][01]+" />
-        <RegExpr attribute="Octal" context="IntSuffix" String="0[0-7]+" />
-        <RegExpr attribute="Decimal" context="IntSuffix" String="0(?![xXbB0-9])|[1-9][0-9]*" />
-        <RegExpr attribute="Error" context="#pop" String="[._0-9A-Za-z']+" />
+        <RegExpr attribute="Binary" context="IntSuffix" String="0[Bb][01]++" />
+        <RegExpr attribute="Octal" context="IntSuffix" String="0[0-7]++" />
+        <RegExpr attribute="Decimal" context="IntSuffix" String="0(?![xXbB0-9])|[1-9][0-9]*+" />
+        <RegExpr attribute="Error" context="#pop" String="[._0-9A-Za-z']++" />
       </context>
 
       <context name="IntSuffix" attribute="Error" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="NumericSuffixError">
diff --git a/xml/cmake.xml b/xml/cmake.xml
--- a/xml/cmake.xml
+++ b/xml/cmake.xml
@@ -31,7 +31,7 @@
 
 <language
     name="CMake"
-    version="22"
+    version="24"
     kateversion="2.4"
     section="Other"
     extensions="CMakeLists.txt;*.cmake;*.cmake.in"
@@ -45,6 +45,7 @@
     <list name="commands">
         <item>break</item>
         <item>cmake_host_system_information</item>
+        <item>cmake_language</item>
         <item>cmake_minimum_required</item>
         <item>cmake_parse_arguments</item>
         <item>cmake_policy</item>
@@ -185,6 +186,11 @@
       <item>TOTAL_PHYSICAL_MEMORY</item>
       <item>TOTAL_VIRTUAL_MEMORY</item>
     </list>
+    <list name="cmake_language_nargs">
+      <item>CALL</item>
+      <item>CODE</item>
+      <item>EVAL</item>
+    </list>
     <list name="cmake_minimum_required_nargs">
       <item>FATAL_ERROR</item>
       <item>VERSION</item>
@@ -218,6 +224,7 @@
     </list>
     <list name="elseif_nargs">
       <item>AND</item>
+      <item>COMMAND</item>
       <item>DEFINED</item>
       <item>EQUAL</item>
       <item>EXISTS</item>
@@ -250,6 +257,8 @@
     <list name="execute_process_nargs">
       <item>COMMAND</item>
       <item>COMMAND_ECHO</item>
+      <item>ECHO_ERROR_VARIABLE</item>
+      <item>ECHO_OUTPUT_VARIABLE</item>
       <item>ENCODING</item>
       <item>ERROR_FILE</item>
       <item>ERROR_QUIET</item>
@@ -275,8 +284,12 @@
       <item>UTF8</item>
     </list>
     <list name="file_nargs">
+      <item>@ONLY</item>
       <item>APPEND</item>
+      <item>ARCHIVE_CREATE</item>
+      <item>ARCHIVE_EXTRACT</item>
       <item>CONDITION</item>
+      <item>CONFIGURE</item>
       <item>CONFIGURE_DEPENDS</item>
       <item>CONTENT</item>
       <item>COPY</item>
@@ -285,13 +298,16 @@
       <item>DIRECTORY_PERMISSIONS</item>
       <item>DOWNLOAD</item>
       <item>ENCODING</item>
+      <item>ESCAPE_QUOTES</item>
       <item>EXCLUDE</item>
       <item>EXPECTED_HASH</item>
       <item>EXPECTED_MD5</item>
+      <item>FILES</item>
       <item>FILES_MATCHING</item>
       <item>FILE_PERMISSIONS</item>
       <item>FOLLOW_SYMLINKS</item>
       <item>FOLLOW_SYMLINK_CHAIN</item>
+      <item>FORMAT</item>
       <item>GENERATE</item>
       <item>GET_RUNTIME_DEPENDENCIES</item>
       <item>GLOB</item>
@@ -309,13 +325,16 @@
       <item>LIMIT_INPUT</item>
       <item>LIMIT_OUTPUT</item>
       <item>LIST_DIRECTORIES</item>
+      <item>LIST_ONLY</item>
       <item>LOCK</item>
       <item>LOG</item>
       <item>MAKE_DIRECTORY</item>
       <item>MD5</item>
+      <item>MTIME</item>
       <item>NETRC</item>
       <item>NETRC_FILE</item>
       <item>NEWLINE_CONSUME</item>
+      <item>NEWLINE_STYLE</item>
       <item>NO_HEX_CONVERSION</item>
       <item>NO_SOURCE_PERMISSIONS</item>
       <item>OFFSET</item>
@@ -353,19 +372,28 @@
       <item>TOUCH_NOCREATE</item>
       <item>TO_CMAKE_PATH</item>
       <item>TO_NATIVE_PATH</item>
+      <item>TYPE</item>
       <item>UPLOAD</item>
       <item>USERPWD</item>
       <item>USE_SOURCE_PERMISSIONS</item>
       <item>UTC</item>
+      <item>VERBOSE</item>
       <item>WRITE</item>
     </list>
     <list name="file_sargs">
+      <item>7zip</item>
+      <item>BZip2</item>
+      <item>CRLF</item>
+      <item>DOS</item>
       <item>FILE</item>
       <item>FUNCTION</item>
       <item>GROUP_EXECUTE</item>
       <item>GROUP_READ</item>
       <item>GROUP_WRITE</item>
+      <item>GZip</item>
       <item>IGNORED</item>
+      <item>LF</item>
+      <item>None</item>
       <item>OPTIONAL</item>
       <item>OWNER_EXECUTE</item>
       <item>OWNER_READ</item>
@@ -374,14 +402,23 @@
       <item>REQUIRED</item>
       <item>SETGID</item>
       <item>SETUID</item>
+      <item>UNIX</item>
       <item>UTF-16BE</item>
       <item>UTF-16LE</item>
       <item>UTF-32B</item>
       <item>UTF-32LE</item>
       <item>UTF-8</item>
+      <item>WIN32</item>
       <item>WORLD_EXECUTE</item>
       <item>WORLD_READ</item>
       <item>WORLD_WRITE</item>
+      <item>XZ</item>
+      <item>Zstd</item>
+      <item>gnutar</item>
+      <item>pax</item>
+      <item>paxr</item>
+      <item>raw</item>
+      <item>zip</item>
     </list>
     <list name="find_file_nargs">
       <item>CMAKE_FIND_ROOT_PATH_BOTH</item>
@@ -398,6 +435,7 @@
       <item>ONLY_CMAKE_FIND_ROOT_PATH</item>
       <item>PATHS</item>
       <item>PATH_SUFFIXES</item>
+      <item>REQUIRED</item>
     </list>
     <list name="find_library_nargs">
       <item>CMAKE_FIND_ROOT_PATH_BOTH</item>
@@ -415,6 +453,7 @@
       <item>ONLY_CMAKE_FIND_ROOT_PATH</item>
       <item>PATHS</item>
       <item>PATH_SUFFIXES</item>
+      <item>REQUIRED</item>
     </list>
     <list name="find_package_nargs">
       <item>CMAKE_FIND_ROOT_PATH_BOTH</item>
@@ -458,6 +497,7 @@
       <item>ONLY_CMAKE_FIND_ROOT_PATH</item>
       <item>PATHS</item>
       <item>PATH_SUFFIXES</item>
+      <item>REQUIRED</item>
     </list>
     <list name="find_program_nargs">
       <item>CMAKE_FIND_ROOT_PATH_BOTH</item>
@@ -475,6 +515,7 @@
       <item>ONLY_CMAKE_FIND_ROOT_PATH</item>
       <item>PATHS</item>
       <item>PATH_SUFFIXES</item>
+      <item>REQUIRED</item>
     </list>
     <list name="foreach_nargs">
       <item>IN</item>
@@ -521,11 +562,13 @@
       <item>SET</item>
       <item>SOURCE</item>
       <item>TARGET</item>
+      <item>TARGET_DIRECTORY</item>
       <item>TEST</item>
       <item>VARIABLE</item>
     </list>
     <list name="if_nargs">
       <item>AND</item>
+      <item>COMMAND</item>
       <item>DEFINED</item>
       <item>EQUAL</item>
       <item>EXISTS</item>
@@ -601,6 +644,7 @@
       <item>DESCENDING</item>
       <item>FILE_BASENAME</item>
       <item>INSENSITIVE</item>
+      <item>NATURAL</item>
       <item>SENSITIVE</item>
       <item>STRING</item>
     </list>
@@ -649,6 +693,7 @@
       <item>PROPERTY</item>
       <item>SOURCE</item>
       <item>TARGET</item>
+      <item>TARGET_DIRECTORY</item>
       <item>TEST</item>
       <item>VARIABLE</item>
     </list>
@@ -679,6 +724,7 @@
       <item>GENEX_STRIP</item>
       <item>GREATER</item>
       <item>GREATER_EQUAL</item>
+      <item>HEX</item>
       <item>JOIN</item>
       <item>LENGTH</item>
       <item>LESS</item>
@@ -722,6 +768,7 @@
     </list>
     <list name="while_nargs">
       <item>AND</item>
+      <item>COMMAND</item>
       <item>DEFINED</item>
       <item>EQUAL</item>
       <item>EXISTS</item>
@@ -866,6 +913,10 @@
       <item>NAMESPACE</item>
       <item>TARGETS</item>
     </list>
+    <list name="get_source_file_property_nargs">
+      <item>DIRECTORY</item>
+      <item>TARGET_DIRECTORY</item>
+    </list>
     <list name="include_directories_nargs">
       <item>AFTER</item>
       <item>BEFORE</item>
@@ -968,7 +1019,9 @@
       <item>Swift</item>
     </list>
     <list name="set_source_files_properties_nargs">
+      <item>DIRECTORY</item>
       <item>PROPERTIES</item>
+      <item>TARGET_DIRECTORY</item>
     </list>
     <list name="set_target_properties_nargs">
       <item>PROPERTIES</item>
@@ -1221,6 +1274,7 @@
       <item>RETURN_VALUE</item>
       <item>SCHEDULE_RANDOM</item>
       <item>START</item>
+      <item>STOP_ON_FAILURE</item>
       <item>STOP_TIME</item>
       <item>STRIDE</item>
       <item>TEST_LOAD</item>
@@ -1244,6 +1298,9 @@
     <list name="variables">
       <item>ANDROID</item>
       <item>APPLE</item>
+      <item>ARGC</item>
+      <item>ARGN</item>
+      <item>ARGV</item>
       <item>BORLAND</item>
       <item>BUILD_SHARED_LIBS</item>
       <item>BUILD_TESTING</item>
@@ -1322,6 +1379,7 @@
       <item>CMAKE_CROSS_CONFIGS</item>
       <item>CMAKE_CTEST_ARGUMENTS</item>
       <item>CMAKE_CTEST_COMMAND</item>
+      <item>CMAKE_CUDA_ARCHITECTURES</item>
       <item>CMAKE_CUDA_COMPILE_FEATURES</item>
       <item>CMAKE_CUDA_EXTENSIONS</item>
       <item>CMAKE_CUDA_HOST_COMPILER</item>
@@ -1413,6 +1471,7 @@
       <item>CMAKE_Fortran_MODDIR_FLAG</item>
       <item>CMAKE_Fortran_MODOUT_FLAG</item>
       <item>CMAKE_Fortran_MODULE_DIRECTORY</item>
+      <item>CMAKE_Fortran_PREPROCESS</item>
       <item>CMAKE_GENERATOR</item>
       <item>CMAKE_GENERATOR_INSTANCE</item>
       <item>CMAKE_GENERATOR_NO_COMPILER_ENV</item>
@@ -1424,7 +1483,6 @@
       <item>CMAKE_GLOBAL_AUTORCC_TARGET_NAME</item>
       <item>CMAKE_GNUtoMS</item>
       <item>CMAKE_HAS_ANSI_STRING_STREAM</item>
-      <item>CMAKE_HOME_DIRECTORY</item>
       <item>CMAKE_HOST_APPLE</item>
       <item>CMAKE_HOST_SOLARIS</item>
       <item>CMAKE_HOST_SYSTEM</item>
@@ -1493,7 +1551,6 @@
       <item>CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS</item>
       <item>CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP</item>
       <item>CMAKE_INSTALL_UCRT_LIBRARIES</item>
-      <item>CMAKE_INTERNAL_PLATFORM_ABI</item>
       <item>CMAKE_INTERPROCEDURAL_OPTIMIZATION</item>
       <item>CMAKE_IOS_INSTALL_COMBINED</item>
       <item>CMAKE_JOB_POOLS</item>
@@ -1535,7 +1592,6 @@
       <item>CMAKE_NETRC</item>
       <item>CMAKE_NETRC_FILE</item>
       <item>CMAKE_NINJA_OUTPUT_PATH_PREFIX</item>
-      <item>CMAKE_NOT_USING_CONFIG_FLAGS</item>
       <item>CMAKE_NO_ANSI_FOR_SCOPE</item>
       <item>CMAKE_NO_ANSI_STREAM_HEADERS</item>
       <item>CMAKE_NO_ANSI_STRING_STREAM</item>
@@ -1548,6 +1604,7 @@
       <item>CMAKE_OSX_SYSROOT</item>
       <item>CMAKE_PARENT_LIST_FILE</item>
       <item>CMAKE_PATCH_VERSION</item>
+      <item>CMAKE_PCH_WARN_INVALID</item>
       <item>CMAKE_PDB_OUTPUT_DIRECTORY</item>
       <item>CMAKE_POSITION_INDEPENDENT_CODE</item>
       <item>CMAKE_PREFIX_PATH</item>
@@ -1592,8 +1649,6 @@
       <item>CMAKE_STATIC_LINKER_FLAGS_INIT</item>
       <item>CMAKE_SUBLIME_TEXT_2_ENV_SETTINGS</item>
       <item>CMAKE_SUBLIME_TEXT_2_EXCLUDE_BUILD_TREE</item>
-      <item>CMAKE_SUPPRESS_DEVELOPER_ERRORS</item>
-      <item>CMAKE_SUPPRESS_DEVELOPER_WARNINGS</item>
       <item>CMAKE_SUPPRESS_REGENERATION</item>
       <item>CMAKE_SWIG_FLAGS</item>
       <item>CMAKE_SWIG_OUTDIR</item>
@@ -1634,7 +1689,6 @@
       <item>CMAKE_VS_GLOBALS</item>
       <item>CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD</item>
       <item>CMAKE_VS_INCLUDE_PACKAGE_TO_DEFAULT_BUILD</item>
-      <item>CMAKE_VS_INTEL_Fortran_PROJECT_VERSION</item>
       <item>CMAKE_VS_JUST_MY_CODE_DEBUGGING</item>
       <item>CMAKE_VS_MSBUILD_COMMAND</item>
       <item>CMAKE_VS_NsightTegra_VERSION</item>
@@ -1678,6 +1732,7 @@
       <item>CPACK_ABSOLUTE_DESTINATION_FILES</item>
       <item>CPACK_ARCHIVE_COMPONENT_INSTALL</item>
       <item>CPACK_ARCHIVE_FILE_NAME</item>
+      <item>CPACK_ARCHIVE_THREADS</item>
       <item>CPACK_BUILD_SOURCE_DIRS</item>
       <item>CPACK_BUNDLE_APPLE_CERT_APP</item>
       <item>CPACK_BUNDLE_APPLE_CODESIGN_FILES</item>
@@ -1742,9 +1797,9 @@
       <item>CPACK_DMG_SLA_LANGUAGES</item>
       <item>CPACK_DMG_VOLUME_NAME</item>
       <item>CPACK_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION</item>
-      <item>CPACK_EXT_ENABLE_STAGING</item>
-      <item>CPACK_EXT_PACKAGE_SCRIPT</item>
-      <item>CPACK_EXT_REQUESTED_VERSIONS</item>
+      <item>CPACK_EXTERNAL_ENABLE_STAGING</item>
+      <item>CPACK_EXTERNAL_PACKAGE_SCRIPT</item>
+      <item>CPACK_EXTERNAL_REQUESTED_VERSIONS</item>
       <item>CPACK_GENERATOR</item>
       <item>CPACK_IFW_ADMIN_TARGET_DIRECTORY</item>
       <item>CPACK_IFW_BINARYCREATOR_EXECUTABLE</item>
@@ -1788,7 +1843,6 @@
       <item>CPACK_INSTALL_CMAKE_PROJECTS</item>
       <item>CPACK_INSTALL_COMMANDS</item>
       <item>CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS</item>
-      <item>CPACK_INSTALL_SCRIPT</item>
       <item>CPACK_INSTALL_SCRIPTS</item>
       <item>CPACK_MONOLITHIC_INSTALL</item>
       <item>CPACK_NSIS_COMPRESSOR</item>
@@ -1807,6 +1861,7 @@
       <item>CPACK_NSIS_INSTALLED_ICON_NAME</item>
       <item>CPACK_NSIS_INSTALLER_MUI_ICON_CODE</item>
       <item>CPACK_NSIS_INSTALL_ROOT</item>
+      <item>CPACK_NSIS_MANIFEST_DPI_AWARE</item>
       <item>CPACK_NSIS_MENU_LINKS</item>
       <item>CPACK_NSIS_MODIFY_PATH</item>
       <item>CPACK_NSIS_MUI_FINISHPAGE_RUN</item>
@@ -1838,7 +1893,6 @@
       <item>CPACK_NUGET_PACKAGE_VERSION</item>
       <item>CPACK_OUTPUT_CONFIG_FILE</item>
       <item>CPACK_PACKAGE_CHECKSUM</item>
-      <item>CPACK_PACKAGE_CONTACT</item>
       <item>CPACK_PACKAGE_DESCRIPTION</item>
       <item>CPACK_PACKAGE_DESCRIPTION_FILE</item>
       <item>CPACK_PACKAGE_DESCRIPTION_SUMMARY</item>
@@ -1850,7 +1904,6 @@
       <item>CPACK_PACKAGE_INSTALL_DIRECTORY</item>
       <item>CPACK_PACKAGE_INSTALL_REGISTRY_KEY</item>
       <item>CPACK_PACKAGE_NAME</item>
-      <item>CPACK_PACKAGE_RELOCATABLE</item>
       <item>CPACK_PACKAGE_VENDOR</item>
       <item>CPACK_PACKAGE_VERSION</item>
       <item>CPACK_PACKAGE_VERSION_MAJOR</item>
@@ -1926,8 +1979,10 @@
       <item>CPACK_RPM_PACKAGE_VENDOR</item>
       <item>CPACK_RPM_PACKAGE_VERSION</item>
       <item>CPACK_RPM_POST_INSTALL_SCRIPT_FILE</item>
+      <item>CPACK_RPM_POST_TRANS_SCRIPT_FILE</item>
       <item>CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE</item>
       <item>CPACK_RPM_PRE_INSTALL_SCRIPT_FILE</item>
+      <item>CPACK_RPM_PRE_TRANS_SCRIPT_FILE</item>
       <item>CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE</item>
       <item>CPACK_RPM_RELOCATION_PATHS</item>
       <item>CPACK_RPM_SOURCE_PKG_BUILD_PARAMS</item>
@@ -2023,6 +2078,8 @@
       <item>CTEST_P4_COMMAND</item>
       <item>CTEST_P4_OPTIONS</item>
       <item>CTEST_P4_UPDATE_OPTIONS</item>
+      <item>CTEST_RESOURCE_SPEC_FILE</item>
+      <item>CTEST_RUN_CURRENT_SCRIPT</item>
       <item>CTEST_SCP_COMMAND</item>
       <item>CTEST_SITE</item>
       <item>CTEST_SOURCE_DIRECTORY</item>
@@ -2120,6 +2177,21 @@
       <item>XCODE_VERSION</item>
     </list>
 
+    <list name="deprecated-or-internal-variables">
+      <item>CMAKE_HOME_DIRECTORY</item>
+      <item>CMAKE_INTERNAL_PLATFORM_ABI</item>
+      <item>CMAKE_NOT_USING_CONFIG_FLAGS</item>
+      <item>CMAKE_SUPPRESS_DEVELOPER_ERRORS</item>
+      <item>CMAKE_SUPPRESS_DEVELOPER_WARNINGS</item>
+      <item>CMAKE_VS_INTEL_Fortran_PROJECT_VERSION</item>
+      <item>CPACK_INSTALL_PREFIX</item>
+      <item>CPACK_INSTALL_SCRIPT</item>
+      <item>CPACK_PACKAGE_CONTACT</item>
+      <item>CPACK_PACKAGE_RELOCATABLE</item>
+      <item>CPACK_TEMPORARY_DIRECTORY</item>
+      <item>CPACK_TOPLEVEL_DIRECTORY</item>
+    </list>
+
     <list name="environment-variables">
       <item>CC</item>
       <item>CFLAGS</item>
@@ -2293,6 +2365,7 @@
       <item>COMPILE_PDB_NAME</item>
       <item>COMPILE_PDB_OUTPUT_DIRECTORY</item>
       <item>CROSSCOMPILING_EMULATOR</item>
+      <item>CUDA_ARCHITECTURES</item>
       <item>CUDA_EXTENSIONS</item>
       <item>CUDA_PTX_COMPILATION</item>
       <item>CUDA_RESOLVE_DEVICE_SYMBOLS</item>
@@ -2324,6 +2397,7 @@
       <item>FRAMEWORK_VERSION</item>
       <item>Fortran_FORMAT</item>
       <item>Fortran_MODULE_DIRECTORY</item>
+      <item>Fortran_PREPROCESS</item>
       <item>GENERATOR_FILE_NAME</item>
       <item>GNUtoMS</item>
       <item>HAS_CXX</item>
@@ -2382,6 +2456,8 @@
       <item>LINK_SEARCH_START_STATIC</item>
       <item>LINK_WHAT_YOU_USE</item>
       <item>LOCATION</item>
+      <item>MACHO_COMPATIBILITY_VERSION</item>
+      <item>MACHO_CURRENT_VERSION</item>
       <item>MACOSX_BUNDLE</item>
       <item>MACOSX_BUNDLE_INFO_PLIST</item>
       <item>MACOSX_FRAMEWORK_INFO_PLIST</item>
@@ -2395,6 +2471,7 @@
       <item>OSX_COMPATIBILITY_VERSION</item>
       <item>OSX_CURRENT_VERSION</item>
       <item>OUTPUT_NAME</item>
+      <item>PCH_WARN_INVALID</item>
       <item>PDB_NAME</item>
       <item>PDB_OUTPUT_DIRECTORY</item>
       <item>POSITION_INDEPENDENT_CODE</item>
@@ -2425,6 +2502,7 @@
       <item>UNITY_BUILD_BATCH_SIZE</item>
       <item>UNITY_BUILD_CODE_AFTER_INCLUDE</item>
       <item>UNITY_BUILD_CODE_BEFORE_INCLUDE</item>
+      <item>UNITY_BUILD_MODE</item>
       <item>VERSION</item>
       <item>VISIBILITY_INLINES_HIDDEN</item>
       <item>VS_CONFIGURATION_TYPE</item>
@@ -2448,12 +2526,14 @@
       <item>VS_MOBILE_EXTENSIONS_VERSION</item>
       <item>VS_NO_SOLUTION_DEPLOY</item>
       <item>VS_PACKAGE_REFERENCES</item>
+      <item>VS_PLATFORM_TOOLSET</item>
       <item>VS_PROJECT_IMPORT</item>
       <item>VS_SCC_AUXPATH</item>
       <item>VS_SCC_LOCALPATH</item>
       <item>VS_SCC_PROJECTNAME</item>
       <item>VS_SCC_PROVIDER</item>
       <item>VS_SDK_REFERENCES</item>
+      <item>VS_SOLUTION_DEPLOY</item>
       <item>VS_USER_PROPS</item>
       <item>VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION</item>
       <item>VS_WINRT_COMPONENT</item>
@@ -2496,6 +2576,7 @@
       <item>COMPILE_OPTIONS</item>
       <item>EXTERNAL_OBJECT</item>
       <item>Fortran_FORMAT</item>
+      <item>Fortran_PREPROCESS</item>
       <item>GENERATED</item>
       <item>HEADER_FILE_ONLY</item>
       <item>INCLUDE_DIRECTORIES</item>
@@ -2520,6 +2601,7 @@
       <item>VS_DEPLOYMENT_LOCATION</item>
       <item>VS_INCLUDE_IN_VSIX</item>
       <item>VS_RESOURCE_GENERATOR</item>
+      <item>VS_SETTINGS</item>
       <item>VS_SHADER_DISABLE_OPTIMIZATIONS</item>
       <item>VS_SHADER_ENABLE_DEBUG</item>
       <item>VS_SHADER_ENTRYPOINT</item>
@@ -2609,6 +2691,10 @@
       <item>COMPILE_FEATURES</item>
       <item>COMPILE_LANG_AND_ID</item>
       <item>COMPILE_LANGUAGE</item>
+      <item>LINK_LANG_AND_ID</item>
+      <item>LINK_LANGUAGE</item>
+      <item>DEVICE_LINK</item>
+      <item>HOST_LINK</item>
       <item>ANGLE-R</item>
       <item>COMMA</item>
       <item>SEMICOLON</item>
@@ -2660,6 +2746,7 @@
         <DetectSpaces/>
         <WordDetect String="break" insensitive="true" attribute="Command" context="break_ctx" />
         <WordDetect String="cmake_host_system_information" insensitive="true" attribute="Command" context="cmake_host_system_information_ctx" />
+        <WordDetect String="cmake_language" insensitive="true" attribute="Command" context="cmake_language_ctx" />
         <WordDetect String="cmake_minimum_required" insensitive="true" attribute="Command" context="cmake_minimum_required_ctx" />
         <WordDetect String="cmake_parse_arguments" insensitive="true" attribute="Command" context="cmake_parse_arguments_ctx" />
         <WordDetect String="cmake_policy" insensitive="true" attribute="Command" context="cmake_policy_ctx" />
@@ -2667,11 +2754,11 @@
         <WordDetect String="continue" insensitive="true" attribute="Command" context="continue_ctx" />
         <WordDetect String="elseif" insensitive="true" attribute="Command" context="elseif_ctx" />
         <WordDetect String="else" insensitive="true" attribute="Command" context="else_ctx" />
-        <WordDetect String="endforeach" insensitive="true" attribute="Command" context="endforeach_ctx" />
-        <WordDetect String="endfunction" insensitive="true" attribute="Command" context="endfunction_ctx" />
-        <WordDetect String="endif" insensitive="true" attribute="Command" context="endif_ctx" />
-        <WordDetect String="endmacro" insensitive="true" attribute="Command" context="endmacro_ctx" />
-        <WordDetect String="endwhile" insensitive="true" attribute="Command" context="endwhile_ctx" />
+        <WordDetect String="endforeach" insensitive="true" attribute="Command" context="endforeach_ctx" endRegion="foreach" />
+        <WordDetect String="endfunction" insensitive="true" attribute="Command" context="endfunction_ctx" endRegion="function" />
+        <WordDetect String="endif" insensitive="true" attribute="Command" context="endif_ctx" endRegion="if" />
+        <WordDetect String="endmacro" insensitive="true" attribute="Command" context="endmacro_ctx" endRegion="macro" />
+        <WordDetect String="endwhile" insensitive="true" attribute="Command" context="endwhile_ctx" endRegion="while" />
         <WordDetect String="execute_process" insensitive="true" attribute="Command" context="execute_process_ctx" />
         <WordDetect String="file" insensitive="true" attribute="Command" context="file_ctx" />
         <WordDetect String="find_file" insensitive="true" attribute="Command" context="find_file_ctx" />
@@ -2679,17 +2766,17 @@
         <WordDetect String="find_package" insensitive="true" attribute="Command" context="find_package_ctx" />
         <WordDetect String="find_path" insensitive="true" attribute="Command" context="find_path_ctx" />
         <WordDetect String="find_program" insensitive="true" attribute="Command" context="find_program_ctx" />
-        <WordDetect String="foreach" insensitive="true" attribute="Command" context="foreach_ctx" />
-        <WordDetect String="function" insensitive="true" attribute="Command" context="function_ctx" />
+        <WordDetect String="foreach" insensitive="true" attribute="Command" context="foreach_ctx" beginRegion="foreach" />
+        <WordDetect String="function" insensitive="true" attribute="Command" context="function_ctx" beginRegion="function" />
         <WordDetect String="get_cmake_property" insensitive="true" attribute="Command" context="get_cmake_property_ctx" />
         <WordDetect String="get_directory_property" insensitive="true" attribute="Command" context="get_directory_property_ctx" />
         <WordDetect String="get_filename_component" insensitive="true" attribute="Command" context="get_filename_component_ctx" />
         <WordDetect String="get_property" insensitive="true" attribute="Command" context="get_property_ctx" />
-        <WordDetect String="if" insensitive="true" attribute="Command" context="if_ctx" />
+        <WordDetect String="if" insensitive="true" attribute="Command" context="if_ctx" beginRegion="if" />
         <WordDetect String="include" insensitive="true" attribute="Command" context="include_ctx" />
         <WordDetect String="include_guard" insensitive="true" attribute="Command" context="include_guard_ctx" />
         <WordDetect String="list" insensitive="true" attribute="Command" context="list_ctx" />
-        <WordDetect String="macro" insensitive="true" attribute="Command" context="macro_ctx" />
+        <WordDetect String="macro" insensitive="true" attribute="Command" context="macro_ctx" beginRegion="macro" />
         <WordDetect String="mark_as_advanced" insensitive="true" attribute="Command" context="mark_as_advanced_ctx" />
         <WordDetect String="math" insensitive="true" attribute="Command" context="math_ctx" />
         <WordDetect String="message" insensitive="true" attribute="Command" context="message_ctx" />
@@ -2703,7 +2790,7 @@
         <WordDetect String="string" insensitive="true" attribute="Command" context="string_ctx" />
         <WordDetect String="unset" insensitive="true" attribute="Command" context="unset_ctx" />
         <WordDetect String="variable_watch" insensitive="true" attribute="Command" context="variable_watch_ctx" />
-        <WordDetect String="while" insensitive="true" attribute="Command" context="while_ctx" />
+        <WordDetect String="while" insensitive="true" attribute="Command" context="while_ctx" beginRegion="while" />
         <WordDetect String="add_compile_definitions" insensitive="true" attribute="Command" context="add_compile_definitions_ctx" />
         <WordDetect String="add_compile_options" insensitive="true" attribute="Command" context="add_compile_options_ctx" />
         <WordDetect String="add_custom_command" insensitive="true" attribute="Command" context="add_custom_command_ctx" />
@@ -2789,6 +2876,14 @@
         <keyword attribute="Special Args" context="#stay" String="cmake_host_system_information_sargs" />
         <IncludeRules context="User Function Args" />
       </context>
+      <context attribute="Normal Text" lineEndContext="#stay" name="cmake_language_ctx">
+        <DetectChar attribute="Normal Text" context="cmake_language_ctx_op" char="(" />
+      </context>
+      <context attribute="Normal Text" lineEndContext="#stay" name="cmake_language_ctx_op">
+        <IncludeRules context="EndCmdPop2" />
+        <keyword attribute="Named Args" context="#stay" String="cmake_language_nargs" />
+        <IncludeRules context="User Function Args" />
+      </context>
       <context attribute="Normal Text" lineEndContext="#stay" name="cmake_minimum_required_ctx">
         <DetectChar attribute="Normal Text" context="cmake_minimum_required_ctx_op" char="(" />
       </context>
@@ -3370,6 +3465,7 @@
       </context>
       <context attribute="Normal Text" lineEndContext="#stay" name="get_source_file_property_ctx_op">
         <IncludeRules context="EndCmdPop2" />
+        <keyword attribute="Named Args" context="#stay" String="get_source_file_property_nargs" />
         <keyword attribute="Property" context="#stay" String="source-properties" />
         <IncludeRules context="Detect More source-properties" />
         <IncludeRules context="User Function Args" />
@@ -3723,6 +3819,7 @@
         <RegExpr attribute="Property" context="#stay" String="\b&id_re;_OUTPUT_NAME\b" />
         <RegExpr attribute="Property" context="#stay" String="\b&id_re;_POSTFIX\b" />
         <RegExpr attribute="Property" context="#stay" String="\bEXCLUDE_FROM_DEFAULT_BUILD_&id_re;\b" />
+        <RegExpr attribute="Property" context="#stay" String="\bFRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bIMPORTED_IMPLIB_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bIMPORTED_LIBNAME_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bIMPORTED_LINK_DEPENDENT_LIBRARIES_&id_re;\b" />
@@ -3757,6 +3854,7 @@
         <RegExpr attribute="Property" context="#stay" String="\bVS_DOTNET_REFERENCE_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bVS_DOTNET_REFERENCEPROP_&id_re;_TAG_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bVS_GLOBAL_&id_re;\b" />
+        <RegExpr attribute="Property" context="#stay" String="\bVS_SOURCE_SETTINGS_&id_re;\b" />
         <RegExpr attribute="Property" context="#stay" String="\bXCODE_ATTRIBUTE_&id_re;\b" />
       </context>
 
@@ -3784,15 +3882,16 @@
 
       <context attribute="Normal Text" lineEndContext="#stay" name="Detect Builtin Variables">
         <RegExpr attribute="Internal Name" context="#stay" String="\b_&id_re;\b" />
+        <keyword attribute="CMake Internal Variable" context="#stay" String="deprecated-or-internal-variables" insensitive="false" />
         <keyword attribute="Builtin Variable" context="#stay" String="variables" insensitive="false" />
         <IncludeRules context="Detect More Builtin Variables" />
-        <!-- JGM: next line is needed because we don't really handle
-             \b at the beginning of a regex, and we don't want to
-             capture part of FOO_BAR as an "Internal Name" -->
-        <RegExpr attribute="Normal Text" context="#stay" String="&id_re;\b" />
       </context>
 
       <context attribute="Normal Text" lineEndContext="#stay" name="Detect More Builtin Variables">
+        <RegExpr attribute="CMake Internal Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_ABI\b" />
+        <RegExpr attribute="CMake Internal Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_ARCHITECTURE_ID\b" />
+        <RegExpr attribute="CMake Internal Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_VERSION_INTERNAL\b" />
+        <RegExpr attribute="CMake Internal Variable" context="#stay" String="\bCMAKE_&id_re;_PLATFORM_ID\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_BINARY_DIR\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_SOURCE_DIR\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_VERSION\b" />
@@ -3821,7 +3920,10 @@
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_LIBRARY_DIRS\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_VERSION_COUNT\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_VERSION_STRING\b" />
+        <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_KEYWORDS_MISSING_VALUES\b" />
+        <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_UNPARSED_ARGUMENTS\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\b&id_re;_MODULE_NAME\b" />
+        <RegExpr attribute="Builtin Variable" context="#stay" String="\bARGV[0-9]+\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_POSTFIX\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_ANDROID_TOOLCHAIN_MACHINE\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_ANDROID_TOOLCHAIN_PREFIX\b" />
@@ -3831,7 +3933,6 @@
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_ARCHIVE_FINISH\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_CLANG_TIDY\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER\b" />
-        <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_ABI\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_AR\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_EXTERNAL_TOOLCHAIN\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_ID\b" />
@@ -3873,7 +3974,6 @@
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_LINKER_WRAPPER_FLAG_SEP\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_LINK_EXECUTABLE\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_OUTPUT_EXTENSION\b" />
-        <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_PLATFORM_ID\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_SIMULATE_ID\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_SIMULATE_VERSION\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_&id_re;_SIZEOF_DATA_PTR\b" />
@@ -3887,6 +3987,7 @@
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_DISABLE_FIND_PACKAGE_&id_re;\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_EXE_LINKER_FLAGS_&id_re;\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_EXE_LINKER_FLAGS_&id_re;_INIT\b" />
+        <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_FRAMEWORK_MULTI_CONFIG_POSTFIX_&id_re;\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_INTERPROCEDURAL_OPTIMIZATION_&id_re;\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_LIBRARY_OUTPUT_DIRECTORY_&id_re;\b" />
         <RegExpr attribute="Builtin Variable" context="#stay" String="\bCMAKE_MAP_IMPORTED_CONFIG_&id_re;\b" />
@@ -3995,18 +4096,12 @@
 
       <context attribute="Normal Text" lineEndContext="#stay" name="Detect Variable Substitutions">
         <RegExpr attribute="Cache Variable Substitution" context="#stay" String="\$CACHE\{\s*[\w-]+\s*\}" />
-        <RegExpr attribute="Environment Variable Substitution" context="EnvVarSubst" String="\$ENV\{\s*[\w-]+\s*\}" lookAhead="true" />
+        <RegExpr attribute="Environment Variable Substitution" context="EnvVarSubst" String="\$?ENV\{" />
         <Detect2Chars attribute="Variable Substitution" context="VarSubst" char="$" char1="{" />
         <RegExpr attribute="@Variable Substitution" context="@VarSubst" String="@&id_re;@" lookAhead="true" />
       </context>
 
       <context attribute="Environment Variable Substitution" lineEndContext="#pop" name="EnvVarSubst">
-        <DetectIdentifier />
-        <DetectChar attribute="Environment Variable Substitution" context="EnvVarSubstVar" char="{" />
-        <DetectChar attribute="Environment Variable Substitution" context="#pop" char="}" />
-      </context>
-
-      <context attribute="Environment Variable Substitution" lineEndContext="#pop" name="EnvVarSubstVar">
         <keyword attribute="Standard Environment Variable" context="#stay" String="environment-variables" insensitive="false" />
         <RegExpr attribute="Standard Environment Variable" context="#stay" String="\b&id_re;_DIR\b" />
         <RegExpr attribute="Standard Environment Variable" context="#stay" String="\b&id_re;_ROOT\b" />
@@ -4014,7 +4109,8 @@
         <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bASM&id_re;FLAGS\b" />
         <RegExpr attribute="Standard Environment Variable" context="#stay" String="\bCMAKE_&id_re;_COMPILER_LAUNCHER\b" />
         <DetectIdentifier />
-        <DetectChar attribute="Environment Variable Substitution" context="#pop#pop" char="}" />
+        <IncludeRules context="Detect Variable Substitutions" />
+        <DetectChar attribute="Environment Variable Substitution" context="#pop" char="}" />
       </context>
 
       <context attribute="Variable Substitution" lineEndContext="#pop" name="VarSubst">
@@ -4025,6 +4121,7 @@
       </context>
 
       <context attribute="@Variable Substitution" lineEndContext="#pop" name="@VarSubst">
+        <IncludeRules context="Detect Builtin Variables" />
         <DetectChar attribute="@Variable Substitution" context="VarSubst@" char="@" />
       </context>
 
@@ -4071,6 +4168,7 @@
       </context>
 
       <context attribute="Comment" lineEndContext="#stay" name="Bracketed Comment" dynamic="true">
+        <LineContinue attribute="Comment" context="#stay" />
         <RegExpr attribute="Comment" context="#pop" String=".*\]%1\]" dynamic="true" />
         <IncludeRules context="##Alerts" />
         <IncludeRules context="##Modelines" />
@@ -4115,6 +4213,7 @@
       <itemData name="Strings" defStyleNum="dsString" spellChecking="true" />
       <itemData name="Escapes" defStyleNum="dsChar" spellChecking="false" />
       <itemData name="Builtin Variable" defStyleNum="dsDecVal" color="#c09050" selColor="#c09050" spellChecking="false" />
+      <itemData name="CMake Internal Variable" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" />
       <itemData name="Internal Name" defStyleNum="dsDecVal" color="#303030" selColor="#303030" spellChecking="false" />
       <itemData name="Variable Substitution" defStyleNum="dsDecVal" spellChecking="false" />
       <itemData name="@Variable Substitution" defStyleNum="dsBaseN" spellChecking="false" />
diff --git a/xml/elm.xml b/xml/elm.xml
--- a/xml/elm.xml
+++ b/xml/elm.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd">
-<language name="Elm" version="2" kateversion="5.0" section="Sources" extensions="*.elm" author="Bonghyun Kim (bonghyun.d.kim@gmail.com)" license="MIT" style="elm">
+<language name="Elm" version="3" kateversion="5.0" section="Sources" extensions="*.elm" author="Bonghyun Kim (bonghyun.d.kim@gmail.com)" license="MIT" style="elm">
   <highlighting>
     <list name="declarations">
       <item>type</item>
@@ -56,7 +56,7 @@
         <RegExpr attribute="Name"         context="#stay" String="(\b[a-z]\w*|\b_\b)" />
         <RegExpr attribute="Operator"         context="#stay" String="(-&gt;|::|\/\/|\.\.|&amp;&amp;|\|\||\+\+|\|&gt;|&lt;\||&gt;&gt;|&lt;&lt;|==|\/=|&lt;=|&gt;=)" />
         <RegExpr attribute="Operator"         context="#stay" String="[+-\/*%=&gt;&lt;^\|!]" />
-        <RegExpr attribute="Operator"         context="#stay" String="[@\#$&amp;~?]" />
+        <AnyChar attribute="Operator"         context="#stay" String="@#$&amp;~?" />
 
         <RegExpr attribute="Type"             context="#stay" String="\b[A-Z][\w]*" />
 
diff --git a/xml/erlang.xml b/xml/erlang.xml
--- a/xml/erlang.xml
+++ b/xml/erlang.xml
@@ -213,7 +213,7 @@
 
       <!-- finish off the atom in quoted string (allow for escaped single quotes -->
       <context name="stringquote" attribute="String" lineEndContext="#pop">
-        <RegExpr attribute="String" context="#pop" String="(?:\\&quot;|[^&quot;])*&quot;" />
+        <RegExpr attribute="String" context="#pop" String="(?:(?:\\&quot;)?[^&quot;]*)*&quot;" />
       </context>
       
       <!-- finish off the comment (allows for alerts) -->
diff --git a/xml/erlang.xml.patch b/xml/erlang.xml.patch
deleted file mode 100644
--- a/xml/erlang.xml.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/skylighting-core/xml/erlang.xml b/skylighting-core/xml/erlang.xml
-index 7bbcbc9..b631afd 100644
---- a/skylighting-core/xml/erlang.xml
-+++ b/skylighting-core/xml/erlang.xml
-@@ -213,7 +213,7 @@
- 
-       <!-- finish off the atom in quoted string (allow for escaped single quotes -->
-       <context name="stringquote" attribute="String" lineEndContext="#pop">
--        <RegExpr attribute="String" context="#pop" String="(?:(?:\\&quot;)?[^&quot;]*)*&quot;" />
-+        <RegExpr attribute="String" context="#pop" String="(?:\\&quot;|[^&quot;])*&quot;" />
-       </context>
-       
-       <!-- finish off the comment (allows for alerts) -->
diff --git a/xml/glsl.xml b/xml/glsl.xml
--- a/xml/glsl.xml
+++ b/xml/glsl.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd">
-<language name="GLSL" section="3D" extensions="*.glsl;*.vert;*.vs;*.frag;*.fs;*.geom;*.gs;*.tcs;*.tes" mimetype="text/x-glslsrc" version="4" kateversion="5.0" author="Oliver Richers (o.richers@tu-bs.de)" license="LGPL">
+<language name="GLSL" section="3D" extensions="*.glsl;*.vert;*.vs;*.frag;*.fs;*.geom;*.gs;*.tcs;*.tes" mimetype="text/x-glslsrc" version="5" kateversion="5.0" author="Oliver Richers (o.richers@tu-bs.de)" license="LGPL">
 	<highlighting>
 		<list name="keywords">
 			<item>break</item>
@@ -1173,8 +1173,8 @@
 				<DetectChar attribute="Preprocessor" context="Preprocessor" char="#" firstNonSpace="true"/>
 				<RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*[(])" />
 				
-				<RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
-				<AnyChar attribute="Symbol" context="#stay" String=".+-/*%&lt;&gt;[]()^|&amp;~=!:;,?&#59;" />
+				<DetectChar attribute="Symbol" context="Member" char="." />
+				<AnyChar attribute="Symbol" context="#stay" String="+-/*%&lt;&gt;[]()^|&amp;~=!:;,?&#59;" />
 			</context>
 			<context name="Member" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
 				<RegExpr attribute="Function" context="#pop" String="\b[_\w][_\w\d]*(?=[\s]*)" />
diff --git a/xml/graphql.xml b/xml/graphql.xml
new file mode 100644
--- /dev/null
+++ b/xml/graphql.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd">
+<!--
+  GraphQL: https://graphql.org/
+  Synatx: https://github.com/graphql/graphql-spec/blob/master/spec/Section%202%20- -%20Language.md
+     and: https://github.com/graphql/graphql-spec/blob/master/spec/Appendix%20B%20- -%20Grammar%20Summary.md
+-->
+<language name="GraphQL" section="Other" version="1" kateversion="2.4" extensions="*.graphql" author="Volker Krause (vkrause@kde.org)" license="MIT">
+  <highlighting>
+    <list name="listKeywords">
+      <item>enum</item>
+      <item>extend</item>
+      <item>fragment</item>
+      <item>implements</item>
+      <item>input</item>
+      <item>interface</item>
+      <item>mutation</item>
+      <item>on</item>
+      <item>query</item>
+      <item>scalar</item>
+      <item>schema</item>
+      <item>subscription</item>
+      <item>type</item>
+      <item>union</item>
+    </list>
+   <list name="listConstants">
+      <item>null</item>
+      <item>true</item>
+      <item>false</item>
+    </list>
+    <list name="listTypes">
+      <item>Boolean</item>
+      <item>Float</item>
+      <item>ID</item>
+      <item>Int</item>
+      <item>String</item>
+    </list>
+
+    <contexts>
+      <context name="ctxNormal" lineEndContext="#stay" attribute="Normal">
+        <DetectChar char="{" beginRegion="RegionBrace"/>
+        <DetectChar char="}" endRegion="RegionBrace"/>
+        <Float attribute="Float"/>
+        <Int attribute="Decimal"/>
+        <keyword String="listKeywords" attribute="Keyword"/>
+        <keyword String="listConstants" attribute="Constant"/>
+        <keyword String="listTypes" attribute="Type"/>
+        <StringDetect attribute="String" context="ctxBlockString" String="&quot;&quot;&quot;"/>
+        <DetectChar attribute="String" context="ctxString" char="&quot;"/>
+        <DetectChar attribute="Comment" context="ctxComment" char="#"/>
+        <RegExpr String="\$[_A-Za-z][_0-9A-Za-z]*" attribute="Variable"/>
+        <RegExpr String="@[_A-Za-z][_0-9A-Za-z]*" attribute="Directive"/>
+      </context>
+
+      <context name="ctxString" attribute="String" lineEndContext="#pop">
+        <HlCStringChar attribute="Special Character" context="#stay"/>
+        <DetectChar attribute="String" context="#pop" char="&quot;"/>
+      </context>
+      <context name="ctxBlockString" attribute="String" lineEndContext="#stay">
+        <HlCStringChar attribute="Special Character" context="#stay"/>
+        <StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;"/>
+      </context>
+
+      <context name="ctxComment" attribute="Comment" lineEndContext="#pop">
+        <IncludeRules context="##Alerts"/>
+      </context>
+    </contexts>
+
+    <itemDatas>
+      <itemData name="Normal" defStyleNum="dsNormal" spellChecking="false"/>
+      <itemData name="Keyword" defStyleNum="dsKeyword" spellChecking="false"/>
+      <itemData name="Variable" defStyleNum="dsVariable" spellChecking="false"/>
+      <itemData name="Decimal" defStyleNum="dsDecVal"/>
+      <itemData name="Float" defStyleNum="dsFloat"/>
+      <itemData name="String" defStyleNum="dsString"/>
+      <itemData name="Special Character" defStyleNum="dsChar" spellChecking="false"/>
+      <itemData name="Constant" defStyleNum="dsConstant" spellChecking="false"/>
+      <itemData name="Type" defStyleNum="dsDataType" spellChecking="false"/>
+      <itemData name="Directive" defStyleNum="dsAttribute" spellChecking="false"/>
+      <itemData name="Comment" defStyleNum="dsComment"/>
+    </itemDatas>
+  </highlighting>
+</language>
diff --git a/xml/isocpp.xml b/xml/isocpp.xml
--- a/xml/isocpp.xml
+++ b/xml/isocpp.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd"
 [
-    <!ENTITY int "(?:[0-9](?:'?[0-9]+)*)">
-    <!ENTITY hex_int "(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f]+)*)">
+    <!ENTITY int "(?:[0-9](?:'?[0-9]++)*+)">
+    <!ENTITY hex_int "(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f]++)*+)">
     <!ENTITY exp_float "(?:[eE][+-]?&int;)">
     <!ENTITY exp_hexfloat "(?:[pP][-+]?&int;)">
 
@@ -24,7 +24,7 @@
 <language
     name="ISO C++"
     section="Sources"
-    version="18"
+    version="19"
     kateversion="5.0"
     indenter="cstyle"
     style="C++"
@@ -305,7 +305,7 @@
         <Detect2Chars attribute="Symbol" context="Attribute" char="[" char1="[" />
         <StringDetect attribute="Symbol" context="Attribute" String="&lt;:&lt;:" /> <!-- Digraph: [[ -->
         <!-- Match numbers -->
-        <RegExpr attribute="Decimal" context="Number" String="\.?[0-9]" lookAhead="true" />
+        <RegExpr context="Number" String="\.?\d" lookAhead="true" />
         <!-- Match comments -->
         <IncludeRules context="match comments and region markers" />
         <!-- Match keywords -->
@@ -392,16 +392,16 @@
       </context>
 
       <context name="Number" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
-        <RegExpr attribute="Float" context="FloatSuffix" String="\.&int;&exp_float;?|&int;(?:&exp_float;|\.&int;?&exp_float;?)|0[xX](?:\.&hex_int;&exp_hexfloat;?|&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))" />
+        <RegExpr attribute="Float" context="FloatSuffix" String="\.&int;&exp_float;?|0[xX](?:\.&hex_int;&exp_hexfloat;?|&hex_int;(?:&exp_hexfloat;|\.&hex_int;?&exp_hexfloat;?))|&int;(?:&exp_float;|\.&int;?&exp_float;?)" />
         <IncludeRules context="Integer" />
       </context>
 
       <context name="Integer" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
         <RegExpr attribute="Hex" context="IntSuffix" String="0[xX]&hex_int;" />
-        <RegExpr attribute="Binary" context="IntSuffix" String="0[Bb][01](?:'?[01]+)*" />
-        <RegExpr attribute="Octal" context="IntSuffix" String="0(?:'?[0-7]+)+" />
-        <RegExpr attribute="Decimal" context="IntSuffix" String="0(?![xXbB0-9])|[1-9](?:'?[0-9]+)*" />
-        <RegExpr attribute="Error" context="#pop" String="[._0-9A-Za-z']+" />
+        <RegExpr attribute="Binary" context="IntSuffix" String="0[Bb][01](?:'?[01]++)*+" />
+        <RegExpr attribute="Octal" context="IntSuffix" String="0(?:'?[0-7]++)++" />
+        <RegExpr attribute="Decimal" context="IntSuffix" String="0(?![xXbB0-9])|[1-9](?:'?[0-9]++)*+" />
+        <RegExpr attribute="Error" context="#pop" String="[._0-9A-Za-z']++" />
       </context>
 
       <context name="IntSuffix" attribute="Error" lineEndContext="#pop#pop" fallthrough="true" fallthroughContext="NumericSuffixError">
@@ -702,7 +702,7 @@
         <Detect2Chars attribute="Symbol" context="Attribute In PP" char="[" char1="[" />
         <StringDetect attribute="Symbol" context="Attribute In PP" String="&lt;:&lt;:" /> <!-- Digraph: [[ -->
         <!-- Match numbers -->
-        <RegExpr attribute="Decimal" context="Number" String="\.?[0-9]" lookAhead="true" />
+        <RegExpr context="Number" String="\.?\d" lookAhead="true" />
         <!-- Match comments -->
         <IncludeRules context="match comments" />
         <!-- Match punctuators -->
diff --git a/xml/java.xml b/xml/java.xml
--- a/xml/java.xml
+++ b/xml/java.xml
@@ -4,7 +4,7 @@
 	<!ENTITY int "[0-9]([0-9_]*[0-9])?">
 	<!ENTITY hex "[0-9a-fA-F]([0-9a-fA-F_]*[0-9a-fA-F])?">
 ]>
-<language name="Java" version="5" kateversion="5.0" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)">
+<language name="Java" version="6" kateversion="5.0" section="Sources" extensions="*.java" mimetype="text/x-java" license="LGPL" author="Alfredo Luiz Foltran Fialho (alfoltran@ig.com.br)">
 	<highlighting>
 		<list name="java15">
 			<item>ACTIVE</item>
@@ -3786,9 +3786,9 @@
 				<RegExpr attribute="Keyword" context="Imports" String="\b(package|import)\b" />
 				<RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*(/\*\s*\d+\s*\*/\s*)?[(])" />
 				<RegExpr attribute="Annotation" context="#stay" String="@[_\w][_\w\d]*" />
-				<RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
+				<DetectChar attribute="Symbol" context="Member" char="." />
 				<DetectChar attribute="Symbol" context="InFunctionCall" char="("/>
-				<AnyChar attribute="Symbol" context="#stay" String=":!%&amp;+,-/.*&lt;=&gt;?[]|~^&#59;"/>
+				<AnyChar attribute="Symbol" context="#stay" String=":!%&amp;+,-/*&lt;=&gt;?[]|~^&#59;"/>
 			</context>
 			<context attribute="Normal Text" lineEndContext="#stay" name="InFunctionCall">
 				<IncludeRules context="Normal"/>
diff --git a/xml/lua.xml b/xml/lua.xml
--- a/xml/lua.xml
+++ b/xml/lua.xml
@@ -48,7 +48,7 @@
     - NOTE, FIXME, TODO alerts added on comments
     - improved highlighting
 -->
-<language name="Lua" version="9" indenter="lua" kateversion="5.0" section="Scripts" extensions="*.lua" mimetype="text/x-lua">
+<language name="Lua" version="10" indenter="lua" kateversion="5.0" section="Scripts" extensions="*.lua" mimetype="text/x-lua">
   <highlighting>
     <list name="keywords">
       <item>and</item>
@@ -149,7 +149,7 @@
       <item>coroutine.create</item>
       <item>coroutine.isyieldable</item>
       <item>coroutine.resume</item>
-      <item>coroutine.kill</item>
+      <item>coroutine.close</item>
       <item>coroutine.running</item>
       <item>coroutine.status</item>
       <item>coroutine.wrap</item>
@@ -423,6 +423,8 @@
       <item>__call</item>
 
       <item>__tostring</item>
+      <item>__name</item>
+      <item>__close</item>
       <item>__pairs</item>
       <!-- setmetatable -->
       <item>__metatable</item>
@@ -477,6 +479,7 @@
         <keyword      attribute="BVar"     context="#stay"         String="basevar"/>
 
         <WordDetect   attribute="Keyword"  context="Function" beginRegion="chunk" String="function" />
+        <WordDetect   attribute="Keyword"  context="Local" String="local" />
         <keyword      attribute="Keyword"  context="#stay" String="keywords" />
         <keyword      attribute="Control"  context="StartControl" beginRegion="chunk" String="startcontrol" />
         <keyword      attribute="Control"  context="#stay" String="control" />
@@ -484,11 +487,11 @@
         <DetectChar   attribute="Symbols"  context="#stay" beginRegion="table" char="{" />
         <DetectChar   attribute="Symbols"  context="#stay" endRegion="table"   char="}" />
 
-        <RegExpr      attribute="Numbers"  context="#stay" String="(?:0[xX](?:\.&HEX;+|&HEX;+\.?&HEX;*)(?:[pP][-+]?\d*)?|(?:\.\d+|\d+\.?\d*)(?:[eE][-+]?\d*)?)"/>
+        <RegExpr      attribute="Normal Text" context="#stay" String="[a-zA-Z_][a-zA-Z0-9_]*(?=\s*([({'&quot;]|\[\[|\[=))" />
+        <RegExpr      attribute="Constant" context="#stay" String="[A-Z_][A-Z0-9_]*\b" />
+        <DetectIdentifier attribute="Variable" context="#stay" />
 
-        <RegExpr      attribute="Normal Text" context="#stay" String="\b[a-zA-Z_][a-zA-Z0-9_]*(?=\s*([({'&quot;]|\[\[|\[=))" />
-        <RegExpr      attribute="Constant" context="#stay" String="\b[A-Z_][A-Z0-9_]*\b" />
-        <RegExpr      attribute="Variable" context="#stay" String="\b[a-zA-Z_][a-zA-Z0-9_]*\b" />
+        <RegExpr      attribute="Numbers"  context="NumberSuffix" String="(?:0[xX](?:\.&HEX;+|&HEX;+\.?&HEX;*)(?:[pP][-+]?\d*)?|(?:\.\d+|\d+\.?\d*)(?:[eE][-+]?\d*)?)"/>
 
         <Detect2Chars attribute="Error"    context="#stay" char="!" char1="="/>
         <Detect2Chars attribute="Error"    context="#stay" char="-" char1="="/>
@@ -504,6 +507,30 @@
         <IncludeRules context="Normal" />
       </context>
 
+      <context name="NumberSuffix" attribute="Normal Text"  lineEndContext="#pop" fallthroughContext="#pop">
+        <!-- some syntax like a=32print(a) are valid, but ugly -->
+        <DetectIdentifier attribute="Error" context="#pop" />
+      </context>
+
+      <context name="Local" attribute="Normal Text"  lineEndContext="#pop" fallthroughContext="#pop">
+        <DetectSpaces />
+        <IncludeRules context="##DoxygenLua" />
+        <RegExpr          attribute="Constant" context="LocalVariable" String="\b[A-Z_][A-Z0-9_]*\b" />
+        <DetectIdentifier attribute="Variable" context="LocalVariable" />
+      </context>
+
+      <context name="LocalVariable" attribute="Normal Text"  lineEndContext="#pop#pop" fallthroughContext="#pop#pop">
+        <DetectSpaces />
+        <IncludeRules context="##DoxygenLua" />
+        <DetectChar   attribute="Symbols"   context="#pop" char="," />
+        <DetectChar   attribute="Attribute" context="Attribute" char="&lt;" lookAhead="true" />
+      </context>
+
+      <context name="Attribute" attribute="Attribute"  lineEndContext="#pop">
+        <RegExpr      attribute="Attribute" context="#pop" String="&lt;\s*(?:close|const)\s*>" />
+        <RegExpr      attribute="Error"     context="#pop" String="&lt;\s*\w*\s*>?" />
+      </context>
+
       <context name="Function" attribute="Normal Text"      lineEndContext="#stay">
         <WordDetect   attribute="Keyword"  context="#pop"  endRegion="chunk"   String="end" />
         <IncludeRules context="Normal" />
@@ -556,6 +583,7 @@
       <itemData name="RawStrings"      defStyleNum="dsVerbatimString"/>
       <itemData name="Symbols"         defStyleNum="dsOperator" spellChecking="false"/>
       <itemData name="Variable"        defStyleNum="dsNormal" /> <!-- JGM -->
+      <itemData name="Attribute"       defStyleNum="dsAttribute" spellChecking="false"/>
     </itemDatas>
   </highlighting>
   <general>
diff --git a/xml/lua.xml.patch b/xml/lua.xml.patch
--- a/xml/lua.xml.patch
+++ b/xml/lua.xml.patch
@@ -1,11 +1,11 @@
---- xml/lua.xml.orig	2018-06-08 09:28:41.000000000 -0700
-+++ xml/lua.xml	2018-06-08 09:28:33.000000000 -0700
-@@ -518,7 +518,7 @@
+--- lua.xml.orig	2020-07-29 11:31:42.000000000 -0700
++++ lua.xml	2020-07-29 11:31:57.000000000 -0700
+@@ -582,7 +582,7 @@
        <itemData name="Strings"         defStyleNum="dsString"/>
        <itemData name="RawStrings"      defStyleNum="dsVerbatimString"/>
        <itemData name="Symbols"         defStyleNum="dsOperator" spellChecking="false"/>
 -      <itemData name="Variable"        defStyleNum="dsKeyword" color="#5555FF" selColor="#ffffff" bold="0" italic="0" spellChecking="false"/>
 +      <itemData name="Variable"        defStyleNum="dsNormal" /> <!-- JGM -->
+       <itemData name="Attribute"       defStyleNum="dsAttribute" spellChecking="false"/>
      </itemDatas>
    </highlighting>
-   <general>
diff --git a/xml/m4.xml b/xml/m4.xml
--- a/xml/m4.xml
+++ b/xml/m4.xml
@@ -38,7 +38,7 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 -->
-<language name="GNU M4" version="2" section="Sources" kateversion="3.0" extensions="*.m4;" author="Jaak Ristioja" license="New BSD License">
+<language name="GNU M4" version="3" section="Sources" kateversion="3.0" extensions="*.m4;" author="Jaak Ristioja" license="New BSD License">
   <highlighting>
     <list name="optbuiltins">
       <item>__gnu__</item>
@@ -165,7 +165,7 @@
         <DetectChar attribute="Commas" char="," context="#stay"/>
         <DetectChar attribute="Operators" char="(" context="inparenthesis" beginRegion="parenthesis"/>
         <DetectChar attribute="Operators" char=")" context="#pop" endRegion="parenthesis"/>
-        <RegExpr attribute="Operators" String="[+*/%\|=\!&lt;&gt;!^&amp;~-]" context="#stay"/>
+        <AnyChar attribute="Operators" String="+*/%|=!&lt;&gt;^&amp;~-" context="#stay"/>
       </context>
       <context name="inparenthesis" attribute="Normal Text" lineEndContext="#stay" noIndentationBasedFolding="true">
         <IncludeRules context="Normal Text" />
diff --git a/xml/mediawiki.xml b/xml/mediawiki.xml
--- a/xml/mediawiki.xml
+++ b/xml/mediawiki.xml
@@ -6,7 +6,7 @@
   <!ENTITY wikiLinkWithDescription "\[\[[^]|]*\|[^]]*\]\]">
   <!ENTITY wikiLinkWithoutDescription "\[\[[^]|]*\]\]">
 ]>
-<language name="MediaWiki" section="Markup" version="6" kateversion="5.0" extensions="*.mediawiki" mimetype="" license="FDL" >
+<language name="MediaWiki" section="Markup" version="7" kateversion="5.0" extensions="*.mediawiki" mimetype="" license="FDL" >
   <highlighting>
     <contexts>
       <context attribute="Normal" lineEndContext="#stay" name="normal" >
@@ -15,7 +15,8 @@
         <RegExpr String="[=]{4,4}(?!=)" context="Section4" attribute="Section" column="0" />
         <RegExpr String="[=]{3,3}(?!=)" context="Section3" attribute="Section" column="0" />
         <RegExpr String="[=]{2,2}(?!=)" context="Section2" attribute="Section" column="0" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <DetectChar char=";" attribute="WikiTag" context="DefinitionListHeader" column="0" />
         <IncludeRules context="FindListItem" />
         <IncludeRules context="FindUrl" />
@@ -29,7 +30,7 @@
         <StringDetect String="&lt;pre&gt;" context="Pre" attribute="HtmlTag" />
         <IncludeRules context="FindSyntaxHighlightingHtmlElement" />
         <RegExpr String="[&lt;][^&gt;]+[&gt;]" attribute="HtmlTag" context="#stay" />
-        <RegExpr String="[\s]" context="Unformatted" column="0" />
+        <DetectSpaces context="Unformatted" column="0" />
       </context>
       <context name="TableHeader" attribute="Normal" lineEndContext="TableContent" >
         <Detect2Chars char="{" char1="|" attribute="WikiTag" beginRegion="table" />
@@ -58,13 +59,15 @@
         <IncludeRules context="FindSyntaxHighlightingHtmlElement" />
         <RegExpr String="[&lt;][^&gt;]+[&gt;]" attribute="HtmlTag" context="#stay" />
         <RegExpr String="[\s]" context="Unformatted" column="0" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <RegExpr String="[-]{4,}" attribute="WikiTag" context="#stay" />
         <DetectChar char="!" attribute="WikiTag" context="#stay" column="0" />
       </context>
       <context attribute="Section" lineEndContext="#pop" name="Section5" >
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindUrl" />
         <IncludeRules context="FindTextDecorationsInHeader" />
         <StringDetect String="{{{" context="TemplateParameter" attribute="WikiTag" />
@@ -83,7 +86,8 @@
       </context>
       <context attribute="Section" lineEndContext="#pop" name="Section4" >
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindUrl" />
         <IncludeRules context="FindTextDecorationsInHeader" />
         <StringDetect String="{{{" context="TemplateParameter" attribute="WikiTag" />
@@ -101,7 +105,8 @@
       </context>
       <context attribute="Section" lineEndContext="#pop" name="Section3" >
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindUrl" />
         <IncludeRules context="FindTextDecorationsInHeader" />
         <StringDetect String="{{{" context="TemplateParameter" attribute="WikiTag" />
@@ -119,7 +124,8 @@
       </context>
       <context attribute="Section" lineEndContext="#pop" name="Section2" >
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindUrl" />
         <IncludeRules context="FindTextDecorationsInHeader" />
         <StringDetect String="{{{" context="TemplateParameter" attribute="WikiTag" />
@@ -284,7 +290,8 @@
       <context attribute="Normal" lineEndContext="#stay" name="TemplateParameterSlot" >
         <Detect2Chars char="}" char1="}" context="#pop" attribute="WikiTag" lookAhead="true" />
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindListItem" />
         <IncludeRules context="FindUrlWithinTemplate" />
         <IncludeRules context="FindTextDecorations" />
@@ -306,7 +313,8 @@
       </context>
       <context attribute="Normal" lineEndContext="#stay" name="TemplateParameterSlotValue" >
         <StringDetect String="&lt;!--" context="comment" attribute="Comment" beginRegion="comment" />
-        <RegExpr String="[~]{3,4}" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~~" attribute="WikiTag" context="#stay" />
+        <StringDetect String="~~~" attribute="WikiTag" context="#stay" />
         <IncludeRules context="FindListItem" />
         <IncludeRules context="FindUrlWithinTemplate" />
         <IncludeRules context="FindTextDecorations" />
diff --git a/xml/nim.xml b/xml/nim.xml
new file mode 100644
--- /dev/null
+++ b/xml/nim.xml
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd">
+
+<!--
+Improvements:
+
+- fixed typo: "lamba" is now "lambda"
+- added bind, func, typed, untyped, on, off
+- added multiline strings
+- added multiline comments (with stacking!)
+- added support for hex, binary, and octal numbers
+- added support for numerical literal suffixes (e.g. 'f64)
+- made escape sequences in strings work slightly better (still needs work)
+- changed pragma syntax highlighting to dsAttribute instead of dsDataType
+- doc comments
+- TODO/BUG/FIXME/HACK/XXXX/NOTE comments
+
+-->
+
+<language
+	name="Nim"
+	version="1.0"
+	kateversion="2.4"
+	section="Sources"
+	extensions="*.nim"
+	mimetype="text/x-nim"
+	author="github.com/juancarlospaco"
+	license="WTFPL">
+
+	<highlighting>
+		<list name="keywords">
+			<item> const </item>
+			<item> export </item>
+			<item> import </item>
+			<item> include </item>
+			<item> lambda </item>
+			<item> let </item>
+			<item> var </item>
+		</list>
+
+		<list name="controls">
+			<item> assert </item> <!-- system -->
+			<item> asm </item>
+			<item> atomic </item>
+			<item> block </item>
+			<item> break </item>
+			<item> case </item>
+			<item> cast </item>
+			<item> compiles </item> <!-- system -->
+			<item> continue </item>
+			<item> declared </item> <!-- system -->
+			<item> declaredinscope </item> <!-- system -->
+			<item> defined </item> <!-- system -->
+			<item> discard </item>
+			<item> do </item>
+			<item> echo </item> <!-- system -->
+			<item> elif </item>
+			<item> else </item>
+			<item> end </item>
+			<item> except </item>
+			<item> finally </item>
+			<item> for </item>
+			<item> from </item>
+			<item> if </item>
+			<item> mixin </item>
+			<item> bind </item>
+			<item> new </item> <!-- system -->
+			<item> raise </item>
+			<item> return </item>
+			<item> sizeof </item> <!-- system -->
+			<item> try </item>
+			<item> when </item>
+			<item> while </item>
+			<item> quit </item> <!-- system -->
+			<item> using </item>
+			<item> yield </item>
+		</list>
+
+		<list name="operators">
+			<item> addr </item>
+			<item> and </item>
+			<item> as </item>
+			<item> div </item>
+			<item> in </item>
+			<item> is </item>
+			<item> isnot </item>
+			<item> mod </item>
+			<item> not </item>
+			<item> notin </item>
+			<item> of </item>
+			<item> or </item>
+			<item> shl </item>
+			<item> shr </item>
+			<item> xor </item>
+		</list>
+
+		<list name="types">
+			<item> array </item>
+			<item> bool </item>
+			<item> byte </item>
+			<item> cchar </item>
+			<item> cdouble </item>
+			<item> char </item>
+			<item> cfloat </item>
+			<item> cint </item>
+			<item> clong </item>
+			<item> cshort </item>
+			<item> cstring </item>
+			<item> cuint </item>
+			<item> distinct </item>
+			<item> expr </item>
+			<item> float </item>
+			<item> float32 </item>
+			<item> float64 </item>
+			<item> generic </item>
+			<item> int </item>
+			<item> int8 </item>
+			<item> int16 </item>
+			<item> int32 </item>
+			<item> int64 </item>
+			<item> interface </item>
+			<item> openarray </item>
+			<item> pointer </item>
+			<item> set </item>
+			<item> seq </item>
+			<item> stmt </item>
+			<item> string </item>
+			<item> tuple </item>
+			<item> typedesc </item>
+			<item> uint </item>
+			<item> uint8 </item>
+			<item> uint16 </item>
+			<item> uint32 </item>
+			<item> uint64 </item>
+			<item> varargs </item>
+			<item> void </item>
+			<item> untyped </item>
+			<item> typed </item>
+		</list>
+
+		<list name="attrs">
+			<item> out </item>
+			<item> ptr </item>
+			<item> ref </item>
+			<item> shared </item>
+			<item> static </item>
+		</list>
+
+		<list name="consts">
+			<item> false </item>
+			<item> inf </item>
+			<item> nil </item>
+			<item> true </item>
+			<item> on </item>
+			<item> off </item>
+		</list>
+
+		<list name="others">
+			<item> result </item>
+		</list>
+
+		<contexts>
+			<context name="Normal" attribute="Normal Text" lineEndContext="#stay">
+				<keyword context="#stay" attribute="Keywords" String="keywords"/>
+				<keyword context="#stay" attribute="Controls" String="controls"/>
+				<keyword context="#stay" attribute="Symbols"  String="operators"/>
+				<keyword context="#stay" attribute="Types"    String="types"/>
+				<keyword context="#stay" attribute="Attrs"    String="attrs"/>
+				<keyword context="#stay" attribute="Others"   String="others"/>
+				<keyword context="#stay" attribute="Float"    String="consts"/>
+
+				<RegExpr context="Proctar" attribute="Keywords" String="\bconverter\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\biterator\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\bmacro\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\bmethod\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\bproc\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\bfunc\b\s*"/>
+				<RegExpr context="Proctar" attribute="Keywords" String="\btemplate\b\s*"/>
+				<RegExpr context="Typetar" attribute="Keywords" String="\btype\b\s*"/>
+				<RegExpr context="Typetar" attribute="Keywords" String="\bconcept\b\s*"/>
+				<RegExpr context="Typetar" attribute="Keywords" String="\bobject\b\s*"/>
+				<RegExpr context="Typetar" attribute="Keywords" String="\benum\b\s*"/>
+
+                <RegExpr context="#stay" attribute="Hex"      String="0[xX][0-9A-Fa-f][0-9A-Fa-f_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
+                <RegExpr context="#stay" attribute="Octal"    String="0o[0-7][0-7_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
+                <RegExpr context="#stay" attribute="Binary"   String="0[bB][01][01_]*('(([ui](8|16|32|64))|(f(32|64|128))|[ufd]))?"/>
+				<RegExpr context="#stay" attribute="Types"    String="\b_*[A-Z](?:\w|\._*[A-Z])*\b"/>
+				<RegExpr context="#stay" attribute="Funcs"    String="\b\w+\b\s*(?=(\[.*\]\w*)?([\(]|([ ](?![,+\-*/=!^&amp;&lt;&gt;|?]|and|as|div|in|is|isnot|mod|notin|of|or|shl|shr|xor))))"/>
+
+				<DetectIdentifier/>
+
+				<Detect2Chars context="Pragmatar" attribute="Pragmas" char="{" char1="."/>
+				<RegExpr context="Proptar" attribute="Brackets" String="\.(?!\d)"/>
+				<RegExpr context="#stay" attribute="Float" String="\.(?=\d)"/>
+
+				<AnyChar context="#stay" attribute="Brackets" String="()[]{},:;"/>
+				<AnyChar context="#stay" attribute="Symbols"  String="+-*/=!@$%^&amp;&lt;&gt;|?"/>
+
+				<Int        context="#stay"   attribute="Decimal"/>
+				<HlCChar    context="#stay"   attribute="Char"/>
+                <DetectChar context="string" attribute="String" char="&quot;" beginRegion="String"/>
+
+				<RegExpr context="DocComment2" attribute="DocComment" String="##[[]"/>
+				<Detect2Chars context="DocComment1" attribute="DocComment" char="#" char1="#"/>
+				<Detect2Chars context="Comment2" attribute="Comment" char="#" char1="[" beginRegion="Comment"/>
+				<DetectChar context="Comment1" attribute="Comment" char="#"/>
+			</context>
+
+            <context name="stringescape" attribute="String Char" lineEndContext="#stay">
+              <RegExpr attribute="String Char" String="\\[&quot;abfnrtv]" context="#stay"/>
+            </context>
+
+			<context name="string" attribute="String" lineEndContext="#stay">
+                <IncludeRules context="stringescape"/>
+				<DetectChar context="#pop" attribute="String" char="&quot;" endRegion="String"/>
+			</context>
+
+			<context name="Comment1" attribute="Comment" lineEndContext="#pop">
+				<LineContinue attribute="Comment" context="#stay"/>
+				<RegExpr      attribute="Alert"   context="#stay" String="(BUG|XXXX|HACK)"/>
+				<RegExpr      attribute="Warning" context="#stay" String="(TODO|FIXME)"/>
+				<RegExpr      attribute="Info"    context="#stay" String="(NOTE)"/>
+			</context>
+
+			<context name="DocComment1" attribute="DocComment" lineEndContext="#pop">
+				<LineContinue attribute="DocComment" context="#stay"/>
+			</context>
+
+			<context name="DocComment2" attribute="DocComment" lineEndContext="#stay">
+				<LineContinue attribute="DocComment" context="#stay"/>
+                <RegExpr attribute="DocComment" context="DocComment2" String="##[[]" beginRegion="DocComment"/>
+				<RegExpr attribute="DocComment" context="#pop" String="[]]##" endRegion="DocComment"/>
+			</context>
+
+			<context name="Comment2" attribute="Comment" lineEndContext="#stay">
+				<LineContinue attribute="Comment" context="#stay"/>
+				<RegExpr      attribute="Alert"   context="#stay" String="(BUG|XXXX|HACK)"/>
+				<RegExpr      attribute="Warning" context="#stay" String="(TODO|FIXME)"/>
+				<RegExpr      attribute="Info"    context="#stay" String="(NOTE)"/>
+                <Detect2Chars attribute="Comment" context="Comment2" char="#" char1="[" beginRegion="Comment"/>
+				<Detect2Chars attribute="Comment" context="#pop" char="]" char1="#" endRegion="Comment"/>
+			</context>
+
+			<context name="Typetar" attribute="TypeDefs" lineEndContext="#pop">
+				<DetectChar context="#stay" attribute="Brackets" char="."/>
+				<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/>
+				<AnyChar context="#pop" attribute="Symbols"  String=" +-*/=!@$%^&amp;&lt;&gt;"/>
+			</context>
+
+			<context name="Proctar" attribute="ProcDefs" lineEndContext="#pop">
+				<DetectChar context="QuoteProctar" attribute="ProcDefs" char="`"/>
+				<DetectChar context="#stay" attribute="Brackets" char="."/>
+				<AnyChar context="#pop" attribute="Brackets" String="()[]{},:;"/>
+				<AnyChar context="#pop" attribute="Symbols"  String=" +-*/=!@$%^&amp;&lt;&gt;"/>
+			</context>
+
+			<context name="QuoteProctar" attribute="ProcDefs" lineEndContext="#pop">
+				<DetectChar context="#pop" attribute="ProcDefs" char="`"/>
+			</context>
+
+			<context name="Pragmatar" attribute="Pragmas" lineEndContext="#stay">
+				<Detect2Chars context="#pop" attribute="Pragmas" char="." char1="}"/>
+			</context>
+
+			<context name="Proptar" attribute="Props" lineEndContext="#pop">
+				<keyword context="#pop" attribute="Types" String="types"/>
+				<RegExpr context="#pop" attribute="Types" String="_*[A-Z]\w*"/>
+				<RegExpr context="#pop" attribute="Funcs" String="_*[a-z]\w*(?=\()"/>
+				<RegExpr context="#pop" attribute="Props" String="_*[a-z]\w*(?=\.)"/>
+				<RegExpr context="#pop" attribute="Props" String="_*[a-z]\w*"/>
+				<RegExpr context="#pop" attribute="Brackets" String="\.+"/>
+			</context>
+		</contexts>
+
+		<itemDatas>
+			<itemData name="Normal Text" defStyleNum="dsNormal"    spellChecking="false"/>
+			<itemData name="Keywords"    defStyleNum="dsKeyword"   spellChecking="false"/>
+			<itemData name="Controls"    defStyleNum="dsDataType"  spellChecking="false"/>
+			<itemData name="Pragmas"     defStyleNum="dsAttribute" spellChecking="false"/>
+			<itemData name="Types"       defStyleNum="dsDataType"  spellChecking="false"/>
+			<itemData name="Props"       defStyleNum="dsDataType"  spellChecking="false"/>
+			<itemData name="Funcs"       defStyleNum="dsDataType"  spellChecking="false"/>
+			<itemData name="Attrs"       defStyleNum="dsDataType"  spellChecking="false"/>
+			<itemData name="Others"      defStyleNum="dsOthers"    spellChecking="false"/>
+
+			<itemData name="TypeDefs"    defStyleNum="dsDataType" spellChecking="false" bold="true"/>
+			<itemData name="ProcDefs"    defStyleNum="dsString"   spellChecking="false" bold="true"/>
+
+			<itemData name="Brackets"    defStyleNum="dsKeyword"  spellChecking="false"/>
+			<itemData name="Symbols"     defStyleNum="dsComment"  spellChecking="false"/>
+
+			<itemData name="Decimal"     defStyleNum="dsDecVal"   spellChecking="false"/>
+			<itemData name="Hex"         defStyleNum="dsBaseN"    spellChecking="false"/>
+			<itemData name="Binary"      defStyleNum="dsBaseN"    spellChecking="false"/>
+			<itemData name="Octal"       defStyleNum="dsBaseN"    spellChecking="false"/>
+			<itemData name="Float"       defStyleNum="dsFloat"    spellChecking="false"/>
+			<itemData name="Char"        defStyleNum="dsChar"     spellChecking="false"/>
+			<itemData name="String"      defStyleNum="dsString"   spellChecking="false"/>
+			<itemData name="Comment"     defStyleNum="dsComment"  spellChecking="false"/>
+			<itemData name="Alert"       defStyleNum="dsAlert"    spellChecking="false" bold="true"/>
+			<itemData name="Warning"     defStyleNum="dsWarning"  spellChecking="false" bold="true"/>
+			<itemData name="Info"        defStyleNum="dsInformation" spellChecking="false" bold="true"/>
+
+			<itemData name="DocComment"  defStyleNum="dsDocumentation"  spellChecking="true"/>
+		</itemDatas>
+	</highlighting>
+
+	<general>
+		<comments>
+			<comment name="singleLine" start="#" position="beforewhitespace"/>
+		</comments>
+		<folding indentationsensitive="true" />
+		<indentation mode="nimrod"/>
+		<keywords casesensitive="0"/>
+	</general>
+
+</language>
diff --git a/xml/perl.xml b/xml/perl.xml
--- a/xml/perl.xml
+++ b/xml/perl.xml
@@ -39,7 +39,7 @@
 
    Enhance tr/// and y/// support.
 -->
-<language name="Perl" version="10" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
+<language name="Perl" version="11" kateversion="2.4" section="Scripts" extensions="*.pl;*.PL;*.pm" mimetype="application/x-perl;text/x-perl" priority="5" author="Anders Lund (anders@alweb.dk)" license="LGPLv2">
   <highlighting>
     <list name="keywords">
       <item>if</item>
@@ -465,7 +465,7 @@
         <IncludeRules context="ipstring_internal" />
       </context>
       <context name="ip_string_6" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true">
-        <RegExpr attribute="String (interpolated)" context="#stay" String="\\%1" dynamic="true" />
+        <RegExpr attribute="String (interpolated)" context="#stay" String="\%1" dynamic="true" />
         <DetectChar attribute="Operator" context="#pop#pop#pop" char="1" dynamic="true"  endRegion="String"/>
         <IncludeRules context="ipstring_internal" />
       </context>
@@ -508,7 +508,7 @@
       <context name="string_6" attribute="String" lineEndContext="#stay" dynamic="true">
         <DetectIdentifier />
         <Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" />
-        <RegExpr attribute="String Special Character" context="#stay" String="\\%1" dynamic="true"/>
+        <RegExpr attribute="String Special Character" context="#stay" String="\%1" dynamic="true"/>
         <DetectChar attribute="Operator" context="#pop#pop" char="1" dynamic="true" endRegion="String" />
       </context>
 
@@ -625,7 +625,7 @@
         <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=%1)" dynamic="true" />
         <RegExpr attribute="Operator" context="#pop#pop" String="%1[cgimosx]*" dynamic="true" endRegion="Pattern" />
         <IncludeRules context="regex_pattern_internal_ip" />
-        <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=\\%1)" dynamic="true" />
+        <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=\%1)" dynamic="true" />
       </context>
       <context name="pattern_brace" attribute="Pattern" lineEndContext="#stay">
         <RegExpr attribute="Operator" context="#pop#pop" String="\}[cgimosx]*" endRegion="Pattern" />
@@ -674,7 +674,7 @@
       <context name="regex_pattern_internal_rules_2" attribute="Pattern" lineEndContext="#stay">
         <Detect2Chars attribute="Pattern Internal Operator" context="pat_ext" char="(" char1="?" />
         <DetectChar attribute="Pattern Internal Operator" context="pat_char_class" char="[" />
-        <RegExpr attribute="Pattern Internal Operator" context="#stay" String="[()?^*+|]" />
+        <AnyChar attribute="Pattern Internal Operator" context="#stay" String="()?^*+|" />
         <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\{[\d, ]+\}" />
         <DetectChar attribute="Pattern Internal Operator" context="#stay" char="$" />
         <RegExpr attribute="Comment" context="#stay" String="\s{3,}#.*$" />
@@ -694,8 +694,8 @@
         <IncludeRules context="regex_pattern_internal_rules_2" />
       </context>
       <context name="pat_ext" attribute="Pattern Internal Operator" lineEndContext="#stay">
+        <AnyChar attribute="Pattern Internal Operator" context="#pop" String=":=!&gt;&lt;" />
         <RegExpr attribute="Comment" context="#pop" String="\#[^)]*" />
-        <RegExpr attribute="Pattern Internal Operator" context="#pop" String="[:=!&gt;&lt;]+" />
         <DetectChar attribute="Pattern Internal Operator" context="#pop" char=")" />
       </context>
       <context name="pat_char_class" attribute="Pattern Character Class" lineEndContext="#stay">
diff --git a/xml/perl.xml.patch b/xml/perl.xml.patch
deleted file mode 100644
--- a/xml/perl.xml.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- ../syntax-highlighting/data/syntax/perl.xml	2016-12-14 12:44:11.000000000 +0100
-+++ perl.xml	2017-02-16 16:14:04.000000000 +0100
-@@ -452,7 +452,7 @@
-         <IncludeRules context="ipstring_internal" />
-       </context>
-       <context name="ip_string_6" attribute="String (interpolated)" lineEndContext="#stay" dynamic="true">
--        <RegExpr attribute="String (interpolated)" context="#stay" String="\%1" dynamic="true" />
-+        <RegExpr attribute="String (interpolated)" context="#stay" String="\\%1" dynamic="true" />
-         <DetectChar attribute="Operator" context="#pop#pop#pop" char="1" dynamic="true"  endRegion="String"/>
-         <IncludeRules context="ipstring_internal" />
-       </context>
-@@ -495,7 +495,7 @@
-       <context name="string_6" attribute="String" lineEndContext="#stay" dynamic="true">
-         <DetectIdentifier />
-         <Detect2Chars attribute="String Special Character" context="#stay" char="\" char1="\" />
--        <RegExpr attribute="String Special Character" context="#stay" String="\%1" dynamic="true"/>
-+        <RegExpr attribute="String Special Character" context="#stay" String="\\%1" dynamic="true"/>
-         <DetectChar attribute="Operator" context="#pop#pop" char="1" dynamic="true" endRegion="String" />
-       </context>
- 
-@@ -600,7 +600,7 @@
-         <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=%1)" dynamic="true" />
-         <RegExpr attribute="Operator" context="#pop#pop" String="%1[cgimosx]*" dynamic="true" endRegion="Pattern" />
-         <IncludeRules context="regex_pattern_internal_ip" />
--        <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=\%1)" dynamic="true" />
-+        <RegExpr attribute="Pattern Internal Operator" context="#stay" String="\$(?=\\%1)" dynamic="true" />
-       </context>
-       <context name="pattern_brace" attribute="Pattern" lineEndContext="#stay">
-         <RegExpr attribute="Operator" context="#pop#pop" String="\}[cgimosx]*" endRegion="Pattern" />
diff --git a/xml/powershell.xml b/xml/powershell.xml
--- a/xml/powershell.xml
+++ b/xml/powershell.xml
@@ -1,7 +1,7 @@
 <!DOCTYPE language SYSTEM "language.dtd">
 <language
   name="PowerShell"
-  version="5"
+  version="6"
   kateversion="5.0"
   extensions="*.ps1;*.ps1m;*.ps1d"
   section="Scripts"
@@ -889,8 +889,8 @@
         <RegExpr attribute="Keyword" context="#stay" String="\b\$script(?=\s+(:))"/>
         <RegExpr attribute="Variable" context="#stay" String="\$+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" />
         <keyword attribute="Special Variable" context="#stay" String="special-variables"/>
-        <RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
-        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
+        <DetectChar attribute="Symbol" context="Member" char="." />
+        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/*&lt;=&gt;?[]|~^&#59;"/>
       </context>
       <context attribute="String Char" lineEndContext="#stay" name="StringEscape">
         <RegExpr attribute="String Char" String="`[`&quot;0abefnrtv]" context="#stay"/>
diff --git a/xml/scala.xml b/xml/scala.xml
--- a/xml/scala.xml
+++ b/xml/scala.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE language SYSTEM "language.dtd">
-<language name="Scala" version="6" kateversion="2.3" section="Sources"
+<language name="Scala" version="7" kateversion="2.3" section="Sources"
           extensions="*.scala;*.sbt" mimetype="text/x-scala" license="LGPL"
           author="Stephane Micheloud (stephane.micheloud@epfl.ch)">
 <!--
@@ -3425,8 +3425,8 @@
         <RegExpr attribute="Keyword" context="Imports" String="\b(package|import)\b" />
 -->
         <RegExpr attribute="Function" context="#stay" String="\b[_\w][_\w\d]*(?=[\s]*(/\*\s*\d+\s*\*/\s*)?[(])" />
-        <RegExpr attribute="Symbol" context="Member" String="[.]{1,1}" />
-        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/.*&lt;=&gt;?[]|~^&#59;"/>
+        <DetectChar attribute="Symbol" context="Member" char="." />
+        <AnyChar attribute="Symbol" context="#stay" String=":!%&amp;()+,-/*&lt;=&gt;?[]|~^&#59;"/>
       </context>
       <context name="Float Suffixes" attribute="Float" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
           <AnyChar String="fF" attribute="Float" context="#pop"/>
diff --git a/xml/tcsh.xml b/xml/tcsh.xml
--- a/xml/tcsh.xml
+++ b/xml/tcsh.xml
@@ -655,7 +655,7 @@
       <context attribute="Normal Text" lineEndContext="#pop" name="CmdSetEnv" fallthrough="true" fallthroughContext="#pop">
         <!-- handle command line options -->
         <RegExpr attribute="Variable" context="#pop" String="\b&varname;" />
-        <RegExpr attribute="Variable" context="Assign" String=" " />
+        <RegExpr attribute="Variable" context="Assign" String="\s" />
         <IncludeRules context="FindMost" />
       </context>
 
diff --git a/xml/tcsh.xml.patch b/xml/tcsh.xml.patch
deleted file mode 100644
--- a/xml/tcsh.xml.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- tcsh.xml.orig	2018-06-08 09:32:02.000000000 -0700
-+++ tcsh.xml	2018-06-08 09:32:06.000000000 -0700
-@@ -674,7 +674,7 @@
-       <context attribute="Normal Text" lineEndContext="#pop" name="CmdSetEnv" fallthrough="true" fallthroughContext="#pop">
-         <!-- handle command line options -->
-         <RegExpr attribute="Variable" context="#pop" String="\b&varname;" />
--        <RegExpr attribute="Variable" context="Assign" String="\s" />
-+        <RegExpr attribute="Variable" context="Assign" String=" " />
-         <IncludeRules context="FindMost" />
-       </context>
- 
diff --git a/xml/toml.xml b/xml/toml.xml
new file mode 100644
--- /dev/null
+++ b/xml/toml.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd"
+[
+	<!ENTITY more "(_\d+)*">
+	<!ENTITY int  "[+-]?(0|[1-9]\d*)&more;">
+	<!ENTITY frac "\.\d+&more;">
+	<!ENTITY exp  "[eE][+-]?\d+&more;">
+
+	<!ENTITY offset   "[+-]\d\d:\d\d">
+	<!ENTITY time     "\d\d:\d\d:\d\d(\.\d+)?(&offset;|Z)?">
+	<!ENTITY datetime "\d\d\d\d-\d\d-\d\d(T&time;)?">
+]>
+<!-- https://github.com/toml-lang/toml -->
+<language name="TOML" section="Configuration" extensions="*.toml" mimetype="text/x-toml" version="5" kateversion="5.0" author="flying-sheep@web.de" license="LGPLv2+">
+<highlighting>
+	<list name="bools">
+		<item>true</item>
+		<item>false</item>
+	</list>
+	<contexts>
+		<context attribute="Error" lineEndContext="#stay" name="Toml">
+			<DetectSpaces attribute="Whitespace"/>
+			<Detect2Chars attribute="TableHeader" context="NestedTableHeader" char="[" char1="[" endRegion="Table"/>
+			<DetectChar attribute="TableHeader" context="TableHeader" char="[" endRegion="Table"/>
+			<RegExpr    attribute="Key" context="#stay"   String="[\w-]+" firstNonSpace="true"/>
+			<DetectChar attribute="Key" context="QuotedKey" char="&quot;" firstNonSpace="true"/>
+			<DetectChar attribute="Assignment" context="Value" char="="/>
+			<DetectChar char="#" attribute="Comment" context="Comment"/>
+		</context>
+		<!-- table headers -->
+		<context attribute="TableHeader" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop" name="TableHeader">
+			<IncludeRules context="TableHeaderCommon"/>
+			<DetectChar attribute="TableHeader" context="#pop" char="]" beginRegion="Table"/>
+		</context>
+		<context attribute="TableHeader" fallthrough="true" fallthroughContext="#pop" lineEndContext="#pop" name="NestedTableHeader">
+			<IncludeRules context="TableHeaderCommon"/>
+			<Detect2Chars attribute="TableHeader" context="#pop" char="]" char1="]" beginRegion="Table"/>
+		</context>
+		<context attribute="TableHeader" lineEndContext="#pop" name="TableHeaderCommon">
+			<DetectSpaces attribute="Whitespace"/>
+			<DetectChar attribute="TableHeader" context="#stay" char="."/>
+			<RegExpr    attribute="Key" context="#stay" String="[\w-]+"/>
+			<DetectChar attribute="Key" context="QuotedKey" char="&quot;"/>
+		</context>
+		<!-- values -->
+		<context attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop" name="Value">
+			<DetectSpaces attribute="Whitespace"/>
+			<RegExpr attribute="Date"  context="#stay" String="&datetime;"/>
+			<keyword attribute="Bool" String="bools" context="#stay"/>
+			<RegExpr attribute="Float" context="#stay" String="&int;(&frac;&exp;|&frac;|&exp;)"/>
+			<RegExpr attribute="Int"   context="#stay" String="&int;"/>
+			<StringDetect attribute="String" context="MultilineString"    String="&quot;&quot;&quot;"/>
+			<DetectChar   attribute="String" context="String"               char="&quot;"/>
+			<StringDetect attribute="String" context="LitMultilineString" String="'''"/>
+			<DetectChar   attribute="String" context="LitString"            char="'"/>
+			<DetectChar attribute="Array" context="Array" char="["/>
+			<DetectChar attribute="InlineTable" context="InlineTable" char="{"/>
+			<DetectChar char="#" attribute="Comment" context="Comment"/>
+		</context>
+		<context attribute="Comment" lineEndContext="#pop" name="Comment">
+			<DetectSpaces/>
+			<IncludeRules context="##Alerts" />
+			<DetectIdentifier/>
+		</context>
+		<!-- Quoted keys and Strings -->
+		<context attribute="Key" lineEndContext="#pop" name="QuotedKey">
+			<LineContinue attribute="Escape" context="#stay"/>
+			<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
+			<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
+			<RegExpr attribute="Error" String="\\." context="#stay" />
+			<DetectChar attribute="Key" context="#pop" char="&quot;"/>
+		</context>
+		<context attribute="String" lineEndContext="#pop" name="String">
+			<LineContinue attribute="Escape" context="#stay"/>
+			<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
+			<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
+			<RegExpr attribute="Error" String="\\." context="#stay" />
+			<DetectChar attribute="String" context="#pop" char="&quot;"/>
+		</context>
+		<context attribute="String" lineEndContext="#stay" name="MultilineString">
+			<LineContinue attribute="Escape" context="#stay"/>
+			<RegExpr attribute="Escape" String="\\[btnfr&quot;\\]" context="#stay" />
+			<RegExpr attribute="Escape" String="\\(u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})" context="#stay" />
+			<RegExpr attribute="Error" String="\\." context="#stay" />
+			<StringDetect attribute="String" context="#pop" String="&quot;&quot;&quot;"/>
+		</context>
+		<context attribute="LitString" lineEndContext="#pop" name="LitString">
+			<DetectChar attribute="String" context="#pop" char="'"/>
+		</context>
+		<context attribute="LitString" lineEndContext="#stay" name="LitMultilineString">
+			<StringDetect attribute="String" context="#pop" String="'''"/>
+		</context>
+		<!-- Arrays -->
+		<context attribute="Array" lineEndContext="#stay" name="Array">
+			<IncludeRules context="Value" />
+			<DetectChar context="#pop" attribute="Array" char="]" />
+			<DetectChar context="#stay" attribute="NextEntry" char="," />
+		</context>
+		<context attribute="InlineTable" lineEndContext="#stay" name="InlineTable">
+			<RegExpr    attribute="Key" context="#stay"   String="[\w-]+"/>
+			<DetectChar attribute="Key" context="QuotedKey" char="&quot;"/>
+			<DetectChar attribute="Assignment" context="Value" char="="/>
+			<DetectChar char="#" attribute="Comment" context="Comment"/>
+			<DetectChar context="#pop" attribute="InlineTable" char="}" />
+			<DetectChar context="#stay" attribute="NextEntry" char="," />
+		</context>
+	</contexts>
+	<itemDatas>
+		<itemData name="Normal Text" defStyleNum="dsNormal"/>
+		<itemData name="Key"         defStyleNum="dsDataType"/>
+		<itemData name="TableHeader" defStyleNum="dsKeyword"/>
+		<itemData name="Assignment"  defStyleNum="dsOperator"/>
+		<itemData name="Comment"     defStyleNum="dsComment"/>
+
+		<itemData name="Date"        defStyleNum="dsBaseN"/>
+		<itemData name="Float"       defStyleNum="dsFloat"/>
+		<itemData name="Int"         defStyleNum="dsDecVal"/>
+		<itemData name="Bool"        defStyleNum="dsConstant"/>
+		<itemData name="String"      defStyleNum="dsString"/>
+		<itemData name="LitString"   defStyleNum="dsVerbatimString"/>
+		<itemData name="Escape"      defStyleNum="dsSpecialChar"/>
+		<itemData name="Array"       defStyleNum="dsOperator"/>
+		<itemData name="InlineTable" defStyleNum="dsOperator"/>
+		<itemData name="NextEntry"   defStyleNum="dsOperator"/>
+
+		<itemData name="Whitespace"  defStyleNum="dsNormal"/>
+		<itemData name="Error"       defStyleNum="dsError"/>
+	</itemDatas>
+</highlighting>
+<general>
+	<comments>
+		<comment name="singleLine" start="#" />
+	</comments>
+</general>
+</language>
diff --git a/xml/xul.xml b/xml/xul.xml
--- a/xml/xul.xml
+++ b/xml/xul.xml
@@ -4,7 +4,7 @@
 	<!ENTITY name    "[A-Za-z_:][\w.:_-]*">
 	<!ENTITY entref  "&amp;(#[0-9]+|#[xX][0-9A-Fa-f]+|&name;);">
 ]>
-<language name="XUL" version="5" kateversion="5.0" section="Markup" extensions="*.xul;*.xbl" mimetype="text/xul" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl), Anders Lund (anders@alweb.dk), Joseph Wenninger (jowenn@kde.org), Whitehawk Stormchaser (zerokode@gmx.net), Marc Dassonneville (marc.dassonneville@gmail.com)" license="LGPL">
+<language name="XUL" version="6" kateversion="5.0" section="Markup" extensions="*.xul;*.xbl" mimetype="text/xul" casesensitive="1" indenter="xml" author="Wilbert Berendsen (wilbert@kde.nl), Anders Lund (anders@alweb.dk), Joseph Wenninger (jowenn@kde.org), Whitehawk Stormchaser (zerokode@gmx.net), Marc Dassonneville (marc.dassonneville@gmail.com)" license="LGPL">
 
 <highlighting>
    <list name="keywords">
@@ -520,7 +520,7 @@
      <DetectChar attribute="String" context="String 1" char="'"/>
      <Detect2Chars attribute="Comment" context="JSComment" char="/" char1="/"/>
      <Detect2Chars attribute="Comment" context="Multi/inline Comment" char="/" char1="*" beginRegion="Comment"/>
-     <RegExpr attribute="Normal Text" context="(Internal regex catch)" String="[=?:]" />
+     <AnyChar attribute="Normal Text" context="(Internal regex catch)" String="=?:" />
      <RegExpr attribute="Normal Text" context="(Internal regex catch)" String="\(" />
      <DetectChar attribute="Symbol" context="#stay" char="{" beginRegion="Brace1" />
      <DetectChar attribute="Symbol" context="#stay" char="}" endRegion="Brace1" />
diff --git a/xml/zsh.xml b/xml/zsh.xml
--- a/xml/zsh.xml
+++ b/xml/zsh.xml
@@ -8,7 +8,7 @@
         <!ENTITY noword   "(?![\w$+-])">                <!-- no word, $, + or - following -->
         <!ENTITY pathpart "([\w_@.&#37;*?+-]|\\ )">     <!-- valid character in a file name -->
 ]>
-<language name="Zsh" version="3" kateversion="2.4" section="Scripts" extensions="*.sh;*.zsh;.zshrc;.zprofile;.zlogin;.zlogout;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Jonathan Kolberg (bulldog98@kubuntu-de.org)" license="LGPL">
+<language name="Zsh" version="4" kateversion="2.4" section="Scripts" extensions="*.sh;*.zsh;.zshrc;.zprofile;.zlogin;.zlogout;.profile" mimetype="application/x-shellscript" casesensitive="1" author="Jonathan Kolberg (bulldog98@kubuntu-de.org)" license="LGPL">
 
 <!-- (c) 2011 by Jonathan Kolberg (bulldog98@kubuntu-de.org)
   modified for zsh -->
@@ -600,7 +600,8 @@
         <!-- handle here document -->
         <Detect2Chars attribute="Redirection" context="HereDoc" char="&lt;" char1="&lt;" lookAhead="true" />
         <!-- handle process subst -->
-        <RegExpr attribute="Redirection" context="ProcessSubst" String="[&lt;&gt;]\(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&lt;" char1="(" />
+        <Detect2Chars attribute="Redirection" context="ProcessSubst" char="&gt;" char1="(" />
         <!-- handle redirection -->
         <RegExpr attribute="Redirection" context="#stay" String="([0-9]*(&gt;{1,2}|&lt;)(&amp;[0-9]+-?)?|&amp;&gt;|&gt;&amp;|[0-9]*&lt;&gt;)" />
         <!-- handle &, &&, | and || -->
