Closed anish-palakurthi closed 2 weeks ago
To address the issue where the first line of an array cannot be a comment, follow these steps:
datamodel.pest
file to allow comments at the start of arrays.array = { "[" ~ (whitespaces? ~ comment_block ~ whitespaces? ~ value ~ ("," ~ value)*)? ~ "]" }
json_parse_state.rs
file to handle comments at the start of arrays.// In json_parse_state.rs, modify the logic to handle comments at the start of arrays
if let Some(JsonCollection::Array) = self.collection_stack.last() {
if let Some(JsonCollection::TrailingComment | JsonCollection::BlockComment) = self.collection_stack.get(self.collection_stack.len() - 2) {
// Handle the comment appropriately
}
}
These changes should allow comments to be the first line in an array and provide better error handling.
/engine/baml-lib/prompt-parser/src/parser/datamodel.pest /engine/baml-lib/jsonish/src/jsonish/parser/fixing_parser
Surface better error or fix Pest grammar to allow this