fix:timedot: accept numbers beginning with a decimal point again [#2130]

This commit is contained in:
Simon Michael 2023-12-08 15:08:35 -10:00
parent 2cf83cd213
commit aaf4a38161
2 changed files with 12 additions and 4 deletions

View File

@ -209,8 +209,8 @@ type Hours = Quantity
-- (or empty string for none).
durationsp :: TextParser m [(Hours,TagValue)]
durationsp =
(dotquantityp <&> \h -> [(h,"")])
<|> (numericquantityp <&> \h -> [(h,"")])
(try numericquantityp <&> \h -> [(h,"")]) -- try needed because numbers can begin with .
<|> (dotquantityp <&> \h -> [(h,"")])
<|> letterquantitiesp
<|> pure [(0,"")]

View File

@ -57,17 +57,25 @@ $ hledger -ftimedot:- reg -w80
$ hledger -ftimedot:- reg -w80 tag:posting-tag --alias fos:haskell=λ
2023-01-01 different transac.. (λ) 1.00 1.00
# ** 4. Each of these formats is printed as exactly a quarter hour.
# ** 4. Each of these formats is parsed as exactly 0.25.
<
2023-01-01
a .
b 0.25
c 15m
c .25
d 0,25
e ,25
f 15m
g 0.25h
$ hledger -ftimedot:- print
2023-01-01 *
(a) 0.25
(b) 0.25
(c) 0.25
(d) 0.25
(e) 0.25
(f) 0.25
(g) 0.25
>=