diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-12-06 18:03:14 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-12-06 18:03:14 -0300 |
commit | 18b36cc11c208c18422a9327abd52861c165d5d3 (patch) | |
tree | be6618440d0129fe45f84f5bb715206bbe51f2b3 /parser.lisp | |
parent | 1d6874e060fce727616017f73149bef197f69d7b (diff) | |
download | monparser-18b36cc11c208c18422a9327abd52861c165d5d3.tar.gz monparser-18b36cc11c208c18422a9327abd52861c165d5d3.zip |
Reduce iterators with optional and many
Diffstat (limited to 'parser.lisp')
-rw-r--r-- | parser.lisp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/parser.lisp b/parser.lisp index 2da9975..989938b 100644 --- a/parser.lisp +++ b/parser.lisp @@ -84,15 +84,9 @@ (defun optional (p) (either p nothing)) -(defun zero-or-more (p) - (either (comp ((x p) - (xs (zero-or-more p))) - (cons x xs)) - nothing)) - -(defun one-or-more (p) +(defun many (p) (comp ((x p) - (xs (zero-or-more p))) + (xs (optional (many p)))) (cons x xs))) (defun separated-list (p separator) |