journal: really don't parse + before an amount as part of the commodity (fixes #181 harder)
This commit is contained in:
		
							parent
							
								
									8341b4a8d3
								
							
						
					
					
						commit
						70ad5b26ff
					
				| @ -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 | ||||
|  | ||||
| @ -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" | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user