Skip to content

Bug in attempt? #15

@ath

Description

@ath
;; works as expected
(run (attempt (p/char \space)) " ")
==> \space

;; expected nil
(run (attempt (p/char \space)) "")
==> Unexpected end of input at line: 1 column: 1
  [Thrown class java.lang.RuntimeException]

;; expected nil
(run (attempt (p/char \space)) "x")
==> Unexpected token 'x' at line: 1 column: 1
  [Thrown class java.lang.RuntimeException]

From the docstring “A parser that will attempt to parse p, and upon failure never consume any input” it was not clear to me, that attempt would throw an Exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions