Toml.Semantics

toml-parser-1.3.0.0: TOML 1.0.0 parser

Copyright | (c) Eric Mertens 2023
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | Safe-Inferred
Language | Haskell2010

Toml.Semantics

Description

This module extracts the nested Map representation of a TOML file. It detects invalid key assignments and resolves dotted key assignments.

Synopsis

- data SemanticError = SemanticError {
  - errorKey :: String
  - errorKind :: SemanticErrorKind
  }
- data SemanticErrorKind
  - = AlreadyAssigned
  - | ClosedTable
  - | ImplicitlyTable
- semantics :: [Expr] -> Either (Located SemanticError) Table

# Documentation

data SemanticError #

The type of errors that can be generated when resolving all the key used in a TOML document. These errors always pertain to some key to caused one of three conflicts.

Since: 1.3.0.0

Constructors

SemanticError |
Fields errorKey :: String errorKind :: SemanticErrorKind

#### Instances

Instances details

Read SemanticError # | Default instance
Instance details Defined in Toml.Semantics Methods readsPrec :: Int -> ReadS SemanticError readList :: ReadS [SemanticError] readPrec :: ReadPrec SemanticError readListPrec :: ReadPrec [SemanticError]
Show SemanticError # | Default instance
Instance details Defined in Toml.Semantics Methods showsPrec :: Int -> SemanticError -> ShowS show :: SemanticError -> String showList :: [SemanticError] -> ShowS
Eq SemanticError # | Default instance
Instance details Defined in Toml.Semantics Methods (==) :: SemanticError -> SemanticError -> Bool (/=) :: SemanticError -> SemanticError -> Bool
Ord SemanticError # | Default instance
Instance details Defined in Toml.Semantics Methods compare :: SemanticError -> SemanticError -> Ordering (<) :: SemanticError -> SemanticError -> Bool (<=) :: SemanticError -> SemanticError -> Bool (>) :: SemanticError -> SemanticError -> Bool (>=) :: SemanticError -> SemanticError -> Bool max :: SemanticError -> SemanticError -> SemanticError min :: SemanticError -> SemanticError -> SemanticError

data SemanticErrorKind #

Enumeration of the kinds of conflicts a key can generate.

Since: 1.3.0.0

Constructors

AlreadyAssigned | Attempted to assign to a key that was already assigned
ClosedTable | Attempted to open a table already closed
ImplicitlyTable | Attempted to open a tables as an array of tables that was implicitly defined to be a table

#### Instances

Instances details

Read SemanticErrorKind # | Default instance
Instance details Defined in Toml.Semantics Methods readsPrec :: Int -> ReadS SemanticErrorKind readList :: ReadS [SemanticErrorKind] readPrec :: ReadPrec SemanticErrorKind readListPrec :: ReadPrec [SemanticErrorKind]
Show SemanticErrorKind # | Default instance
Instance details Defined in Toml.Semantics Methods showsPrec :: Int -> SemanticErrorKind -> ShowS show :: SemanticErrorKind -> String showList :: [SemanticErrorKind] -> ShowS
Eq SemanticErrorKind # | Default instance
Instance details Defined in Toml.Semantics Methods (==) :: SemanticErrorKind -> SemanticErrorKind -> Bool (/=) :: SemanticErrorKind -> SemanticErrorKind -> Bool
Ord SemanticErrorKind # | Default instance
Instance details Defined in Toml.Semantics Methods compare :: SemanticErrorKind -> SemanticErrorKind -> Ordering (<) :: SemanticErrorKind -> SemanticErrorKind -> Bool (<=) :: SemanticErrorKind -> SemanticErrorKind -> Bool (>) :: SemanticErrorKind -> SemanticErrorKind -> Bool (>=) :: SemanticErrorKind -> SemanticErrorKind -> Bool max :: SemanticErrorKind -> SemanticErrorKind -> SemanticErrorKind min :: SemanticErrorKind -> SemanticErrorKind -> SemanticErrorKind

semantics :: [Expr] -> Either (Located SemanticError) Table #

Extract semantic value from sequence of raw TOML expressions or report a semantic error.

Since: 1.3.0.0