Init
This commit is contained in:
commit
c9f61c4e06
16 changed files with 1366 additions and 0 deletions
26
src/ParserMonad.hs
Normal file
26
src/ParserMonad.hs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module ParserMonad where
|
||||
|
||||
import Data.String
|
||||
import Data.Text (Text)
|
||||
import Data.Text qualified as Text
|
||||
import Text.Parsec (Parsec)
|
||||
import Text.Parsec qualified as Parsec
|
||||
|
||||
import Types
|
||||
|
||||
type Parser = Parsec Text ParserState
|
||||
|
||||
instance (a ~ Text) => IsString (Parser a) where
|
||||
fromString = fmap Text.pack . Parsec.string
|
||||
|
||||
{- | The only bit of information we really care about trudging along with us
|
||||
through parsing is the version attached to a @\@since@ annotation - if
|
||||
the doc even contained one.
|
||||
-}
|
||||
newtype ParserState = ParserState
|
||||
{ since :: Maybe Since
|
||||
}
|
||||
deriving (Eq, Show)
|
||||
|
||||
initialParserState :: ParserState
|
||||
initialParserState = ParserState Nothing
|
||||
Loading…
Add table
Add a link
Reference in a new issue