pub enum PpTokenKind {
Ident,
Number,
CharConst,
StringLit,
HeaderName,
Punct(Punct),
Other,
Eof,
}Expand description
What a preprocessing token is.
Deliberately not #[non_exhaustive]. A new pp-token category has to break every match
that reads one, because there is no sensible default for “some category I have not heard
of” in a preprocessor.
Variants§
Ident
An identifier, or a keyword. The lexer does not know which; that is phase 7’s job and
it depends on -std=, per spec/06-lexer-and-parser.md section 6.1.
Number
A preprocessing number, in the loose phase 3 grammar.
CharConst
A character constant, including any L, u, U or u8 prefix and both quotes.
StringLit
A string literal, including any prefix and both quotes.
HeaderName
A <stdio.h> or "local.h" header name. Only produced by
Lexer::header_name, because whether one is even
possible here is a fact about the directive being parsed and the scanner has no way to
know it.
Punct(Punct)
A punctuator.
Other
A byte that is not part of any other category, such as a stray backtick. Legal as a pp-token, an error by phase 7 unless a macro ate it first.
Eof
End of the file. Carries an empty span at the end so that a diagnostic about a truncated construct has somewhere to point.
Trait Implementations§
Source§impl Clone for PpTokenKind
impl Clone for PpTokenKind
Source§fn clone(&self) -> PpTokenKind
fn clone(&self) -> PpTokenKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more