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

View File

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

View File

@ -9,9 +9,11 @@ $ hledger -f- check
>2// >2//
>=1 >=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 apply account a
end apply
apply account a
end end
$ hledger -f- check $ hledger -f- check
>2// >2//

View File

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