Commit Graph

76 Commits

Author SHA1 Message Date
Geoffroy Couprie
ab7211e2fc remove some character parsers
list of removed parsers: eol, alpha, digit, hex_digit, oct_digit,
alphanumeric, space, multispace

Those parsers were aliases of other parsers, like alpha being an alias
of alias1. So they are still present, this is just reducing the number
of functions to choose from
2019-04-26 16:12:36 +02:00
Geoffroy Couprie
3fffcd61fc fix imports 2019-04-21 18:27:28 +02:00
Geoffroy Couprie
ee5aeb0d0b merge the macros.rs and nom.rs modules in the combinator module 2019-04-20 12:16:38 +02:00
Geoffroy Couprie
d85878e26a remove usage of CompleteByteSlice and CompleteStr
since we now have specialized versions of a lot of parsers for streaming
or complete input cases, we can remove the awkward types CompleteByteSlice
and CompleteStr, along with uses of the AtEof trait that were present in
most combinators.
This change simplifies the code, and shows (especially in the arithmetic
expressions parser tests) that the new function based solution can
perform the same work as macros while simplifying the code on complete
input
2019-04-17 12:14:15 +02:00
Geoffroy Couprie
4b31ffee2f make speciaized versiuons of most character level parsers 2019-04-15 15:15:14 +02:00
Geoffroy Couprie
9e2bd27f2d move the character level parsers from the nom module to character 2019-04-15 10:05:49 +02:00
Geoffroy Couprie
55bac0bfa8 fmt 2018-02-17 15:06:43 +01:00
Geoffroy Couprie
81f19c160e simplify the ini test 2018-02-11 21:50:36 +01:00
Geoffroy Couprie
9a4a7668b1 fmt 2018-01-18 15:32:53 +01:00
Geoffroy Couprie
6d5b23632d fix Incomplete usage in many* parsers
this is a breaking change in their behaviour:
- if they receive an empty input, they will return incomplete (if not at
eof)
- if they reach the end of input without the child parser returning an
error, they will return Incomplete

while this may break some parsers, this behaviour is more logical with
the rest of nom and much stricter
2018-01-13 16:44:21 +01:00
Geoffroy Couprie
47deaa1d03 many0 should not return until its child parser fails
if we reached the end of input, test with at_eof, to see if we should
return the whole input slice or not.
This will potentially break some existing parsers that rely on many0
trying to consume everything, but this behaviour is more correct and
aligned with the rest of nom
2018-01-11 19:29:46 +01:00
Geoffroy Couprie
a53febdfdf set the max line width at 140 2017-12-10 21:40:59 +01:00
Geoffroy Couprie
87d8370064 more rustfmt fixes 2017-12-10 21:05:22 +01:00
Geoffroy Couprie
e58efb7f93 start using rustfmt 2017-12-10 19:50:12 +01:00
Roman Proskuryakov
1946fb0ddb Fix casting character literal to u8
Signed-off-by: Geoffroy Couprie <geo.couprie@gmail.com>
2017-12-10 00:20:00 +01:00
Geoffroy Couprie
54d1fae5b9 use error conversion everywhere
if type inference for the error type (E) still appear, it means I forgot
to use error conversion somewhere
2017-09-21 12:04:53 +02:00
Geoffroy Couprie
6a15807cd4 move from IResult to Result
this will make it easier to be compatible with other crates like
error_chain, and we can reuse a lot of code coming for free with
Result. Incomplete is merged into the error side. I still do not
consider it to be an error,but this side will also contain unrecoverable
errors at some point (errors that cause alt and others to return
instead of testing the next branch), so it will be easier to put it in
this enum.
2017-09-07 14:32:20 +02:00
Geoffroy Couprie
d435822e15 use the simplified INI parser in the test 2017-03-23 16:22:54 +01:00
Geoffroy Couprie
ef1811667e move the ini benches to their own files 2017-03-23 11:44:27 +01:00
Utkarsh Kukreti
967bfca6af Add a simple benchmark to both ini and ini_str parsers.
These can be run on Rust Nightly using:

    cargo bench --features nightly --test ini

and

    cargo bench --features nightly --test ini_str

On my machine, these currently run at around 99 MB/s and 101 MB/s
respectively (best of many runs).
2017-03-21 20:59:10 +05:30
Utkarsh Kukreti
9728862088 perf(tests/ini{,_str}): remove unnecessary cloning and refactor 2017-03-11 14:21:42 +05:30
Marc-Antoine Perennou
5007ca2ea0 tests/ini: don't use chain!
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-10-22 15:23:58 +02:00
Antoine Catton
6828ecff15 Use named!() for the ini parser 2016-07-09 23:53:28 +02:00
Geoffroy Couprie
575518e488 Replace a use of chain with tuple! and try_parse! 2016-02-08 18:14:19 +01:00
Dabo Ross
a182c0027f Use for _ in &vec {} instead of for _ in vec.iter() {} 2015-09-11 13:59:54 -07:00
Geoffroy Couprie
bcaf4d3114 Realign stuff and remove warnings 2015-04-25 14:30:54 +02:00
Geoffroy Couprie
d4f8d7ade7 Integrate the new error reporting types 2015-04-25 14:22:47 +02:00
CrimsonVoid
973309e248 Fully qualify types in macros 2015-04-25 04:15:06 -05:00
Geoffroy Couprie
01de866760 Pass str::from_utf8 to some parsers instead of from_utf8 2015-04-23 12:03:57 +02:00
Geoffroy Couprie
f39912cc19 remove a log message 2015-04-12 19:38:11 +02:00
Geoffroy Couprie
bf1d06a9cb Remove unused feature gates. Remove some warnings 2015-03-30 16:13:31 +02:00
Geoffroy Couprie
3bf10e873d update to rustc b0fd67b3e 2015-03-26 12:46:41 +01:00
Geoffroy Couprie
009370b86a take_until* are now embeddable in other macros 2015-03-24 06:57:24 +01:00
Geoffroy Couprie
b088922be1 make take_until! and take_until_either! not consume the input
This makes much more sense that way, the common case should be to
leave the separator, as it is more explicit
2015-03-24 06:53:57 +01:00
Geoffroy Couprie
b03892ce49 remove a few other function definitions 2015-03-20 01:52:24 +01:00
Geoffroy Couprie
de6affa81c Update to latest rustc 2015-03-20 01:02:02 +01:00
Geoffroy Couprie
fe3da10323 remove two sueless functions from the ini parser 2015-03-19 22:38:33 +01:00
Geoffroy Couprie
0626155080 Add map!, map_opt! and map_res! combinators 2015-03-19 18:42:17 +01:00
Geoffroy Couprie
92a1861d41 remove some warnings 2015-03-19 15:45:34 +01:00
Geoffroy Couprie
7023b43094 Allow nested chain tags 2015-03-19 15:26:25 +01:00
Geoffroy Couprie
6817f46595 remove some usage of fold macros 2015-03-19 12:01:40 +01:00
Geoffroy Couprie
012ea5f763 New unnamed parser syntax 2015-03-18 12:41:48 +01:00
Geoffroy Couprie
232f6766c6 Incomplete can hold either a needed size, or an unknown size 2015-03-01 23:49:04 +01:00
Kevin Butler
d2006d3c59 Use AsBytes trait for improved API aesthetics 2015-02-25 14:14:06 +00:00
Geoffroy Couprie
e6ca611f0c Do not use as_bytes so much 2015-02-25 14:31:37 +01:00
Geoffroy Couprie
e121f0aa6f Remove useless lifetime declarations 2015-02-20 18:51:40 +01:00
Geoffroy Couprie
8a46dd2bcc Remove some warnings and update the slicing syntax 2015-02-17 18:33:10 +01:00
Geoffroy Couprie
a62148a917 At last, rename the traits to something more sensible 2015-02-17 17:40:41 +01:00
Geoffroy Couprie
a4a5482a3d Adapt the INI parser to optional parsing in chain 2015-02-17 16:34:44 +01:00
Geoffroy Couprie
fefa5b748a Put the closure at the end of the chain parser 2015-02-16 14:54:49 +01:00