pub enum Token<'a> {
Number(&'a [u8]),
Name(&'a [u8]),
Keyword(&'a [u8]),
Delim(Delim),
Eof,
}Expand description
One syntactic token, borrowing from the file.
The tokenizer is deliberately shallow: it reports what shape a run of
bytes has, never what it means. Whether 12 is a length, an object
number, or an array element is the grammar’s business, so a number arrives
as Token::Number carrying its spelling and the value parse happens one
layer up.
Variants§
Number(&'a [u8])
A word whose every byte is in the numeric class. Spelling is kept
because --37, 1.2.3 and +-. all reach here, and only the value
parse decides what they are worth.
Name(&'a [u8])
A name, without its leading slash and before escape decoding. An
empty slice is the valid empty name /.
Keyword(&'a [u8])
A keyword or any other run of regular bytes: obj, endstream,
true, or junk.
Delim(Delim)
A punctuation token: one delimiter, or the paired << and >>.
Eof
The file ended before another token began.