json_syntax/parse/
null.rs

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