config-value

Simple, layout-based value language similar to YAML or JSON https://github.com/glguy/config-value

Latest on Hackage:0.6.3

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

MIT licensed by Eric Mertens
Maintained by emertens@gmail.com

config-value

Hackage Build Status

This package implements a simple, layout-based value definition language used for supplying configuration values to various applications.

Live Demo

The config-value and config-schema packages are available in a live demo.

Example

-- Line comments until newline
layout:
  based:
    configuration:
      {} -- empty section

    sections:
     "glguy"

    {- Block comments
       {- nested comments -}
       "O'caml style {- strings in comments"
       so you can comment out otherwise valid
       portions of your config
    -}
    atoms      : yes

    decimal    : -1234
    hexadecimal: 0x1234
    octal      : 0o1234
    binary     : 0b1010
    floating   : 12.34e56

lists:
   * sections: in-lists
     next-section: still-in-list
   * [ "inline", "lists" ]
   * * "nestable"
     * "layout"
     * "lists"
   * 3

unicode : "standard Haskell format strings (1 ≤ 2)\x2228(2 ≤ 3)"

Format

The language supports: Strings, Atoms, Integers, Lists, Nested Sections.

Sections are layout based. The contents of a section must be indented further than the section heading. The whitespace between a section heading and its colon is not significant. Section names must start with a letter and may contain letters, numbers, dashes (-), underscores (_), and periods (.).

Lists are either layout based with * prefixes or inline surrounded by [ and ] delimited by ,

Strings are surrounded by " and use Haskell-style escapes.

Numbers support decimal, hexadecimal (0x), octal (0o), and binary (0b).

Atoms follow the same lexical rule as section heading.

Changes

0.6.3

  • Add valuePlate

0.6.2.1

  • Fixed error output for unexpected floating point literal

0.6.2

  • Nicer errors on unterminated inline lists and sections.
  • Stop enforcing well-formed text files

0.6.1

  • Add vim syntax highlighting file
  • Fix string gaps, they shouldn't require a newline

0.6

  • Annotate Value with file positions
  • Derive Generic1 instances for Value

0.5.1

  • Allow trailing commas in lists and section lists
  • Support inline section lists using {}
  • Add more documentation

0.5

  • Add support for floating-point numbers

0.4.0.2

  • Internal lexer and parser improvements
  • Added support for \& escape sequence

0.4.0.1

  • Loosen version constraints to build back to GHC 7.4.2
  • Remove unused bytestring dependency

0.4

  • Make Atom a newtype to help distinguish it from Text
  • Add values traversal for traversing individual elements of a list

0.3

  • Replace yes and no with generalized atoms
  • Add character index to error position
  • Add human readable error messages

0.2

  • Take Text as the input to parse

0.1.1

  • Added Config.Lens module
  • Added aligned fields to pretty printer

0.1

  • Initial release
Depends on:
comments powered byDisqus