Skip to main content

CrystalElementType

Enum CrystalElementType 

Source
#[repr(u16)]
pub enum CrystalElementType {
Show 186 variants Whitespace = 0, Comment = 1, Identifier = 2, Number = 3, String = 4, Character = 5, Symbol = 6, ClassKeyword = 7, ModuleKeyword = 8, DefKeyword = 9, EndKeyword = 10, IfKeyword = 11, ElseKeyword = 12, ElsifKeyword = 13, UnlessKeyword = 14, CaseKeyword = 15, WhenKeyword = 16, ThenKeyword = 17, WhileKeyword = 18, UntilKeyword = 19, ForKeyword = 20, InKeyword = 21, DoKeyword = 22, BeginKeyword = 23, RescueKeyword = 24, EnsureKeyword = 25, BreakKeyword = 26, NextKeyword = 27, ReturnKeyword = 28, YieldKeyword = 29, SuperKeyword = 30, SelfKeyword = 31, TrueKeyword = 32, FalseKeyword = 33, NilKeyword = 34, AndKeyword = 35, OrKeyword = 36, NotKeyword = 37, Plus = 38, Minus = 39, Star = 40, Slash = 41, Percent = 42, StarStar = 43, Equal = 44, EqualEqual = 45, NotEqual = 46, Less = 47, LessEqual = 48, Greater = 49, GreaterEqual = 50, Spaceship = 51, Match = 52, NotMatch = 53, And = 54, Or = 55, Not = 56, BitwiseAnd = 57, BitwiseOr = 58, BitwiseXor = 59, BitwiseNot = 60, LeftShift = 61, RightShift = 62, LogicalAnd = 63, LogicalOr = 64, PlusEqual = 65, MinusEqual = 66, StarEqual = 67, SlashEqual = 68, PercentEqual = 69, StarStarEqual = 70, AndEqual = 71, OrEqual = 72, XorEqual = 73, LeftShiftEqual = 74, RightShiftEqual = 75, LogicalAndEqual = 76, LogicalOrEqual = 77, LeftParen = 78, RightParen = 79, LeftBrace = 80, RightBrace = 81, LeftBracket = 82, RightBracket = 83, Comma = 84, Semicolon = 85, Dot = 86, DotDot = 87, DotDotDot = 88, Colon = 89, DoubleColon = 90, Arrow = 91, FatArrow = 92, Question = 93, At = 94, DoubleAt = 95, Dollar = 96, Newline = 97, Eof = 98, Error = 99, Root = 100, Program = 101, SourceFile = 102, ClassDef = 103, ModuleDef = 104, MethodDef = 105, Block = 106, IfExpr = 107, UnlessExpr = 108, CaseExpr = 109, WhenClause = 110, WhileExpr = 111, UntilExpr = 112, ForExpr = 113, BeginExpr = 114, RescueClause = 115, EnsureClause = 116, CallExpr = 117, IndexExpr = 118, MemberExpr = 119, BinaryExpr = 120, UnaryExpr = 121, AssignExpr = 122, LiteralExpr = 123, IdentifierExpr = 124, ArrayExpr = 125, HashExpr = 126, HashPair = 127, BlockExpr = 128, LambdaExpr = 129, YieldExpr = 130, ReturnExpr = 131, BreakExpr = 132, NextExpr = 133, SuperExpr = 134, SelfExpr = 135, ParenExpr = 136, TypeExpr = 137, GenericType = 138, UnionType = 139, TupleType = 140, NamedTupleType = 141, ProcType = 142, Pattern = 143, IdentifierPattern = 144, LiteralPattern = 145, ArrayPattern = 146, HashPattern = 147, TuplePattern = 148, ParamList = 149, Param = 150, SplatParam = 151, DoubleSplatParam = 152, BlockParam = 153, Annotation = 154, MacroDef = 155, MacroCall = 156, MacroExpr = 157, Alias = 158, Include = 159, Extend = 160, Require = 161, Private = 162, Protected = 163, Public = 164, Abstract = 165, Virtual = 166, Override = 167, StructDef = 168, EnumDef = 169, UnionDef = 170, LibDef = 171, RaiseExpr = 172, RangeExpr = 173, ExclusiveRangeExpr = 174, RegexLiteral = 175, StringInterpolation = 176, InterpolationExpr = 177, SymbolLiteral = 178, ConstantRef = 179, InstanceVar = 180, ClassVar = 181, GlobalVar = 182, Getter = 183, Setter = 184, OperatorDef = 185,
}
Expand description

Enum representing all possible element types in Crystal.

Variants§

§

Whitespace = 0

Whitespace characters.

§

Comment = 1

Comments.

§

Identifier = 2

Identifiers.

§

Number = 3

Numeric literals.

§

String = 4

String literals.

§

Character = 5

Character literals.

§

Symbol = 6

Symbol literals.

§

ClassKeyword = 7

class keyword.

§

ModuleKeyword = 8

module keyword.

§

DefKeyword = 9

def keyword.

§

EndKeyword = 10

end keyword.

§

IfKeyword = 11

if keyword.

§

ElseKeyword = 12

else keyword.

§

ElsifKeyword = 13

elsif keyword.

§

UnlessKeyword = 14

unless keyword.

§

CaseKeyword = 15

case keyword.

§

WhenKeyword = 16

when keyword.

§

ThenKeyword = 17

then keyword.

§

WhileKeyword = 18

while keyword.

§

UntilKeyword = 19

until keyword.

§

ForKeyword = 20

for keyword.

§

InKeyword = 21

in keyword.

§

DoKeyword = 22

do keyword.

§

BeginKeyword = 23

begin keyword.

§

RescueKeyword = 24

rescue keyword.

§

EnsureKeyword = 25

ensure keyword.

§

BreakKeyword = 26

break keyword.

§

NextKeyword = 27

next keyword.

§

ReturnKeyword = 28

return keyword.

§

YieldKeyword = 29

yield keyword.

§

SuperKeyword = 30

super keyword.

§

SelfKeyword = 31

self keyword.

§

TrueKeyword = 32

true keyword.

§

FalseKeyword = 33

false keyword.

§

NilKeyword = 34

nil keyword.

§

AndKeyword = 35

and keyword.

§

OrKeyword = 36

or keyword.

§

NotKeyword = 37

not keyword.

§

Plus = 38

+ operator.

§

Minus = 39

- operator.

§

Star = 40

* operator.

§

Slash = 41

/ operator.

§

Percent = 42

% operator.

§

StarStar = 43

** operator.

§

Equal = 44

= operator.

§

EqualEqual = 45

== operator.

§

NotEqual = 46

!= operator.

§

Less = 47

< operator.

§

LessEqual = 48

<= operator.

§

Greater = 49

> operator.

§

GreaterEqual = 50

>= operator.

§

Spaceship = 51

<=> operator.

§

Match = 52

=~ operator.

§

NotMatch = 53

!~ operator.

§

And = 54

& operator.

§

Or = 55

| operator.

§

Not = 56

! operator.

§

BitwiseAnd = 57

& bitwise operator.

§

BitwiseOr = 58

| bitwise operator.

§

BitwiseXor = 59

^ bitwise operator.

§

BitwiseNot = 60

~ bitwise operator.

§

LeftShift = 61

<< operator.

§

RightShift = 62

>> operator.

§

LogicalAnd = 63

&& operator.

§

LogicalOr = 64

|| operator.

§

PlusEqual = 65

+= operator.

§

MinusEqual = 66

-= operator.

§

StarEqual = 67

*= operator.

§

SlashEqual = 68

/= operator.

§

PercentEqual = 69

%= operator.

§

StarStarEqual = 70

**= operator.

§

AndEqual = 71

&= operator.

§

OrEqual = 72

|= operator.

§

XorEqual = 73

^= operator.

§

LeftShiftEqual = 74

<<= operator.

§

RightShiftEqual = 75

>>= operator.

§

LogicalAndEqual = 76

&&= operator.

§

LogicalOrEqual = 77

||= operator.

§

LeftParen = 78

( symbol.

§

RightParen = 79

) symbol.

§

LeftBrace = 80

{ symbol.

§

RightBrace = 81

} symbol.

§

LeftBracket = 82

[ symbol.

§

RightBracket = 83

] symbol.

§

Comma = 84

, symbol.

§

Semicolon = 85

; symbol.

§

Dot = 86

. symbol.

§

DotDot = 87

.. symbol.

§

DotDotDot = 88

... symbol.

§

Colon = 89

: symbol.

§

DoubleColon = 90

:: symbol.

§

Arrow = 91

-> symbol.

§

FatArrow = 92

=> symbol.

§

Question = 93

? symbol.

§

At = 94

@ symbol.

§

DoubleAt = 95

@@ symbol.

§

Dollar = 96

$ symbol.

§

Newline = 97

Newline character.

§

Eof = 98

End of file.

§

Error = 99

Error element.

§

Root = 100

Root node.

§

Program = 101

Program node.

§

SourceFile = 102

Source file node.

§

ClassDef = 103

Class definition.

§

ModuleDef = 104

Module definition.

§

MethodDef = 105

Method definition.

§

Block = 106

Block node.

§

IfExpr = 107

if expression.

§

UnlessExpr = 108

unless expression.

§

CaseExpr = 109

case expression.

§

WhenClause = 110

when clause.

§

WhileExpr = 111

while expression.

§

UntilExpr = 112

until expression.

§

ForExpr = 113

for expression.

§

BeginExpr = 114

begin expression.

§

RescueClause = 115

rescue clause.

§

EnsureClause = 116

ensure clause.

§

CallExpr = 117

Call expression.

§

IndexExpr = 118

Index expression.

§

MemberExpr = 119

Member expression.

§

BinaryExpr = 120

Binary expression.

§

UnaryExpr = 121

Unary expression.

§

AssignExpr = 122

Assignment expression.

§

LiteralExpr = 123

Literal expression.

§

IdentifierExpr = 124

Identifier expression.

§

ArrayExpr = 125

Array expression.

§

HashExpr = 126

Hash expression.

§

HashPair = 127

Hash pair.

§

BlockExpr = 128

Block expression.

§

LambdaExpr = 129

Lambda expression.

§

YieldExpr = 130

yield expression.

§

ReturnExpr = 131

return expression.

§

BreakExpr = 132

break expression.

§

NextExpr = 133

next expression.

§

SuperExpr = 134

super expression.

§

SelfExpr = 135

self expression.

§

ParenExpr = 136

Parenthesized expression.

§

TypeExpr = 137

Type expression.

§

GenericType = 138

Generic type.

§

UnionType = 139

Union type.

§

TupleType = 140

Tuple type.

§

NamedTupleType = 141

Named tuple type.

§

ProcType = 142

Proc type.

§

Pattern = 143

Pattern node.

§

IdentifierPattern = 144

Identifier pattern.

§

LiteralPattern = 145

Literal pattern.

§

ArrayPattern = 146

Array pattern.

§

HashPattern = 147

Hash pattern.

§

TuplePattern = 148

Tuple pattern.

§

ParamList = 149

Parameter list.

§

Param = 150

Parameter node.

§

SplatParam = 151

Splat parameter.

§

DoubleSplatParam = 152

Double splat parameter.

§

BlockParam = 153

Block parameter.

§

Annotation = 154

Annotation node.

§

MacroDef = 155

Macro definition.

§

MacroCall = 156

Macro call.

§

MacroExpr = 157

Macro expression.

§

Alias = 158

Alias definition.

§

Include = 159

include statement.

§

Extend = 160

extend statement.

§

Require = 161

require statement.

§

Private = 162

private visibility.

§

Protected = 163

protected visibility.

§

Public = 164

public visibility.

§

Abstract = 165

abstract modifier.

§

Virtual = 166

virtual modifier.

§

Override = 167

override modifier.

§

StructDef = 168

Struct definition.

§

EnumDef = 169

Enum definition.

§

UnionDef = 170

Union definition.

§

LibDef = 171

Lib definition.

§

RaiseExpr = 172

raise expression.

§

RangeExpr = 173

Range expression.

§

ExclusiveRangeExpr = 174

Exclusive range expression.

§

RegexLiteral = 175

Regex literal.

§

StringInterpolation = 176

String interpolation.

§

InterpolationExpr = 177

Interpolation expression.

§

SymbolLiteral = 178

Symbol literal.

§

ConstantRef = 179

Constant reference.

§

InstanceVar = 180

Instance variable.

§

ClassVar = 181

Class variable.

§

GlobalVar = 182

Global variable.

§

Getter = 183

Getter method.

§

Setter = 184

Setter method.

§

OperatorDef = 185

Operator definition.

Implementations§

Source§

impl CrystalElementType

Source

pub fn is_trivia(&self) -> bool

Check if the syntax kind is trivia (whitespace, comment, or newline)

Source

pub fn is_keyword(self) -> bool

Check if the syntax kind is a keyword

Source

pub fn is_literal(self) -> bool

Check if the syntax kind is a literal

Source

pub fn is_operator(self) -> bool

Check if the syntax kind is an operator

Source

pub fn is_assignment_operator(self) -> bool

Check if the syntax kind is an assignment operator

Source

pub fn is_delimiter(self) -> bool

Check if the syntax kind is a delimiter

Trait Implementations§

Source§

impl Clone for CrystalElementType

Source§

fn clone(&self) -> CrystalElementType

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 CrystalElementType

Source§

impl Debug for CrystalElementType

Source§

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

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

impl<'de> Deserialize<'de> for CrystalElementType

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 Display for CrystalElementType

Source§

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

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

impl ElementType for CrystalElementType

Source§

type Role = UniversalElementRole

The associated role type for this element kind.
Source§

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

Returns the general syntactic role of this element. Read more
Source§

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

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

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

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

fn is_root(&self) -> bool

Returns true if this element represents the root of the parsed tree.
Source§

fn is_error(&self) -> bool

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

impl Eq for CrystalElementType

Source§

impl From<CrystalTokenType> for CrystalElementType

Source§

fn from(token: CrystalTokenType) -> Self

Converts to this type from the input type.
Source§

impl Hash for CrystalElementType

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 CrystalElementType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 Serialize for CrystalElementType

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 StructuralPartialEq for CrystalElementType

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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