1pub(crate) mod u16str;
18pub(crate) mod word_info;
19
20use nom::number::complete::{le_u32, le_u8};
21use nom::Parser;
22
23use crate::dic::word_id::WordId;
24use crate::error::SudachiNomResult;
25
26pub fn u32_array_parser(input: &[u8]) -> SudachiNomResult<&[u8], Vec<u32>> {
27 let (rest, length) = le_u8(input)?;
28 nom::multi::count(le_u32, length as usize)(rest)
29}
30
31pub fn u32_wid_array_parser(input: &[u8]) -> SudachiNomResult<&[u8], Vec<WordId>> {
32 let (rest, length) = le_u8(input)?;
33 nom::multi::count(le_u32.map(WordId::from_raw), length as usize)(rest)
34}
35
36pub fn skip_wid_array(input: &[u8]) -> SudachiNomResult<&[u8], Vec<WordId>> {
37 let (rest, length) = le_u8(input)?;
38 let num_bytes = length as usize * 4;
39 let next = &rest[num_bytes..];
40 Ok((next, Vec::new()))
41}
42
43pub fn skip_u32_array(input: &[u8]) -> SudachiNomResult<&[u8], Vec<u32>> {
44 let (rest, length) = le_u8(input)?;
45 let num_bytes = length as usize * 4;
46 let next = &rest[num_bytes..];
47 Ok((next, Vec::new()))
48}
49
50pub fn u32_parser(input: &[u8]) -> SudachiNomResult<&[u8], u32> {
51 le_u32(input)
52}