toml-parser-2.0.0.0: TOML 1.0.0 parser
Copyright(c) Eric Mertens 2023
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.Syntax.Parser

Contents

Description

This module parses TOML tokens into a list of raw, uninterpreted sections and assignments.

Synopsis

Types

data Expr a Source #

Headers and assignments corresponding to lines of a TOML file

Constructors

KeyValExpr (Key a) (Val a)

key value assignment: key = value

TableExpr (Key a)

table: [key]

ArrayTableExpr (Key a)

array of tables: [[key]]

Instances

Instances details
Read a => Read (Expr a) Source # 
Instance details

Defined in Toml.Syntax.Types

Show a => Show (Expr a) Source # 
Instance details

Defined in Toml.Syntax.Types

Methods

showsPrec :: Int -> Expr a -> ShowS #

show :: Expr a -> String #

showList :: [Expr a] -> ShowS #

data SectionKind Source #

Kinds of table headers

Constructors

TableKind
table
ArrayTableKind
[array of tables
]

data Val a Source #

Unvalidated TOML values. Table are represented as a list of assignments rather than as resolved maps.

Instances

Instances details
Read a => Read (Val a) Source # 
Instance details

Defined in Toml.Syntax.Types

Show a => Show (Val a) Source # 
Instance details

Defined in Toml.Syntax.Types

Methods

showsPrec :: Int -> Val a -> ShowS #

show :: Val a -> String #

showList :: [Val a] -> ShowS #

type Key a = NonEmpty (a, Text) Source #

Non-empty sequence of dotted simple keys

Parser

parseRawToml :: Text -> Either (Located String) [Expr Position] Source #

Parse a list of tokens either returning the first unexpected token or a list of the TOML statements in the file to be processed by Toml.Semantics.