branch: master commit c61a38c5eada1c33be1d08597e346c9559fa7ab6 Author: Junpeng Qiu <qjpchm...@gmail.com> Commit: Junpeng Qiu <qjpchm...@gmail.com>
Add convenient newline methods --- parsec.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/parsec.el b/parsec.el index 5153c84..453a116 100644 --- a/parsec.el +++ b/parsec.el @@ -89,11 +89,22 @@ (parsec-stop :expected (format "%s" pred) :found (parsec-eof-or-char-as-string))))) +(defun parsec-newline () + (parsec-ch ?\n)) + +(defun parsec-crlf () + (parsec-and (parsec-ch ?\r) (parsec-ch ?\n))) + +(defun parsec-eol () + (parsec-or (parsec-newline) (parsec-crlf))) + (defun parsec-eob () (unless (eobp) (parsec-stop :expected "`EOF'" :found (parsec-eof-or-char-as-string)))) +(defalias 'parsec-eof 'parsec-eob) + (defun parsec-re (regexp) (if (looking-at regexp) (progn (goto-char (match-end 0))