From 85e9fbcf7dd6a3e2a79115947d03a69deecac4ab Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 22 Dec 2022 01:50:37 -1000 Subject: [PATCH] imp: journal: allow an empty double-quoted commodity symbol "" is equivalent to writing no symbol. But it's now possible to declare market prices for the no-symbol commodity, which occurs eg with timedot data. P 2022-01-01 "" $100 --- hledger-lib/Hledger/Read/Common.hs | 2 +- hledger/test/ledger-compat/syntax/hledger-other.test | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 86b8a5dae..ea9ce6987 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -831,7 +831,7 @@ commoditysymbolp = quotedcommoditysymbolp :: TextParser m CommoditySymbol quotedcommoditysymbolp = - between (char '"') (char '"') $ takeWhile1P Nothing f + between (char '"') (char '"') $ takeWhileP Nothing f where f c = c /= ';' && c /= '\n' && c /= '\"' simplecommoditysymbolp :: TextParser m CommoditySymbol diff --git a/hledger/test/ledger-compat/syntax/hledger-other.test b/hledger/test/ledger-compat/syntax/hledger-other.test index 5ca4d6e9d..e77af5403 100644 --- a/hledger/test/ledger-compat/syntax/hledger-other.test +++ b/hledger/test/ledger-compat/syntax/hledger-other.test @@ -54,6 +54,7 @@ assert 1 bucket Assets:Checking A Assets:Checking C $1 = USD 1 +C 1 "" = $1 capture Expenses:Deductible:Medical Medical check 1 define var_name=$100