module Proteome.Files.Syntax where

import qualified Data.Map.Strict as Map (fromList)
import Ribosome.Data.SyntaxItem (SyntaxItem (options, params))
import Ribosome.Syntax (HiLink (HiLink), Syntax (Syntax), syntaxMatch, syntaxVerbatim)
import Text.RawString.QQ (r)

asterisk :: SyntaxItem
asterisk :: SyntaxItem
asterisk =
  SyntaxItem
item {[Text]
options :: [Text]
$sel:options:SyntaxItem :: [Text]
options, Map Text Text
params :: Map Text Text
$sel:params:SyntaxItem :: Map Text Text
params}
  where
    item :: SyntaxItem
item = SyntaxGroup -> Text -> SyntaxItem
syntaxMatch SyntaxGroup
"ProFilesAsterisk" [r|^ \*|]
    options :: [Text]
options = [Item [Text]
"skipwhite"]
    params :: Map Text Text
params = [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Text
"nextgroup", Text
"ProFilesBase,ProFilesName")]

base :: SyntaxItem
base :: SyntaxItem
base =
  SyntaxItem
item {[Text]
options :: [Text]
$sel:options:SyntaxItem :: [Text]
options, Map Text Text
params :: Map Text Text
$sel:params:SyntaxItem :: Map Text Text
params}
  where
    item :: SyntaxItem
item = SyntaxGroup -> Text -> SyntaxItem
syntaxMatch SyntaxGroup
"ProFilesBase" [r|\[[^]]\+\]|]
    options :: [Text]
options = [Item [Text]
"skipwhite", Item [Text]
"contained"]
    params :: Map Text Text
params = [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(Text
"nextgroup", Text
"ProFilesName")]

name :: SyntaxItem
name :: SyntaxItem
name =
  SyntaxItem
item {[Text]
options :: [Text]
$sel:options:SyntaxItem :: [Text]
options}
  where
    item :: SyntaxItem
item = SyntaxGroup -> Text -> SyntaxItem
syntaxMatch SyntaxGroup
"ProFilesName" Text
".*"
    options :: [Text]
options = [Item [Text]
"contained"]

sync :: SyntaxItem
sync :: SyntaxItem
sync =
  Text -> SyntaxItem
syntaxVerbatim Text
"syntax sync minlines=1"

hlAsterisk :: HiLink
hlAsterisk :: HiLink
hlAsterisk =
  SyntaxGroup -> SyntaxGroup -> HiLink
HiLink SyntaxGroup
"ProFilesAsterisk" SyntaxGroup
"Todo"

hlBase :: HiLink
hlBase :: HiLink
hlBase =
  SyntaxGroup -> SyntaxGroup -> HiLink
HiLink SyntaxGroup
"ProFilesBase" SyntaxGroup
"Directory"

hlName :: HiLink
hlName :: HiLink
hlName =
  SyntaxGroup -> SyntaxGroup -> HiLink
HiLink SyntaxGroup
"ProFilesName" SyntaxGroup
"Type"

filesSyntax :: Syntax
filesSyntax :: Syntax
filesSyntax =
  [SyntaxItem] -> [Highlight] -> [HiLink] -> Syntax
Syntax [SyntaxItem]
items [] [HiLink]
links
  where
    items :: [SyntaxItem]
items =
      [Item [SyntaxItem]
SyntaxItem
asterisk, Item [SyntaxItem]
SyntaxItem
base, Item [SyntaxItem]
SyntaxItem
name, Item [SyntaxItem]
SyntaxItem
sync]
    links :: [HiLink]
links =
      [Item [HiLink]
HiLink
hlAsterisk, Item [HiLink]
HiLink
hlBase, Item [HiLink]
HiLink
hlName]