esp8266at: change to nom 5

This commit is contained in:
Wladimir J. van der Laan 2019-12-31 23:19:41 +00:00
parent a59cbcd4ee
commit d128fdd4a8
2 changed files with 5 additions and 4 deletions

View File

@ -9,7 +9,7 @@ std = []
default = ["std"] default = ["std"]
[dependencies] [dependencies]
nom = { version = "4", default-features = false } nom = { version = "5", default-features = false }
[dev-dependencies] [dev-dependencies]
clap = "2" clap = "2"

View File

@ -1,6 +1,7 @@
/** Parser for ESP8266 AT responses */ /** Parser for ESP8266 AT responses */
use core::str; use core::str;
use nom::{Offset, digit, hex_digit}; use nom::Offset;
use nom::character::streaming::{digit1 as digit, hex_digit1 as hex_digit};
/** Connection type for CIPSTATUS etc */ /** Connection type for CIPSTATUS etc */
#[derive(Debug, Copy, Clone, PartialEq, Eq)] #[derive(Debug, Copy, Clone, PartialEq, Eq)]
@ -94,7 +95,7 @@ named!(num_i32<&[u8], i32>,
map_res!( map_res!(
recognize!( recognize!(
tuple!( tuple!(
opt!(one_of!(b"-")), opt!(one_of!("-")),
digit digit
) )
), ),
@ -117,7 +118,7 @@ named!(hex_u8<&[u8], u8>,
named!(qstr<&[u8], &[u8]>, named!(qstr<&[u8], &[u8]>,
do_parse!( do_parse!(
tag!(b"\"") >> tag!(b"\"") >>
a: escaped!(is_not!(b"\\\""), b'\\', one_of!(b"\"\\")) >> a: escaped!(is_not!("\\\""), '\\', one_of!("\"\\")) >>
//a: is_not!(b"\"") >> //a: is_not!(b"\"") >>
tag!(b"\"") >> tag!(b"\"") >>
( a ) ( a )