imp: journal: ignore end apply fixed, end apply tag directives (ledger compat)

This commit is contained in:
Simon Michael 2022-12-22 01:12:56 -10:00
parent af5645ebb7
commit a5d6b42322
4 changed files with 19 additions and 4 deletions

View File

@ -239,7 +239,9 @@ directivep = (do
,applyaccountdirectivep
,endapplyaccountdirectivep
,applyfixeddirectivep
,endapplyfixeddirectivep
,applytagdirectivep
,endapplytagdirectivep
,assertdirectivep
,bucketdirectivep
,capturedirectivep
@ -528,12 +530,15 @@ formatdirectivep expectedsym = do
-- More Ledger directives, ignore for now:
-- apply fixed, apply tag, assert, bucket, A, capture, check, define, expr
applyfixeddirectivep, applytagdirectivep, assertdirectivep, bucketdirectivep,
capturedirectivep, checkdirectivep, definedirectivep, exprdirectivep,
valuedirectivep, pythondirectivep, evaldirectivep, commandlineflagdirectivep
applyfixeddirectivep, endapplyfixeddirectivep, applytagdirectivep, endapplytagdirectivep,
assertdirectivep, bucketdirectivep, capturedirectivep, checkdirectivep,
definedirectivep, exprdirectivep, valuedirectivep, pythondirectivep,
evaldirectivep, commandlineflagdirectivep
:: JournalParser m ()
applyfixeddirectivep = do string "apply fixed" >> lift restofline >> return ()
endapplyfixeddirectivep = do string "end apply fixed" >> lift restofline >> return ()
applytagdirectivep = do string "apply tag" >> lift restofline >> return ()
endapplytagdirectivep = do string "end apply tag" >> lift restofline >> return ()
assertdirectivep = do string "assert" >> lift restofline >> return ()
bucketdirectivep = do string "A " <|> string "bucket " >> lift restofline >> return ()
capturedirectivep = do string "capture" >> lift restofline >> return ()

View File

@ -2741,7 +2741,9 @@ These other Ledger directives are currently ignored:
```journal
apply fixed COMM AMT
end apply fixed
apply tag TAG
end apply tag
assert EXPR
A ACCT
bucket ACCT

View File

@ -9,9 +9,11 @@ $ hledger -f- check
>2//
>=1
# `end` close block commands like `apply` or `comment` (ignores any words after "end")
# Just `end` or `end apply` as shorthand for closing the most recent "apply FOO".
<
apply account a
end apply
apply account a
end
$ hledger -f- check
>2//

View File

@ -35,17 +35,23 @@ Y 1111
1/1
year 2222
2/2
apply year 3333
3/3
$ hledger -f- print
1111-01-01
2222-02-02
3333-03-03
>=
# ignored directives
<
apply fixed CAD $0.90
end apply fixed
apply tag tag1:val1
end apply tag
assert 1
bucket Assets:Checking
A Assets:Checking