2019-05-27 11:34:01 +04:00
|
|
|
use std::fs::File;
|
|
|
|
use std::io::BufRead;
|
|
|
|
use std::io::BufReader;
|
|
|
|
|
2019-06-02 03:04:31 +04:00
|
|
|
use esp8266at::response::{parse,ParseResult};
|
2019-05-27 11:34:01 +04:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let f = File::open("data/parses.txt").unwrap();
|
|
|
|
let file = BufReader::new(&f);
|
|
|
|
for line in file.lines() {
|
|
|
|
let l = line.unwrap();
|
|
|
|
if l.len() >= 2 {
|
|
|
|
let mut lb = l[2..].as_bytes().to_vec();
|
|
|
|
lb.push(13);
|
|
|
|
lb.push(10);
|
2019-06-02 03:04:31 +04:00
|
|
|
let res = parse(&lb);
|
2019-05-27 11:34:01 +04:00
|
|
|
match res {
|
2019-06-02 03:04:31 +04:00
|
|
|
ParseResult::Err => {
|
2019-05-27 11:34:01 +04:00
|
|
|
println!("failed command was: {}", l);
|
|
|
|
}
|
2019-06-02 03:04:31 +04:00
|
|
|
ParseResult::Incomplete => {
|
|
|
|
println!("incomplete command was: {}", l);
|
|
|
|
}
|
|
|
|
ParseResult::Ok(res, x) => {
|
|
|
|
if res == lb.len() {
|
2019-05-27 11:34:01 +04:00
|
|
|
println!("{:?}", x);
|
|
|
|
} else {
|
|
|
|
println!("non-empty residue command was: {}", l);
|
|
|
|
println!("{:?} {:?}", res, x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|