[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a06220c 42/60: Update README
From: |
Junpeng Qiu |
Subject: |
[elpa] master a06220c 42/60: Update README |
Date: |
Tue, 25 Oct 2016 17:45:15 +0000 (UTC) |
branch: master
commit a06220cf36736dc206c07f77b646b03e9d02106c
Author: Junpeng Qiu <address@hidden>
Commit: Junpeng Qiu <address@hidden>
Update README
---
README.org | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/README.org b/README.org
index faa1805..97e9214 100644
--- a/README.org
+++ b/README.org
@@ -60,7 +60,8 @@ So we can
Note:
- =parsec-str= and =parsec-string= are different. =parsec-string= behaves the
same as =string= in Haskell, and =parsec-str= is more like combining
- =string= and =try= in Haskell.
+ =string= and =try= in Haskell. Personally I found =parsec-str= easier to
use
+ because =parsec-str= is "atomic", which is similar to =parsec-ch=.
- Use the power of regular expressions provided by =parsec-re= and simplify
the parser!
** Parser Combinators
@@ -151,7 +152,7 @@ So we can
(parsec-string "*/"))))
#+END_SRC
- THe equivalent Haskell program:
+ The following Haskell program does a similar thing:
#+BEGIN_SRC haskell
import Text.Parsec
@@ -263,6 +264,19 @@ So we can
least the error message could tell us some information. Yeah, not perfect but
usable.
+ To test whether a parser returns an error, use =parsec-error-p=. If it
returns
+ an error, you can use =parsec-error-str= to retrieve the error message as a
+ string.
+
+ You can decide what to do based on the return value of a parser:
+ #+BEGIN_SRC elisp
+ (let ((res (parsec-with-input "hello"
+ (parsec-str "world"))))
+ (if (parsec-error-p res)
+ (message "Parser failed:\n%s" (parsec-error-str res))
+ (message "Parser succeeded by returning %s" res)))
+ #+END_SRC
+
* Acknowledgement
- Daan Leijen for Haskell's Parsec
- [[https://github.com/jwiegley/][John Wiegley]] for
[[https://github.com/jwiegley/emacs-pl][emacs-pl]]
- [elpa] master c61a38c 22/60: Add convenient newline methods, (continued)
- [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, 2016/10/25
- [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 <=
- [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
- [elpa] master 3827d26 36/60: Add docs for user-interface functions & combinators, Junpeng Qiu, 2016/10/25
- [elpa] master 8c108be 56/60: Add parsec-peek and parsec-peek-p, Junpeng Qiu, 2016/10/25
- [elpa] master 6001a70 12/60: Refine and add more parsec API, Junpeng Qiu, 2016/10/25
- [elpa] master da878fa 18/60: Use parsec-query for other return values, Junpeng Qiu, 2016/10/25