branch: master commit fdb3d9995958e90c63ad895ace26bab7c47f209f Author: Junpeng Qiu <qjpchm...@gmail.com> Commit: Junpeng Qiu <qjpchm...@gmail.com>
Fix some code in simple-csv-parser.el --- examples/simple-csv-parser-tests.el | 2 +- examples/simple-csv-parser.el | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/simple-csv-parser-tests.el b/examples/simple-csv-parser-tests.el index 1cb1e9d..d118c12 100644 --- a/examples/simple-csv-parser-tests.el +++ b/examples/simple-csv-parser-tests.el @@ -30,7 +30,7 @@ (ert-deftest test-simple-csv () (should (equal - (s-parse-csv "a1s,b,d,e,f\na,,c,d,") + (s-parse-csv "a1s,b,d,e,f\na,,c,d,\n") '(("a1s" "b" "d" "e" "f") ("a" "" "c" "d" ""))))) diff --git a/examples/simple-csv-parser.el b/examples/simple-csv-parser.el index 2132ecd..91feaed 100644 --- a/examples/simple-csv-parser.el +++ b/examples/simple-csv-parser.el @@ -27,15 +27,16 @@ (require 'parsec) (defun s-csv-file () - (parsec-many (s-csv-line))) + (parsec-return (parsec-many (s-csv-line)) + (parsec-eof))) (defun s-csv-line () - (prog1 (s-csv-cells) + (parsec-return (s-csv-cells) (s-csv-eol))) (defun s-csv-eol () (parsec-or (parsec-str "\n") - (parsec-eob))) + (parsec-eof))) (defun s-csv-cells () (cons (s-csv-cell-content) (s-csv-remaining-cells)))