#[repr(u16)]pub enum SyntaxKind {
Show 81 variants
WHITESPACE = 0,
LINE_COMMENT = 1,
BLOCK_COMMENT = 2,
IDENT = 3,
NUMBER = 4,
STRING = 5,
L_BRACE = 6,
R_BRACE = 7,
L_BRACK = 8,
R_BRACK = 9,
L_PAREN = 10,
R_PAREN = 11,
COMMA = 12,
COLON = 13,
DOT = 14,
AT = 15,
HASH = 16,
AMP = 17,
QUESTION = 18,
EQ = 19,
ELLIPSIS = 20,
EQ_EQ = 21,
BANG_EQ = 22,
LT_EQ = 23,
GT_EQ = 24,
AMP_AMP = 25,
PIPE_PIPE = 26,
PLUS_PLUS = 27,
FAT_ARROW = 28,
THIN_ARROW = 29,
LT = 30,
GT = 31,
PLUS = 32,
MINUS = 33,
STAR = 34,
SLASH = 35,
PERCENT = 36,
BANG = 37,
PIPE = 38,
UNDERSCORE = 39,
UNKNOWN = 40,
F_STRING_OPEN = 41,
F_STRING_CLOSE = 42,
F_STRING_LITERAL = 43,
F_STRING_INTERP_START = 44,
F_STRING_INTERP_END = 45,
DOCUMENT = 46,
DIRECTIVE = 47,
DECORATOR = 48,
DICT = 49,
DICT_FIELD = 50,
LIST = 51,
COMPREHENSION = 52,
CLOSURE = 53,
CLOSURE_PARAM = 54,
CALL_EXPR = 55,
CALL_ARG = 56,
BINARY_EXPR = 57,
UNARY_EXPR = 58,
TERNARY_EXPR = 59,
REFERENCE_EXPR = 60,
VARIABLE_EXPR = 61,
WHERE_EXPR = 62,
MATCH_EXPR = 63,
MATCH_ARM = 64,
MATCH_PATTERN = 65,
VARIANT_CTOR = 66,
F_STRING = 67,
F_STRING_INTERPOLATION = 68,
SPREAD_EXPR = 69,
TYPE_NODE = 70,
WILDCARD = 71,
LITERAL = 72,
ERROR = 73,
TUPLE_TYPE = 74,
SCHEMA_WITH = 75,
SCHEMA_METHOD = 76,
ENUM_VARIANT = 77,
ENUM_VARIANT_FIELD = 78,
TUPLE = 79,
__LAST = 80,
}Expand description
All token and node kinds the v2 parser produces. The discriminant is
kept stable and small (u16) so rowan’s green tree can stash it
efficiently — and so adding a new kind in the middle would shift
values, change the boundary checks below. Append-only is the rule:
new kinds go before SyntaxKind::__LAST.
Variants§
WHITESPACE = 0
Run of \t \n\r characters between meaningful tokens.
LINE_COMMENT = 1
// ... to end of line.
BLOCK_COMMENT = 2
/* ... */ (may span lines).
IDENT = 3
Any [A-Za-z_][A-Za-z0-9_]* — keywords are NOT split out at
lex time; the parser checks the text where context matters
(where, match, with, from, as, etc.).
NUMBER = 4
Integer / hex / octal / binary / float / scientific. The lexer
captures the whole literal as one token; semantic conversion
to i64 / f64 happens later.
STRING = 5
Any of: plain "...", raw r"..." / r#"..."#, f-string
f"..." / f#"..."#. The whole literal — opening quote
through closing quote — is one token at the CST level. The
typed-AST layer breaks f-strings into FString parts.
L_BRACE = 6
R_BRACE = 7
L_BRACK = 8
R_BRACK = 9
L_PAREN = 10
R_PAREN = 11
COMMA = 12
COLON = 13
DOT = 14
AT = 15
@ — decorator sigil.
HASH = 16
# — directive sigil.
AMP = 17
& — reference sigil (&root.x).
QUESTION = 18
? — optional-type marker or ternary head.
EQ = 19
= — standalone assignment-position equals.
ELLIPSIS = 20
... spread / variadic.
EQ_EQ = 21
==
BANG_EQ = 22
!=
LT_EQ = 23
<=
GT_EQ = 24
>=
AMP_AMP = 25
&&
PIPE_PIPE = 26
||
PLUS_PLUS = 27
++
FAT_ARROW = 28
=>
THIN_ARROW = 29
->
LT = 30
<
GT = 31
>
PLUS = 32
+
MINUS = 33
-
STAR = 34
* — multiplication, wildcard, or spread depending on context.
SLASH = 35
/
PERCENT = 36
%
BANG = 37
!
PIPE = 38
|
UNDERSCORE = 39
A bare _ (an underscore NOT followed by another identifier
char). The Rust-style pattern wildcard for match catch-all arms
(_: result) and ignored variant-payload slots. A _foo /
my_var still lexes as IDENT. The schema-field “any-value”
validator keeps its own * spelling (STAR); the two roles are
deliberately distinct tokens.
UNKNOWN = 40
Any source byte the lexer couldn’t classify (stray UTF-8 punctuation, control characters, etc.). Emitted as a single- codepoint token so the round-trip-by-bytes invariant holds. Downstream tooling treats this like a syntax error.
F_STRING_OPEN = 41
Opening f" / f#" / f##" … — # count varies.
F_STRING_CLOSE = 42
Closing " / "# / "## matching the open count.
F_STRING_LITERAL = 43
Verbatim literal chunk between interpolations / quotes.
F_STRING_INTERP_START = 44
${
F_STRING_INTERP_END = 45
Closing } of an interpolation.
DOCUMENT = 46
Whole-file root. Always present. Children: trivia*, top-level directives*, top-level value, trivia*.
DIRECTIVE = 47
A #name <body?> form.
DECORATOR = 48
@name(args?) form.
DICT = 49
{ ... } dict / object literal.
DICT_FIELD = 50
One key: value (or key(params): body) pair inside a DICT.
LIST = 51
[ ... ] list / array literal.
COMPREHENSION = 52
for x in xs if cond body inside a LIST.
CLOSURE = 53
name(p, q, ...) [-> R]: body lowered to closure.
CLOSURE_PARAM = 54
Single closure parameter (name: T or bare name).
CALL_EXPR = 55
name(arg1, arg2 = expr, ...) call.
CALL_ARG = 56
One arg inside a call’s parens — positional or name = expr.
BINARY_EXPR = 57
Binary operation node (a + b, a == b, etc.).
UNARY_EXPR = 58
Unary operation node (!a, -a).
TERNARY_EXPR = 59
cond ? then : else.
REFERENCE_EXPR = 60
&base.x.y reference.
VARIABLE_EXPR = 61
name[.tail]* bareword path.
WHERE_EXPR = 62
expr where { bindings }.
MATCH_EXPR = 63
expr match { type: arm, ... }.
MATCH_ARM = 64
One arm inside a MATCH_EXPR.
MATCH_PATTERN = 65
Rust-like enum payload match pattern, e.g. Pair(a, b).
VARIANT_CTOR = 66
EnumName.VariantName { ... }.
F_STRING = 67
f"..." rendered as a CST node so interpolations are children.
The lexer emits the whole f-string as one STRING leaf; the
CST builder breaks it into F_STRING_OPEN, F_STRING_LITERAL
chunks, F_STRING_INTERPOLATION children, and F_STRING_CLOSE.
F_STRING_INTERPOLATION = 68
One ${ expr } zone inside an SyntaxKind::F_STRING. Children are
F_STRING_INTERP_START, then a regular Relon expression node,
then F_STRING_INTERP_END.
SPREAD_EXPR = 69
Spread expression ...expr inside a dict / list.
TYPE_NODE = 70
A type expression: Int, List<String>, User?, …
WILDCARD = 71
* in wildcard / placeholder position.
LITERAL = 72
Literal true / false and removed null spelling.
ERROR = 73
Unrecoverable parse failure: spans the bytes the parser couldn’t fit into any production. Always has at least one child token. This is the “first-class hole” that lets downstream tooling keep working on partial input.
TUPLE_TYPE = 74
(T1, T2, ...) tuple type — appears in type-hint position
((Int, String) pair: ...) and inside generic argument lists
(List<(Int, String)>). The 1-tuple uses a trailing-comma
(T,) disambiguator; () is the zero-tuple.
SCHEMA_WITH = 75
#schema ... with { ... } body — a structured method list.
Children: one SCHEMA_METHOD per declaration plus any
schema-level pragma directives. The CST keeps every byte
verbatim; the typed-AST layer reads the structure.
SCHEMA_METHOD = 76
One method declaration inside a SyntaxKind::SCHEMA_WITH block.
Children: optional pragma directives (#derive, #native,
#internal), an IDENT method name, optional <T> generics,
CLOSURE_PARAM list, a TYPE_NODE return type, and an
expression body (omitted when #native is set).
ENUM_VARIANT = 77
One variant inside a Rust-like #enum Name { ... } declaration.
ENUM_VARIANT_FIELD = 78
One named payload field inside a #enum variant body.
TUPLE = 79
(e1, e2, ...) tuple value literal. Distinct from a
parenthesised group (e) (which carries no comma) and from the
(p, q) => body closure form. The 1-tuple uses a trailing-comma
(e,) disambiguator; () is the zero-tuple (unit). Children are
the element expressions in source order.
__LAST = 80
Sentinel to keep (SyntaxKind as u16) < (__LAST as u16)
available for boundary checks. Never produced.
Implementations§
Source§impl SyntaxKind
impl SyntaxKind
Sourcepub fn is_trivia(self) -> bool
pub fn is_trivia(self) -> bool
True for WHITESPACE / LINE_COMMENT / BLOCK_COMMENT —
tokens that carry no semantic content. Useful for skipping
when walking the tree for meaningful structure.
Sourcepub fn is_token(self) -> bool
pub fn is_token(self) -> bool
True when the kind names a leaf (token) rather than a
composite branch (node). All kinds before DOCUMENT in the
enum order are leaves; everything from DOCUMENT to ERROR
is a node. Keep in sync with the enum layout above.
pub fn is_node(self) -> bool
Trait Implementations§
Source§impl Clone for SyntaxKind
impl Clone for SyntaxKind
Source§fn clone(&self) -> SyntaxKind
fn clone(&self) -> SyntaxKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SyntaxKind
Source§impl Debug for SyntaxKind
impl Debug for SyntaxKind
Source§impl Display for SyntaxKind
impl Display for SyntaxKind
impl Eq for SyntaxKind
Source§impl From<SyntaxKind> for SyntaxKind
impl From<SyntaxKind> for SyntaxKind
Source§fn from(kind: SyntaxKind) -> Self
fn from(kind: SyntaxKind) -> Self
Source§impl Hash for SyntaxKind
impl Hash for SyntaxKind
Source§impl Ord for SyntaxKind
impl Ord for SyntaxKind
Source§fn cmp(&self, other: &SyntaxKind) -> Ordering
fn cmp(&self, other: &SyntaxKind) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for SyntaxKind
impl PartialEq for SyntaxKind
Source§fn eq(&self, other: &SyntaxKind) -> bool
fn eq(&self, other: &SyntaxKind) -> bool
self and other values to be equal, and is used by ==.