Commit ad92d3e
authored
Fix the jsonish bug with no newline before object field (#1985)
Fix the jsonish bug with no newline before object field
<!-- ELLIPSIS_HIDDEN -->
----
> [!IMPORTANT]
> Fixes JSON parser bug for object fields without newline and adds test
for enum parsing without leading newline.
>
> - **Behavior**:
> - Fixes bug in `should_close_unescaped_string()` in
`json_parse_state.rs` to handle object fields without a newline.
> - Adds handling for identifiers as possible values in
`should_close_unescaped_string()`.
> - **Enums**:
> - Introduces `Pos` enum in `json_parse_state.rs` to manage parsing
states: `InNothing`, `Unknown`, `InObjectKey`, `InObjectValue`,
`InArray`.
> - **Tests**:
> - Adds `test_enum_without_leading_newline` in `test_class.rs` to
verify parsing of enums without leading newline.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for 4e47377. You can
[customize](https://app.ellipsis.dev/BoundaryML/settings/summaries) this
summary. It will automatically update as commits are pushed.</sup>
<!-- ELLIPSIS_HIDDEN -->1 parent 18b57dd commit ad92d3e
2 files changed
Lines changed: 47 additions & 15 deletions
File tree
- engine/baml-lib/jsonish/src
- jsonish/parser/fixing_parser
- tests
Lines changed: 24 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
22 | 31 | | |
23 | 32 | | |
24 | 33 | | |
| |||
128 | 137 | | |
129 | 138 | | |
130 | 139 | | |
131 | | - | |
| 140 | + | |
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
137 | | - | |
| 146 | + | |
138 | 147 | | |
139 | | - | |
| 148 | + | |
140 | 149 | | |
141 | 150 | | |
142 | | - | |
143 | | - | |
| 151 | + | |
| 152 | + | |
144 | 153 | | |
145 | 154 | | |
146 | 155 | | |
147 | | - | |
| 156 | + | |
148 | 157 | | |
149 | 158 | | |
150 | | - | |
| 159 | + | |
151 | 160 | | |
152 | 161 | | |
153 | 162 | | |
| |||
164 | 173 | | |
165 | 174 | | |
166 | 175 | | |
167 | | - | |
168 | | - | |
| 176 | + | |
| 177 | + | |
169 | 178 | | |
170 | 179 | | |
171 | 180 | | |
| |||
179 | 188 | | |
180 | 189 | | |
181 | 190 | | |
182 | | - | |
| 191 | + | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
| |||
198 | 207 | | |
199 | 208 | | |
200 | 209 | | |
201 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
202 | 214 | | |
203 | 215 | | |
204 | 216 | | |
| |||
291 | 303 | | |
292 | 304 | | |
293 | 305 | | |
294 | | - | |
| 306 | + | |
295 | 307 | | |
296 | 308 | | |
297 | 309 | | |
| |||
307 | 319 | | |
308 | 320 | | |
309 | 321 | | |
310 | | - | |
311 | 322 | | |
312 | 323 | | |
313 | 324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1490 | 1490 | | |
1491 | 1491 | | |
1492 | 1492 | | |
1493 | | - | |
1494 | 1493 | | |
1495 | 1494 | | |
1496 | 1495 | | |
| |||
1601 | 1600 | | |
1602 | 1601 | | |
1603 | 1602 | | |
1604 | | - | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
0 commit comments