Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
#[repr(u32)]
pub enum SyntaxKind {
Show 180 variants Whitespace = 0, LineComment = 1, DocComment = 2, RegionComment = 3, EndRegionComment = 4, LineContinuation = 5, NewlinePhys = 6, Bom = 7, Newline = 8, Indent = 9, Dedent = 10, Int = 11, Float = 12, String = 13, StringName = 14, NodePath = 15, Ident = 16, True = 17, False = 18, Null = 19, ConstPi = 20, ConstTau = 21, ConstInf = 22, ConstNan = 23, IfKw = 24, ElifKw = 25, ElseKw = 26, ForKw = 27, WhileKw = 28, MatchKw = 29, WhenKw = 30, BreakKw = 31, ContinueKw = 32, PassKw = 33, ReturnKw = 34, VarKw = 35, ConstKw = 36, EnumKw = 37, FuncKw = 38, StaticKw = 39, SignalKw = 40, ClassKw = 41, ClassNameKw = 42, ExtendsKw = 43, IsKw = 44, InKw = 45, AsKw = 46, SelfKw = 47, SuperKw = 48, VoidKw = 49, AwaitKw = 50, PreloadKw = 51, AssertKw = 52, BreakpointKw = 53, NotKw = 54, AndKw = 55, OrKw = 56, YieldKw = 57, NamespaceKw = 58, TraitKw = 59, LParen = 60, RParen = 61, LBrack = 62, RBrack = 63, LBrace = 64, RBrace = 65, Comma = 66, Colon = 67, Semicolon = 68, Dot = 69, DotDot = 70, Ellipsis = 71, At = 72, Dollar = 73, Percent = 74, Amp = 75, Arrow = 76, ColonEq = 77, Plus = 78, Minus = 79, Star = 80, Slash = 81, StarStar = 82, Eq = 83, EqEq = 84, Neq = 85, Lt = 86, Gt = 87, Le = 88, Ge = 89, AmpAmp = 90, PipePipe = 91, Bang = 92, Tilde = 93, Pipe = 94, Caret = 95, Shl = 96, Shr = 97, PlusEq = 98, MinusEq = 99, StarEq = 100, SlashEq = 101, StarStarEq = 102, PercentEq = 103, AmpEq = 104, PipeEq = 105, CaretEq = 106, ShlEq = 107, ShrEq = 108, Error = 109, Eof = 110, SourceFile = 111, ExtendsClause = 112, ClassNameDecl = 113, Annotation = 114, AnnotationArgList = 115, InnerClassDecl = 116, ClassBody = 117, FuncDecl = 118, ParamList = 119, Param = 120, VarargParam = 121, VarDecl = 122, ConstDecl = 123, EnumDecl = 124, EnumVariant = 125, SignalDecl = 126, PropertyBody = 127, Getter = 128, Setter = 129, Name = 130, TypeRef = 131, TypedArray = 132, TypedDict = 133, Block = 134, IfStmt = 135, ElifClause = 136, ElseClause = 137, ForStmt = 138, WhileStmt = 139, MatchStmt = 140, MatchArm = 141, ReturnStmt = 142, BreakStmt = 143, ContinueStmt = 144, PassStmt = 145, AssertStmt = 146, BreakpointStmt = 147, ExprStmt = 148, VarStmt = 149, PatternLiteral = 150, PatternBind = 151, PatternWildcard = 152, PatternArray = 153, PatternDict = 154, PatternRest = 155, PatternGuard = 156, BinExpr = 157, UnaryExpr = 158, TernaryExpr = 159, CastExpr = 160, IsExpr = 161, InExpr = 162, CallExpr = 163, ArgList = 164, IndexExpr = 165, FieldExpr = 166, AwaitExpr = 167, LambdaExpr = 168, ParenExpr = 169, ArrayLit = 170, DictLit = 171, DictEntry = 172, NameRef = 173, Literal = 174, GetNodeExpr = 175, UniqueNodeExpr = 176, PreloadExpr = 177, ErrorNode = 178, Tombstone = 179,
}
Expand description

Every terminal and non-terminal kind in the GDScript syntax tree.

Variants are grouped: trivia, synthetic block-structure, literals/names, keywords, built-in constant names, punctuation/operators, error tokens, then grammar-production nodes. Tombstone is kept last as the count sentinel.

Variants§

§

Whitespace = 0

A run of spaces and/or tabs.

§

LineComment = 1

# ... to end of line.

§

DocComment = 2

## ... documentation comment (feeds hover later).

§

RegionComment = 3

#region ... fold-region opener (a comment, flagged for folding).

§

EndRegionComment = 4

#endregion ... fold-region closer.

§

LineContinuation = 5

A \ immediately before a newline — joins the logical line.

§

NewlinePhys = 6

A physical line break (\n, \r\n, or \r). The pre-pass keeps it as trivia for losslessness and emits a synthetic SyntaxKind::Newline where a statement actually terminates.

§

Bom = 7

A UTF-8 byte-order mark (U+FEFF). Some editors prepend one to a saved .gd file; Godot strips a leading BOM, so we keep it as its own trivia token (not Whitespace — that would mis-count the first line’s indentation by 3 bytes, and not an Error — the file is valid GDScript).

§

Newline = 8

Logical statement terminator (outside brackets, not after a continuation).

§

Indent = 9

Block open — indentation increased.

§

Dedent = 10

Block close — indentation decreased (possibly several in a row).

§

Int = 11

Integer literal: 45, 0x8f51, 0b101010, 12_345.

§

Float = 12

Float literal: 3.14, .5, 1., 58.1e-10.

§

String = 13

String literal: "...", '...', """...""", '''...''', raw r"...".

§

StringName = 14

StringName literal: &"..." / &'...'.

§

NodePath = 15

NodePath literal: ^"..." / ^'...'.

§

Ident = 16

An identifier: [A-Za-z_][A-Za-z0-9_]*.

§

True = 17

§

False = 18

§

Null = 19

§

ConstPi = 20

§

ConstTau = 21

§

ConstInf = 22

§

ConstNan = 23

§

IfKw = 24

§

ElifKw = 25

§

ElseKw = 26

§

ForKw = 27

§

WhileKw = 28

§

MatchKw = 29

§

WhenKw = 30

§

BreakKw = 31

§

ContinueKw = 32

§

PassKw = 33

§

ReturnKw = 34

§

VarKw = 35

§

ConstKw = 36

§

EnumKw = 37

§

FuncKw = 38

§

StaticKw = 39

§

SignalKw = 40

§

ClassKw = 41

§

ClassNameKw = 42

§

ExtendsKw = 43

§

IsKw = 44

§

InKw = 45

§

AsKw = 46

§

SelfKw = 47

§

SuperKw = 48

§

VoidKw = 49

§

AwaitKw = 50

§

PreloadKw = 51

§

AssertKw = 52

§

BreakpointKw = 53

§

NotKw = 54

§

AndKw = 55

§

OrKw = 56

§

YieldKw = 57

Deprecated since GDScript 2.0 — still lexed so we can diagnose it.

§

NamespaceKw = 58

Reserved but unused — lexed to reject as an identifier.

§

TraitKw = 59

Reserved but unused.

§

LParen = 60

§

RParen = 61

§

LBrack = 62

§

RBrack = 63

§

LBrace = 64

§

RBrace = 65

§

Comma = 66

§

Colon = 67

§

Semicolon = 68

§

Dot = 69

§

DotDot = 70

§

Ellipsis = 71

§

At = 72

§

Dollar = 73

§

Percent = 74

§

Amp = 75

§

Arrow = 76

§

ColonEq = 77

§

Plus = 78

§

Minus = 79

§

Star = 80

§

Slash = 81

§

StarStar = 82

§

Eq = 83

§

EqEq = 84

§

Neq = 85

§

Lt = 86

§

Gt = 87

§

Le = 88

§

Ge = 89

§

AmpAmp = 90

§

PipePipe = 91

§

Bang = 92

§

Tilde = 93

§

Pipe = 94

§

Caret = 95

§

Shl = 96

§

Shr = 97

§

PlusEq = 98

§

MinusEq = 99

§

StarEq = 100

§

SlashEq = 101

§

StarStarEq = 102

§

PercentEq = 103

§

AmpEq = 104

§

PipeEq = 105

§

CaretEq = 106

§

ShlEq = 107

§

ShrEq = 108

§

Error = 109

An unlexable byte — carried into the tree (never dropped) for losslessness.

§

Eof = 110

Virtual end-of-input. Used by the parser; never emitted into the tree.

§

SourceFile = 111

§

ExtendsClause = 112

§

ClassNameDecl = 113

§

Annotation = 114

§

AnnotationArgList = 115

§

InnerClassDecl = 116

§

ClassBody = 117

§

FuncDecl = 118

§

ParamList = 119

§

Param = 120

§

VarargParam = 121

§

VarDecl = 122

§

ConstDecl = 123

§

EnumDecl = 124

§

EnumVariant = 125

§

SignalDecl = 126

§

PropertyBody = 127

§

Getter = 128

§

Setter = 129

§

Name = 130

§

TypeRef = 131

§

TypedArray = 132

§

TypedDict = 133

§

Block = 134

§

IfStmt = 135

§

ElifClause = 136

§

ElseClause = 137

§

ForStmt = 138

§

WhileStmt = 139

§

MatchStmt = 140

§

MatchArm = 141

§

ReturnStmt = 142

§

BreakStmt = 143

§

ContinueStmt = 144

§

PassStmt = 145

§

AssertStmt = 146

§

BreakpointStmt = 147

§

ExprStmt = 148

§

VarStmt = 149

§

PatternLiteral = 150

§

PatternBind = 151

§

PatternWildcard = 152

§

PatternArray = 153

§

PatternDict = 154

§

PatternRest = 155

§

PatternGuard = 156

§

BinExpr = 157

§

UnaryExpr = 158

§

TernaryExpr = 159

§

CastExpr = 160

§

IsExpr = 161

§

InExpr = 162

§

CallExpr = 163

§

ArgList = 164

§

IndexExpr = 165

§

FieldExpr = 166

§

AwaitExpr = 167

§

LambdaExpr = 168

§

ParenExpr = 169

§

ArrayLit = 170

§

DictLit = 171

§

DictEntry = 172

§

NameRef = 173

§

Literal = 174

§

GetNodeExpr = 175

§

UniqueNodeExpr = 176

§

PreloadExpr = 177

§

ErrorNode = 178

§

Tombstone = 179

Count sentinel — keep last (drives the u32 ↔ kind range).

Implementations§

Source§

impl SyntaxKind

Source

pub const fn is_trivia(self) -> bool

Trivia carry source bytes but are skipped by the parser (re-attached by the tree sink). The synthetic Newline/Indent/Dedent markers are not trivia — the parser consumes them to recover block structure.

Source

pub const fn is_synthetic_layout(self) -> bool

The synthetic, zero-width block-structure markers injected by the pre-pass.

Source

pub const fn is_node(self) -> bool

Whether this kind is a node (grammar production) rather than a token.

Trait Implementations§

Source§

impl Clone for SyntaxKind

Source§

fn clone(&self) -> SyntaxKind

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 SyntaxKind

Source§

impl Debug for SyntaxKind

Source§

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

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

impl Eq for SyntaxKind

Source§

impl Hash for SyntaxKind

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 SyntaxKind

Source§

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

Source§

impl Syntax for SyntaxKind

Source§

fn from_raw(raw: RawSyntaxKind) -> Self

Construct a semantic item kind from the compact representation.
Source§

fn into_raw(self) -> RawSyntaxKind

Convert a semantic item kind into a more compact representation.
Source§

fn static_text(self) -> Option<&'static str>

Fixed text for a particular syntax kind. Implement for kinds that will only ever represent the same text, such as punctuation (like a semicolon), keywords (like fn), or operators (like <=). Read more

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

Source§

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

Compare self to key and return true if they are equal.
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.