rust: nom4 requires to add complete!() when using many! combinators

pull/3646/head
Pierre Chifflier 7 years ago committed by Victor Julien
parent 8c0cde36c6
commit f22695130b

@ -192,7 +192,7 @@ named!(pub parse_option<DHCPOption>,
/// Parse and return all the options. Upon the end of option indicator
/// all the data will be consumed.
named!(pub parse_all_options<Vec<DHCPOption>>, many0!(call!(parse_option)));
named!(pub parse_all_options<Vec<DHCPOption>>, many0!(complete!(call!(parse_option))));
pub fn dhcp_parse(input: &[u8]) -> IResult<&[u8], DHCPMessage> {
match parse_header(input) {

@ -179,7 +179,7 @@ fn dns_parse_answer<'a>(slice: &'a [u8], message: &'a [u8], count: usize)
let result: IResult<&'a [u8], Vec<Vec<u8>>> =
closure!(&'a [u8], do_parse!(
rdata: many_m_n!(1, n,
apply!(dns_parse_rdata, message, rrtype))
complete!(apply!(dns_parse_rdata, message, rrtype)))
>> (rdata)
))(data);
match result {

@ -672,7 +672,7 @@ named!(nfs4_res_readdir_ok<Nfs4ResponseReaddir>,
do_parse!(
_verifier: be_u64
// run parser until we find a 'value follows == 0'
>> listing: many_till!(call!(nfs4_res_readdir_entry), peek!(tag!(b"\x00\x00\x00\x00")))
>> listing: many_till!(complete!(call!(nfs4_res_readdir_entry)), peek!(tag!(b"\x00\x00\x00\x00")))
// value follows == 0 checked by line above
>> _value_follows: be_u32
>> eof: be_u32

@ -160,7 +160,7 @@ named!(pub parse_smb1_negotiate_protocol_record<Smb1NegotiateProtocolRecord>,
_wtc: le_u8
>> _bcc: le_u16
// dialects is a list of [1 byte buffer format][string][0 terminator]
>> dialects: many1!(take_until_and_consume!("\0"))
>> dialects: many1!(complete!(take_until_and_consume!("\0")))
>> (Smb1NegotiateProtocolRecord {
dialects
}))

Loading…
Cancel
Save