mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-29 13:22:27 +03:00
imp: journal: ignore more ledger directives (ledger compat)
apply fixed, apply tag, assert, bucket, A, capture, check, define, expr And reorder the directivep parsers.
This commit is contained in:
parent
e09ab0936a
commit
abd104ccee
@ -237,16 +237,24 @@ directivep = (do
|
||||
,endaliasesdirectivep
|
||||
,accountdirectivep
|
||||
,applyaccountdirectivep
|
||||
,commoditydirectivep
|
||||
,endapplyaccountdirectivep
|
||||
,applyfixeddirectivep
|
||||
,applytagdirectivep
|
||||
,assertdirectivep
|
||||
,bucketdirectivep
|
||||
,capturedirectivep
|
||||
,checkdirectivep
|
||||
,commoditydirectivep
|
||||
,commodityconversiondirectivep
|
||||
,definedirectivep
|
||||
,exprdirectivep
|
||||
,payeedirectivep
|
||||
,tagdirectivep
|
||||
,endtagdirectivep
|
||||
,decimalmarkdirectivep
|
||||
,defaultyeardirectivep
|
||||
,defaultcommoditydirectivep
|
||||
,commodityconversiondirectivep
|
||||
,ignoredpricecommoditydirectivep
|
||||
,decimalmarkdirectivep
|
||||
,tagdirectivep
|
||||
,endtagdirectivep
|
||||
]
|
||||
) <?> "directive"
|
||||
|
||||
@ -514,6 +522,19 @@ formatdirectivep expectedsym = do
|
||||
else customFailure $ parseErrorAt off $
|
||||
printf "commodity directive symbol \"%s\" and format directive symbol \"%s\" should be the same" expectedsym acommodity
|
||||
|
||||
-- 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 :: JournalParser m ()
|
||||
applyfixeddirectivep = do string "apply fixed" >> lift restofline >> return ()
|
||||
applytagdirectivep = do string "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 ()
|
||||
checkdirectivep = do string "check" >> lift restofline >> return ()
|
||||
definedirectivep = do string "define" >> lift restofline >> return ()
|
||||
exprdirectivep = do string "expr" >> lift restofline >> return ()
|
||||
|
||||
keywordp :: String -> JournalParser m ()
|
||||
keywordp = void . string . fromString
|
||||
|
||||
|
@ -2735,6 +2735,22 @@ can be used to avoid figuring out correct entries,
|
||||
makes your financial data less portable and less trustworthy in an audit.
|
||||
|
||||
|
||||
### Other Ledger directives
|
||||
|
||||
These other Ledger directives are currently ignored:
|
||||
|
||||
```journal
|
||||
apply fixed COMM AMT
|
||||
apply tag TAG
|
||||
assert EXPR
|
||||
A ACCT
|
||||
bucket ACCT
|
||||
capture ACCT REGEX
|
||||
check EXPR
|
||||
define VAR=EXPR
|
||||
expr EXPR
|
||||
```
|
||||
|
||||
# CSV
|
||||
|
||||
hledger can read [CSV](http://en.wikipedia.org/wiki/Comma-separated_values) files
|
||||
|
@ -32,61 +32,6 @@ $ hledger -f- accounts # -> both account names printed, alias did not work
|
||||
Expenses:Food
|
||||
food
|
||||
|
||||
# `apply fixed` set fixated prices
|
||||
<
|
||||
apply fixed CAD $0.90
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `assert` test a value expression
|
||||
<
|
||||
assert 1
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `bucket`/`A` set a default balancing account
|
||||
<
|
||||
bucket Assets:Checking
|
||||
A Assets:Checking
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `capture` replace accounts matched by regex with another
|
||||
<
|
||||
capture Expenses:Deductible:Medical Medical
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `check` test a value expression
|
||||
<
|
||||
check 1
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `commodity` subdirectives
|
||||
<
|
||||
commodity $
|
||||
note American Dollars
|
||||
format $1,000.00
|
||||
nomarket
|
||||
alias USD
|
||||
default
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `define` define value expressions for future use
|
||||
<
|
||||
define var_name=$100
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `end` close block commands like `apply` or `comment` (ignores any words after "end")
|
||||
<
|
||||
comment
|
||||
@ -95,29 +40,6 @@ end
|
||||
2222-02-02
|
||||
$ hledger -f- print # -> nothing printed, comment did not end
|
||||
|
||||
# `expr` ?
|
||||
<
|
||||
expr 1
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `payee` subdirectives
|
||||
<
|
||||
payee KFC
|
||||
alias KENTUCKY FRIED CHICKEN
|
||||
uuid 1234
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `apply tag` assign a tag to transactions
|
||||
<
|
||||
apply tag tag1:val1
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `tag` pre-declare tag names
|
||||
<
|
||||
tag tag1
|
||||
@ -130,13 +52,6 @@ $ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `C AMT1 = AMT2` declare a commodity equivalency
|
||||
<
|
||||
C $ 1 USD
|
||||
$ hledger -f- check
|
||||
>2//
|
||||
>=1
|
||||
|
||||
# `I, i, O, o, b, h` embedded timeclock entries
|
||||
<
|
||||
i 2013/04/05 12:00:00 Personal:Lunch
|
||||
|
@ -17,11 +17,6 @@ $ hledger -f- check
|
||||
D $0.0
|
||||
$ hledger -f- check
|
||||
|
||||
# `N COMM` ignore pricing information for a commodity (ignored)
|
||||
<
|
||||
N USD
|
||||
$ hledger -f- check
|
||||
|
||||
# star comment line
|
||||
<
|
||||
*
|
||||
@ -46,3 +41,18 @@ $ hledger -f- print
|
||||
2222-02-02
|
||||
|
||||
>=
|
||||
|
||||
# ignored directives
|
||||
<
|
||||
apply fixed CAD $0.90
|
||||
apply tag tag1:val1
|
||||
assert 1
|
||||
bucket Assets:Checking
|
||||
A Assets:Checking
|
||||
C $1 = USD 1
|
||||
capture Expenses:Deductible:Medical Medical
|
||||
check 1
|
||||
define var_name=$100
|
||||
expr 1
|
||||
N USD
|
||||
$ hledger -f- check
|
||||
|
Loading…
Reference in New Issue
Block a user