Function mentat_parser_utils::value_and_span::is_valid_keyword_map_k_v [] [src]

pub fn is_valid_keyword_map_k_v<'a>(
    (k, v): (&'a ValueAndSpan, &'a ValueAndSpan)
) -> bool

A [k v] pair in the map form of a keyword map must have the shape [:k, [v1, v2, ...]], with none of v1, v2, ... a keyword: without loss of generality, we cannot represent the case where vn is a keyword :l, since [:k v1 v2 ... :l], isn't a valid keyword map in vector form. This function tests that a [k v] pair obeys these constraints.

If we didn't test this, then we might flatten a map [:k [:l]] to[:k :l]`, which isn't a valid keyword map in vector form.