[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj a424f87c1b 054/185: :#/# is a valid keyword. :::h
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj a424f87c1b 054/185: :#/# is a valid keyword. :::hello is not |
Date: |
Tue, 28 Dec 2021 14:05:16 -0500 (EST) |
branch: elpa/parseclj
commit a424f87c1beec89727798ded682245376bda0942
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>
:#/# is a valid keyword. :::hello is not
---
clj-lex.el | 14 +++++++++-----
tests/edn-el-test-suite.el | 36 ++++++++++++++++++------------------
2 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/clj-lex.el b/clj-lex.el
index 604f29d1e9..66f307deef 100644
--- a/clj-lex.el
+++ b/clj-lex.el
@@ -168,13 +168,17 @@ behavior."
(defun clj-lex-keyword ()
(let ((pos (point)))
(right-char)
- (when (equal (char-after (point)) ?:)
+ (when (equal (char-after (point)) ?:) ;; same-namespace keyword
(right-char))
- (if (clj-lex-symbol-start? (char-after (point)))
- (clj-lex-token :keyword (clj-lex-get-symbol-at-point pos) pos)
+ (if (equal (char-after (point)) ?:) ;; three colons in a row => lex-error
+ (progn
+ (right-char)
+ (clj-lex-token :lex-error (buffer-substring-no-properties pos
(point)) pos 'error-type :invalid-keyword))
(progn
- (right-char)
- (clj-lex-token :lex-error (buffer-substring-no-properties pos (point))
pos 'error-type :invalid-keyword)))))
+ (while (or (clj-lex-symbol-rest? (char-after (point)))
+ (equal (char-after (point)) ?#))
+ (right-char))
+ (clj-lex-token :keyword (buffer-substring-no-properties pos (point))
pos)))))
(defun clj-lex-comment ()
(let ((pos (point)))
diff --git a/tests/edn-el-test-suite.el b/tests/edn-el-test-suite.el
index d42e021fd4..7e11b695df 100644
--- a/tests/edn-el-test-suite.el
+++ b/tests/edn-el-test-suite.el
@@ -60,24 +60,24 @@
(should (equal [a d] (clj-parse-edn-str "[a #_ ;we are discarding what comes
next
c d]"))))
-;; (ert-deftest string ()
-;; :tags '(edn string)
-;; (should (equal "this is a string" (clj-parse-edn-str "\"this is a
string\"")))
-;; (should (equal "this has an escaped \"quote in it"
-;; (clj-parse-edn-str "\"this has an escaped \\\"quote in
it\"")))
-;; (should (equal "foo\tbar" (clj-parse-edn-str "\"foo\\tbar\"")))
-;; (should (equal "foo\nbar" (clj-parse-edn-str "\"foo\\nbar\"")))
-;; (should (equal "this is a string \\ that has an escaped backslash"
-;; (clj-parse-edn-str "\"this is a string \\\\ that has an
escaped backslash\"")))
-;; (should (equal "[" (clj-parse-edn-str "\"[\""))))
-
-;; (ert-deftest keywords ()
-;; :tags '(edn keywords)
-;; (should (equal :namespace\.of\.some\.length/keyword-name
-;; (clj-parse-edn-str
":namespace.of.some.length/keyword-name")))
-;; (should (equal :\#/\# (clj-parse-edn-str ":#/#")))
-;; (should (equal :\#/:a (clj-parse-edn-str ":#/:a")))
-;; (should (equal :\#foo (clj-parse-edn-str ":#foo"))))
+(ert-deftest string ()
+ :tags '(edn string)
+ (should (equal "this is a string" (clj-parse-edn-str "\"this is a
string\"")))
+ (should (equal "this has an escaped \"quote in it"
+ (clj-parse-edn-str "\"this has an escaped \\\"quote in
it\"")))
+ (should (equal "foo\tbar" (clj-parse-edn-str "\"foo\\tbar\"")))
+ (should (equal "foo\nbar" (clj-parse-edn-str "\"foo\\nbar\"")))
+ (should (equal "this is a string \\ that has an escaped backslash"
+ (clj-parse-edn-str "\"this is a string \\\\ that has an
escaped backslash\"")))
+ (should (equal "[" (clj-parse-edn-str "\"[\""))))
+
+(ert-deftest keywords ()
+ :tags '(edn keywords)
+ (should (equal :namespace\.of\.some\.length/keyword-name
+ (clj-parse-edn-str ":namespace.of.some.length/keyword-name")))
+ (should (equal :\#/\# (clj-parse-edn-str ":#/#")))
+ (should (equal :\#/:a (clj-parse-edn-str ":#/:a")))
+ (should (equal :\#foo (clj-parse-edn-str ":#foo"))))
;; (ert-deftest integers ()
;; :tags '(edn integers)
- [nongnu] elpa/parseclj 67171853f5 026/185: lex characters, (continued)
- [nongnu] elpa/parseclj 67171853f5 026/185: lex characters, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 4f54ba52fe 033/185: Add support for sets, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 4f647c8cff 036/185: Remove duplicate defination of clj-lex--token-token, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1b2b221c98 038/185: Add AST to Elisp and Clojure/EDN printers, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 9404763e11 042/185: Make sure Travis uses the right Emacs, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 29411e2103 045/185: Add a design document to share vision and collect feedback, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 0702332e5d 046/185: Merge branch 'master' of https://github.com/lambdaisland/clj-parse, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 553f8618e1 044/185: Rework `clj-parse-deftest` macro, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj da89bf82a3 050/185: Allow colons inside symbols, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 81fe979450 051/185: Handle parsing of semicolon-based comments., ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj a424f87c1b 054/185: :#/# is a valid keyword. :::hello is not,
ELPA Syncer <=
- [nongnu] elpa/parseclj f34b8460a8 055/185: Correctly parse numbers in scientific notation, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 6fe4ce6095 058/185: Add script to compare speed of edn.el and clj-parse.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7d70ee4c38 059/185: Add support for tagged literals, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 4367db07aa 061/185: Move tests to tests/, bench to benchmark/, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 46570ce843 060/185: A # can be part of a symbol, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj fcd1a086f6 081/185: Rename clj-ast to parseclj-ast, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 987bd16a57 089/185: Position starts at 1, not at 0 (just like (point)), ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 313fc4e630 077/185: Rename to parseclj, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7f8bcd405e 095/185: Make checkdoc happy with parseclj.el, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 0f16fcf2fa 084/185: Implement parsing with lexical preservation (keep whitespace, comments), ELPA Syncer, 2021/12/28