Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
pub enum SyntaxKind {
Show 348 variants WHITESPACE = 0, NEWLINE, COMMENT, BLOCK_COMMENT, IDENT, QUOTED_IDENT, STRING, DOLLAR_STRING, FILE_URI, INT_NUMBER, FLOAT_NUMBER, VARIABLE, PLACEHOLDER, L_PAREN, R_PAREN, L_BRACKET, R_BRACKET, L_BRACE, R_BRACE, COMMA, DOT, SEMICOLON, COLON, COLON2, ASSIGN, EQ, NEQ, LT, LTE, NULL_SAFE_EQ, GT, GTE, PLUS, MINUS, STAR, SLASH, PERCENT, CONCAT, PIPE, PIPE_GT, FLOW_PIPE, ARROW, FAT_ARROW, AMP, CARET, TILDE, AT, DOLLAR, QUESTION, BANG, SELECT_KW, FROM_KW, WHERE_KW, GROUP_KW, BY_KW, HAVING_KW, ORDER_KW, LIMIT_KW, OFFSET_KW, FETCH_KW, TOP_KW, AS_KW, AND_KW, OR_KW, NOT_KW, NULL_KW, IS_KW, IN_KW, LIKE_KW, ILIKE_KW, RLIKE_KW, REGEXP_KW, BETWEEN_KW, CASE_KW, WHEN_KW, THEN_KW, ELSE_KW, END_KW, JOIN_KW, INNER_KW, LEFT_KW, RIGHT_KW, FULL_KW, OUTER_KW, CROSS_KW, LATERAL_KW, NATURAL_KW, ON_KW, USING_KW, WITH_KW, RECURSIVE_KW, UNION_KW, ALL_KW, ANY_KW, EXCEPT_KW, INTERSECT_KW, MINUS_KW, DISTINCT_KW, QUALIFY_KW, OVER_KW, PARTITION_KW, WINDOW_KW, ROWS_KW, RANGE_KW, UNBOUNDED_KW, PRECEDING_KW, FOLLOWING_KW, CURRENT_KW, ROW_KW, ASC_KW, DESC_KW, NULLS_KW, FIRST_KW, LAST_KW, TRUE_KW, FALSE_KW, CAST_KW, TRY_CAST_KW, EXISTS_KW, VALUES_KW, PIVOT_KW, UNPIVOT_KW, SAMPLE_KW, TABLESAMPLE_KW, CREATE_KW, REPLACE_KW, IF_KW, TABLE_KW, VIEW_KW, TEMPORARY_KW, TEMP_KW, TRANSIENT_KW, VOLATILE_KW, SECURE_KW, INSERT_KW, INTO_KW, UPDATE_KW, DELETE_KW, MERGE_KW, SET_KW, FLATTEN_KW, CONNECT_KW, START_KW, PRIOR_KW, LANGUAGE_KW, JAVASCRIPT_KW, PYTHON_KW, JAVA_KW, SCALA_KW, SQL_KW, BEGIN_KW, DECLARE_KW, LET_KW, RETURN_KW, CALL_KW, PROCEDURE_KW, FUNCTION_KW, RETURNS_KW, TASK_KW, WAREHOUSE_KW, SCHEDULE_KW, AFTER_KW, COPY_KW, GRANTS_KW, HANDLER_KW, PACKAGES_KW, IMPORTS_KW, RUNTIME_VERSION_KW, EXECUTE_KW, OWNER_KW, CALLER_KW, STRICT_KW, CALLED_KW, INPUT_KW, OUTPUT_KW, OUT_KW, MATCHED_KW, DROP_KW, ALTER_KW, WITHIN_KW, FOR_KW, IMMEDIATE_KW, OVERWRITE_KW, GRANT_KW, REVOKE_KW, USE_KW, SHOW_KW, DESCRIBE_KW, TRUNCATE_KW, COMMIT_KW, ROLLBACK_KW, UNDROP_KW, ELSEIF_KW, WHILE_KW, LOOP_KW, REPEAT_KW, UNTIL_KW, DO_KW, EXCEPTION_KW, CURSOR_KW, RESULTSET_KW, SOURCE_FILE, ERROR, EOF, CONTEXTUAL_KEYWORD, SELECT_STMT, EXPR_STMT, SELECT_LIST, SELECT_ITEM, FROM_CLAUSE, WHERE_CLAUSE, TABLE_REF, LATERAL_VIEW, TIME_TRAVEL, SAMPLE_CLAUSE, AS_OF_TRAVEL, ARG_LIST, TYPE_NAME, NAME, NAME_REF, LITERAL, STAR_EXPR, PAREN_EXPR, PREFIX_EXPR, BIN_EXPR, CALL_EXPR, INDEX_EXPR, CAST_EXPR, BIND_MARKER, INTERVAL_LITERAL, ARRAY_LITERAL, OBJECT_LITERAL, OBJECT_FIELD, WITH_QUERY, WITH_CLAUSE, CTE, COLUMN_LIST, SET_OP, SUBQUERY, GROUP_BY_CLAUSE, HAVING_CLAUSE, QUALIFY_CLAUSE, ORDER_BY_CLAUSE, DISTRIBUTE_BY_CLAUSE, SORT_BY_CLAUSE, CLUSTER_BY_CLAUSE, ORDER_BY_ITEM, LIMIT_CLAUSE, OFFSET_CLAUSE, JOIN, IS_EXPR, IN_EXPR, BETWEEN_EXPR, EXISTS_EXPR, EXPR_LIST, WINDOW_EXPR, WINDOW_SPEC, PARTITION_BY_CLAUSE, WINDOW_FRAME, CASE_EXPR, CASE_WHEN, JSON_ACCESS, LAMBDA_EXPR, LAMBDA_PARAMS, VALUES_CLAUSE, VALUES_ROW, INSERT_STMT, UPDATE_STMT, DELETE_STMT, MERGE_STMT, SET_CLAUSE, ASSIGNMENT, MERGE_WHEN, CREATE_STMT, DROP_STMT, ALTER_STMT, GRANT_STMT, REVOKE_STMT, CALL_STMT, USE_STMT, SHOW_STMT, DESCRIBE_STMT, TRUNCATE_STMT, COMMENT_STMT, TRANSACTION_STMT, UNDROP_STMT, BLOCK_STMT, DECLARE_SECTION, DECLARE_ITEM, STMT_LIST, EXCEPTION_SECTION, EXCEPTION_WHEN, LET_STMT, ASSIGN_STMT, RETURN_STMT, IF_STMT, LOOP_STMT, CASE_STMT, CASE_STMT_WHEN, SCRIPT_STMT, COLUMN_DEF_LIST, COLUMN_DEF, ROUTINE_RETURNS_CLAUSE, ROUTINE_LANGUAGE_CLAUSE, WITHIN_GROUP, PIVOT_CLAUSE, NAMED_ARG, MATCH_RECOGNIZE, MEASURES_CLAUSE, ROW_MATCH_CLAUSE, AFTER_MATCH_CLAUSE, PATTERN_CLAUSE, PATTERN_BODY, SUBSET_CLAUSE, DEFINE_CLAUSE, DEFINE_ITEM, START_WITH_CLAUSE, CONNECT_BY_CLAUSE, FLOW_STMT, SET_STMT, EXECUTE_STMT, GROUPING_SETS, COPY_STMT, STAGE_FILE_STMT, COPY_LOCATION, COPY_OPTION, STAGE_REF, INTO_CLAUSE, INSERT_WHEN, OBJECT_PROPERTY, STREAM_SOURCE, TASK_AFTER, SEMANTIC_VIEW_CLAUSE, SEMANTIC_VIEW_ITEM, PRIV_LIST, GRANT_TARGET, GRANTEE, ALTER_ACTION, VACUUM_STMT, OPTIMIZE_STMT, ZORDER_CLAUSE, CACHE_STMT, UNCACHE_STMT, REFRESH_STMT, DESCRIBE_HISTORY_STMT, RESTORE_STMT, ANALYZE_STMT, MSCK_REPAIR_STMT, // some variants omitted
}
Expand description

Every lexical token kind and syntax node kind understood by sql-dialect-fmt.

Ordering is significant: variants are contiguous from 0, which makes SyntaxKind::from_u16 a checked transmute. The __KW_START / __KW_END sentinels bracket the keyword block so SyntaxKind::is_keyword is a range check.

Variants§

§

WHITESPACE = 0

§

NEWLINE

§

COMMENT

§

BLOCK_COMMENT

§

IDENT

§

QUOTED_IDENT

§

STRING

§

DOLLAR_STRING

§

FILE_URI

§

INT_NUMBER

§

FLOAT_NUMBER

§

VARIABLE

§

PLACEHOLDER

§

L_PAREN

§

R_PAREN

§

L_BRACKET

§

R_BRACKET

§

L_BRACE

§

R_BRACE

§

COMMA

§

DOT

§

SEMICOLON

§

COLON

§

COLON2

§

ASSIGN

§

EQ

§

NEQ

§

LT

§

LTE

§

NULL_SAFE_EQ

§

GT

§

GTE

§

PLUS

§

MINUS

§

STAR

§

SLASH

§

PERCENT

§

CONCAT

§

PIPE

§

PIPE_GT

§

FLOW_PIPE

§

ARROW

§

FAT_ARROW

§

AMP

§

CARET

§

TILDE

§

AT

§

DOLLAR

§

QUESTION

§

BANG

§

SELECT_KW

§

FROM_KW

§

WHERE_KW

§

GROUP_KW

§

BY_KW

§

HAVING_KW

§

ORDER_KW

§

LIMIT_KW

§

OFFSET_KW

§

FETCH_KW

§

TOP_KW

§

AS_KW

§

AND_KW

§

OR_KW

§

NOT_KW

§

NULL_KW

§

IS_KW

§

IN_KW

§

LIKE_KW

§

ILIKE_KW

§

RLIKE_KW

§

REGEXP_KW

§

BETWEEN_KW

§

CASE_KW

§

WHEN_KW

§

THEN_KW

§

ELSE_KW

§

END_KW

§

JOIN_KW

§

INNER_KW

§

LEFT_KW

§

RIGHT_KW

§

FULL_KW

§

OUTER_KW

§

CROSS_KW

§

LATERAL_KW

§

NATURAL_KW

§

ON_KW

§

USING_KW

§

WITH_KW

§

RECURSIVE_KW

§

UNION_KW

§

ALL_KW

§

ANY_KW

§

EXCEPT_KW

§

INTERSECT_KW

§

MINUS_KW

§

DISTINCT_KW

§

QUALIFY_KW

§

OVER_KW

§

PARTITION_KW

§

WINDOW_KW

§

ROWS_KW

§

RANGE_KW

§

UNBOUNDED_KW

§

PRECEDING_KW

§

FOLLOWING_KW

§

CURRENT_KW

§

ROW_KW

§

ASC_KW

§

DESC_KW

§

NULLS_KW

§

FIRST_KW

§

LAST_KW

§

TRUE_KW

§

FALSE_KW

§

CAST_KW

§

TRY_CAST_KW

§

EXISTS_KW

§

VALUES_KW

§

PIVOT_KW

§

UNPIVOT_KW

§

SAMPLE_KW

§

TABLESAMPLE_KW

§

CREATE_KW

§

REPLACE_KW

§

IF_KW

§

TABLE_KW

§

VIEW_KW

§

TEMPORARY_KW

§

TEMP_KW

§

TRANSIENT_KW

§

VOLATILE_KW

§

SECURE_KW

§

INSERT_KW

§

INTO_KW

§

UPDATE_KW

§

DELETE_KW

§

MERGE_KW

§

SET_KW

§

FLATTEN_KW

§

CONNECT_KW

§

START_KW

§

PRIOR_KW

§

LANGUAGE_KW

§

JAVASCRIPT_KW

§

PYTHON_KW

§

JAVA_KW

§

SCALA_KW

§

SQL_KW

§

BEGIN_KW

§

DECLARE_KW

§

LET_KW

§

RETURN_KW

§

CALL_KW

§

PROCEDURE_KW

§

FUNCTION_KW

§

RETURNS_KW

§

TASK_KW

§

WAREHOUSE_KW

§

SCHEDULE_KW

§

AFTER_KW

§

COPY_KW

§

GRANTS_KW

§

HANDLER_KW

§

PACKAGES_KW

§

IMPORTS_KW

§

RUNTIME_VERSION_KW

§

EXECUTE_KW

§

OWNER_KW

§

CALLER_KW

§

STRICT_KW

§

CALLED_KW

§

INPUT_KW

§

OUTPUT_KW

§

OUT_KW

§

MATCHED_KW

§

DROP_KW

§

ALTER_KW

§

WITHIN_KW

§

FOR_KW

§

IMMEDIATE_KW

§

OVERWRITE_KW

§

GRANT_KW

§

REVOKE_KW

§

USE_KW

§

SHOW_KW

§

DESCRIBE_KW

§

TRUNCATE_KW

§

COMMIT_KW

§

ROLLBACK_KW

§

UNDROP_KW

§

ELSEIF_KW

§

WHILE_KW

§

LOOP_KW

§

REPEAT_KW

§

UNTIL_KW

§

DO_KW

§

EXCEPTION_KW

§

CURSOR_KW

§

RESULTSET_KW

§

SOURCE_FILE

§

ERROR

§

EOF

§

CONTEXTUAL_KEYWORD

A soft (contextual) keyword token: a word that the grammar recognized as a keyword in a specific position (e.g. ASOF, MATCH_RECOGNIZE, AT/BEFORE, GROUPING SETS) but that is not reserved — elsewhere it is an ordinary identifier. Tagged via bump_as, it sits outside the keyword range (so it never reserves the word) yet lets the formatter upper-case it and the highlighter colour it like a keyword. See parser::ContextualKeyword.

§

SELECT_STMT

§

EXPR_STMT

§

SELECT_LIST

§

SELECT_ITEM

§

FROM_CLAUSE

§

WHERE_CLAUSE

§

TABLE_REF

§

LATERAL_VIEW

§

TIME_TRAVEL

§

SAMPLE_CLAUSE

§

AS_OF_TRAVEL

§

ARG_LIST

§

TYPE_NAME

§

NAME

§

NAME_REF

§

LITERAL

§

STAR_EXPR

§

PAREN_EXPR

§

PREFIX_EXPR

§

BIN_EXPR

§

CALL_EXPR

§

INDEX_EXPR

§

CAST_EXPR

§

BIND_MARKER

§

INTERVAL_LITERAL

§

ARRAY_LITERAL

§

OBJECT_LITERAL

§

OBJECT_FIELD

§

WITH_QUERY

§

WITH_CLAUSE

§

CTE

§

COLUMN_LIST

§

SET_OP

§

SUBQUERY

§

GROUP_BY_CLAUSE

§

HAVING_CLAUSE

§

QUALIFY_CLAUSE

§

ORDER_BY_CLAUSE

§

DISTRIBUTE_BY_CLAUSE

§

SORT_BY_CLAUSE

§

CLUSTER_BY_CLAUSE

§

ORDER_BY_ITEM

§

LIMIT_CLAUSE

§

OFFSET_CLAUSE

§

JOIN

§

IS_EXPR

§

IN_EXPR

§

BETWEEN_EXPR

§

EXISTS_EXPR

§

EXPR_LIST

§

WINDOW_EXPR

§

WINDOW_SPEC

§

PARTITION_BY_CLAUSE

§

WINDOW_FRAME

§

CASE_EXPR

§

CASE_WHEN

§

JSON_ACCESS

§

LAMBDA_EXPR

§

LAMBDA_PARAMS

§

VALUES_CLAUSE

§

VALUES_ROW

§

INSERT_STMT

§

UPDATE_STMT

§

DELETE_STMT

§

MERGE_STMT

§

SET_CLAUSE

§

ASSIGNMENT

§

MERGE_WHEN

§

CREATE_STMT

§

DROP_STMT

§

ALTER_STMT

§

GRANT_STMT

§

REVOKE_STMT

§

CALL_STMT

§

USE_STMT

§

SHOW_STMT

§

DESCRIBE_STMT

§

TRUNCATE_STMT

§

COMMENT_STMT

§

TRANSACTION_STMT

§

UNDROP_STMT

§

BLOCK_STMT

§

DECLARE_SECTION

§

DECLARE_ITEM

§

STMT_LIST

§

EXCEPTION_SECTION

§

EXCEPTION_WHEN

§

LET_STMT

§

ASSIGN_STMT

§

RETURN_STMT

§

IF_STMT

§

LOOP_STMT

§

CASE_STMT

A procedural CASE … END [CASE] statement inside a block, distinct from CASE_EXPR.

§

CASE_STMT_WHEN

One WHEN <test> THEN <stmts> arm of a procedural CASE_STMT.

§

SCRIPT_STMT

§

COLUMN_DEF_LIST

§

COLUMN_DEF

§

ROUTINE_RETURNS_CLAUSE

A routine’s RETURNS <type> signature clause.

§

ROUTINE_LANGUAGE_CLAUSE

A routine’s LANGUAGE <language> signature clause.

§

WITHIN_GROUP

§

PIVOT_CLAUSE

§

NAMED_ARG

§

MATCH_RECOGNIZE

§

MEASURES_CLAUSE

§

ROW_MATCH_CLAUSE

§

AFTER_MATCH_CLAUSE

§

PATTERN_CLAUSE

§

PATTERN_BODY

§

SUBSET_CLAUSE

§

DEFINE_CLAUSE

§

DEFINE_ITEM

§

START_WITH_CLAUSE

§

CONNECT_BY_CLAUSE

§

FLOW_STMT

§

SET_STMT

§

EXECUTE_STMT

§

GROUPING_SETS

§

COPY_STMT

§

STAGE_FILE_STMT

§

COPY_LOCATION

§

COPY_OPTION

§

STAGE_REF

§

INTO_CLAUSE

§

INSERT_WHEN

§

OBJECT_PROPERTY

§

STREAM_SOURCE

§

TASK_AFTER

§

SEMANTIC_VIEW_CLAUSE

§

SEMANTIC_VIEW_ITEM

§

PRIV_LIST

§

GRANT_TARGET

§

GRANTEE

§

ALTER_ACTION

§

VACUUM_STMT

§

OPTIMIZE_STMT

§

ZORDER_CLAUSE

§

CACHE_STMT

§

UNCACHE_STMT

§

REFRESH_STMT

§

DESCRIBE_HISTORY_STMT

§

RESTORE_STMT

§

ANALYZE_STMT

§

MSCK_REPAIR_STMT

Implementations§

Source§

impl SyntaxKind

Source

pub const fn to_u16(self) -> u16

Raw u16 discriminant (as stored by the rowan green tree).

Source

pub fn from_u16(raw: u16) -> SyntaxKind

Reconstruct a SyntaxKind from its raw discriminant.

§Panics

Panics if raw is out of range. Because the enum is contiguous and #[repr(u16)], any in-range value corresponds to a real variant, so the transmute is sound.

Source

pub const fn is_trivia(self) -> bool

Whitespace, newlines, and comments — preserved but ignored by the grammar.

Source

pub const fn is_comment(self) -> bool

-- / // line comments and /* */ block comments.

Source

pub fn is_keyword(self) -> bool

True for any reserved/keyword kind (the block between the sentinels).

Source

pub fn describe(self) -> &'static str

A human-readable name for this kind, for diagnostics.

Where the Debug representation reads SyntaxKind::INTO_KW (useless to a SQL author), this reads INTO; punctuation is quoted ('('), and the literal/name kinds get a phrase (an identifier, a string literal). Keyword kinds derive their text from the variant name by stripping the trailing _KW, so every keyword is covered without a per-variant arm.

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