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

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

[nongnu] elpa/parseclj fcd1a086f6 081/185: Rename clj-ast to parseclj-as


From: ELPA Syncer
Subject: [nongnu] elpa/parseclj fcd1a086f6 081/185: Rename clj-ast to parseclj-ast
Date: Tue, 28 Dec 2021 14:05:20 -0500 (EST)

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

    Rename clj-ast to parseclj-ast
---
 Cask                                               |  2 +-
 clj-ast.el => parseclj-ast.el                      | 48 +++++++++++-----------
 parseclj.el                                        |  2 +-
 test/{clj-ast-test.el => parseclj-ast-test.el}     | 26 ++++++------
 ...nparse-test.el => parseclj-ast-unparse-test.el} | 42 +++++++++----------
 5 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/Cask b/Cask
index a906ff2929..add9a8b9d9 100644
--- a/Cask
+++ b/Cask
@@ -6,7 +6,7 @@
 
 (files "parseclj-lex.el"
        "clj-edn.el"
-       "clj-ast.el")
+       "parseclj-ast.el")
 
 (development
  (depends-on "a")
diff --git a/clj-ast.el b/parseclj-ast.el
similarity index 71%
rename from clj-ast.el
rename to parseclj-ast.el
index f5d6d2465e..c4b52e1bd9 100644
--- a/clj-ast.el
+++ b/parseclj-ast.el
@@ -1,4 +1,4 @@
-;;; clj-ast.el --- Clojure parser/unparser              -*- lexical-binding: 
t; -*-
+;;; parseclj-ast.el --- Clojure parser/unparser              -*- 
lexical-binding: t; -*-
 
 ;; Copyright (C) 2017  Arne Brasseur
 
@@ -33,7 +33,7 @@
 (defun parseclj--make-node (type position &rest kvs)
   (apply 'a-list ':node-type type ':position position kvs))
 
-(defun clj-ast--reduce-leaf (stack token)
+(defun parseclj-ast--reduce-leaf (stack token)
   (if (eq (parseclj-lex-token-type token) :whitespace)
       stack
     (cons
@@ -42,7 +42,7 @@
                            ':value (parseclj--leaf-token-value token))
      stack)))
 
-(defun clj-ast--reduce-branch (stack opener-token children)
+(defun parseclj-ast--reduce-branch (stack opener-token children)
   (let* ((pos (a-get opener-token 'pos))
          (type (parseclj-lex-token-type opener-token))
          (type (cl-case type
@@ -61,56 +61,56 @@
           (parseclj--make-node type pos :children children)
           stack)))))
 
-(defun clj-ast-parse ()
+(defun parseclj-ast-parse ()
   "Parse Clojure code in buffer to AST.
 
 Parses code in the current buffer, starting from the current
 position of (point)."
-  (parseclj-parse #'clj-ast--reduce-leaf #'clj-ast--reduce-branch))
+  (parseclj-parse #'parseclj-ast--reduce-leaf #'parseclj-ast--reduce-branch))
 
-(defun clj-ast-parse-str (s)
+(defun parseclj-ast-parse-str (s)
   "Parse Clojure code in string S to AST."
   (with-temp-buffer
     (insert s)
     (goto-char 1)
-    (clj-ast-parse)))
+    (parseclj-ast-parse)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Unparser
 
-(defun clj-ast-unparse-collection (nodes ld rd)
+(defun parseclj-ast-unparse-collection (nodes ld rd)
   (insert ld)
   (when-let (node (car nodes))
-    (clj-ast-unparse node))
+    (parseclj-ast-unparse node))
   (seq-doseq (node (cdr nodes))
     (insert " ")
-    (clj-ast-unparse node))
+    (parseclj-ast-unparse node))
   (insert rd))
 
-(defun clj-ast-unparse-tag (node)
+(defun parseclj-ast-unparse-tag (node)
   (progn
     (insert "#")
     (insert (symbol-name (a-get node :tag)))
     (insert " ")
-    (clj-ast-unparse (car (a-get node :children)))))
+    (parseclj-ast-unparse (car (a-get node :children)))))
 
-(defun clj-ast-unparse (node)
+(defun parseclj-ast-unparse (node)
   (if (parseclj--is-leaf? node)
       (insert (alist-get ':form node))
     (let ((subnodes (alist-get ':children node)))
       (cl-case (a-get node ':node-type)
-        (:root (clj-ast-unparse-collection subnodes "" ""))
-        (:list (clj-ast-unparse-collection subnodes "(" ")"))
-        (:vector (clj-ast-unparse-collection subnodes "[" "]"))
-        (:set (clj-ast-unparse-collection subnodes "#{" "}"))
-        (:map (clj-ast-unparse-collection subnodes "{" "}"))
-        (:tag (clj-ast-unparse-tag node))))))
-
-(defun clj-ast-unparse-str (data)
+        (:root (parseclj-ast-unparse-collection subnodes "" ""))
+        (:list (parseclj-ast-unparse-collection subnodes "(" ")"))
+        (:vector (parseclj-ast-unparse-collection subnodes "[" "]"))
+        (:set (parseclj-ast-unparse-collection subnodes "#{" "}"))
+        (:map (parseclj-ast-unparse-collection subnodes "{" "}"))
+        (:tag (parseclj-ast-unparse-tag node))))))
+
+(defun parseclj-ast-unparse-str (data)
   (with-temp-buffer
-    (clj-ast-unparse data)
+    (parseclj-ast-unparse data)
     (buffer-substring-no-properties (point-min) (point-max))))
 
-(provide 'clj-ast)
+(provide 'parseclj-ast)
 
-;;; clj-ast.el ends here
+;;; parseclj-ast.el ends here
diff --git a/parseclj.el b/parseclj.el
index d15ea4c00b..0baf76e635 100644
--- a/parseclj.el
+++ b/parseclj.el
@@ -35,7 +35,7 @@
 
 (require 'parseclj-lex)
 (require 'clj-edn)
-(require 'clj-ast)
+(require 'parseclj-ast)
 
 (defvar parseclj--leaf-tokens '(:whitespace
                                  :comment
diff --git a/test/clj-ast-test.el b/test/parseclj-ast-test.el
similarity index 67%
rename from test/clj-ast-test.el
rename to test/parseclj-ast-test.el
index d825d180bd..59ec572e86 100644
--- a/test/clj-ast-test.el
+++ b/test/parseclj-ast-test.el
@@ -1,4 +1,4 @@
-;;; clj-ast-test.el --- Unit tests for AST parsing/unparsing
+;;; parseclj-ast-test.el --- Unit tests for AST parsing/unparsing
 
 ;; Copyright (C) 2017  Arne Brasseur
 
@@ -28,41 +28,41 @@
 ;;; Code
 
 (require 'ert)
-(require 'clj-ast)
+(require 'parseclj-ast)
 
 (load "test/parseclj-test-data.el")
 
-(defmacro define-clj-ast-parse-tests ()
+(defmacro define-parseclj-ast-parse-tests ()
   `(progn
      ,@(mapcar
         (lambda (pair)
           (let ((name (car pair))
                 (data (cdr pair)))
             (if (and (a-get data :source) (a-get data :ast))
-                (let ((test-name (intern (concat "clj-ast-parse:" name))))
+                (let ((test-name (intern (concat "parseclj-ast-parse:" name))))
                   `(ert-deftest ,test-name ()
-                     :tags '(clj-ast)
+                     :tags '(parseclj-ast)
                      (with-temp-buffer
                        (insert ,(a-get data :source))
                        (goto-char 1)
-                       (should (a-equal (clj-ast-parse) ',(a-get data 
:ast)))))))))
+                       (should (a-equal (parseclj-ast-parse) ',(a-get data 
:ast)))))))))
         parseclj-test-data)))
 
-(defmacro define-clj-ast-roundtrip-tests ()
+(defmacro define-parseclj-ast-roundtrip-tests ()
   `(progn
      ,@(mapcar
         (lambda (pair)
           (let ((name (car pair))
                 (data (cdr pair)))
             (if (and (a-get data :ast) (a-get data :source))
-                (let ((test-name (intern (concat "clj-ast-rountrip:" name))))
+                (let ((test-name (intern (concat "parseclj-ast-rountrip:" 
name))))
                   `(ert-deftest ,test-name ()
-                     :tags '(clj-ast-rountrip)
-                     (should (a-equal (clj-ast-parse-str (clj-ast-unparse-str 
',(a-get data :ast))) ',(a-get data :ast))))))))
+                     :tags '(parseclj-ast-rountrip)
+                     (should (a-equal (parseclj-ast-parse-str 
(parseclj-ast-unparse-str ',(a-get data :ast))) ',(a-get data :ast))))))))
         parseclj-test-data)))
 
 
-(define-clj-ast-roundtrip-tests)
-(define-clj-ast-parse-tests)
+(define-parseclj-ast-roundtrip-tests)
+(define-parseclj-ast-parse-tests)
 
-;;; clj-ast-test.el ends here
+;;; parseclj-ast-test.el ends here
diff --git a/test/clj-ast-unparse-test.el b/test/parseclj-ast-unparse-test.el
similarity index 89%
rename from test/clj-ast-unparse-test.el
rename to test/parseclj-ast-unparse-test.el
index 798aba4f32..3851fd073e 100644
--- a/test/clj-ast-unparse-test.el
+++ b/test/parseclj-ast-unparse-test.el
@@ -1,4 +1,4 @@
-;;; clj-ast-unparse-test.el --- Print Clojure AST back to code - tests
+;;; parseclj-ast-unparse-test.el --- Print Clojure AST back to code - tests
 
 ;; Copyright (C) 2017  Arne Brasseur
 
@@ -28,14 +28,14 @@
 ;;; Code:
 
 (require 'ert)
-(require 'clj-ast)
+(require 'parseclj-ast)
 
 ;;; Printer modes
 ;; ----------------------------------------------------------------------------
 
-(ert-deftest clj-ast-unparse-list ()
+(ert-deftest parseclj-ast-unparse-list ()
   (should (equal "(0 1 2)"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :list)
                                                        (:position . 1)
@@ -52,17 +52,17 @@
                                                                       (:form . 
"2")
                                                                       (:value 
. 2))))))))))))
 
-(ert-deftest clj-ast-unparse-empty-list ()
+(ert-deftest parseclj-ast-unparse-empty-list ()
   (should (equal "()"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :list)
                                                        (:position . 1)
                                                        (:children . 
nil)))))))))
 
-(ert-deftest clj-ast-unparse-nested-list ()
+(ert-deftest parseclj-ast-unparse-nested-list ()
   (should (equal "((.9 abc (true) (hello)))"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :list)
                                                        (:position . 1)
@@ -89,18 +89,18 @@
                                                                                
               (:form . "hello")
                                                                                
               (:value . hello))))))))))))))))
 
-(ert-deftest clj-ast-unparse-string ()
+(ert-deftest parseclj-ast-unparse-string ()
   (should (equal "\"abc hello \\t\\\"x\""
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :string)
                                                        (:position . 1)
                                                        (:form . "\"abc hello 
\\t\\\"x\"")
                                                        (:value . "abc hello 
\t\"x")))))))))
 
-(ert-deftest clj-ast-unparse-chars ()
+(ert-deftest parseclj-ast-unparse-chars ()
   (should (equal "(\\newline \\return \\space \\tab \\a \\b \\c \\u0078 
\\o171)"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :list)
                                                        (:position . 1)
@@ -115,18 +115,18 @@
                                                                      
((:node-type . :character) (:position . 47) (:form . "\\o171") (:value . 
?y)))))))))
                  )))
 
-(ert-deftest clj-ast-unparse-keyword ()
+(ert-deftest parseclj-ast-unparse-keyword ()
   (should (equal ":foo-bar"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :keyword)
                                                        (:position . 1)
                                                        (:form . ":foo-bar")
                                                        (:value . 
:foo-bar)))))))))
 
-(ert-deftest clj-ast-unparse-vector ()
+(ert-deftest parseclj-ast-unparse-vector ()
   (should (equal "[123]"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :vector)
                                                        (:position . 1)
@@ -135,9 +135,9 @@
                                                                       (:form . 
"123")
                                                                       (:value 
. 123))))))))))))
 
-(ert-deftest clj-ast-unparse-map ()
+(ert-deftest parseclj-ast-unparse-map ()
   (should (equal "{:count 123}"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :map)
                                                        (:position . 1)
@@ -150,9 +150,9 @@
                                                                       (:form . 
"123")
                                                                       (:value 
. 123))))))))))))
 
-(ert-deftest clj-ast-unparse-set ()
+(ert-deftest parseclj-ast-unparse-set ()
   (should (equal "#{:x}"
-                 (clj-ast-unparse-str '((:node-type . :root)
+                 (parseclj-ast-unparse-str '((:node-type . :root)
                                         (:position . 0)
                                         (:children . (((:node-type . :set)
                                                        (:position . 1)
@@ -163,4 +163,4 @@
 
 (provide 'clj-unparse-test)
 
-;;; clj-ast-unparse-test.el ends here
+;;; parseclj-ast-unparse-test.el ends here



reply via email to

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