packages feed

config-value 0.8 → 0.8.1

raw patch · 7 files changed

+50/−31 lines, 7 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,13 @@+0.8.1+---+* Allow underscores in number literals+  Copied from <https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0076-numeric-underscores.rst#new-syntax-this-proposal>++  Underscores are allowed and ignored+  - in the *middle* of integer-parts of the literal syntax+  - between base-markers (0x, 0o, 0b) and number part+  - before the `eEpP` part of an exponent+ 0.8 --- * Allow atoms and section names to start with `@` or `$`
README.md view
@@ -1,6 +1,6 @@ # config-value -[![Hackage](https://img.shields.io/hackage/v/config-value.svg)](https://hackage.haskell.org/package/config-value) [![Build Status](https://secure.travis-ci.org/glguy/config-value.svg)](http://travis-ci.org/glguy/config-value)+[![Hackage](https://img.shields.io/hackage/v/config-value.svg)](https://hackage.haskell.org/package/config-value) [![Build Status](https://api.travis-ci.com/glguy/config-value.svg)](http://travis-ci.com/glguy/config-value)  This package implements a simple, layout-based value definition language used for supplying configuration values to various applications.@@ -21,6 +21,8 @@     configuration:       {} -- empty section +    inline-maps: {key1: value1, key2: value2}+     sections:      "glguy" @@ -30,14 +32,16 @@        so you can comment out otherwise valid        portions of your config     -}-    atoms      : yes+    atoms:       yes -    decimal    : -1234+    decimal:     -1234     hexadecimal: 0x1234-    octal      : 0o1234-    binary     : 0b1010-    floating   : 12.34e56+    octal:       0o1234+    binary:      0b1010 +    floats:      [1e2, 0x3p-5, 24.48]+    underscores: 1_000_000+ lists:    * sections: in-lists      next-section: still-in-list@@ -47,7 +51,10 @@      * "lists"    * 3 -unicode : "standard Haskell format strings (1 ≤ 2)\x2228(2 ≤ 3)"+unicode: "standard Haskell format strings (1 ≤ 2)x2228(2 ≤ 3)"++multiline: "haskell style\+           \string gaps" ```  Format
config-value.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                config-value-version:             0.8+version:             0.8.1 synopsis:            Simple, layout-based value language similar to YAML or JSON license:             MIT license-file:        LICENSE@@ -48,7 +48,7 @@    build-tool-depends:     alex:alex   ^>= 3.2.4,-    happy:happy ^>= 1.19,+    happy:happy >= 1.19 && <1.21,    hs-source-dirs:      src   default-language:    Haskell2010
src/Config/Lexer.x view
@@ -21,19 +21,20 @@  $asciialpha     = [A-Z a-z] $digit          = [0-9]-$octdigit       = [0-7]-$hexdigit       = [0-9a-fA-F]-$bindigit       = [0-1]+$octit          = [0-7]+$hexit          = [0-9a-fA-F]+$binit          = [0-1] $white_no_nl    = $white # \n $charesc        = [abfnrtv\\\"'&] $cntrl          = [A-Z@\[\\\]\^_] $alpha          = [$unilower $uniupper $asciialpha] +@spacer         = _* -@decimal        = $digit+-@octal          = $octdigit+-@binary         = $bindigit+-@hexadecimal    = $hexdigit++@decimal        = $digit (@spacer $digit)*+@octal          = $octit (@spacer $octit)*+@binary         = $binit (@spacer $binit)*+@hexadecimal    = $hexit (@spacer $hexit)*  -- Copied from Haskell 2010 @ascii          = \^ $cntrl@@ -44,14 +45,14 @@                 | SP  | DEL @escape         =   $charesc                 |   @ascii-                |   @decimal-                | o @octal-                | x @hexadecimal+                |   $digit++                | o $octit++                | x $hexit+  @atom           = [$alpha \$ \@] [$alpha $digit $unidigit \. _ \-]* -@exponent       = [Ee] [\-\+]? @decimal-@hexexponent    = [Pp] [\-\+]? @decimal+@exponent       = @spacer [Ee] [\-\+]? @decimal+@hexexponent    = @spacer [Pp] [\-\+]? @decimal  config :- @@ -66,10 +67,10 @@ "]"                     { token_ CloseList              } "*"                     { token_ Bullet                 } -"-"? 0 [Xx] @hexadecimal ("." @hexadecimal?)? @hexexponent? { token number }-"-"? 0 [Oo] @octal       ("." @octal      ?)?               { token number }-"-"? 0 [Bb] @binary      ("." @binary     ?)?               { token number }-"-"?        @decimal     ("." @decimal    ?)? @exponent?    { token number }+"-"? 0 [Xx] @spacer @hexadecimal ("." @hexadecimal?)? @hexexponent? { token number }+"-"? 0 [Oo] @spacer @octal       ("." @octal      ?)?               { token number }+"-"? 0 [Bb] @spacer @binary      ("." @binary     ?)?               { token number }+"-"?                @decimal     ("." @decimal    ?)? @exponent?    { token number } @atom                   { token Atom                    } @atom $white_no_nl* :   { token section                 } \"                      { startString                   }
src/Config/LexerUtils.hs view
@@ -148,7 +148,8 @@ number ::   Text {- ^ sign-prefix-digits -} ->   Token-number = Number . Config.NumberParser.number . Text.unpack . Text.toUpper+number = Number . Config.NumberParser.number+       . Text.unpack . Text.toUpper . Text.filter ('_' /=)  -- | Process a section heading token section :: Text -> Token
src/Config/Number.hs view
@@ -61,17 +61,17 @@     Radix16{} -> 16  -- | Convert a number to a 'Rational'. Warning: This can use a--- lot of member in the case of very large exponent parts.+-- lot of memory in the case of very large exponent parts. numberToRational :: Number -> Rational numberToRational (MkNumber r c) =   case r of     Radix2    -> c     Radix8    -> c     Radix10 e -> c * 10 ^^ e-    Radix16 e -> c * 2  ^^ e+    Radix16 e -> c *  2 ^^ e  -- | Convert a number to a 'Integer'. Warning: This can use a--- lot of member in the case of very large exponent parts.+-- lot of memory in the case of very large exponent parts. numberToInteger :: Number -> Maybe Integer numberToInteger n   | denominator r == 1 = Just $! numerator r@@ -85,4 +85,4 @@  -- | 'Rational' to a radix 10 'Number' with no exponent rationalToNumber :: Rational -> Number-rationalToNumber r = (MkNumber (Radix10 0) r)+rationalToNumber = MkNumber (Radix10 0)
src/Config/Value.hs view
@@ -21,7 +21,7 @@ -- -- Example: -----    * @my-key: my-value@ is @'Section' _ ('Atom' _ "my-key") ('Atom' _ "my-value")@+--    * @my-key: my-value@ is @'Section' _ "my-key" ('Atom' _ "my-value")@ data Section a = Section   { sectionAnn   :: a   , sectionName  :: Text