diff options
| author | Teddy Wing | 2018-11-01 04:26:52 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-11-01 04:41:57 +0100 |
| commit | 6658bb238d87f2182f3c2a6119b86c5fdea9b36b (patch) | |
| tree | ab0a3f65104c97edb9fd6a0386aa8eed89ca6d3c /build.rs | |
| parent | 13e90c090923a209e5e26fb3e609d5d12f737f53 (diff) | |
| download | dome-key-map-6658bb238d87f2182f3c2a6119b86c5fdea9b36b.tar.bz2 | |
parser: Propagate errors to the root parser
Thanks to Arnavion on Mozilla#rust for clueing me into this:
> The documentation starts with "A parser in this library can be
> described as a function which takes some input and if it is
> successful, returns a value together with the remaining input."
> Key phrase being "with the remaining input"
> So I assume it just matches as best as it can (which is nothing, in
> your case)
> Maybe you want to use some one-or-more combinator rather than many
> which is a zero-or-more combinator
> Then add your own check that "the remaining input" is empty
Replacing my `many()` parsers with `many1()` correctly propagates errors
up from sub-parers. Nice!
This will fail when we try to parse an empty string, but we can just add
a special case for that to parse successfully.
Diffstat (limited to 'build.rs')
0 files changed, 0 insertions, 0 deletions
