Skip to main content

CTokenType

Enum CTokenType 

Source
#[repr(u16)]
pub enum CTokenType {
Show 101 variants LeftParen = 0, RightParen = 1, LeftBracket = 2, RightBracket = 3, LeftBrace = 4, RightBrace = 5, Comma = 6, Semicolon = 7, Colon = 8, Dot = 9, Question = 10, Plus = 11, Minus = 12, Star = 13, Slash = 14, Percent = 15, Assign = 16, PlusAssign = 17, MinusAssign = 18, StarAssign = 19, SlashAssign = 20, PercentAssign = 21, Equal = 22, NotEqual = 23, Less = 24, Greater = 25, LessEqual = 26, GreaterEqual = 27, LogicalAnd = 28, LogicalOr = 29, LogicalNot = 30, BitAnd = 31, BitOr = 32, BitXor = 33, BitNot = 34, LeftShift = 35, RightShift = 36, AndAssign = 37, OrAssign = 38, XorAssign = 39, LeftShiftAssign = 40, RightShiftAssign = 41, Increment = 42, Decrement = 43, Arrow = 44, Auto = 45, Break = 46, Case = 47, Char = 48, Const = 49, Continue = 50, Default = 51, Do = 52, Double = 53, Else = 54, Enum = 55, Extern = 56, Float = 57, For = 58, Goto = 59, If = 60, Inline = 61, Int = 62, Long = 63, Register = 64, Restrict = 65, Return = 66, Short = 67, Signed = 68, Sizeof = 69, Static = 70, Struct = 71, Switch = 72, Typedef = 73, Union = 74, Unsigned = 75, Void = 76, Volatile = 77, While = 78, Alignas = 79, Alignof = 80, Atomic = 81, Bool = 82, Complex = 83, Generic = 84, Imaginary = 85, Noreturn = 86, StaticAssert = 87, ThreadLocal = 88, Identifier = 89, StringLiteral = 90, CharConstant = 91, IntConstant = 92, FloatConstant = 93, Whitespace = 94, LineComment = 95, BlockComment = 96, Preprocessor = 97, Text = 98, Error = 99, Eof = 100,
}
Expand description

Represents different types of tokens in the C language.

Variants§

§

LeftParen = 0

Left parenthesis: (

§

RightParen = 1

Right parenthesis: )

§

LeftBracket = 2

Left bracket: [

§

RightBracket = 3

Right bracket: ]

§

LeftBrace = 4

Left brace: {

§

RightBrace = 5

Right brace: }

§

Comma = 6

Comma: ,

§

Semicolon = 7

Semicolon: ;

§

Colon = 8

Colon: :

§

Dot = 9

Dot: .

§

Question = 10

Question mark: ?

§

Plus = 11

Addition operator: +

§

Minus = 12

Subtraction operator: -

§

Star = 13

Multiplication operator: *

§

Slash = 14

Division operator: /

§

Percent = 15

Modulo operator: %

§

Assign = 16

Assignment operator: =

§

PlusAssign = 17

Addition assignment: +=

§

MinusAssign = 18

Subtraction assignment: -=

§

StarAssign = 19

Multiplication assignment: *=

§

SlashAssign = 20

Division assignment: /=

§

PercentAssign = 21

Modulo assignment: %=

§

Equal = 22

Equality comparison: ==

§

NotEqual = 23

Inequality comparison: !=

§

Less = 24

Less than: <

§

Greater = 25

Greater than: >

§

LessEqual = 26

Less than or equal: <=

§

GreaterEqual = 27

Greater than or equal: >=

§

LogicalAnd = 28

Logical AND: &&

§

LogicalOr = 29

Logical OR: ||

§

LogicalNot = 30

Logical NOT: !

§

BitAnd = 31

Bitwise AND: &

§

BitOr = 32

Bitwise OR: |

§

BitXor = 33

Bitwise XOR: ^

§

BitNot = 34

Bitwise NOT: ~

§

LeftShift = 35

Left shift: <<

§

RightShift = 36

Right shift: >>

§

AndAssign = 37

Bitwise AND assignment: &=

§

OrAssign = 38

Bitwise OR assignment: |=

§

XorAssign = 39

Bitwise XOR assignment: ^=

§

LeftShiftAssign = 40

Left shift assignment: <<=

§

RightShiftAssign = 41

Right shift assignment: >>=

§

Increment = 42

Increment: ++

§

Decrement = 43

Decrement: --

§

Arrow = 44

Arrow operator: ->

§

Auto = 45

auto keyword

§

Break = 46

break keyword

§

Case = 47

case keyword

§

Char = 48

char keyword

§

Const = 49

const keyword

§

Continue = 50

continue keyword

§

Default = 51

default keyword

§

Do = 52

do keyword

§

Double = 53

double keyword

§

Else = 54

else keyword

§

Enum = 55

enum keyword

§

Extern = 56

extern keyword

§

Float = 57

float keyword

§

For = 58

for keyword

§

Goto = 59

goto keyword

§

If = 60

if keyword

§

Inline = 61

inline keyword

§

Int = 62

int keyword

§

Long = 63

long keyword

§

Register = 64

register keyword

§

Restrict = 65

restrict keyword

§

Return = 66

return keyword

§

Short = 67

short keyword

§

Signed = 68

signed keyword

§

Sizeof = 69

sizeof keyword

§

Static = 70

static keyword

§

Struct = 71

struct keyword

§

Switch = 72

switch keyword

§

Typedef = 73

typedef keyword

§

Union = 74

union keyword

§

Unsigned = 75

unsigned keyword

§

Void = 76

void keyword

§

Volatile = 77

volatile keyword

§

While = 78

while keyword

§

Alignas = 79

_Alignas keyword

§

Alignof = 80

_Alignof keyword

§

Atomic = 81

_Atomic keyword

§

Bool = 82

_Bool keyword

§

Complex = 83

_Complex keyword

§

Generic = 84

_Generic keyword

§

Imaginary = 85

_Imaginary keyword

§

Noreturn = 86

_Noreturn keyword

§

StaticAssert = 87

_Static_assert keyword

§

ThreadLocal = 88

_Thread_local keyword

§

Identifier = 89

Identifier

§

StringLiteral = 90

String literal

§

CharConstant = 91

Character constant

§

IntConstant = 92

Integer constant

§

FloatConstant = 93

Floating-point constant

§

Whitespace = 94

Whitespace

§

LineComment = 95

Single-line comment

§

BlockComment = 96

Multi-line comment

§

Preprocessor = 97

Preprocessor directive

§

Text = 98

Raw text or unrecognized sequence

§

Error = 99

Invalid token

§

Eof = 100

End of stream

Implementations§

Source§

impl CTokenType

Source

pub fn is_keyword(&self) -> bool

Returns true if the token is a keyword.

Trait Implementations§

Source§

impl Clone for CTokenType

Source§

fn clone(&self) -> CTokenType

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CTokenType

Source§

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

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

impl Default for CTokenType

Source§

fn default() -> CTokenType

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CTokenType

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<CTokenType> for CElementType

Source§

fn from(token: CTokenType) -> Self

Converts to this type from the input type.
Source§

impl Hash for CTokenType

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 Ord for CTokenType

Source§

fn cmp(&self, other: &CTokenType) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for CTokenType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for CTokenType

Source§

fn partial_cmp(&self, other: &CTokenType) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for CTokenType

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TokenType for CTokenType

Source§

const END_OF_STREAM: Self = Self::Eof

The end of stream token.

Source§

type Role = UniversalTokenRole

The token role type.

Source§

fn is_ignored(&self) -> bool

Returns true if the token should be ignored during parsing.

Source§

fn is_comment(&self) -> bool

Returns true if the token is a comment.

Source§

fn is_whitespace(&self) -> bool

Returns true if the token is whitespace.

Source§

fn role(&self) -> Self::Role

Returns the role of the token.

Source§

fn is_role(&self, role: Self::Role) -> bool

Returns true if this token matches the specified language-specific role.
Source§

fn is_universal(&self, role: UniversalTokenRole) -> bool

Returns true if this token matches the specified universal role.
Source§

fn is_error(&self) -> bool

Returns true if this token represents an error condition.
Source§

fn is_end_of_stream(&self) -> bool

Returns true if this token represents the end of the input stream.
Source§

impl Copy for CTokenType

Source§

impl Eq for CTokenType

Source§

impl StructuralPartialEq for CTokenType

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 = Infallible

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,