diff options
author | Colin Okay <cbeok@protonmail.com> | 2020-09-24 16:31:05 -0500 |
---|---|---|
committer | Colin Okay <cbeok@protonmail.com> | 2020-09-24 16:31:05 -0500 |
commit | 174f4686444f13b1e944af807864dc8c8133bd44 (patch) | |
tree | de65aa75edc910cb6f81f616aefb59177fbeed16 | |
parent | 8ad16d7f71ebce2f69f8df7aebfda5bf5715019c (diff) |
addded note about gotchas using <<or
-rw-r--r-- | parzival.lisp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/parzival.lisp b/parzival.lisp index 71bb6c0..9f80fef 100644 --- a/parzival.lisp +++ b/parzival.lisp @@ -182,7 +182,12 @@ CONDITION is true, then the THEN parser is run, otherwise the ELSE parser is run (defun <<or (&rest parsers) "Tries each parser one after the other, rewinding the input stream after each - failure, and resulting in the first successful parse." + failure, and resulting in the first successful parse. + + Hence, the order in which the parsers appear is significant. As a + general rule, you should list the most specific parsers first. + + E.g. (<<string \"foobar\") is more specific than (<<string \"foo\")" (cond ((null parsers) <fail<) ((null (cdr parsers)) (car parsers)) (t |