imp!: journal: Remove deprecated account type code syntax from account

directives.

Previously, you declare an account type with the following format:
account assets  A
This has been deprecated since 1.13, and should now be declared with one
of:
account assets  ; type:A
account assets  ; type:asset
This commit is contained in:
Stephen Morgan 2022-01-29 08:57:22 +11:00 committed by Simon Michael
parent 929f13ec03
commit df4949ad1a
4 changed files with 7 additions and 14 deletions

View File

@ -347,12 +347,6 @@ accountdirectivep = do
-- the account name, possibly modified by preceding alias or apply account directives
acct <- modifiedaccountnamep
-- maybe an account type code (ALERX) after two or more spaces
-- XXX added in 1.11, deprecated in 1.13, remove in 1.14
mtypecode :: Maybe Char <- lift $ optional $ try $ do
skipNonNewlineSpaces1 -- at least one more space in addition to the one consumed by modifiedaccountp
choice $ map char "ALERXV"
-- maybe a comment, on this and/or following lines
(cmt, tags) <- lift transactioncommentp
@ -362,8 +356,7 @@ accountdirectivep = do
-- an account type may have been set by account type code or a tag;
-- the latter takes precedence
let
mtypecode' :: Maybe Text = lookup accountTypeTagName tags <|> (T.singleton <$> mtypecode)
metype = parseAccountTypeCode <$> mtypecode'
metype = parseAccountTypeCode <$> lookup accountTypeTagName tags
-- update the journal
addAccountDeclaration (acct, cmt, tags)
@ -1010,7 +1003,7 @@ tests_JournalReader = testGroup "JournalReader" [
,testGroup "accountdirectivep" [
testCase "with-comment" $ assertParse accountdirectivep "account a:b ; a comment\n"
,testCase "does-not-support-!" $ assertParseError accountdirectivep "!account a:b\n" ""
,testCase "account-type-code" $ assertParse accountdirectivep "account a:b A\n"
,testCase "account-type-code" $ assertParse accountdirectivep "account a:b ; type:A\n"
,testCase "account-type-tag" $ assertParseStateOn accountdirectivep "account a:b ; type:asset\n"
jdeclaredaccounts
[("a:b", AccountDeclarationInfo{adicomment = "type:asset\n"

View File

@ -3037,7 +3037,7 @@ account assets:bank:checking
Here is the full syntax of account directives:
```journal
account ACCTNAME [ACCTTYPE] [;COMMENT]
account ACCTNAME [;type:ACCTTYPE] [COMMENT]
[;COMMENTS]
[LEDGER-STYLE SUBDIRECTIVES, IGNORED]
```

View File

@ -13,11 +13,11 @@ b
# "b" is a liability. "b:bb" is an asset.
<
; a liability
account asset L
account asset ; type:L
; an asset
account b:bb A
account b:bb ; type:A
; a liability
account b L
account b ; type:L
2018/1/1
(asset:a) 1

View File

@ -329,7 +329,7 @@ hledger -f - balance --no-total -E -B
# 27. The equity account used by --infer-equity can be customised
hledger -f- print --infer-equity
<<<
account equity:trades V
account equity:trades ; type:V
2011/01/01
expenses:foreign currency €100 @ $1.35