Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Data/Configurator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ empty = Config "" $ unsafePerformIO $ do
-- > HerList = [1, "foo", off]
--
-- A name must begin with a Unicode letter, which is followed by zero
-- or more of a Unicode alphanumeric code point, hyphen \"@-@\", or
-- underscore \"@_@\".
-- or more of a Unicode alphanumeric code point, hyphen \"@-@\",
-- underscore \"@_@\", or colon \"@:@\".
--
-- Bindings are created or overwritten in the order in which they are
-- encountered. It is legitimate for a name to be bound multiple
Expand Down
2 changes: 1 addition & 1 deletion Data/Configurator/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ident = do
throw (ParseError "" $ "reserved word (" ++ show n ++ ") used as identifier")
return n
where
isCont c = isAlphaNum c || c == '_' || c == '-'
isCont c = isAlphaNum c || c == '_' || c == '-' || c == ':'

value :: Parser Value
value = mconcat [
Expand Down
9 changes: 9 additions & 0 deletions tests/Test.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ loadTest =
deep <- lookup cfg "ag.q-e.i_u9.a"
assertEqual "deep bool" deep (Just False :: Maybe Bool)

adcolon <- lookup cfg "a:d"
assertEqual "colon identifiers" adcolon (Just False :: Maybe Bool)

abc <- lookup cfg "a:b:c"
assertEqual "multiple colon identifiers" abc (Just "hello" :: Maybe Text)

c <- lookup cfg "c:"
assertEqual "colon identifiers without suffix or space" c (Just 1 :: Maybe Int)

typesTest :: Assertion
typesTest =
withLoad "pathological.cfg" $ \cfg -> do
Expand Down
4 changes: 4 additions & 0 deletions tests/resources/pathological.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ ba = "$(HOME)"
xs = [1,2,3]

c = "x"

a:d = false
a:b:c = "hello"
c:=1