Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
pub enum SyntaxKind {
Show 159 variants WHITESPACE = 0, NEWLINE, LINE_COMMENT, BLOCK_COMMENT, KW_INCLUDE, KW_EXTERNAL, KW_VAR, KW_CONST, KW_LIST, KW_TEMP, KW_RETURN, KW_REF, KW_TRUE, KW_FALSE, KW_NOT, KW_AND, KW_OR, KW_MOD, KW_HAS, KW_HASNT, KW_ELSE, KW_FUNCTION, KW_STOPPING, KW_CYCLE, KW_SHUFFLE, KW_ONCE, KW_DONE, KW_END, KW_TODO, EQ, PLUS_EQ, MINUS_EQ, EQ_EQ, BANG_EQ, LT, GT, LT_EQ, GT_EQ, AMP, AMP_AMP, PLUS, MINUS, STAR, SLASH, PERCENT, CARET, BANG, QUESTION, BANG_QUESTION, DOLLAR, L_PAREN, R_PAREN, L_BRACE, R_BRACE, L_BRACKET, R_BRACKET, PIPE, COMMA, DOT, COLON, HASH, TILDE, BACKSLASH, GLUE, DIVERT, THREAD, TUNNEL_ONWARDS, INTEGER, FLOAT, QUOTE, STRING_TEXT, STRING_ESCAPE, IDENT, ERROR_TOKEN, EOF, SOURCE_FILE, INCLUDE_STMT, FILE_PATH, EXTERNAL_DECL, KNOT_DEF, KNOT_HEADER, KNOT_BODY, KNOT_PARAMS, KNOT_PARAM_DECL, STITCH_DEF, STITCH_HEADER, STITCH_BODY, EMPTY_LINE, AUTHOR_WARNING, LOGIC_LINE, CONTENT_LINE, TAG_LINE, STRAY_CLOSING_BRACE, RETURN_STMT, TEMP_DECL, ASSIGNMENT, MIXED_CONTENT, TEXT, ESCAPE, GLUE_NODE, CHOICE, CHOICE_BULLETS, LABEL, CHOICE_CONDITION, CHOICE_START_CONTENT, CHOICE_BRACKET_CONTENT, CHOICE_INNER_CONTENT, GATHER, GATHER_DASHES, TAGS, TAG, INLINE_LOGIC, MULTILINE_BLOCK, SEQUENCE_WITH_ANNOTATION, SEQUENCE_SYMBOL_ANNOTATION, SEQUENCE_WORD_ANNOTATION, INLINE_BRANCHES_SEQ, MULTILINE_BRANCHES_SEQ, MULTILINE_BRANCH_SEQ, BRANCH_CONTENT, CONDITIONAL_WITH_EXPR, BRANCHLESS_COND_BODY, ELSE_BRANCH, INLINE_BRANCHES_COND, MULTILINE_BRANCHES_COND, MULTILINE_CONDITIONAL, MULTILINE_BRANCH_COND, MULTILINE_BRANCH_BODY, IMPLICIT_SEQUENCE, INNER_EXPRESSION, PREFIX_EXPR, POSTFIX_EXPR, INFIX_EXPR, PAREN_EXPR, FUNCTION_CALL, ARG_LIST, DIVERT_TARGET_EXPR, LIST_EXPR, DIVERT_NODE, SIMPLE_DIVERT, DIVERT_TARGET_WITH_ARGS, THREAD_START, TUNNEL_ONWARDS_NODE, TUNNEL_CALL_NODE, IDENTIFIER, PATH, VAR_DECL, CONST_DECL, LIST_DECL, LIST_DEF, LIST_MEMBER, LIST_MEMBER_ON, LIST_MEMBER_OFF, FUNCTION_PARAM_LIST, INTEGER_LIT, FLOAT_LIT, STRING_LIT, BOOLEAN_LIT, ERROR, // some variants omitted
}
Expand description

All syntactic constructs in the Ink language.

Tokens (lexer output) and nodes (parser output) share a single flat enum so that rowan can store them in one u16 discriminant. Use [is_token] and [is_node] to classify at runtime.

Variants§

§

WHITESPACE = 0

Spaces and tabs (NOT newlines).

§

NEWLINE

\n or \r\n.

§

LINE_COMMENT

// ... through end-of-line.

§

BLOCK_COMMENT

/* ... */ (may span lines).

§

KW_INCLUDE

§

KW_EXTERNAL

§

KW_VAR

§

KW_CONST

§

KW_LIST

§

KW_TEMP

§

KW_RETURN

§

KW_REF

§

KW_TRUE

§

KW_FALSE

§

KW_NOT

§

KW_AND

§

KW_OR

§

KW_MOD

§

KW_HAS

§

KW_HASNT

§

KW_ELSE

§

KW_FUNCTION

§

KW_STOPPING

§

KW_CYCLE

§

KW_SHUFFLE

§

KW_ONCE

§

KW_DONE

§

KW_END

§

KW_TODO

§

EQ

=

§

PLUS_EQ

+=

§

MINUS_EQ

-=

§

EQ_EQ

==

§

BANG_EQ

!=

§

LT

<

§

GT

>

§

LT_EQ

<=

§

GT_EQ

>=

§

AMP

&

§

AMP_AMP

&&

§

PLUS

+

§

MINUS

-

§

STAR

*

§

SLASH

/

§

PERCENT

%

§

CARET

^

§

BANG

!

§

QUESTION

?

§

BANG_QUESTION

!?

§

DOLLAR

$

§

L_PAREN

(

§

R_PAREN

)

§

L_BRACE

{

§

R_BRACE

}

§

L_BRACKET

[

§

R_BRACKET

]

§

PIPE

|

§

COMMA

,

§

DOT

.

§

COLON

:

§

HASH

#

§

TILDE

~

§

BACKSLASH

\

§

GLUE

<>

§

DIVERT

->

§

THREAD

<-

§

TUNNEL_ONWARDS

->->

§

INTEGER

Integer literal (digits only; no leading sign).

§

FLOAT

Float literal (digits.digits).

§

QUOTE

" (opening or closing quote).

§

STRING_TEXT

Run of non-special characters inside a string literal.

§

STRING_ESCAPE

Escape sequence inside a string (\n, \t, \\, \").

§

IDENT

Identifier: (IDENT_START IDENT_CONTINUE*) | (DIGIT+ IDENT_START IDENT_CONTINUE*).

§

ERROR_TOKEN

Any byte the lexer could not classify.

§

EOF

End of file (synthetic).

§

SOURCE_FILE

§

INCLUDE_STMT

§

FILE_PATH

§

EXTERNAL_DECL

§

KNOT_DEF

§

KNOT_HEADER

§

KNOT_BODY

§

KNOT_PARAMS

§

KNOT_PARAM_DECL

§

STITCH_DEF

§

STITCH_HEADER

§

STITCH_BODY

§

EMPTY_LINE

§

AUTHOR_WARNING

§

LOGIC_LINE

§

CONTENT_LINE

§

TAG_LINE

§

STRAY_CLOSING_BRACE

§

RETURN_STMT

§

TEMP_DECL

§

ASSIGNMENT

§

MIXED_CONTENT

§

TEXT

§

ESCAPE

§

GLUE_NODE

§

CHOICE

§

CHOICE_BULLETS

§

LABEL

§

CHOICE_CONDITION

§

CHOICE_START_CONTENT

§

CHOICE_BRACKET_CONTENT

§

CHOICE_INNER_CONTENT

§

GATHER

§

GATHER_DASHES

§

TAGS

§

TAG

§

INLINE_LOGIC

§

MULTILINE_BLOCK

§

SEQUENCE_WITH_ANNOTATION

§

SEQUENCE_SYMBOL_ANNOTATION

§

SEQUENCE_WORD_ANNOTATION

§

INLINE_BRANCHES_SEQ

§

MULTILINE_BRANCHES_SEQ

§

MULTILINE_BRANCH_SEQ

§

BRANCH_CONTENT

§

CONDITIONAL_WITH_EXPR

§

BRANCHLESS_COND_BODY

§

ELSE_BRANCH

§

INLINE_BRANCHES_COND

§

MULTILINE_BRANCHES_COND

§

MULTILINE_CONDITIONAL

§

MULTILINE_BRANCH_COND

§

MULTILINE_BRANCH_BODY

§

IMPLICIT_SEQUENCE

§

INNER_EXPRESSION

§

PREFIX_EXPR

§

POSTFIX_EXPR

§

INFIX_EXPR

§

PAREN_EXPR

§

FUNCTION_CALL

§

ARG_LIST

§

DIVERT_TARGET_EXPR

§

LIST_EXPR

§

DIVERT_NODE

§

SIMPLE_DIVERT

§

DIVERT_TARGET_WITH_ARGS

§

THREAD_START

§

TUNNEL_ONWARDS_NODE

§

TUNNEL_CALL_NODE

§

IDENTIFIER

§

PATH

§

VAR_DECL

§

CONST_DECL

§

LIST_DECL

§

LIST_DEF

§

LIST_MEMBER

§

LIST_MEMBER_ON

§

LIST_MEMBER_OFF

§

FUNCTION_PARAM_LIST

§

INTEGER_LIT

§

FLOAT_LIT

§

STRING_LIT

§

BOOLEAN_LIT

§

ERROR

Implementations§

Source§

impl SyntaxKind

Source

pub fn is_token(self) -> bool

Returns true for tokens produced by the lexer (leaf nodes in the CST).

Source

pub fn is_node(self) -> bool

Returns true for composite nodes built by the parser.

Source

pub fn is_trivia(self) -> bool

Returns true for trivia — tokens the parser may skip over. NEWLINE is not trivia; it terminates lines and delimits blocks.

Source

pub fn is_keyword(self) -> bool

Returns true for keyword tokens.

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

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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 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 PartialOrd for SyntaxKind

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 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<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.