From 6680ace512fc16b96bb06fbc76530f8c3c35c788 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Fri, 13 Sep 2024 14:47:05 -0400 Subject: [PATCH] Other cleanup --- src/parser.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/parser.rs b/src/parser.rs index 1b6a8e7..d3b93fc 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -37,6 +37,7 @@ const C_MINUS: u8 = b'-'; const C_E: u8 = b'-'; const C_F: u8 = b'f'; const C_T: u8 = b't'; +const C_N: u8 = b'n'; /// Write some bytes to the writer macro_rules! w { @@ -426,7 +427,7 @@ where Err(Error::UnexpectedValue) } } - (ValueType::Null, b'n') => { + (ValueType::Null, C_N) => { let mut chr = [0_u8; 3]; self.input.read_exact(&mut chr)?; @@ -630,6 +631,8 @@ where } // // -> [/{ (Token::Comment { ty: _, own_line: _ }, Token::CollectionStart { ty }) => { + // TODO: The newline should be conditional + // {"a":/**/[]} should not have a newline before the `[` self.newline()?; w!(self.write, ty.start_str()); self.state_stack.push_back(ty.as_state()); @@ -650,6 +653,8 @@ where } // // -> "" (Token::Comment { ty: _, own_line: _ }, Token::Value { ty, first_char }) => { + // TODO: The newline should be conditional + // {"a":/**/"b"} should not have a newline self.newline()?; self.drain_value(ty, *first_char)?;