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

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

[nongnu] elpa/parseclj 792ba04647 024/185: A more elaborate test, nestin


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj 792ba04647 024/185: A more elaborate test, nesting works!
Date: Tue, 28 Dec 2021 14:05:10 -0500 (EST)

branch: elpa/parseclj
commit 792ba0464745d75138b69b8a164fbc5776d0c1c6
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>

    A more elaborate test, nesting works!
---
 clj-parse-test.el |  7 ++++++-
 clj-parse.el      | 20 +++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/clj-parse-test.el b/clj-parse-test.el
index a6ef69b1e4..8de09a3e8c 100644
--- a/clj-parse-test.el
+++ b/clj-parse-test.el
@@ -44,7 +44,12 @@
   (with-temp-buffer
     (insert "(nil true false hello-world)")
     (goto-char 1)
-    (should (equal (clj-parse) '((nil t nil hello-world))))))
+    (should (equal (clj-parse) '((nil t nil hello-world)))))
+
+  (with-temp-buffer
+    (insert "((.9 abc (true) (hello)))")
+    (goto-char 1)
+    (should (equal (clj-parse) '(((0.9 abc (t) (hello))))))))
 
 ;; (ert-deftest clj-parse-test--reduce-list ()
 ;;   (clj-parse-test--reduce-list ))
diff --git a/clj-parse.el b/clj-parse.el
index 17ec7cdf58..cc40237278 100644
--- a/clj-parse.el
+++ b/clj-parse.el
@@ -25,12 +25,18 @@
 ;;; Code:
 
 (require 'cl-lib)
-
 ;; Before emacs 25.1 it's an ELPA package
 (require 'let-alist)
-
 (require 'clj-lex)
 
+(defvar clj-parse--leaf-tokens '(:whitespace
+                                 :number
+                                 :nil
+                                 :true
+                                 :false
+                                 :symbol)
+  "Tokens that represent leaf nodes in the AST.")
+
 (defun clj-parse-edn-reduce1 (stack token)
   (cl-case (cdr (assq 'type token))
     (:whitespace stack)
@@ -48,14 +54,10 @@
      (:list (-butlast (cdr coll))))
    stack))
 
-(defvar clj-parse--leaf-tokens '(:whitespace :number :nil :true :false 
:symbol))
-
-
+;; TODO move this to clj-lex
 (defun clj-parse--token-type (token)
-  (and (listp token) (cdr (assq 'type token))))
-
-(defun clj-parse--unwind-stack (stack target)
-  (let ((result nil))))
+  (and (listp token)
+       (cdr (assq 'type token))))
 
 (defun clj-parse--reduce-list (stack reducN)
   (let ((coll nil))



reply via email to

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