nom_config_in/config_in.rs
1use nom::{multi::many0, sequence::delimited, IResult};
2use serde::Serialize;
3
4use crate::{
5 entry::{parse_entry, Entry},
6 util::ws_comment,
7 ConfigInInput,
8};
9
10#[derive(Debug, Serialize, Clone, PartialEq, Default)]
11pub struct ConfigIn {
12 pub file: String,
13 pub entries: Vec<Entry>,
14}
15
16pub fn parse_config(input: ConfigInInput) -> IResult<ConfigInInput, Vec<Entry>> {
17 delimited(ws_comment, many0(parse_entry), ws_comment)(input)
18}