mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-07 21:15:19 +03:00
clarify modifiedaccountnamep
This commit is contained in:
parent
f4c963b648
commit
591abefe9e
@ -31,7 +31,7 @@ module Hledger.Read.JournalReader (
|
||||
datetimep,
|
||||
codep,
|
||||
accountnamep,
|
||||
modifiedaccountname,
|
||||
modifiedaccountnamep,
|
||||
postingp,
|
||||
amountp,
|
||||
amountp',
|
||||
@ -577,7 +577,7 @@ postingp = do
|
||||
many1 spacenonewline
|
||||
status <- statusp
|
||||
many spacenonewline
|
||||
account <- modifiedaccountname
|
||||
account <- modifiedaccountnamep
|
||||
let (ptype, account') = (accountNamePostingType account, unbracket account)
|
||||
amount <- spaceandamountormissing
|
||||
massertion <- partialbalanceassertion
|
||||
@ -657,13 +657,15 @@ test_postingp = do
|
||||
#endif
|
||||
|
||||
-- | Parse an account name, then apply any parent account prefix and/or account aliases currently in effect.
|
||||
modifiedaccountname :: Stream [Char] m Char => ParsecT [Char] JournalContext m AccountName
|
||||
modifiedaccountname = do
|
||||
a <- accountnamep
|
||||
prefix <- getParentAccount
|
||||
let prefixed = prefix `joinAccountNames` a
|
||||
modifiedaccountnamep :: Stream [Char] m Char => ParsecT [Char] JournalContext m AccountName
|
||||
modifiedaccountnamep = do
|
||||
parent <- getParentAccount
|
||||
aliases <- getAccountAliases
|
||||
return $ accountNameApplyAliases aliases prefixed
|
||||
a <- accountnamep
|
||||
return $
|
||||
accountNameApplyAliases aliases $
|
||||
joinAccountNames parent
|
||||
a
|
||||
|
||||
-- | Parse an account name. Account names start with a non-space, may
|
||||
-- have single spaces inside them, and are terminated by two or more
|
||||
|
@ -61,7 +61,7 @@ import Hledger.Data
|
||||
-- XXX too much reuse ?
|
||||
import Hledger.Read.JournalReader (
|
||||
directive, marketpricedirective, defaultyeardirective, emptyorcommentlinep, datetimep,
|
||||
parseJournalWith, modifiedaccountname, genericSourcePos
|
||||
parseJournalWith, modifiedaccountnamep, genericSourcePos
|
||||
)
|
||||
import Hledger.Utils
|
||||
|
||||
@ -107,7 +107,7 @@ timelogentry = do
|
||||
code <- oneOf "bhioO"
|
||||
many1 spacenonewline
|
||||
datetime <- datetimep
|
||||
account <- fromMaybe "" <$> optionMaybe (many1 spacenonewline >> modifiedaccountname)
|
||||
account <- fromMaybe "" <$> optionMaybe (many1 spacenonewline >> modifiedaccountnamep)
|
||||
description <- fromMaybe "" <$> optionMaybe (many1 spacenonewline >> restofline)
|
||||
return $ TimeLogEntry sourcepos (read [code]) datetime account description
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user