[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/parseclj 1e46607912 015/185: Split files into packages, Mo
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/parseclj 1e46607912 015/185: Split files into packages, More test setup |
Date: |
Tue, 28 Dec 2021 14:05:09 -0500 (EST) |
branch: elpa/parseclj
commit 1e46607912520c0824855ed74b2526a26a3d94a3
Author: Arne Brasseur <arne@arnebrasseur.net>
Commit: Arne Brasseur <arne@arnebrasseur.net>
Split files into packages, More test setup
---
.dir-locals.el | 2 +
.travis.yml | 13 ++++---
clj-lex-test.el | 50 +++++++++++++++++++++++++
clj-parse.el => clj-lex.el | 85 +++---------------------------------------
clj-parse-test-runner.el | 48 ++++++++++++------------
clj-parse-test.el | 41 +++++++++++++++++++++
clj-parse.el | 92 ++--------------------------------------------
7 files changed, 133 insertions(+), 198 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000000..e793bf010b
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,2 @@
+((nil .
+ ((buffer-save-without-query . t))))
diff --git a/.travis.yml b/.travis.yml
index a233d11372..90d51b51ad 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,12 @@
language: emacs-lisp
env:
- - EMACS=emacs-24.3 PPA=ppa:ubuntu-elisp PACKAGE=emacs-snapshot
- - EMACS=emacs-25.1 PPA=ppa:kelleyk/emacs PACKAGE=emacs25
- - EMACS=emacs-25.1 PPA=ppa:kelleyk/emacs PACKAGE=emacs25 CLJ_PARSE_LINT=true
+ - VERSION=24.3.2 EMACS=emacs PPA=ppa:ubuntu-elisp PACKAGE=emacs-snapshot
+ - VERSION=25.2.1 EMACS=emacs-25.2 PPA=ppa:kelleyk/emacs PACKAGE=emacs25
+ - VERSION=25.2.1 EMACS=emacs-25.2 PPA=ppa:kelleyk/emacs PACKAGE=emacs25
CLJ_PARSE_LINT=true
matrix:
allow_failures:
- - env: EMACS=emacs-25.1 PPA=ppa:kelleyk/emacs PACKAGE=emacs25
CLJ_PARSE_LINT=true
+ - env: VERSION=25.2.1 EMACS=emacs-25.2 PPA=ppa:kelleyk/emacs
PACKAGE=emacs25 CLJ_PARSE_LINT=true
before_install:
- sudo add-apt-repository -y $PPA
@@ -14,5 +14,6 @@ before_install:
- sudo apt-get install -qq $PACKAGE
script:
- - emacs --version
- - emacs -batch -l clj-parse-test-runner.el
+ - $EMACS --version
+ - $EMACS --version | grep $VERSION
+ - $EMACS -batch -l clj-parse-test-runner.el
diff --git a/clj-lex-test.el b/clj-lex-test.el
new file mode 100644
index 0000000000..2eda80a58c
--- /dev/null
+++ b/clj-lex-test.el
@@ -0,0 +1,50 @@
+;;; clj-lex-test.el --- Clojure/EDN parser
+
+;; Copyright (C) 2017 Arne Brasseur
+
+;; Author: Arne Brasseur <arne@arnebrasseur.net>
+;; Version: 0.1.0
+
+;; This program is free software; you can redistribute it and/or modify it
under
+;; the terms of the Mozilla Public License Version 2.0
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+;; details.
+
+;; You should have received a copy of the Mozilla Public License along with
this
+;; program. If not, see <https://www.mozilla.org/media/MPL/2.0/index.txt>.
+
+;;; Commentary:
+
+;; A reader for EDN data files and parser for Clojure source files.
+
+(require 'clj-lex)
+(require 'ert)
+
+(ert-deftest clj-lex-test-next ()
+ (with-temp-buffer
+ (insert "()")
+ (goto-char 1)
+ (should (equal (clj-lex-next) '((type . :lparen) (pos . 1))))
+ (should (equal (clj-lex-next) '((type . :rparen) (pos . 2))))
+ (should (equal (clj-lex-next) '((type . :eof) (pos . 3)))))
+
+ (with-temp-buffer
+ (insert "123")
+ (goto-char 1)
+ (should (equal (clj-lex-next) '((type . :number)
+ (value . 123)
+ (form . "123")
+ (pos . 1)))))
+
+ (with-temp-buffer
+ (insert " \t \n")
+ (goto-char 1)
+ (should (equal (clj-lex-next) '((type . :whitespace) (form . " \t \n")
(pos . 1))))))
+
+
+(provide 'clj-lex-test)
+
+;;; clj-lext-test.el ends here
diff --git a/clj-parse.el b/clj-lex.el
similarity index 51%
copy from clj-parse.el
copy to clj-lex.el
index e3aeb6c7c0..3b8ef7d7c9 100644
--- a/clj-parse.el
+++ b/clj-lex.el
@@ -1,10 +1,9 @@
-;;; clj-parse.el --- Clojure/EDN parser
+;;; clj-lex.el --- Clojure/EDN parser
;; Copyright (C) 2017 Arne Brasseur
;; Author: Arne Brasseur <arne@arnebrasseur.net>
-;; Keywords: lisp
-;; Package-Requires: ((let-alist ""))
+;; Version: 0.1.0
;; This program is free software; you can redistribute it and/or modify it
under
;; the terms of the Mozilla Public License Version 2.0
@@ -21,46 +20,6 @@
;; A reader for EDN data files and parser for Clojure source files.
-;;; Code:
-
-(require 'cl-lib)
-
-;; Before emacs 25.1 it's an ELPA package
-(require 'let-alist)
-
-(defun clj-parse ()
- (clj-parse* 'clj-parse-elisp-reducer))
-
-(defun clj-parse-elisp-reducer (type value)
- (cl-case type
- (:whitespace :ws)
- (:number value)
- (:list value)))
-
-(defun clj-parse* (reducer)
- (let ((stack nil)
- (token (clj-lex-next)))
- (while (not (eq (cdr (assq 'type token)) :eof))
- ;; (prin1 (alist-get 'type token))
- ;; (print token)
- ;; (print stack)
- (let-alist token
- (cl-case .type
- (:whitespace
- (push (funcall reducer :whitespace .form) stack))
- (:number
- (push (funcall reducer :number .value) stack))
- (:lparen
- (push token stack))
- (:rparen
- (let ((list nil))
- (while (not (and (listp (car stack)) (eq (cdr (assq 'type (car
stack))) :lparen)))
- (push (pop stack) list))
- (pop stack) ;; :lparen
- ;; (print list)
- (push (funcall reducer :list list) stack)))))
- (setq token (clj-lex-next)))
- stack))
(defun clj-lex-whitespace ()
(let* ((pos (point)))
@@ -114,40 +73,6 @@
":("))))
-(ert-deftest clj-parse-test ()
- (with-temp-buffer
- (insert "()")
- (goto-char 1)
- (should (equal (clj-parse) '(()))))
-
- (with-temp-buffer
- (insert "(1)")
- (goto-char 1)
- (should (equal (clj-parse) '((1))))))
-
-(ert-deftest clj-lex-next-test ()
- (with-temp-buffer
- (insert "()")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :lparen) (pos . 1))))
- (should (equal (clj-lex-next) '((type . :rparen) (pos . 2))))
- (should (equal (clj-lex-next) '((type . :eof) (pos . 3)))))
-
- (with-temp-buffer
- (insert "123")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :number)
- (value . 123)
- (form . "123")
- (pos . 1)))))
-
- (with-temp-buffer
- (insert " \t \n")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :whitespace) (form . " \t \n")
(pos . 1))))))
-
-
-
-(provide 'clj-parse)
-;;; clj-parse.el ends here
-123
+(provide 'clj-lex)
+
+;;; clj-lex.el ends here
diff --git a/clj-parse-test-runner.el b/clj-parse-test-runner.el
index f14bfb9723..138dc9ea7d 100644
--- a/clj-parse-test-runner.el
+++ b/clj-parse-test-runner.el
@@ -3,9 +3,10 @@
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
;;("melpa" . "https://melpa.org/packages/")
- ;;("melpa-stable" . "https://stable.melpa.org/packages/")
+ ("melpa-stable" . "https://stable.melpa.org/packages/")
))
+
(package-initialize)
(package-refresh-contents)
@@ -15,26 +16,25 @@
(package-install 'package-lint)
-(require 'ert)
-
-;; Tried
-;; - default-directory
-;; - (file-name-directory load-file-name)
-;; Neither works so shelling out to `pwd` it is.
-(let ((pwd (replace-regexp-in-string "\n\\'" "" (shell-command-to-string
"pwd"))))
- (load (concat pwd "/clj-parse.el")))
-
-(if (getenv "CLJ_PARSE_LINT")
- (let ((success t))
- (dolist (file '("clj-parse.el"))
- (with-temp-buffer
- (insert-file-contents file t)
- (emacs-lisp-mode)
- (let ((checking-result (package-lint-buffer)))
- (when checking-result
- (setq success nil)
- (message "In `%s':" file)
- (pcase-dolist (`(,line ,col ,type ,message) checking-result)
- (message " at %d:%d: %s: %s" line col type message))))))
- (kill-emacs (if success 0 1)))
- (ert-run-tests-batch-and-exit))
+(let ((files '("clj-parse.el" "clj-lex.el" "clj-parse-test.el"
"clj-lex-test.el"))
+ (pwd (replace-regexp-in-string "\n\\'" "" (shell-command-to-string
"pwd"))))
+
+ (add-to-list 'load-path pwd)
+
+ (dolist (file files)
+ (load (concat pwd "/" file)))
+
+ (if (getenv "CLJ_PARSE_LINT")
+ (let ((success t))
+ (dolist (file files)
+ (with-temp-buffer
+ (insert-file-contents file t)
+ (emacs-lisp-mode)
+ (let ((checking-result (package-lint-buffer)))
+ (when checking-result
+ (setq success nil)
+ (message "In `%s':" file)
+ (pcase-dolist (`(,line ,col ,type ,message) checking-result)
+ (message " at %d:%d: %s: %s" line col type message))))))
+ (kill-emacs (if success 0 1)))
+ (ert-run-tests-batch-and-exit)))
diff --git a/clj-parse-test.el b/clj-parse-test.el
new file mode 100644
index 0000000000..d40577996c
--- /dev/null
+++ b/clj-parse-test.el
@@ -0,0 +1,41 @@
+;;; clj-parse-test.el --- Clojure/EDN parser
+
+;; Copyright (C) 2017 Arne Brasseur
+
+;; Author: Arne Brasseur <arne@arnebrasseur.net>
+;; Version: 0.1.0
+
+;; This program is free software; you can redistribute it and/or modify it
under
+;; the terms of the Mozilla Public License Version 2.0
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS
+;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+;; details.
+
+;; You should have received a copy of the Mozilla Public License along with
this
+;; program. If not, see <https://www.mozilla.org/media/MPL/2.0/index.txt>.
+
+;;; Commentary:
+
+;; A reader for EDN data files and parser for Clojure source files.
+
+;;; Code:
+
+(require 'clj-parse)
+(require 'ert)
+
+(ert-deftest clj-parse-test ()
+ (with-temp-buffer
+ (insert "()")
+ (goto-char 1)
+ (should (equal (clj-parse) '(()))))
+
+ (with-temp-buffer
+ (insert "(1)")
+ (goto-char 1)
+ (should (equal (clj-parse) '((1))))))
+
+(provide 'clj-parse-test)
+
+;;; clj-parse-test.el ends here
diff --git a/clj-parse.el b/clj-parse.el
index e3aeb6c7c0..e240610c3e 100644
--- a/clj-parse.el
+++ b/clj-parse.el
@@ -4,7 +4,8 @@
;; Author: Arne Brasseur <arne@arnebrasseur.net>
;; Keywords: lisp
-;; Package-Requires: ((let-alist ""))
+;; Package-Requires: ((let-alist "1.0.5"))
+;; Version: 0.1.0
;; This program is free software; you can redistribute it and/or modify it
under
;; the terms of the Mozilla Public License Version 2.0
@@ -28,6 +29,8 @@
;; Before emacs 25.1 it's an ELPA package
(require 'let-alist)
+(require 'clj-lex)
+
(defun clj-parse ()
(clj-parse* 'clj-parse-elisp-reducer))
@@ -62,92 +65,5 @@
(setq token (clj-lex-next)))
stack))
-(defun clj-lex-whitespace ()
- (let* ((pos (point)))
- (while (or (equal (char-after (point)) ?\ )
- (equal (char-after (point)) ?\t)
- (equal (char-after (point)) ?\n)
- (equal (char-after (point)) ?\r)
- (equal (char-after (point)) ?,))
- (right-char))
- `((type . :whitespace) (form . ,(buffer-substring-no-properties pos
(point))) (pos . ,pos))))
-
-
-(defun clj-lex-number ()
- (let* ((pos (point)))
- (while (and (char-after (point))
- (or (and (<= ?0 (char-after (point))) (<= (char-after (point))
?9))
- (eq (char-after (point)) ?.)
- (eq (char-after (point)) ?M)
- (eq (char-after (point)) ?r)))
- (right-char))
- (let* ((num-str (buffer-substring-no-properties pos (point))))
- ;; TODO handle radix, bignuM
- `((type . :number)
- (value . ,(string-to-number num-str))
- (form . ,num-str)
- (pos . ,pos)))))
-
-(defun clj-lex-next ()
- (if (eq (point) (point-max))
- `((type . :eof) (pos . ,(point)))
- (let ((char (char-after (point)))
- (pos (point)))
- (cond
- ((or (equal char ?\ )
- (equal char ?\t)
- (equal char ?\n)
- (equal char ?\r)
- (equal char ?,))
- (clj-lex-whitespace))
-
- ((equal char ?\()
- (right-char)
- `((type . :lparen) (pos . ,pos)))
-
- ((equal char ?\))
- (right-char)
- `((type . :rparen) (pos . ,pos)))
-
- ((and (<= ?0 char) (<= char ?9))
- (clj-lex-number))
-
- ":("))))
-
-(ert-deftest clj-parse-test ()
- (with-temp-buffer
- (insert "()")
- (goto-char 1)
- (should (equal (clj-parse) '(()))))
-
- (with-temp-buffer
- (insert "(1)")
- (goto-char 1)
- (should (equal (clj-parse) '((1))))))
-
-(ert-deftest clj-lex-next-test ()
- (with-temp-buffer
- (insert "()")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :lparen) (pos . 1))))
- (should (equal (clj-lex-next) '((type . :rparen) (pos . 2))))
- (should (equal (clj-lex-next) '((type . :eof) (pos . 3)))))
-
- (with-temp-buffer
- (insert "123")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :number)
- (value . 123)
- (form . "123")
- (pos . 1)))))
-
- (with-temp-buffer
- (insert " \t \n")
- (goto-char 1)
- (should (equal (clj-lex-next) '((type . :whitespace) (form . " \t \n")
(pos . 1))))))
-
-
-
(provide 'clj-parse)
;;; clj-parse.el ends here
-123
- [nongnu] elpa/parseclj dc0d165b0a 152/185: Merge pull request #23 from clojure-emacs/read-one, (continued)
- [nongnu] elpa/parseclj dc0d165b0a 152/185: Merge pull request #23 from clojure-emacs/read-one, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 62c9bf9126 177/185: Remove the last remains of a.el, restructure requires, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 517a371616 166/185: Use map-elt instead of parseclj-alist-get, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj ba04dbe334 171/185: Remove remaining a-list call, move a.el to be test-only, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 48abe456c6 155/185: Update the installation instructions, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj b234692020 157/185: error on unmatched closing paren/brace, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1bb3800f8f 162/185: Update CHANGELOG, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj fcebf65075 180/185: Provide parseclj-alist-merge for older Emacsen, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj eff9411268 161/185: Merge pull request #26 from ikappaki/master, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 689ebddbdd 158/185: Add support for shebang and symbolic values, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 1e46607912 015/185: Split files into packages, More test setup,
ELPA Syncer <=
- [nongnu] elpa/parseclj a9dba19760 086/185: Clean up node and token types, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 9480ae09b3 068/185: push is destructive, in this case cons will do, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj f395b9cbcc 097/185: Move `parseclj--leaf-token-value` to `parseedn` module, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 91dd43667c 110/185: Fix `parseclj-ast--reduce-branch` for tags., ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 9a586f267d 103/185: Remove `parseedn` requirement from `parseclj`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj e65eb085ad 114/185: Remove duplicated test, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 811f35e05a 117/185: Loops reduction over the first 2 elements of the stack, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 5b4b222b4f 124/185: Return error token when there's invalid input in `parseclj-lex-next`, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj b26fadbc05 128/185: Get rid of `parseclj-lex-error-token` side-effect, ELPA Syncer, 2021/12/28
- [nongnu] elpa/parseclj 2ffadc6239 134/185: Mark OPTIONS as unused in `parseedn-reduce-leaf`, ELPA Syncer, 2021/12/28