Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
pub enum SyntaxKind {
Show 193 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, KW_IMPORT, 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, AT_L_BRACKET, GLUE, DIVERT, THREAD, TUNNEL_ONWARDS, INTEGER, FLOAT, QUOTE, STRING_TEXT, STRING_ESCAPE, IDENT, ERROR_TOKEN, EOF, SOURCE_FILE, INCLUDE_STMT, IMPORT_STMT, IMPORT_LIST, IMPORT_ITEM, IMPORT_MODULE, 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, ANNOTATION_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, STMT_BLOCK, IF_STMT, ELSE_CLAUSE, WHILE_STMT, FOR_STMT, BREAK_STMT, CONTINUE_STMT, EXPR_STMT, AWAIT_STMT, ARRAY_LITERAL, MAP_LITERAL, MAP_ENTRY, INDEX_EXPR, TYPE_ANNOTATION, TYPE_EXPR, TYPE_NAME, TYPE_GENERIC, TYPE_FN, STRUCT_DECL, STRUCT_FIELD_DECL, STRUCT_LITERAL, STRUCT_FIELD_INIT, FIELD_ACCESS_EXPR, FN_LITERAL, REF_EXPR, CALL_EXPR, RANGE_EXPR, // 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

§

KW_IMPORT

IMPORT — module import statement (brink extension, M-2, docs/modules-spec.md §2). FROM/AS stay contextual IDENTs.

§

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

\

§

AT_L_BRACKET

@[ — annotation-line opener (brink extension, NS-A2: the @[effects(…)] assertion final form, docs/stdlib-spec.md §9.2). Lexed as one compound token so only the adjacent pair opens an annotation line; a lone @ in prose stays an ERROR_TOKEN swallowed into text, exactly as before.

§

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

§

IMPORT_STMT

IMPORT { a, b AS c } FROM mod or IMPORT mod (M-2).

§

IMPORT_LIST

The { … } name list of a bare-form import.

§

IMPORT_ITEM

One name or name AS alias entry in an import list.

§

IMPORT_MODULE

The module name of an import (both forms).

§

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

§

ANNOTATION_LINE

@[name(args)] — a brink annotation line (NS-A2, the @[effects(…)] assertion surface). Superset-parsed under every dialect; strict-ink rejects it in brink-analyzer::dialect_gate (E051), the standard extension posture.

§

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

§

STMT_BLOCK

{ stmt* } — a braced statement list. Used for the top-level ~ { … } block body and every nested if/while/for body.

§

IF_STMT

if cond { … } (else …)?. if/else if are contextual keywords (plain IDENT tokens) — see parser::logic.

§

ELSE_CLAUSE

The else arm of an IF_STMT: either a nested IF_STMT (else-if) or a bare STMT_BLOCK (else).

§

WHILE_STMT

while cond { … }.

§

FOR_STMT

for name in expr { … }.

§

BREAK_STMT

break.

§

CONTINUE_STMT

continue.

§

EXPR_STMT

A bare expression statement inside a block (function/external calls).

§

AWAIT_STMT

await <cond>FlowFrame suspension point (docs/flow-suspension-spec.md §3). Statement/logic position only (~ await … logic line or inside a ~ { … } block). Brink extension; await is a contextual (soft) keyword recognized only in this statement position, so it stays an ordinary identifier everywhere else. Wraps the condition expression.

§

ARRAY_LITERAL

#[expr, …] — array sigil literal (§3). Expression position only.

§

MAP_LITERAL

#{key: expr, …} — map sigil literal (§3). Expression position only.

§

MAP_ENTRY

One key: expr pair inside a MAP_LITERAL.

§

INDEX_EXPR

base[index] — postfix indexing, chainable (§4).

§

TYPE_ANNOTATION

: type_expr — one annotation, attached after an identifier (param, VAR/temp name) or a knot header’s params (return position).

§

TYPE_EXPR

A type expression: wraps exactly one of TYPE_NAME, TYPE_GENERIC, or TYPE_FN.

§

TYPE_NAME

A bare nominal type name (int, float, bool, string, divert, void, or an unrecognized identifier — semantic validity is an analyzer concern, not a grammar one).

§

TYPE_GENERIC

name<type_expr, …>List<L>, Array<T>, Map<K, V>.

§

TYPE_FN

fn(type_expr, …): type_expr — function type. Parses in T1b/TM-2; types as reserved until T1c.

§

STRUCT_DECL

STRUCT Name = #{ field: type, … }. Top-level only.

§

STRUCT_FIELD_DECL

One field: type pair inside a STRUCT_DECL’s body.

§

STRUCT_LITERAL

Name#{field: expr, …} — struct construction literal. Expression position only, like ARRAY_LITERAL/MAP_LITERAL.

§

STRUCT_FIELD_INIT

One field: expr pair inside a STRUCT_LITERAL.

§

FIELD_ACCESS_EXPR

base.field — postfix field access. Only used where the existing dotted-PATH grammar doesn’t already cover the shape (e.g. after a STRUCT_LITERAL, an INDEX_EXPR, or a parenthesized expression); a bare ident.ident chain still parses as one PATH node and the static-path-vs-field-access ambiguity is resolved by brink-analyzer’s resolution fallback (typed-mode-spec §6), not here.

§

FN_LITERAL

#fn(target, args…) — function-value creation (partial application over a named function). Joins the #[…]/#{…}/Name#{…} sigil family: expression position only — in prose position # still opens a tag, unchanged. Superset grammar — always parses; dialect-gated (E051 under strict-ink) at analysis, same pattern as T1b/TM-4b.

§

REF_EXPR

ref followed by a single lvalue-shaped operand — a plain path, a dotted field chain, […] indexing, or a mix of the two.

§

CALL_EXPR

A postfix call applied to a callee that isn’t a bare name — always rejected at HIR lowering (E104).

§

RANGE_EXPR

start .. end / start ..= end — a range literal expression.

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
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.