Skip to content

Commit

Permalink
Fix a bug in parse_document_content.
Browse files Browse the repository at this point in the history
`peek(stream.input)` is a token instance, so it should be `in(typeof(peek(stream.input)), [A, B, C, D]`.
However, it is better to use `isa` and `Union`, as I mentioned in
JuliaData#161.
  • Loading branch information
Paalon committed Jun 12, 2024
1 parent 45f5cd2 commit f4e51f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ end


function parse_document_content(stream::EventStream)
if in(peek(stream.input), [DirectiveToken, DocumentStartToken, DocumentEndToken,StreamEndToken])
if peek(stream.input) isa Union{DirectiveToken, DocumentStartToken, DocumentEndToken,StreamEndToken}
event = process_empty_scalar(stream, peek(stream.input).span.start_mark)
stream.state = pop!(stream.states)
event
Expand Down

0 comments on commit f4e51f7

Please sign in to comment.