{-# Language Safe #-}
module TOML
(
parseTOML
, Value(..)
, TOMLError(..)
, LexerError(..)
, Located(..)
, Position(..)
, Token(..)
) where
import Control.Monad
import Data.Text (Text)
import TOML.Components
import TOML.Errors
import TOML.Lexer
import TOML.Located
import TOML.Parser
import TOML.Tokens
import TOML.Value
parseTOML :: Text -> Either TOMLError [(Text,Value)]
parseTOML = mapLeft OverlappingKey . componentsToTable
<=< parseComponents . scanTokens
where
mapLeft f (Left e) = Left (f e)
mapLeft _ (Right x) = Right x