branch: elpa/parseclj
commit 0ef32ad9121475bc36af3f64bdbd86ffc3fd1431
Author: Daniel Barreto <[email protected]>
Commit: Daniel Barreto <[email protected]>
Add support for having single quotes in symbols/keywords
---
parseclj-lex.el | 4 ++--
test/parseclj-lex-test.el | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/parseclj-lex.el b/parseclj-lex.el
index 1d4f28a5b5..ea8b65783c 100644
--- a/parseclj-lex.el
+++ b/parseclj-lex.el
@@ -218,7 +218,7 @@ A token is an association list with :token-type as its
first key."
"Return t if CHAR is a valid start for a symbol.
Symbols begin with a non-numeric character and can contain alphanumeric
-characters and . * + ! - _ ? $ % & = < >. If - + or . are the first
+characters and . * + ! - _ ? $ % & = < > '. If - + or . are the first
character, the second character (if any) must be non-numeric.
In some cases, like in tagged elements, symbols are required to start with
@@ -226,7 +226,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 '(?. ?* ?+ ?! ?- ?_ ??
?$ ?% ?& ?= ?< ?> ?/ ?'))))))))
(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 eae02a07af..c1ebc09ce1 100644
--- a/test/parseclj-lex-test.el
+++ b/test/parseclj-lex-test.el
@@ -92,6 +92,11 @@
(goto-char 1)
(should (equal (parseclj-lex-next) '((:token-type . :symbol) (:form .
"foo#") (:pos . 1)))))
+ (with-temp-buffer
+ (insert "foo'")
+ (goto-char 1)
+ (should (equal (parseclj-lex-next) '((:token-type . :symbol) (:form .
"foo'") (:pos . 1)))))
+
(with-temp-buffer
(insert "#inst")
(goto-char 1)
@@ -138,6 +143,11 @@
(goto-char 1)
(should (equal (parseclj-lex-next) (parseclj-lex-token :keyword
":hello-world" 1))))
+ (with-temp-buffer
+ (insert ":hello-world'")
+ (goto-char 1)
+ (should (equal (parseclj-lex-next) (parseclj-lex-token :keyword
":hello-world'" 1))))
+
(with-temp-buffer
(insert ":hello/world")
(goto-char 1)