Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
#[non_exhaustive]
#[repr(u16)]
pub enum SyntaxKind {
Show 167 variants WHITESPACE = 0, LINE_COMMENT = 1, BLOCK_COMMENT = 2, IDENT = 16, QUOTED_IDENT = 17, INT_LITERAL = 18, FLOAT_LITERAL = 19, STRING_LITERAL = 20, PARAM = 21, BOOL_LITERAL = 22, NULL_LITERAL = 23, L_PAREN = 48, R_PAREN = 49, L_BRACK = 50, R_BRACK = 51, L_BRACE = 52, R_BRACE = 53, COMMA = 54, SEMI = 55, COLON = 56, DOUBLE_COLON = 57, DOT = 58, DOT_DOT = 59, PIPE = 60, STAR = 61, PLUS = 62, MINUS = 63, SLASH = 64, PERCENT = 65, CARET = 66, EQ = 67, NEQ = 68, BANG_EQ = 69, LT = 70, LE = 71, GT = 72, GE = 73, ARROW_R = 74, ARROW_L = 75, REGEX_EQ = 76, DOLLAR = 77, BANG = 78, AMP = 79, MATCH_KW = 128, OPTIONAL_KW = 129, WHERE_KW = 130, WITH_KW = 131, RETURN_KW = 132, CREATE_KW = 133, MERGE_KW = 134, DELETE_KW = 135, DETACH_KW = 136, SET_KW = 137, REMOVE_KW = 138, UNWIND_KW = 139, CALL_KW = 140, YIELD_KW = 141, ON_KW = 142, AS_KW = 143, AND_KW = 144, OR_KW = 145, XOR_KW = 146, NOT_KW = 147, IN_KW = 148, IS_KW = 149, NULL_KW = 150, TRUE_KW = 151, FALSE_KW = 152, CASE_KW = 153, WHEN_KW = 154, THEN_KW = 155, ELSE_KW = 156, END_KW = 157, ORDER_KW = 158, BY_KW = 159, ASC_KW = 160, ASCENDING_KW = 161, DESC_KW = 162, DESCENDING_KW = 163, SKIP_KW = 164, LIMIT_KW = 165, DISTINCT_KW = 166, UNION_KW = 167, ALL_KW = 168, STARTS_KW = 169, ENDS_KW = 170, CONTAINS_KW = 171, DIV_KW = 172, MOD_KW = 173, COUNT_KW = 174, EXISTS_KW = 175, SHORTESTPATH_KW = 176, ALLSHORTESTPATHS_KW = 177, ANY_KW = 178, NONE_KW = 179, SINGLE_KW = 180, SOURCE_FILE = 320, STATEMENT = 321, MATCH_CLAUSE = 322, OPTIONAL_MATCH_CLAUSE = 323, WHERE_CLAUSE = 324, WITH_CLAUSE = 325, RETURN_CLAUSE = 326, CREATE_CLAUSE = 327, MERGE_CLAUSE = 328, SET_CLAUSE = 329, REMOVE_CLAUSE = 330, DELETE_CLAUSE = 331, UNWIND_CLAUSE = 332, CALL_CLAUSE = 333, UNION_TAIL = 334, MERGE_ACTION = 335, RETURN_BODY = 336, RETURN_ITEMS = 337, RETURN_ITEM = 338, ORDER_BY = 339, ORDER_ITEM = 340, SKIP_SUBCLAUSE = 341, LIMIT_SUBCLAUSE = 342, PATTERN = 343, PATTERN_PART = 344, NAMED_PATTERN_PART = 345, NODE_PATTERN = 346, REL_PATTERN = 347, REL_DETAIL = 348, REL_LENGTH = 349, LABEL_EXPR = 350, REL_TYPE_EXPR = 351, PROPERTY_MAP = 352, SET_ITEM = 353, REMOVE_ITEM = 354, YIELD_SUBCLAUSE = 355, YIELD_ITEM = 356, PROCEDURE_NAME = 357, BINARY_EXPR = 358, UNARY_EXPR = 359, POSTFIX_EXPR = 360, LITERAL_EXPR = 361, VAR_EXPR = 362, PROP_ACCESS_EXPR = 363, SUBSCRIPT_EXPR = 364, LIST_LITERAL = 365, MAP_LITERAL = 366, MAP_PROJECTION = 367, MAP_PROJECTION_ITEM = 368, CASE_EXPR = 369, CASE_WHEN_ARM = 370, CASE_ELSE_ARM = 371, FUNCTION_CALL = 372, CALL_ARGS = 373, PAREN_EXPR = 374, LIST_COMPREHENSION = 375, PATTERN_COMPREHENSION = 376, PATTERN_PREDICATE = 377, PARAM_EXPR = 378, IS_NULL_EXPR = 379, IN_EXPR = 380, REGEX_MATCH_EXPR = 381, STRING_OP_EXPR = 382, NAME = 383, ARG_LIST = 384, INDEX_EXPR = 385, SLICE_EXPR = 386, LIST_PREDICATE_EXPR = 387, SHORTEST_PATH_PATTERN = 388, ERROR = 768, EOF = 769,
}
Expand description

Every syntactic category in Cypher: tokens, nodes, and meta.

repr(u16) so it can be used directly as a rowan kind.

Marked #[non_exhaustive] per spec §4.4: consumers must use a wildcard arm when matching, so the grammar can grow without breaking every downstream match.

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.
§

WHITESPACE = 0

§

LINE_COMMENT = 1

§

BLOCK_COMMENT = 2

§

IDENT = 16

§

QUOTED_IDENT = 17

§

INT_LITERAL = 18

§

FLOAT_LITERAL = 19

§

STRING_LITERAL = 20

§

PARAM = 21

§

BOOL_LITERAL = 22

§

NULL_LITERAL = 23

§

L_PAREN = 48

§

R_PAREN = 49

§

L_BRACK = 50

§

R_BRACK = 51

§

L_BRACE = 52

§

R_BRACE = 53

§

COMMA = 54

§

SEMI = 55

§

COLON = 56

§

DOUBLE_COLON = 57

§

DOT = 58

§

DOT_DOT = 59

§

PIPE = 60

§

STAR = 61

§

PLUS = 62

§

MINUS = 63

§

SLASH = 64

§

PERCENT = 65

§

CARET = 66

§

EQ = 67

§

NEQ = 68

§

BANG_EQ = 69

§

LT = 70

§

LE = 71

§

GT = 72

§

GE = 73

§

ARROW_R = 74

§

ARROW_L = 75

§

REGEX_EQ = 76

§

DOLLAR = 77

§

BANG = 78

§

AMP = 79

§

MATCH_KW = 128

§

OPTIONAL_KW = 129

§

WHERE_KW = 130

§

WITH_KW = 131

§

RETURN_KW = 132

§

CREATE_KW = 133

§

MERGE_KW = 134

§

DELETE_KW = 135

§

DETACH_KW = 136

§

SET_KW = 137

§

REMOVE_KW = 138

§

UNWIND_KW = 139

§

CALL_KW = 140

§

YIELD_KW = 141

§

ON_KW = 142

§

AS_KW = 143

§

AND_KW = 144

§

OR_KW = 145

§

XOR_KW = 146

§

NOT_KW = 147

§

IN_KW = 148

§

IS_KW = 149

§

NULL_KW = 150

§

TRUE_KW = 151

§

FALSE_KW = 152

§

CASE_KW = 153

§

WHEN_KW = 154

§

THEN_KW = 155

§

ELSE_KW = 156

§

END_KW = 157

§

ORDER_KW = 158

§

BY_KW = 159

§

ASC_KW = 160

§

ASCENDING_KW = 161

§

DESC_KW = 162

§

DESCENDING_KW = 163

§

SKIP_KW = 164

§

LIMIT_KW = 165

§

DISTINCT_KW = 166

§

UNION_KW = 167

§

ALL_KW = 168

§

STARTS_KW = 169

§

ENDS_KW = 170

§

CONTAINS_KW = 171

§

DIV_KW = 172

§

MOD_KW = 173

§

COUNT_KW = 174

§

EXISTS_KW = 175

§

SHORTESTPATH_KW = 176

§

ALLSHORTESTPATHS_KW = 177

§

ANY_KW = 178

§

NONE_KW = 179

§

SINGLE_KW = 180

§

SOURCE_FILE = 320

§

STATEMENT = 321

§

MATCH_CLAUSE = 322

§

OPTIONAL_MATCH_CLAUSE = 323

§

WHERE_CLAUSE = 324

§

WITH_CLAUSE = 325

§

RETURN_CLAUSE = 326

§

CREATE_CLAUSE = 327

§

MERGE_CLAUSE = 328

§

SET_CLAUSE = 329

§

REMOVE_CLAUSE = 330

§

DELETE_CLAUSE = 331

§

UNWIND_CLAUSE = 332

§

CALL_CLAUSE = 333

§

UNION_TAIL = 334

§

MERGE_ACTION = 335

§

RETURN_BODY = 336

§

RETURN_ITEMS = 337

§

RETURN_ITEM = 338

§

ORDER_BY = 339

§

ORDER_ITEM = 340

§

SKIP_SUBCLAUSE = 341

§

LIMIT_SUBCLAUSE = 342

§

PATTERN = 343

§

PATTERN_PART = 344

§

NAMED_PATTERN_PART = 345

§

NODE_PATTERN = 346

§

REL_PATTERN = 347

§

REL_DETAIL = 348

§

REL_LENGTH = 349

§

LABEL_EXPR = 350

§

REL_TYPE_EXPR = 351

§

PROPERTY_MAP = 352

§

SET_ITEM = 353

§

REMOVE_ITEM = 354

§

YIELD_SUBCLAUSE = 355

§

YIELD_ITEM = 356

§

PROCEDURE_NAME = 357

§

BINARY_EXPR = 358

§

UNARY_EXPR = 359

§

POSTFIX_EXPR = 360

§

LITERAL_EXPR = 361

§

VAR_EXPR = 362

§

PROP_ACCESS_EXPR = 363

§

SUBSCRIPT_EXPR = 364

§

LIST_LITERAL = 365

§

MAP_LITERAL = 366

§

MAP_PROJECTION = 367

§

MAP_PROJECTION_ITEM = 368

§

CASE_EXPR = 369

§

CASE_WHEN_ARM = 370

§

CASE_ELSE_ARM = 371

§

FUNCTION_CALL = 372

§

CALL_ARGS = 373

§

PAREN_EXPR = 374

§

LIST_COMPREHENSION = 375

§

PATTERN_COMPREHENSION = 376

§

PATTERN_PREDICATE = 377

§

PARAM_EXPR = 378

§

IS_NULL_EXPR = 379

§

IN_EXPR = 380

§

REGEX_MATCH_EXPR = 381

§

STRING_OP_EXPR = 382

§

NAME = 383

§

ARG_LIST = 384

§

INDEX_EXPR = 385

§

SLICE_EXPR = 386

§

LIST_PREDICATE_EXPR = 387

§

SHORTEST_PATH_PATTERN = 388

§

ERROR = 768

§

EOF = 769

Implementations§

Source§

impl SyntaxKind

Source

pub fn from_u16(raw: u16) -> Option<Self>

Convert a raw u16 back into a SyntaxKind. Returns None for values not in the enumeration.

Source

pub const fn is_trivia(self) -> bool

Returns true for the trivia zone (whitespace and comments).

use cyrs_syntax::SyntaxKind;
assert!(SyntaxKind::WHITESPACE.is_trivia());
assert!(!SyntaxKind::IDENT.is_trivia());
Source

pub const fn is_keyword(self) -> bool

Returns true for the keyword zone (MATCH_KW..=SINGLE_KW).

Source

pub const fn is_punct(self) -> bool

Returns true for the punctuation zone (L_PAREN..=AMP).

Source

pub const fn is_literal(self) -> bool

Returns true for literal-shaped tokens: numeric, string, boolean, null, and parameter tokens ($name / $0).

Source

pub const fn is_node(self) -> bool

Returns true for composite syntax nodes (clauses, patterns, expressions, etc. — every kind in SOURCE_FILE..ERROR).

Source

pub const fn is_token(self) -> bool

Returns true for any kind that is a token rather than a node or meta sentinel. Equivalent to !is_node() && !matches!(ERROR | EOF).

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

Source§

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

Formats the value using the given formatter. Read more
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 Copy for SyntaxKind

Source§

impl Eq for SyntaxKind

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.