{-# LANGUAGE StrictData #-}
module Djot.Options
( ParseOptions(..)
, RenderOptions(..)
, SourcePosOption(..) )
where

newtype ParseOptions =
  ParseOptions
  { ParseOptions -> SourcePosOption
sourcePositions :: SourcePosOption -- ^ Add attributes for source lines
  }
  deriving (Int -> ParseOptions -> ShowS
[ParseOptions] -> ShowS
ParseOptions -> String
(Int -> ParseOptions -> ShowS)
-> (ParseOptions -> String)
-> ([ParseOptions] -> ShowS)
-> Show ParseOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ParseOptions -> ShowS
showsPrec :: Int -> ParseOptions -> ShowS
$cshow :: ParseOptions -> String
show :: ParseOptions -> String
$cshowList :: [ParseOptions] -> ShowS
showList :: [ParseOptions] -> ShowS
Show)

newtype RenderOptions =
  RenderOptions
  { RenderOptions -> Bool
preserveSoftBreaks :: Bool -- ^ Preserve soft breaks as in the source
  }
  deriving (Int -> RenderOptions -> ShowS
[RenderOptions] -> ShowS
RenderOptions -> String
(Int -> RenderOptions -> ShowS)
-> (RenderOptions -> String)
-> ([RenderOptions] -> ShowS)
-> Show RenderOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenderOptions -> ShowS
showsPrec :: Int -> RenderOptions -> ShowS
$cshow :: RenderOptions -> String
show :: RenderOptions -> String
$cshowList :: [RenderOptions] -> ShowS
showList :: [RenderOptions] -> ShowS
Show)

-- | Adding source positions for blocks adds almost no overhead to parsing.
-- Adding source positions for inlines has a small penalty.  For many purposes
-- it is enough to have source lines for blocks, so we offer the option.
data SourcePosOption =
  NoSourcePos | BlockSourcePos | AllSourcePos
  deriving (Int -> SourcePosOption -> ShowS
[SourcePosOption] -> ShowS
SourcePosOption -> String
(Int -> SourcePosOption -> ShowS)
-> (SourcePosOption -> String)
-> ([SourcePosOption] -> ShowS)
-> Show SourcePosOption
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SourcePosOption -> ShowS
showsPrec :: Int -> SourcePosOption -> ShowS
$cshow :: SourcePosOption -> String
show :: SourcePosOption -> String
$cshowList :: [SourcePosOption] -> ShowS
showList :: [SourcePosOption] -> ShowS
Show, SourcePosOption -> SourcePosOption -> Bool
(SourcePosOption -> SourcePosOption -> Bool)
-> (SourcePosOption -> SourcePosOption -> Bool)
-> Eq SourcePosOption
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SourcePosOption -> SourcePosOption -> Bool
== :: SourcePosOption -> SourcePosOption -> Bool
$c/= :: SourcePosOption -> SourcePosOption -> Bool
/= :: SourcePosOption -> SourcePosOption -> Bool
Eq, Eq SourcePosOption
Eq SourcePosOption =>
(SourcePosOption -> SourcePosOption -> Ordering)
-> (SourcePosOption -> SourcePosOption -> Bool)
-> (SourcePosOption -> SourcePosOption -> Bool)
-> (SourcePosOption -> SourcePosOption -> Bool)
-> (SourcePosOption -> SourcePosOption -> Bool)
-> (SourcePosOption -> SourcePosOption -> SourcePosOption)
-> (SourcePosOption -> SourcePosOption -> SourcePosOption)
-> Ord SourcePosOption
SourcePosOption -> SourcePosOption -> Bool
SourcePosOption -> SourcePosOption -> Ordering
SourcePosOption -> SourcePosOption -> SourcePosOption
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SourcePosOption -> SourcePosOption -> Ordering
compare :: SourcePosOption -> SourcePosOption -> Ordering
$c< :: SourcePosOption -> SourcePosOption -> Bool
< :: SourcePosOption -> SourcePosOption -> Bool
$c<= :: SourcePosOption -> SourcePosOption -> Bool
<= :: SourcePosOption -> SourcePosOption -> Bool
$c> :: SourcePosOption -> SourcePosOption -> Bool
> :: SourcePosOption -> SourcePosOption -> Bool
$c>= :: SourcePosOption -> SourcePosOption -> Bool
>= :: SourcePosOption -> SourcePosOption -> Bool
$cmax :: SourcePosOption -> SourcePosOption -> SourcePosOption
max :: SourcePosOption -> SourcePosOption -> SourcePosOption
$cmin :: SourcePosOption -> SourcePosOption -> SourcePosOption
min :: SourcePosOption -> SourcePosOption -> SourcePosOption
Ord)