[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
- [nongnu] elpa/parseclj 0702332e5d 046/185: Merge branch 'master' of https://github.com/lambdaisland/clj-parse, (continued)
- [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, 2021/12/28
- [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 <=
- [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
- [nongnu] elpa/parseclj ca854455f6 099/185: Add missing requirement to `parseedn`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj adbc0cabf5 100/185: Move `parseclj--{leaf, closing}-tokens` to `parseclj-lex` module, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 7794d9ee59 101/185: Add docstrings for `parseclj-lex` module, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 296a093132 102/185: Remove `parseclj-unparse`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj d6525d30c6 111/185: Merge pull request #10 from lambdaisland/fix-ast-reduce-tag, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 0ef32ad912 120/185: Add support for having single quotes in symbols/keywords, ELPA Syncer, 2021/12/28