diff --git a/hledger-lib/Hledger/Read/JournalReader.hs b/hledger-lib/Hledger/Read/JournalReader.hs index ac9cb42d0..c6fe74d92 100644 --- a/hledger-lib/Hledger/Read/JournalReader.hs +++ b/hledger-lib/Hledger/Read/JournalReader.hs @@ -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 diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index eb6c82791..94ee4fe48 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -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 diff --git a/hledger/test/ledger-compat/syntax/hledger-ledger-unsupported.test b/hledger/test/ledger-compat/syntax/hledger-ledger-unsupported.test index 27b7b50ed..895b7d684 100644 --- a/hledger/test/ledger-compat/syntax/hledger-ledger-unsupported.test +++ b/hledger/test/ledger-compat/syntax/hledger-ledger-unsupported.test @@ -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 diff --git a/hledger/test/ledger-compat/syntax/hledger-other.test b/hledger/test/ledger-compat/syntax/hledger-other.test index a1cb1dc39..75f8a858d 100644 --- a/hledger/test/ledger-compat/syntax/hledger-other.test +++ b/hledger/test/ledger-compat/syntax/hledger-other.test @@ -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