hsini-0.5.2.2: ini configuration files

Copyright | 2011-2014 Magnus Therning
License | BSD3
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Ini.Reader.Internals

Description

Internal functions used in `Reader`.

Synopsis

- data IniReaderError
  - = IniParserError String
  - | IniSyntaxError String
  - | IniOtherError String
- type IniParseResult = Either IniReaderError
- data IniFile
  - = SectionL String
  - | OptionL String String
  - | OptionContL String
  - | CommentL
- buildConfig :: [IniFile] -> IniParseResult Config
- eatWhiteSpace :: Parser String
- secParser :: Parser IniFile
- optLineParser :: Parser IniFile
- optContParser :: Parser IniFile
- noiseParser :: Parser IniFile
- iniParser :: Parser [IniFile]

# Documentation

data IniReaderError Source #

Constructors

IniParserError String |
IniSyntaxError String |
IniOtherError String |

#### Instances

Instances details

Show IniReaderError Source # |
Instance details Defined in Data.Ini.Reader.Internals Methods showsPrec :: Int -> IniReaderError -> ShowS Source # show :: IniReaderError -> String Source # showList :: [IniReaderError] -> ShowS Source #
Eq IniReaderError Source # |
Instance details Defined in Data.Ini.Reader.Internals Methods (==) :: IniReaderError -> IniReaderError -> Bool Source # (/=) :: IniReaderError -> IniReaderError -> Bool Source #

type IniParseResult = Either IniReaderError Source #

data IniFile Source #

The type used to represent a line of a config file.

Constructors

SectionL String |
OptionL String String |
OptionContL String |
CommentL |

#### Instances

Instances details

Show IniFile Source # |
Instance details Defined in Data.Ini.Reader.Internals Methods showsPrec :: Int -> IniFile -> ShowS Source # show :: IniFile -> String Source # showList :: [IniFile] -> ShowS Source #
Eq IniFile Source # |
Instance details Defined in Data.Ini.Reader.Internals Methods (==) :: IniFile -> IniFile -> Bool Source # (/=) :: IniFile -> IniFile -> Bool Source #

buildConfig :: [IniFile] -> IniParseResult Config Source #

Build a configuration from a list of `IniFile` items.

eatWhiteSpace :: Parser String Source #

Consumer of whitespace "`t`".

secParser :: Parser IniFile Source #

Parser for the start-of-section line. It expects the line to start with a `[` then find the section name, and finally a `]`. The section name may be surrounded by any number of white space characters (see `eatWhiteSpace`).

optLineParser :: Parser IniFile Source #

Parser for a single line of an option. The line must start with an option name, then a `=` must be found, and finally the rest of the line is taken as the option value. The equal sign may be surrounded by any number of white space characters (see `eatWhiteSpace`).

optContParser :: Parser IniFile Source #

Parser for an option-value continuation line. The line must start with either a space or a tab character ("`t`"). Everything else on the line, until the newline character, is taken as the continuation of an option value.

noiseParser :: Parser IniFile Source #

Parser for "noise" in the configuration file, such as comments and empty lines. (Note that lines containing only space characters will be successfully parsed by `optContParser`.)

iniParser :: Parser [IniFile] Source #