fixed all errors kind of

This commit is contained in:
nora 2022-02-13 23:29:29 +01:00
parent 5dc33f0dab
commit 30f9070cca
5 changed files with 1760 additions and 1478 deletions

View file

@ -140,7 +140,6 @@ pub fn timestamp(input: &[u8]) -> IResult<Timestamp> {
pub fn table(input: &[u8]) -> IResult<Table> {
let (input, len) = u32(Big)(input)?;
let (input, values) = count(table_value_pair, usize::try_from(len).unwrap())(input)?;
let table = HashMap::from_iter(values.into_iter());
Ok((input, table))
@ -215,9 +214,14 @@ fn field_value(input: &[u8]) -> IResult<FieldValue> {
number!(b"T", timestamp, u64(Big), Timestamp, R);
fn field_table(input: &[u8]) -> R {
let (input, _) = tag("F")(input)?;
table(input).map(|(input, value)| (input, FieldValue::FieldTable(value)))
}
fn void(input: &[u8]) -> R {
tag("V")(input).map(|(input, _)| (input, FieldValue::Void))
}
alt((
boolean,
short_short_int,
@ -235,5 +239,7 @@ fn field_value(input: &[u8]) -> IResult<FieldValue> {
long_str,
field_array,
timestamp,
field_table,
void,
))(input)
}