Regex consistency and cleanup.
This commit is contained in:
parent
4df990014f
commit
98f8df5583
1 changed files with 12 additions and 13 deletions
|
|
@ -24,6 +24,15 @@
|
||||||
(eval-when-compile
|
(eval-when-compile
|
||||||
(require 'cl))
|
(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
|
(defconst ledger-amount-decimal-comma-regex
|
||||||
"-?[1-9][0-9.]*[,]?[0-9]*")
|
"-?[1-9][0-9.]*[,]?[0-9]*")
|
||||||
|
|
||||||
|
|
@ -33,8 +42,6 @@
|
||||||
(defconst ledger-other-entries-regex
|
(defconst ledger-other-entries-regex
|
||||||
"\\(^[~=A-Za-z].+\\)+")
|
"\\(^[~=A-Za-z].+\\)+")
|
||||||
|
|
||||||
;\\|^\\([A-Za-z] .+\\)\\)
|
|
||||||
|
|
||||||
(defconst ledger-comment-regex
|
(defconst ledger-comment-regex
|
||||||
"\\( \\| \\|^\\)\\(;.*\\)")
|
"\\( \\| \\|^\\)\\(;.*\\)")
|
||||||
|
|
||||||
|
|
@ -42,13 +49,13 @@
|
||||||
"^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)")
|
"^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)")
|
||||||
|
|
||||||
(defconst ledger-payee-pending-regex
|
(defconst ledger-payee-pending-regex
|
||||||
"^[0-9]+[-/.=][-/.=0-9]+\\s-\\!\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
"^[0-9]+[-/][-/.=0-9]+\\s-\\!\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
||||||
|
|
||||||
(defconst ledger-payee-cleared-regex
|
(defconst ledger-payee-cleared-regex
|
||||||
"^[0-9]+[-/.=][-/.=0-9]+\\s-\\*\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
"^[0-9]+[-/][-/.=0-9]+\\s-\\*\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
||||||
|
|
||||||
(defconst ledger-payee-uncleared-regex
|
(defconst ledger-payee-uncleared-regex
|
||||||
"^[0-9]+[-/.=][-/.=0-9]+\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
"^[0-9]+[-/][-/.=0-9]+\\s-+\\(([^)]+)\\s-+\\)?\\([^*].+?\\)\\(;\\|$\\)")
|
||||||
|
|
||||||
(defconst ledger-init-string-regex
|
(defconst ledger-init-string-regex
|
||||||
"^--.+?\\($\\|[ ]\\)")
|
"^--.+?\\($\\|[ ]\\)")
|
||||||
|
|
@ -62,14 +69,6 @@
|
||||||
(defconst ledger-account-cleared-regex
|
(defconst ledger-account-cleared-regex
|
||||||
"\\(^[ \t]+\\)\\(\\*.+?\\)\\( \\|$\\)")
|
"\\(^[ \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)
|
(defmacro ledger-define-regexp (name regex docs &rest args)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue