lib: pushAccount -> pushDeclaredAccount

This commit is contained in:
Simon Michael 2018-09-22 21:06:29 -10:00
parent 8c18bada0c
commit 598129ad6a
2 changed files with 4 additions and 5 deletions

View File

@ -39,7 +39,7 @@ module Hledger.Read.Common (
getDefaultCommodityAndStyle, getDefaultCommodityAndStyle,
getDefaultAmountStyle, getDefaultAmountStyle,
getAmountStyle, getAmountStyle,
pushAccount, pushDeclaredAccount,
pushParentAccount, pushParentAccount,
popParentAccount, popParentAccount,
getParentAccount, getParentAccount,
@ -265,8 +265,8 @@ getAmountStyle commodity = do
let effectiveStyle = listToMaybe $ catMaybes [specificStyle, defaultStyle] let effectiveStyle = listToMaybe $ catMaybes [specificStyle, defaultStyle]
return effectiveStyle return effectiveStyle
pushAccount :: AccountName -> JournalParser m () pushDeclaredAccount :: AccountName -> JournalParser m ()
pushAccount acct = modify' (\j -> j{jdeclaredaccounts = (acct, Nothing) : jdeclaredaccounts j}) pushDeclaredAccount acct = modify' (\j -> j{jdeclaredaccounts = acct : jdeclaredaccounts j})
pushParentAccount :: AccountName -> JournalParser m () pushParentAccount :: AccountName -> JournalParser m ()
pushParentAccount acct = modify' (\j -> j{jparseparentaccounts = acct : jparseparentaccounts j}) pushParentAccount acct = modify' (\j -> j{jparseparentaccounts = acct : jparseparentaccounts j})

View File

@ -265,8 +265,7 @@ accountdirectivep = do
let macode :: Maybe AccountCode = read <$> macode' let macode :: Maybe AccountCode = read <$> macode'
newline newline
skipMany indentedlinep skipMany indentedlinep
pushDeclaredAccount acct
modify' (\j -> j{jdeclaredaccounts = (acct, macode) : jdeclaredaccounts j})
indentedlinep :: JournalParser m String indentedlinep :: JournalParser m String
indentedlinep = lift (skipSome spacenonewline) >> (rstrip <$> lift restofline) indentedlinep = lift (skipSome spacenonewline) >> (rstrip <$> lift restofline)