don't treat accounts with trailing space and no amount as different
This commit is contained in:
		
							parent
							
								
									c76540e348
								
							
						
					
					
						commit
						e9f4b32d02
					
				| @ -254,11 +254,16 @@ ledgertransaction = do | |||||||
|   restofline |   restofline | ||||||
|   return (RawTransaction account amount comment) |   return (RawTransaction account amount comment) | ||||||
| 
 | 
 | ||||||
| -- | account names may have single spaces in them, and are terminated by two or more spaces | -- | account names may have single spaces inside them, and are terminated by two or more spaces | ||||||
| ledgeraccount :: Parser String | ledgeraccount :: Parser String | ||||||
| ledgeraccount =  | ledgeraccount = do | ||||||
|     many1 ((alphaNum <|> char ':' <|> char '/' <|> char '_' <?> "account name")  |     accountname <- many1 (accountnamechar <|> singlespace) | ||||||
|            <|> try (do {spacenonewline; do {notFollowedBy spacenonewline; return ' '}} <?> "double space")) |     return $ striptrailingspace accountname | ||||||
|  |     where  | ||||||
|  |       accountnamechar = alphaNum <|> oneOf ":/_" <?> "account name character" | ||||||
|  |       singlespace = try (do {spacenonewline; do {notFollowedBy spacenonewline; return ' '}}) | ||||||
|  |       -- couldn't avoid consuming a final space sometimes, harmless | ||||||
|  |       striptrailingspace s = if last s == ' ' then take (length s - 1) s else s | ||||||
| 
 | 
 | ||||||
| ledgeramount :: Parser Amount | ledgeramount :: Parser Amount | ||||||
| ledgeramount =  | ledgeramount =  | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user