htoml-megaparsec 1.0.1.5 → 1.0.1.6
raw patch · 2 files changed
+12/−14 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- htoml-megaparsec.cabal +1/−1
- src/Text/Toml/Parser.hs +11/−13
htoml-megaparsec.cabal view
@@ -1,5 +1,5 @@ name: htoml-megaparsec-version: 1.0.1.5+version: 1.0.1.6 synopsis: Parser for TOML files description: TOML is an obvious and minimal format for config files. This package provides a TOML parser
src/Text/Toml/Parser.hs view
@@ -114,16 +114,14 @@ -- | Parses a table array header. tableArrayHeader :: (TomlM m) => Parser m [Text]-tableArrayHeader = between (twoChar '[') (twoChar ']') headerValue- where- twoChar c = count 2 (char c)+tableArrayHeader = between (string "[[") (string "]]") headerValue -- | Parses the value of any header (names separated by dots), into a list of 'Text'. headerValue :: (TomlM m) => Parser m [Text] headerValue = ((pack <$> some keyChar) <|> anyStr') `sepBy1` char '.' where- keyChar = alphaNumChar <|> char '_' <|> char '-'+ keyChar = alphaNumChar <|> oneOf ("-_" :: String) -- | Parses a key-value assignment. assignment :: (TomlM m) => Parser m (Text, Node)@@ -134,7 +132,7 @@ return (k, v) where -- TODO: Follow the spec, e.g.: only first char cannot be '['.- keyChar = alphaNumChar <|> char '_' <|> char '-'+ keyChar = alphaNumChar <|> oneOf ("-_" :: String) -- | Parses a value.@@ -257,14 +255,14 @@ escSeq :: (TomlM m) => Parser m Char escSeq = char '\\' *> escSeqChar where- escSeqChar = char '"' *> return '"'- <|> char '\\' *> return '\\'- <|> char '/' *> return '/'- <|> char 'b' *> return '\b'- <|> char 't' *> return '\t'+ escSeqChar = char '"'+ <|> char '\\'+ <|> char '/' <|> char 'n' *> return '\n'- <|> char 'f' *> return '\f'+ <|> char 't' *> return '\t' <|> char 'r' *> return '\r'+ <|> char 'b' *> return '\b'+ <|> char 'f' *> return '\f' <|> char 'u' *> unicodeHex 4 <|> char 'U' *> unicodeHex 8 <?> "escape character"@@ -283,9 +281,9 @@ -- | Parser for signs (a plus or a minus). signed :: (Num a, TomlM m) => Parser m a -> Parser m a-signed p = (negate <$> (char '-' *> p))+signed p = p+ <|> (negate <$> (char '-' *> p)) <|> (char '+' *> p)- <|> p -- | Parses the (rest of the) line including an EOF, whitespace and comments.