lib: fix parsing of amounts with a whitespace digits separator
This commit is contained in:
parent
93a2060659
commit
46aae19a54
@ -763,8 +763,9 @@ rawnumberp = do
|
||||
leadingDigits <- some digitChar
|
||||
option (Nothing, [leadingDigits]) . try $ do
|
||||
firstSep <- oneOf sepChars <|> whitespaceChar
|
||||
groups <- some digitChar `sepBy1` char firstSep
|
||||
return (Just firstSep, leadingDigits : groups)
|
||||
secondGroup <- some digitChar
|
||||
otherGroups <- many $ try $ char firstSep *> some digitChar
|
||||
return (Just firstSep, leadingDigits : secondGroup : otherGroups)
|
||||
|
||||
let remSepChars = maybe sepChars (`delete` sepChars) firstSep
|
||||
modifier
|
||||
|
||||
@ -136,17 +136,17 @@ $ hledger -f- bal -V -N
|
||||
#>=1
|
||||
|
||||
# 11. After a space-grouped amount, a posting comment should parse.
|
||||
#<
|
||||
#2018-01-01
|
||||
# (a) USD 1 000 ;comment
|
||||
#
|
||||
#$ hledger -f- print
|
||||
#> // # any stdout, no stderr, 0 exit code
|
||||
<
|
||||
2018-01-01
|
||||
(a) USD 1 000 ;comment
|
||||
|
||||
$ hledger -f- print
|
||||
> // # any stdout, no stderr, 0 exit code
|
||||
|
||||
# 12. After a space-grouped amount, trailing whitespace should parse.
|
||||
#<
|
||||
#2018-01-01
|
||||
# (a) USD 1 000
|
||||
#
|
||||
#$ hledger -f- print
|
||||
#> // # any stdout, no stderr, 0 exit code
|
||||
<
|
||||
2018-01-01
|
||||
(a) USD 1 000
|
||||
|
||||
$ hledger -f- print
|
||||
> // # any stdout, no stderr, 0 exit code
|
||||
|
||||
Loading…
Reference in New Issue
Block a user