Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/decode/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,12 @@ impl<'a> Parser<'a> {
fn parse_regular_array(&mut self, length: usize, depth: usize) -> ToonResult<Value> {
let mut items = Vec::new();

// Empty arrays: return immediately without consuming the trailing newline,
// so the caller's field-parsing loop can correctly check indentation.
if length == 0 {
return Ok(Value::Array(items));
}

match &self.current_token {
Token::Newline => {
self.skip_newlines()?;
Expand Down Expand Up @@ -1086,7 +1092,7 @@ impl<'a> Parser<'a> {
} else if matches!(self.current_token, Token::LeftBracket) {
self.parse_array(depth + 1)?
} else {
self.parse_primitive()?
self.parse_tabular_field_value()?
};

items.push(value);
Expand Down