config-value 0.8.1 → 0.8.2
raw patch · 6 files changed
+34/−18 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- config-value.cabal +3/−3
- src/Config.hs +6/−4
- src/Config/Lexer.x +3/−1
- src/Config/Parser.y +12/−8
- src/Config/Tokens.hs +2/−2
CHANGELOG.md view
@@ -1,3 +1,11 @@+0.8.2+---+* Add `+` and `-` to the set of layout-based list syntax bullets.+ All elements of the list are checked to see that a consistent+ bullet is used. Different bullets might be used to help make+ nested lists more understandable. `-` might be used to make things+ look more like YAML+ 0.8.1 --- * Allow underscores in number literals
config-value.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: config-value-version: 0.8.1+version: 0.8.2 synopsis: Simple, layout-based value language similar to YAML or JSON license: MIT license-file: LICENSE@@ -15,7 +15,7 @@ with fewer special cases and fewer dependencies. It emphasizes layout structure for sections and lists, and requires quotes around strings.-tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.4, GHC==8.10.2+tested-with: GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.4, GHC==8.10.2, GHC==9.0.1 extra-source-files: README.md@@ -40,7 +40,7 @@ Config.Value build-depends:- base >= 4.8 && < 4.15,+ base >= 4.8 && < 4.17, array >= 0.4 && < 0.6, containers >= 0.5 && < 0.7, pretty >= 1.1.1.0 && < 1.2,
src/Config.hs view
@@ -128,9 +128,11 @@ Example: @[1, 2, 3]@ -Layout list entries are started with a leading @*@. Each leading @*@ must occur-in the some column of the file. Lists can be nested by starting the new list-on a column to the right of the current list.+Layout list entries are started with a leading @*@, @+@, or @-@. Each leading bullet+must occur in the some column of the file. Lists can be nested by starting the new+list on a column to the right of the current list. A single list must use the same+bullet token for every element of the list. Nested lists can choose a different+bullet. This can help visually distinguish nested lists. Layout based lists can not occur inside inline list syntax. Layout based section lists can occur inside layout based lists@@ -305,7 +307,7 @@ T.Error e -> explainError e T.Atom atom -> "parse error: unexpected atom: `" ++ Text.unpack atom ++ "`" T.String str -> "parse error: unexpected string: " ++ show (Text.unpack str)- T.Bullet -> "parse error: unexpected bullet '*'"+ T.Bullet s -> "parse error: unexpected bullet '" ++ Text.unpack s ++ "'" T.Comma -> "parse error: unexpected comma ','" T.Section s -> "parse error: unexpected section: `" ++ Text.unpack s ++ "`" T.Number{} -> "parse error: unexpected number"
src/Config/Lexer.x view
@@ -65,7 +65,9 @@ "[" { token_ OpenList } "," { token_ Comma } "]" { token_ CloseList }-"*" { token_ Bullet }+"*" { token Bullet }+"-" { token Bullet }+"+" { token Bullet } "-"? 0 [Xx] @spacer @hexadecimal ("." @hexadecimal?)? @hexexponent? { token number } "-"? 0 [Oo] @spacer @octal ("." @octal ?)? { token number }
src/Config/Parser.y view
@@ -1,5 +1,5 @@ {-{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE Trustworthy, OverloadedStrings #-} module Config.Parser (parseValue) where @@ -15,11 +15,13 @@ STRING { Located _ T.String{} } ATOM { Located _ T.Atom{} } NUMBER { Located _ T.Number{} }-'*' { Located $$ T.Bullet }-'[' { Located $$ T.OpenList }+'*' { Located $$ (T.Bullet "*") }+'+' { Located $$ (T.Bullet "+") }+'-' { Located $$ (T.Bullet "-") }+'[' { Located $$ T.OpenList } ',' { Located _ T.Comma } ']' { Located _ T.CloseList }-'{' { Located $$ T.OpenMap }+'{' { Located $$ T.OpenMap } '}' { Located _ T.CloseMap } SEP { Located _ T.LayoutSep } END { Located _ T.LayoutEnd }@@ -37,7 +39,9 @@ value :: { Value Position } : sections END { sections $1 }- | '*' list END { List $1 (reverse $2) }+ | '*' list('*') END { List $1 (reverse $2) }+ | '-' list('-') END { List $1 (reverse $2) }+ | '+' list('+') END { List $1 (reverse $2) } | simple { $1 } simple :: { Value Position }@@ -70,9 +74,9 @@ section :: { Section Position } : SECTION value { section $1 $2 } -list :: { [Value Position] }- : value { [$1] }- | list SEP '*' value { $4 : $1 }+list(blt) :: { [Value Position] }+ : value { [$1] }+ | list(blt) SEP blt value { $4 : $1 } inlinelist :: { [Value Position] } : { [] }
src/Config/Tokens.hs view
@@ -36,7 +36,7 @@ = Section Text | String Text | Atom Text- | Bullet+ | Bullet Text | Comma | Number Number | OpenList@@ -99,5 +99,5 @@ usesLayout :: Located Token -> Bool usesLayout t | Section{} <- locThing t = True- | Bullet <- locThing t = True+ | Bullet{} <- locThing t = True | otherwise = False