diff options
author | Boutade <thegoofist@protonmail.com> | 2019-05-03 16:00:27 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-05-03 16:00:27 -0500 |
commit | 614f605513f80db554efb3c90cb6c072265bb140 (patch) | |
tree | 756ffc8b97fe619c38a5eb0bdaa159e9f0ac3750 /parzival.lisp | |
parent | d6b9ef40b4e98752d7969c421d04a0cb2618ff4d (diff) |
added to the example json, cleaned up parzival.lisp
Diffstat (limited to 'parzival.lisp')
-rw-r--r-- | parzival.lisp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/parzival.lisp b/parzival.lisp index 4691a07..01e728a 100644 --- a/parzival.lisp +++ b/parzival.lisp @@ -335,20 +335,6 @@ the character C." (<<map-cons result (<<* parser)))))) - ;; (lambda (stream) - ;; (let ((result nil) - ;; (parser (<<~ parser))) - ;; (labels ((rec (stream) - ;; (multiple-value-bind - ;; (res ok? stream2) (funcall parser stream) - ;; (if ok? - ;; (progn - ;; (push res result) - ;; (rec stream2)) - ;; (values (nreverse result) t stream2))))) - ;; (rec stream))))) - - (defun <<+ (parser) "Like <<* but fails if P does not succeed at least once." (<<cons parser (<<* parser))) @@ -386,7 +372,6 @@ the character C." (<<cons value-parser (<<* (<<and separator-parser value-parser)))) - (defun <<brackets (left center right) (<<and left (<<bind center (lambda (bracketed-value) @@ -400,6 +385,7 @@ the character C." ;;; VALUE PARSERS. The following section contains utilities for parsing common ;;; values like strings or numbers. + (defun <<string (str) "Parses exactly the string STR, resulting in STR on success." (<<map (returning str) @@ -421,10 +407,12 @@ the character C." (<<def <whitespace< (<<* (<<or <space< <newline< <return< <linefeed< <tab<)) "Parses zero or more whitespace characters, returning them as a list") + (<<def <word< (<<to-string (<<+ <letter<)) "Parses a sequence of one or more letters characters, resulting in a string containing them.") + (defun read-from-char-list (l) (read-from-string (concatenate 'string l))) @@ -451,7 +439,6 @@ the character C." "Parses a fractional number in decimal format - e.g. .3234 or .002") - (<<def <real< (<<bind (<<? (<<char #\-)) (lambda (neg?) |