apollo-parser@0.8.6
Fixes
-
Correct EOF location reporting for empty input - Abdel-Monaam-Aouini, pull/1021
When lexing an empty input, the parser reported the EOF token one byte past
the end of the source. This caused downstream consumers (error reporters,
span lookups) to point past the file when surfacing diagnostics for empty
documents. The lexer now reports EOF at the actual end of the input.
Maintenance
-
Use
peek_token()instead ofpeek_data().unwrap()- surajk-m, pull/1028, pull/900There were a few places where we called
peek()to check an upcoming token's
kind, and thenpeek_data().unwrap()to check its value. For example, to
identify what type of definition is coming up:type,union, or something
else, like in this code snippet
here.The
unwrap()call was valid in those cases, but it can be improved. For it
to continue to be valid, the current token must not change between those
calls, and this is not statically verifiable. A mistake in a refactor could
disconnect thepeek()andpeek_data()calls and the unwrap could panic.This change replaces these specific uses of
peek_data().unwrap()with
peek_token().