branch: elpa/parseclj
commit 9480ae09b3ee8a5ea02d7d16c86e435f995baaa1
Author: Arne Brasseur <[email protected]>
Commit: Arne Brasseur <[email protected]>
push is destructive, in this case cons will do
The reducer should return the new stack, not modify the actual stack (which
in
this case just modifies the local variable before discarding it).
---
clj-ast.el | 6 +++---
clj-edn.el | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/clj-ast.el b/clj-ast.el
index 7454776621..301aacedaa 100644
--- a/clj-ast.el
+++ b/clj-ast.el
@@ -36,7 +36,7 @@
(defun clj-ast--reduce-leaf (stack token)
(if (eq (clj-lex-token-type token) :whitespace)
stack
- (push
+ (cons
(clj-parse--make-node (clj-lex-token-type token) (a-get token 'pos)
':form (a-get token 'form)
':value (clj-parse--leaf-token-value token))
@@ -54,7 +54,7 @@
(cl-case type
(:root (clj-parse--make-node :root 0 ':children children))
(:discard stack)
- (t (push
+ (t (cons
(clj-parse--make-node type pos
':children children)
stack)))))
@@ -78,7 +78,7 @@
(:vector (clj-parse--string-with-delimiters subnodes "[" "]"))
(:set (clj-parse--string-with-delimiters subnodes "#{" "}"))
(:map (clj-parse--string-with-delimiters subnodes "{" "}"))
- ;; tagged literals
+ (:tag )
))))
(provide 'clj-ast)
diff --git a/clj-edn.el b/clj-edn.el
index 34d7fcaf76..24e858eccc 100644
--- a/clj-edn.el
+++ b/clj-edn.el
@@ -44,14 +44,14 @@ handlers as an optional argument to the reader functions.")
(defun clj-edn-reduce-leaf (stack token)
(if (member (clj-lex-token-type token) (list :whitespace :comment))
stack
- (push (clj-parse--leaf-token-value token) stack)))
+ (cons (clj-parse--leaf-token-value token) stack)))
(defun clj-edn-reduce-node (tag-readers)
(lambda (stack opener-token children)
(let ((token-type (clj-lex-token-type opener-token)))
(if (member token-type '(:root :discard))
stack
- (push
+ (cons
(cl-case token-type
(:lparen children)
(:lbracket (apply #'vector children))