Skip to main content

jstrict/parse/
null.rs

1use super::{Context, Error, Parse, Parser};
2use decoded_char::DecodedChar;
3
4impl Parse for () {
5	fn parse_in<C, E>(
6		parser: &mut Parser<C, E>,
7		_context: Context,
8	) -> Result<(Self, usize), Error<E>>
9	where
10		C: Iterator<Item = Result<DecodedChar, E>>,
11	{
12		let i = parser.begin_fragment();
13		match parser.next_char()? {
14			(_, Some('n')) => match parser.next_char()? {
15				(_, Some('u')) => match parser.next_char()? {
16					(_, Some('l')) => match parser.next_char()? {
17						(_, Some('l')) => {
18							parser.end_fragment(i);
19							Ok(((), i))
20						}
21						(p, unexpected) => Err(Error::unexpected(p, unexpected)),
22					},
23					(p, unexpected) => Err(Error::unexpected(p, unexpected)),
24				},
25				(p, unexpected) => Err(Error::unexpected(p, unexpected)),
26			},
27			(p, unexpected) => Err(Error::unexpected(p, unexpected)),
28		}
29	}
30}