summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Purcell <steve@sanityinc.com>2019-07-09 17:47:59 +1200
committerSteve Purcell <steve@sanityinc.com>2019-07-09 17:48:49 +1200
commit08462cdf1e9c58c45ce3d4909bed7e69a25ed52c (patch)
tree3b69c04893a282b12f6e7fe846c31a8e8fc76b4f
parent0c18566a61ea767aadef1e7b52f21150d8618cc4 (diff)
Avoid [[:space]] in regexes, which can be affected by the syntax table
Fixes #187
-rw-r--r--ledger-regex.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/ledger-regex.el b/ledger-regex.el
index b083f8a..38fd00b 100644
--- a/ledger-regex.el
+++ b/ledger-regex.el
@@ -72,7 +72,7 @@
"^--.+?\\($\\|[ ]\\)")
(defconst ledger-account-name-regex
- "\\(?1:[^][();[:space:]\r\n]+\\(?: [^][();[:space:]\r\n]+\\)*\\)")
+ "\\(?1:[^][(); \t\r\n]+\\(?: [^][(); \t\r\n]+\\)*\\)")
(defconst ledger-account-directive-regex
(concat "^account[ \t]+" ledger-account-name-regex))
@@ -81,7 +81,7 @@
(concat "[[(]?" ledger-account-name-regex "[])]?"))
(defconst ledger-account-any-status-regex
- (concat "^[[:space:]]+\\(?:[!*][[:space:]]*\\)?" ledger-account-name-maybe-virtual-regex))
+ (concat "^[ \t]+\\(?:[!*][ \t]*\\)?" ledger-account-name-maybe-virtual-regex))
;; This would incorrectly match "account (foo)", but writing the regexp this way
;; allows us to have just one match result
@@ -89,10 +89,10 @@
(format "\\(?:%s\\|%s\\)" ledger-account-any-status-regex ledger-account-directive-regex))
(defconst ledger-account-pending-regex
- (concat "\\(^[[:space:]]+\\)!" ledger-account-name-maybe-virtual-regex))
+ (concat "\\(^[ \t]+\\)!" ledger-account-name-maybe-virtual-regex))
(defconst ledger-account-cleared-regex
- (concat "\\(^[[:space:]]+\\)*" ledger-account-name-maybe-virtual-regex))
+ (concat "\\(^[ \t]+\\)*" ledger-account-name-maybe-virtual-regex))
(defmacro ledger-define-regexp (name regex docs &rest args)
"Simplify the creation of a Ledger regex and helper functions."