1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::{
ast::*,
parser::{combinator::*, exchange::*},
};
use nom::Parser;
pub fn header_section(input: &str) -> ParseResult<Vec<Record>> {
tuple_((tag_("HEADER;"), header_entity_list, tag_("ENDSEC;")))
.map(|(_start, entities, _close)| entities)
.parse(input)
}
pub fn header_entity_list(input: &str) -> ParseResult<Vec<Record>> {
many1_(header_entity).parse(input)
}
pub fn header_entity(input: &str) -> ParseResult<Record> {
tuple_((simple_record, char_(';')))
.map(|(record, _semicolon)| record)
.parse(input)
}