[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 32809ad 30/60: Add parsec-error-new-2
From: |
Junpeng Qiu |
Subject: |
[elpa] master 32809ad 30/60: Add parsec-error-new-2 |
Date: |
Tue, 25 Oct 2016 17:45:14 +0000 (UTC) |
branch: master
commit 32809ad80d5af6281a5a70727c74ecd659c73364
Author: Junpeng Qiu <address@hidden>
Commit: Junpeng Qiu <address@hidden>
Add parsec-error-new-2
---
parsec-tests.el | 18 +++++++-----------
parsec.el | 11 +++++++----
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/parsec-tests.el b/parsec-tests.el
index 5e8abd0..63721b3 100644
--- a/parsec-tests.el
+++ b/parsec-tests.el
@@ -27,10 +27,6 @@
(require 'ert)
(require 'parsec)
-(defun test-parsec-error-new (expected found)
- (parsec-error-new (format "Found \"%s\" -> Expected \"%s\""
- found expected)))
-
(ert-deftest test-parsec-ch ()
(should
(equal
@@ -88,7 +84,7 @@
(parsec-with-input "\ra"
(parsec-eol)
(parsech-ch ?a))
- (test-parsec-error-new "\n" "a"))))
+ (parsec-error-new-2 "\n" "a"))))
(ert-deftest test-parsec-eof ()
(should
@@ -153,7 +149,7 @@
(parsec-with-input "abc"
(parsec-or (parsec-string "ac")
(parsec-ch ?a)))
- (test-parsec-error-new "c" "b")))
+ (parsec-error-new-2 "c" "b")))
(should
(equal
(parsec-with-input "abc"
@@ -173,7 +169,7 @@
(parsec-with-input "124"
(parsec-or (parsec-string "13")
(parsec-ch ?1)))
- (test-parsec-error-new "3" "2")))
+ (parsec-error-new-2 "3" "2")))
(should
(equal
(parsec-with-input "124"
@@ -262,12 +258,12 @@
(parsec-many-as-string (parsec-ch ?c))
(parsec-many1-as-string (parsec-ch ?b))
(parsec-many1-as-string (parsec-ch ?c))))
- (test-parsec-error-new "c" "`EOF'")))
+ (parsec-error-new-2 "c" "`EOF'")))
(should
(equal
(parsec-with-input "abababaa"
(parsec-many1-as-string (parsec-string "ab")))
- (test-parsec-error-new "b" "a")))
+ (parsec-error-new-2 "b" "a")))
(should
(equal
(parsec-with-input "abababaa"
@@ -364,7 +360,7 @@
(parsec-or
(parsec-string "ac")
(parsec-many-as-string (parsec-letter)))))
- (test-parsec-error-new "c" "b"))))
+ (parsec-error-new-2 "c" "b"))))
(ert-deftest test-parsec-count ()
(should
@@ -379,7 +375,7 @@
(equal
(parsec-with-input "ab"
(parsec-option "opt" (parsec-string "ac")))
- (test-parsec-error-new "c" "b")))
+ (parsec-error-new-2 "c" "b")))
(should
(equal
(parsec-with-input "ab"
diff --git a/parsec.el b/parsec.el
index d6283a0..8c9b2e2 100644
--- a/parsec.el
+++ b/parsec.el
@@ -41,6 +41,10 @@
(defun parsec-error-new (msg)
(cons 'parsec-error msg))
+(defun parsec-error-new-2 (expected found)
+ (parsec-error-new (format "Found \"%s\" -> Expected \"%s\""
+ found expected)))
+
(defun parsec-error-p (obj)
(and (consp obj)
(eq (car obj) 'parsec-error)))
@@ -59,10 +63,9 @@
(when (or (stringp msg)
(and (stringp expected)
(stringp found)))
- (parsec-error-new (if (stringp msg)
- msg
- (format "Found \"%s\" -> Expected \"%s\""
- found expected))))))))
+ (if (stringp msg)
+ (parsec-error-new msg)
+ (parsec-error-new-2 expected found)))))))
(defun parsec-ch (ch)
(let ((next-char (char-after)))
- [elpa] master 8f0c266 58/60: Add doc for parsec-peek(-p), (continued)
- [elpa] master 8f0c266 58/60: Add doc for parsec-peek(-p), Junpeng Qiu, 2016/10/25
- [elpa] master ffd42de 45/60: Use simple-csv-parser.el as a demo, Junpeng Qiu, 2016/10/25
- [elpa] master bf49fb6 38/60: Upate README, Junpeng Qiu, 2016/10/25
- [elpa] master 966ca9e 43/60: Add comments to parsec.el, Junpeng Qiu, 2016/10/25
- [elpa] master c61a38c 22/60: Add convenient newline methods, Junpeng Qiu, 2016/10/25
- [elpa] master 0c3408a 01/60: Init commit, Junpeng Qiu, 2016/10/25
- [elpa] master 1929932 02/60: Split into two files, Junpeng Qiu, 2016/10/25
- [elpa] master fd77961 25/60: Add a few simple API, Junpeng Qiu, 2016/10/25
- [elpa] master 12d2ad6 24/60: Bug fixes, Junpeng Qiu, 2016/10/25
- [elpa] master adf4706 20/60: Add many-till, notFollowedBy and fix others, Junpeng Qiu, 2016/10/25
- [elpa] master 32809ad 30/60: Add parsec-error-new-2,
Junpeng Qiu <=
- [elpa] master 3503e4a 13/60: Rename for easier understanding, Junpeng Qiu, 2016/10/25
- [elpa] master 4fb2abe 29/60: Update simple-csv-parser, Junpeng Qiu, 2016/10/25
- [elpa] master fa2e6f1 27/60: Add gitignore, Junpeng Qiu, 2016/10/25
- [elpa] master a06220c 42/60: Update README, Junpeng Qiu, 2016/10/25
- [elpa] master f7e8629 26/60: Add tests, Junpeng Qiu, 2016/10/25
- [elpa] master bc11325 50/60: Add file examples/.nosearch, Junpeng Qiu, 2016/10/25
- [elpa] master 1da4344 32/60: Update url-str-parser, Junpeng Qiu, 2016/10/25
- [elpa] master 89dd2ac 54/60: Fix some wording in README, Junpeng Qiu, 2016/10/25
- [elpa] master 55515ca 48/60: Add missing dependencies, Junpeng Qiu, 2016/10/25
- [elpa] master 2e9f962 59/60: Add new package parsec to externals-list, Junpeng Qiu, 2016/10/25