pub struct Token {
pub kind: TokenKind,
pub range: SourceRange,
pub bol: bool,
pub preceded_by_space: bool,
pub errors: Vec<Diagnostic>,
}Expand description
A lexed C token.
Fields§
§kind: TokenKindWhat the token is.
range: SourceRangeWhere it is.
bol: boolWhether it is the first token on its logical line (needed by the preprocessor to spot directives).
preceded_by_space: boolWhether whitespace or a comment preceded it (needed by the preprocessor’s stringification and macro replacement).
errors: Vec<Diagnostic>Everything wrong with this token, and with the text between it and the token before it.
The preprocessor reports what is wrong with the token
itself if and only if the token reaches its output. What stands
whatever becomes of the token — its spelling, and the comments that
preceded it — is reported as soon as the token is read from the file,
which is what keeps it from being lost when the token opens a directive,
names a macro or is an argument the macro drops; see
Diagnostic::lexical.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Token
Auto Trait Implementations§
impl Freeze for Token
impl RefUnwindSafe for Token
impl Send for Token
impl Sync for Token
impl Unpin for Token
impl UnsafeUnpin for Token
impl UnwindSafe for Token
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more