Skip to content

Commit

Permalink
Merge pull request #131 from inhabitedtype/advance-check
Browse files Browse the repository at this point in the history
advance-check: parser should fail on negative inputs
  • Loading branch information
seliopou authored Jan 24, 2018
2 parents 595ec59 + dabd476 commit 838f53c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/angstrom.ml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ let end_of_input =
| false -> fail "end_of_input"

let advance n =
{ run = fun input pos more _fail succ -> succ input (pos + n) more () }
if n < 0
then fail "advance"
else { run = fun input pos more _fail succ -> succ input (pos + n) more () }

let pos =
{ run = fun input pos more _fail succ -> succ input pos more pos }
Expand Down

0 comments on commit 838f53c

Please sign in to comment.