diff --git a/hledger-lib/Hledger/Data/Commodity.hs b/hledger-lib/Hledger/Data/Commodity.hs index 69dea5758..28c9c4765 100644 --- a/hledger-lib/Hledger/Data/Commodity.hs +++ b/hledger-lib/Hledger/Data/Commodity.hs @@ -17,8 +17,8 @@ import Hledger.Data.Types import Hledger.Utils --- characters than can't be in a non-quoted commodity symbol -nonsimplecommoditychars = "0123456789-.@;\n \"{}=" :: String +-- characters that may not be used in a non-quoted commodity symbol +nonsimplecommoditychars = "0123456789-+.@;\n \"{}=" :: String quoteCommoditySymbolIfNeeded s | any (`elem` nonsimplecommoditychars) s = "\"" ++ s ++ "\"" | otherwise = s diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index eac5a2107..f5a19fcb9 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -658,12 +658,12 @@ signp = do leftsymbolamount :: GenParser Char JournalContext Amount leftsymbolamount = do sign <- signp - let applysign = if sign=="-" then negate else id c <- commoditysymbol sp <- many spacenonewline (q,prec,dec,sep,seppos) <- numberp let s = amountstyle{ascommodityside=L, ascommodityspaced=not $ null sp, asdecimalpoint=dec, asprecision=prec, asseparator=sep, asseparatorpositions=seppos} p <- priceamount + let applysign = if sign=="-" then negate else id return $ applysign $ Amount c q p s "left-symbol amount"