module Proteome.Add.Syntax where

import qualified Data.Map.Strict as Map (fromList)
import Ribosome.Data.Syntax.Syntax (HiLink (HiLink), Syntax (Syntax))
import Ribosome.Data.SyntaxItem (SyntaxItem (options, params))
import Ribosome.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
"ProAddAsterisk" [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
"ProAddName")]

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

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

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

addSyntax :: Syntax
addSyntax :: Syntax
addSyntax =
  [SyntaxItem] -> [Highlight] -> [HiLink] -> Syntax
Syntax [SyntaxItem]
items [] [HiLink]
links
  where
    items :: [SyntaxItem]
items =
      [Item [SyntaxItem]
SyntaxItem
asterisk, Item [SyntaxItem]
SyntaxItem
sync]
    links :: [HiLink]
links =
      [Item [HiLink]
HiLink
hlAsterisk, Item [HiLink]
HiLink
hlName]