Skip to main content

PpTokenKind

Enum PpTokenKind 

Source
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

Source§

fn clone(&self) -> PpTokenKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PpTokenKind

Source§

impl Debug for PpTokenKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PpTokenKind

Source§

impl Hash for PpTokenKind

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PpTokenKind

Source§

fn eq(&self, other: &PpTokenKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PpTokenKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.