diff options
author | Craig Earls <enderw88@gmail.com> | 2013-04-07 14:48:33 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-04-07 14:48:33 -0700 |
commit | 98f8df5583f16792243aeadee9ed19bd8b3f7897 (patch) | |
tree | f3d602a10d8adc38910c403a06c72d98ec9ca3ab /lisp | |
parent | 4df990014fede0c7b0c23396f32b1f2c7c636426 (diff) | |
download | fork-ledger-98f8df5583f16792243aeadee9ed19bd8b3f7897.tar.gz fork-ledger-98f8df5583f16792243aeadee9ed19bd8b3f7897.tar.bz2 fork-ledger-98f8df5583f16792243aeadee9ed19bd8b3f7897.zip |
Regex consistency and cleanup.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-regex.el | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el index 1b338012..226475df 100644 --- a/lisp/ldg-regex.el +++ b/lisp/ldg-regex.el @@ -24,6 +24,15 @@ (eval-when-compile (require 'cl)) +(defconst ledger-amount-regex + (concat "\\( \\|\t\\| \t\\)[ \t]*-?" + "\\([A-Z$€£_]+ *\\)?" + "\\(-?[0-9,]+?\\)" + "\\(.[0-9]+\\)?" + "\\( *[[:word:]€£_\"]+\\)?" + "\\([ \t]*[@={]@?[^\n;]+?\\)?" + "\\([ \t]+;.+?\\|[ \t]*\\)?$")) + (defconst ledger-amount-decimal-comma-regex "-?[1-9][0-9.]*[,]?[0-9]*") @@ -33,8 +42,6 @@ (defconst ledger-other-entries-regex "\\(^[~=A-Za-z].+\\)+") -;\\|^\\([A-Za-z] .+\\)\\) - (defconst ledger-comment-regex "\\( \\| \\|^\\)\\(;.*\\)") @@ -42,13 +49,13 @@ "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)") (defconst ledger-payee-pending-regex - "^[0-9]+[-/.=][-/.=0-9]+\\s-\\!\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") + "^[0-9]+[-/][-/.=0-9]+\\s-\\!\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") (defconst ledger-payee-cleared-regex - "^[0-9]+[-/.=][-/.=0-9]+\\s-\\*\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") + "^[0-9]+[-/][-/.=0-9]+\\s-\\*\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") (defconst ledger-payee-uncleared-regex - "^[0-9]+[-/.=][-/.=0-9]+\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") + "^[0-9]+[-/][-/.=0-9]+\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)") (defconst ledger-init-string-regex "^--.+?\\($\\|[ ]\\)") @@ -62,14 +69,6 @@ (defconst ledger-account-cleared-regex "\\(^[ \t]+\\)\\(\\*.+?\\)\\( \\|$\\)") -(defconst ledger-amount-regex - (concat "\\( \\|\t\\| \t\\)[ \t]*-?" - "\\([A-Z$€£_]+ *\\)?" - "\\(-?[0-9,]+?\\)" - "\\(.[0-9]+\\)?" - "\\( *[[:word:]€£_\"]+\\)?" - "\\([ \t]*[@={]@?[^\n;]+?\\)?" - "\\([ \t]+;.+?\\|[ \t]*\\)?$")) (defmacro ledger-define-regexp (name regex docs &rest args) |