Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum SyntaxKind {
Show 40 variants SimpleMessage = 0, ComplexMessage = 1, InputDeclaration = 2, LocalDeclaration = 3, QuotedPattern = 4, Pattern = 5, Matcher = 6, Variant = 7, Expression = 8, MarkupOpen = 9, MarkupStandalone = 10, MarkupClose = 11, Function = 12, Option = 13, Attribute = 14, Variable = 15, Identifier = 16, QuotedLiteral = 17, Text = 18, Escape = 19, LiteralText = 20, UnquotedLiteral = 21, Name = 22, Star = 23, KwInput = 24, KwLocal = 25, KwMatch = 26, LBrace = 27, RBrace = 28, LBrace2 = 29, RBrace2 = 30, Pipe = 31, Dollar = 32, Colon = 33, Hash = 34, Slash = 35, At = 36, Equals = 37, Trivia = 38, Error = 39,
}
Expand description

What a node or token is.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

SimpleMessage = 0

Root of a simple message: one SyntaxKind::Pattern.

§

ComplexMessage = 1

Root of a complex message: declarations, then a body.

§

InputDeclaration = 2

.input {$name …}.

§

LocalDeclaration = 3

.local $name = {…}.

§

QuotedPattern = 4

{{ pattern }}.

§

Pattern = 5

Text and placeholders.

§

Matcher = 6

.match selectors variants.

§

Variant = 7

Keys and a quoted pattern.

§

Expression = 8

{operand :function @attribute}.

§

MarkupOpen = 9

{#name …}.

§

MarkupStandalone = 10

{#name … /}.

§

MarkupClose = 11

{/name …}.

§

Function = 12

:identifier options.

§

Option = 13

identifier = value.

§

Attribute = 14

@identifier [= literal].

§

Variable = 15

$name.

§

Identifier = 16

[namespace :] name.

§

QuotedLiteral = 17

|…|.

§

Text = 18

A run of text characters in a pattern (no escapes).

§

Escape = 19

A two-character escape sequence: \\, \{, \| or \}.

§

LiteralText = 20

A run of characters inside a quoted literal (no escapes).

§

UnquotedLiteral = 21

An unquoted literal.

§

Name = 22

A name (of a variable, or one part of an identifier).

§

Star = 23

The catch-all key *.

§

KwInput = 24

.input.

§

KwLocal = 25

.local.

§

KwMatch = 26

.match.

§

LBrace = 27

{.

§

RBrace = 28

}.

§

LBrace2 = 29

{{.

§

RBrace2 = 30

}}.

§

Pipe = 31

|.

§

Dollar = 32

$.

§

Colon = 33

: (function sigil or namespace separator).

§

Hash = 34

#.

§

Slash = 35

/ (markup-close sigil or standalone marker).

§

At = 36

@.

§

Equals = 37

=.

§

Trivia = 38

Whitespace and bidi marks outside text and literals.

§

Error = 39

Input the parser could not use (a syntax error was reported for it).

Implementations§

Source§

impl SyntaxKind

Source

pub fn is_token(self) -> bool

A leaf (token) kind.

Source

pub fn is_node(self) -> bool

A node kind.

Source

pub fn is_markup(self) -> bool

A markup node kind.

Trait Implementations§

Source§

impl Clone for SyntaxKind

Source§

fn clone(&self) -> Self

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: &Self) -> 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 SyntaxKind

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

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.