Skip to content

Commit

Permalink
fix missing intermediate events (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack-Q authored Jun 27, 2024
1 parent ab15b7a commit 579c5e8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions taskweaver/utils/json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ def process_ev_queue() -> Iterable[ParserEvent]:

for ev in result:
if not ev.is_end:
yield ev
continue
evt = ev.event
val = ev.value
Expand Down Expand Up @@ -468,15 +469,20 @@ def parse_json(token_stream: Iterable[str], skip_after_root: bool = False) -> An
skip_after_root=skip_after_root,
include_all_values=True,
):
if ev.prefix == "" and ev.event in [
# all value closing events
"end_map",
"end_array",
"number",
"string",
"boolean",
"null",
]:
if (
ev.prefix == ""
and ev.is_end
and ev.event
in [
# all value closing events
"end_map",
"end_array",
"number",
"string",
"boolean",
"null",
]
):
ev_queue.append(ev)
assert len(ev_queue) == 1
return ev_queue[0].value

0 comments on commit 579c5e8

Please sign in to comment.