Skip to content

Create a separated error code for "unexpected eof" and "unexpected NOT eof" #1259

@Lucretiel

Description

@Lucretiel

Currently, the error code ErrorKind::Eof is used interchangeably for two contradictory error situations:

  • eof and all_consuming both use it to report that an eof was expected, but more input was found.
  • anychar and many of the nom::number parsers use it to report that more input was expected, but an eof was found.

We should create a consistent pattern for these parsers and update the relevant ones to return a more appropriate code. My personal opinion is that Eof should be used to refer to "expected Eof" situations, and the other parsers should select different codes (for instance, anychar should return ErrorKind::Char).

Prerequisites

Here are a few things you should provide to help me understand the issue:

  • Rust version : rustc 1.48.0 (7eac88abb 2020-11-16)
  • nom version : 6.0.1
  • nom compilation features used: defaults

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions