[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj bd11cf4a42 1/2: Make list of symbol/keyword const
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj bd11cf4a42 1/2: Make list of symbol/keyword constituent characters a custom option |
Date: |
Mon, 28 Mar 2022 01:58:33 -0400 (EDT) |
branch: elpa/parseclj
commit bd11cf4a42abbe718a017d1cb4256172d38b7415
Author: ikappaki <ikappaki@users.noreply.github.com>
Commit: ikappaki <ikappaki@users.noreply.github.com>
Make list of symbol/keyword constituent characters a custom option
---
parseclj-lex.el | 16 +++++++++++++++-
test/parseclj-lex-test.el | 7 ++++++-
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/parseclj-lex.el b/parseclj-lex.el
index 42145b12e4..0dfab226db 100644
--- a/parseclj-lex.el
+++ b/parseclj-lex.el
@@ -29,6 +29,20 @@
(require 'parseclj-alist)
+(defcustom parseclj-lex-symbol-special-chars
+ '(?. ?* ?+ ?! ?- ?_ ?? ?$ ?% ?& ?= ?< ?> ?/ ?')
+ "The list of characters that can consitute a symbol or keyword's name.
+
+Please note that Clojure might at runtime accept keywords with
+more constituent characters than those found in the default value
+of this variable (which is the officially supported list), but
+the end result should be treated as undefined. This could be the
+case for example when keywordized maps are created from external
+sources without keyword validation. Change this value at your
+own risk."
+ :type 'sexp
+ :group 'parseclj)
+
(defvar parseclj-lex--leaf-tokens '(:whitespace
:comment
:symbolic-value
@@ -303,7 +317,7 @@ alphabetic characters only. ALPHA-ONLY ensures this
behavior."
(not (not (and char
(or (and (<= ?a char) (<= char ?z))
(and (<= ?A char) (<= char ?Z))
- (and (not alpha-only) (member char '(?. ?* ?+ ?! ?- ?_ ??
?$ ?% ?& ?= ?< ?> ?/ ?'))))))))
+ (and (not alpha-only) (member char
parseclj-lex-symbol-special-chars)))))))
(defun parseclj-lex-symbol-rest-p (char)
"Return t if CHAR is a valid character in a symbol.
diff --git a/test/parseclj-lex-test.el b/test/parseclj-lex-test.el
index dbf71c3003..63a910defd 100644
--- a/test/parseclj-lex-test.el
+++ b/test/parseclj-lex-test.el
@@ -309,7 +309,12 @@
(should (equal (parseclj-lex-symbol-rest-p ?A) t))
(should (equal (parseclj-lex-symbol-rest-p ?.) t))
(should (equal (parseclj-lex-symbol-rest-p ?~) nil))
- (should (equal (parseclj-lex-symbol-rest-p ? ) nil)))
+ (should (equal (parseclj-lex-symbol-rest-p ? ) nil))
+
+ (should (equal (parseclj-lex-symbol-rest-p ?|) nil))
+ (let ((parseclj-lex-symbol-special-chars (cons ?|
parseclj-lex-symbol-special-chars)))
+ (should (equal (parseclj-lex-symbol-rest-p ?|) t)))
+ (should (equal (parseclj-lex-symbol-rest-p ?|) nil)))
(ert-deftest parseclj-lex-test-get-symbol-at-point ()
(with-temp-buffer
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/parseclj bd11cf4a42 1/2: Make list of symbol/keyword constituent characters a custom option,
ELPA Syncer <=