Skip to main content

SwiftElementType

Enum SwiftElementType 

Source
#[repr(u8)]
pub enum SwiftElementType {
Show 155 variants Whitespace = 0, Newline = 1, Comment = 2, Identifier = 3, Error = 4, Eof = 5, NumberLiteral = 6, StringLiteral = 7, CharLiteral = 8, BooleanLiteral = 9, Class = 10, Struct = 11, Enum = 12, Protocol = 13, Extension = 14, Func = 15, Var = 16, Let = 17, Init = 18, Deinit = 19, Subscript = 20, Typealias = 21, Import = 22, If = 23, Else = 24, Switch = 25, Case = 26, Default = 27, For = 28, While = 29, Repeat = 30, Do = 31, Break = 32, Continue = 33, Fallthrough = 34, Return = 35, Throw = 36, Try = 37, Catch = 38, Finally = 39, Guard = 40, Defer = 41, Public = 42, Private = 43, Internal = 44, Fileprivate = 45, Open = 46, Static = 47, Final = 48, Override = 49, Mutating = 50, Nonmutating = 51, Lazy = 52, Weak = 53, Unowned = 54, Optional = 55, Required = 56, Convenience = 57, Dynamic = 58, Infix = 59, Prefix = 60, Postfix = 61, Any = 62, AnyObject = 63, Self_ = 64, Type = 65, Protocol_ = 66, True = 67, False = 68, Nil = 69, As = 70, Is = 71, In = 72, Where = 73, Associatedtype = 74, Operator = 75, Precedencegroup = 76, Indirect = 77, Rethrows = 78, Throws = 79, Inout = 80, Plus = 81, Minus = 82, Star = 83, Slash = 84, Percent = 85, Equal = 86, NotEqual = 87, Less = 88, Greater = 89, LessEqual = 90, GreaterEqual = 91, LogicalAnd = 92, LogicalOr = 93, LogicalNot = 94, BitAnd = 95, BitOr = 96, BitXor = 97, BitNot = 98, LeftShift = 99, RightShift = 100, Assign = 101, PlusAssign = 102, MinusAssign = 103, StarAssign = 104, SlashAssign = 105, PercentAssign = 106, AndAssign = 107, OrAssign = 108, XorAssign = 109, LeftShiftAssign = 110, RightShiftAssign = 111, Question = 112, QuestionQuestion = 113, Dot = 114, Arrow = 115, Range = 116, ClosedRange = 117, LeftParen = 118, RightParen = 119, LeftBracket = 120, RightBracket = 121, LeftBrace = 122, RightBrace = 123, Comma = 124, Semicolon = 125, Colon = 126, At = 127, Hash = 128, Dollar = 129, Underscore = 130, Backslash = 131, SourceFile = 132, FunctionDeclaration = 133, Parameter = 134, ParameterList = 135, VariableDeclaration = 136, ClassDeclaration = 137, StructDeclaration = 138, EnumDeclaration = 139, ProtocolDeclaration = 140, IfStatement = 141, WhileStatement = 142, ForStatement = 143, ReturnStatement = 144, BreakStatement = 145, ContinueStatement = 146, ExpressionStatement = 147, Block = 148, BinaryExpression = 149, UnaryExpression = 150, CallExpression = 151, MemberExpression = 152, IdentifierExpression = 153, LiteralExpression = 154,
}
Expand description

Element types for the Swift parser.

Variants§

§

Whitespace = 0

Whitespace characters.

§

Newline = 1

Line breaks.

§

Comment = 2

Comments.

§

Identifier = 3

Identifiers.

§

Error = 4

Error element.

§

Eof = 5

End of stream.

§

NumberLiteral = 6

Numeric literals.

§

StringLiteral = 7

String literals.

§

CharLiteral = 8

Character literals.

§

BooleanLiteral = 9

Boolean literals.

§

Class = 10

The class keyword.

§

Struct = 11

The struct keyword.

§

Enum = 12

The enum keyword.

§

Protocol = 13

The protocol keyword.

§

Extension = 14

The extension keyword.

§

Func = 15

The func keyword.

§

Var = 16

The var keyword.

§

Let = 17

The let keyword.

§

Init = 18

The init keyword.

§

Deinit = 19

The deinit keyword.

§

Subscript = 20

The subscript keyword.

§

Typealias = 21

The typealias keyword.

§

Import = 22

The import keyword.

§

If = 23

The if keyword.

§

Else = 24

The else keyword.

§

Switch = 25

The switch keyword.

§

Case = 26

The case keyword.

§

Default = 27

The default keyword.

§

For = 28

The for keyword.

§

While = 29

The while keyword.

§

Repeat = 30

The repeat keyword.

§

Do = 31

The do keyword.

§

Break = 32

The break keyword.

§

Continue = 33

The continue keyword.

§

Fallthrough = 34

The fallthrough keyword.

§

Return = 35

The return keyword.

§

Throw = 36

The throw keyword.

§

Try = 37

The try keyword.

§

Catch = 38

The catch keyword.

§

Finally = 39

The finally keyword.

§

Guard = 40

The guard keyword.

§

Defer = 41

The defer keyword.

§

Public = 42

The public keyword.

§

Private = 43

The private keyword.

§

Internal = 44

The internal keyword.

§

Fileprivate = 45

The fileprivate keyword.

§

Open = 46

The open keyword.

§

Static = 47

The static keyword.

§

Final = 48

The final keyword.

§

Override = 49

The override keyword.

§

Mutating = 50

The mutating keyword.

§

Nonmutating = 51

The nonmutating keyword.

§

Lazy = 52

The lazy keyword.

§

Weak = 53

The weak keyword.

§

Unowned = 54

The unowned keyword.

§

Optional = 55

The optional keyword.

§

Required = 56

The required keyword.

§

Convenience = 57

The convenience keyword.

§

Dynamic = 58

The dynamic keyword.

§

Infix = 59

The infix keyword.

§

Prefix = 60

The prefix keyword.

§

Postfix = 61

The postfix keyword.

§

Any = 62

The Any keyword.

§

AnyObject = 63

The AnyObject keyword.

§

Self_ = 64

The self keyword.

§

Type = 65

The Self keyword.

§

Protocol_ = 66

The Protocol keyword.

§

True = 67

The true keyword.

§

False = 68

The false keyword.

§

Nil = 69

The nil keyword.

§

As = 70

The as keyword.

§

Is = 71

The is keyword.

§

In = 72

The in keyword.

§

Where = 73

The where keyword.

§

Associatedtype = 74

The associatedtype keyword.

§

Operator = 75

The operator keyword.

§

Precedencegroup = 76

The precedencegroup keyword.

§

Indirect = 77

The indirect keyword.

§

Rethrows = 78

The rethrows keyword.

§

Throws = 79

The throws keyword.

§

Inout = 80

The inout keyword.

§

Plus = 81

Plus operator (+).

§

Minus = 82

Minus operator (-).

§

Star = 83

Multiplication operator (*).

§

Slash = 84

Division operator (/).

§

Percent = 85

Modulo operator (%).

§

Equal = 86

Equality operator (==).

§

NotEqual = 87

Inequality operator (!=).

§

Less = 88

Less than operator (<).

§

Greater = 89

Greater than operator (>).

§

LessEqual = 90

Less than or equal to operator (<=).

§

GreaterEqual = 91

Greater than or equal to operator (>=).

§

LogicalAnd = 92

Logical AND operator (&&).

§

LogicalOr = 93

Logical OR operator (||).

§

LogicalNot = 94

Logical NOT operator (!).

§

BitAnd = 95

Bitwise AND operator (&).

§

BitOr = 96

Bitwise OR operator (|).

§

BitXor = 97

Bitwise XOR operator (^).

§

BitNot = 98

Bitwise NOT operator (~).

§

LeftShift = 99

Left shift operator (<<).

§

RightShift = 100

Right shift operator (>>).

§

Assign = 101

Assignment operator (=).

§

PlusAssign = 102

Plus assignment operator (+=).

§

MinusAssign = 103

Minus assignment operator (-=).

§

StarAssign = 104

Multiplication assignment operator (*=).

§

SlashAssign = 105

Division assignment operator (/=).

§

PercentAssign = 106

Modulo assignment operator (%=).

§

AndAssign = 107

Bitwise AND assignment operator (&=).

§

OrAssign = 108

Bitwise OR assignment operator (|=).

§

XorAssign = 109

Bitwise XOR assignment operator (^=).

§

LeftShiftAssign = 110

Left shift assignment operator (<<=).

§

RightShiftAssign = 111

Right shift assignment operator (>>=).

§

Question = 112

Question mark (?).

§

QuestionQuestion = 113

Nil-coalescing operator (??).

§

Dot = 114

Dot operator (.).

§

Arrow = 115

Arrow operator (->).

§

Range = 116

Half-open range operator (..<).

§

ClosedRange = 117

Closed range operator (...).

§

LeftParen = 118

Left parenthesis (().

§

RightParen = 119

Right parenthesis ()).

§

LeftBracket = 120

Left bracket ([).

§

RightBracket = 121

Right bracket (]).

§

LeftBrace = 122

Left brace ({).

§

RightBrace = 123

Right brace (}).

§

Comma = 124

Comma (,).

§

Semicolon = 125

Semicolon (;).

§

Colon = 126

Colon (:).

§

At = 127

At sign (@).

§

Hash = 128

Hash sign (#).

§

Dollar = 129

Dollar sign ($).

§

Underscore = 130

Underscore (_).

§

Backslash = 131

Backslash (\).

§

SourceFile = 132

Source file node.

§

FunctionDeclaration = 133

Function declaration node.

§

Parameter = 134

Parameter node.

§

ParameterList = 135

Parameter list node.

§

VariableDeclaration = 136

Variable declaration node.

§

ClassDeclaration = 137

Class declaration node.

§

StructDeclaration = 138

Struct declaration node.

§

EnumDeclaration = 139

Enum declaration node.

§

ProtocolDeclaration = 140

Protocol declaration node.

§

IfStatement = 141

If statement node.

§

WhileStatement = 142

While statement node.

§

ForStatement = 143

For statement node.

§

ReturnStatement = 144

Return statement node.

§

BreakStatement = 145

Break statement node.

§

ContinueStatement = 146

Continue statement node.

§

ExpressionStatement = 147

Expression statement node.

§

Block = 148

Code block node.

§

BinaryExpression = 149

Binary expression node.

§

UnaryExpression = 150

Unary expression node.

§

CallExpression = 151

Function call expression node.

§

MemberExpression = 152

Member access expression node.

§

IdentifierExpression = 153

Identifier expression node.

§

LiteralExpression = 154

Literal expression node.

Implementations§

Source§

impl SwiftElementType

Source

pub fn is_trivia(&self) -> bool

Returns true if this element type is trivia (whitespace, newline, or comment).

Trait Implementations§

Source§

impl Clone for SwiftElementType

Source§

fn clone(&self) -> SwiftElementType

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 SwiftElementType

Source§

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

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

impl<'de> Deserialize<'de> for SwiftElementType

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 ElementType for SwiftElementType

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 From<SwiftTokenType> for SwiftElementType

Source§

fn from(token: SwiftTokenType) -> Self

Converts to this type from the input type.
Source§

impl Hash for SwiftElementType

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 SwiftElementType

Source§

fn eq(&self, other: &SwiftElementType) -> 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 Serialize for SwiftElementType

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 Copy for SwiftElementType

Source§

impl Eq for SwiftElementType

Source§

impl StructuralPartialEq for SwiftElementType

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>,