emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/parseclj b04eae6738 2/2: Merge pull request #39 from ikapp


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj b04eae6738 2/2: Merge pull request #39 from ikappaki/issue/symbol-pipe-char
Date: Mon, 28 Mar 2022 01:58:33 -0400 (EDT)

branch: elpa/parseclj
commit b04eae67384c1d8181edf318fd62d422a8220724
Merge: f32c041f2b bd11cf4a42
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: GitHub <noreply@github.com>

    Merge pull request #39 from ikappaki/issue/symbol-pipe-char
    
    add `|` to the list of valid symbol chars
---
 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]