module Ribosome.Syntax (
module Ribosome.Data.Syntax,
module Ribosome.Syntax,
) where
import qualified Data.Map.Strict as Map
import Ribosome.Data.Syntax (
HiLink (..),
Highlight (..),
Syntax (..),
SyntaxItem (..),
SyntaxItemDetail (..),
)
syntaxItem :: SyntaxItemDetail -> SyntaxItem
syntaxItem :: SyntaxItemDetail -> SyntaxItem
syntaxItem SyntaxItemDetail
detail =
SyntaxItemDetail -> [Text] -> Map Text Text -> SyntaxItem
SyntaxItem SyntaxItemDetail
detail [Text]
forall a. Default a => a
def Map Text Text
forall a. Default a => a
def
syntaxKeyword :: Text -> Text -> SyntaxItem
syntaxKeyword :: Text -> Text -> SyntaxItem
syntaxKeyword Text
group' Text
keyword =
SyntaxItemDetail -> SyntaxItem
syntaxItem (SyntaxItemDetail -> SyntaxItem) -> SyntaxItemDetail -> SyntaxItem
forall a b. (a -> b) -> a -> b
$ Text -> Text -> [Text] -> SyntaxItemDetail
Keyword Text
group' Text
keyword [Text]
forall a. Default a => a
def
syntaxMatch :: Text -> Text -> SyntaxItem
syntaxMatch :: Text -> Text -> SyntaxItem
syntaxMatch Text
group' Text
pat =
SyntaxItemDetail -> SyntaxItem
syntaxItem (SyntaxItemDetail -> SyntaxItem) -> SyntaxItemDetail -> SyntaxItem
forall a b. (a -> b) -> a -> b
$ Text -> Text -> SyntaxItemDetail
Match Text
group' Text
pat
syntaxRegionOffset :: Text -> Text -> Text -> Maybe Text -> Text -> Text -> SyntaxItem
syntaxRegionOffset :: Text -> Text -> Text -> Maybe Text -> Text -> Text -> SyntaxItem
syntaxRegionOffset Text
group' Text
start Text
end Maybe Text
skip Text
ms Text
me =
SyntaxItemDetail -> SyntaxItem
syntaxItem (SyntaxItemDetail -> SyntaxItem) -> SyntaxItemDetail -> SyntaxItem
forall a b. (a -> b) -> a -> b
$ Text
-> Text -> Text -> Maybe Text -> Text -> Text -> SyntaxItemDetail
Region Text
group' Text
start Text
end Maybe Text
skip Text
ms Text
me
syntaxRegion :: Text -> Text -> Text -> Maybe Text -> SyntaxItem
syntaxRegion :: Text -> Text -> Text -> Maybe Text -> SyntaxItem
syntaxRegion Text
group' Text
start Text
end Maybe Text
skip =
Text -> Text -> Text -> Maybe Text -> Text -> Text -> SyntaxItem
syntaxRegionOffset Text
group' Text
start Text
end Maybe Text
skip Text
"" Text
""
syntaxVerbatim :: Text -> SyntaxItem
syntaxVerbatim :: Text -> SyntaxItem
syntaxVerbatim =
SyntaxItemDetail -> SyntaxItem
syntaxItem (SyntaxItemDetail -> SyntaxItem)
-> (Text -> SyntaxItemDetail) -> Text -> SyntaxItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> SyntaxItemDetail
Verbatim
syntaxHighlight :: Text -> [(Text, Text)] -> Highlight
syntaxHighlight :: Text -> [(Text, Text)] -> Highlight
syntaxHighlight Text
group' =
Text -> Map Text Text -> Highlight
Highlight Text
group' (Map Text Text -> Highlight)
-> ([(Text, Text)] -> Map Text Text) -> [(Text, Text)] -> Highlight
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(Text, Text)] -> Map Text Text
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList