diff options
author | Craig Earls <enderw88@gmail.com> | 2013-04-10 06:33:46 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-04-10 06:33:46 -0700 |
commit | 1286bdeda07792696bb9dfc462488744920695e2 (patch) | |
tree | 7d92c431dd03ac83f429e1e99015b166ec464439 /lisp | |
parent | dde09ef1a10580393ed44d07f7aab779219b8dcf (diff) | |
download | fork-ledger-1286bdeda07792696bb9dfc462488744920695e2.tar.gz fork-ledger-1286bdeda07792696bb9dfc462488744920695e2.tar.bz2 fork-ledger-1286bdeda07792696bb9dfc462488744920695e2.zip |
even better context regex generation
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-context.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/ldg-context.el b/lisp/ldg-context.el index 80e2d544..2915133c 100644 --- a/lisp/ldg-context.el +++ b/lisp/ldg-context.el @@ -28,7 +28,8 @@ (eval-when-compile (require 'cl)) - +;; *-string constants are assembled in the single-line-config macro to +;; form the regex and list of elements (defconst indent-string "\\(^[ \t]+\\)") (defconst status-string "\\([*! ]?\\)") (defconst account-string "[\\[(]?\\(.*?\\)[])]?") @@ -49,20 +50,20 @@ (eval (intern (concat (symbol-name e) "-string")))))) "[ \t]*$") - ,(append elements)))) + ,elements))) (defconst ledger-line-config - `((xact (,(single-line-config date nil status nil nil code payee comment) - ,(single-line-config date nil status nil nil code payee))) - (acct-transaction (,(single-line-config indent comment) - ,(single-line-config indent status account commodity amount nil comment) - ,(single-line-config indent status account commodity amount) - ,(single-line-config indent status account amount nil commodity comment) - ,(single-line-config indent status account amount nil commodity) - ,(single-line-config indent status account amount) - ,(single-line-config indent status account comment) - ,(single-line-config indent status account))))) + (list (list 'xact (list (single-line-config date nil status nil nil code payee comment) + (single-line-config date nil status nil nil code payee))) + (list 'acct-transaction (list (single-line-config indent comment) + (single-line-config indent status account commodity amount nil comment) + (single-line-config indent status account commodity amount) + (single-line-config indent status account amount nil commodity comment) + (single-line-config indent status account amount nil commodity) + (single-line-config indent status account amount) + (single-line-config indent status account comment) + (single-line-config indent status account))))) (defun ledger-extract-context-info (line-type pos) "Get context info for current line with LINE-TYPE. |