Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
#[repr(u16)]
pub enum SyntaxKind {
Show 192 variants WHITESPACE = 0, LINE_COMMENT = 1, BLOCK_COMMENT = 2, PRELUDE = 3, TRAILER = 4, BEGIN_MODULE = 5, SEPARATOR = 6, END_MODULE = 7, PRAGMA_START = 8, ACTION_KW = 9, ASSUME_KW = 10, BOX_ASSUME_KW = 11, ASSUMPTION_KW = 12, CASE_KW = 13, CHOOSE_KW = 14, CONSTANT_KW = 15, ELSE_KW = 16, EXCEPT_KW = 17, EXISTS_KW = 18, EXTENDS_KW = 19, FORALL_KW = 20, IF_KW = 21, INSTANCE_KW = 22, LET_KW = 23, IN_KW = 24, LOCAL_KW = 25, MODULE_KW = 26, NEW_KW = 27, OTHER_KW = 28, PROPOSITION_KW = 29, SF_KW = 30, TEMPORAL_EXISTS_KW = 31, TEMPORAL_FORALL_KW = 32, THEN_KW = 33, BY_KW = 34, ONLY_KW = 35, DEFINE_KW = 36, DEF_KW = 37, THEOREM_KW = 38, USE_KW = 39, HIDE_KW = 40, HAVE_KW = 41, OBVIOUS_KW = 42, OMITTED_KW = 43, LAMBDA_KW = 44, TAKE_KW = 45, PROOF_KW = 46, PROVE_KW = 47, BOX_PROVE_KW = 48, QED_KW = 49, RECURSIVE_KW = 50, STATE_KW = 51, TEMPORAL_KW = 52, PICK_KW = 53, WITNESS_KW = 54, SUFFICES_KW = 55, VARIABLE_KW = 56, WF_KW = 57, WITH_KW = 58, COMMA = 59, COLON = 60, COLON_COLON = 61, DOT = 62, UNDERSCORE = 63, DEF_EQ = 64, L_PAREN = 65, R_PAREN = 66, DEFBREAK_LIT = 67, L_BRACK = 68, R_BRACK_UNDERSCORE = 69, R_BRACK = 70, L_BRACE = 71, R_BRACE = 72, L_ANGLE = 73, R_ANGLE_UNDERSCORE = 74, R_ANGLE = 75, BANG = 76, ARROW = 77, LEFT_ARROW = 78, MAPS_TO = 79, NUMBER = 80, STRING = 81, IDENT = 82, BAD_JUNCTION = 83, LEX_ERROR = 84, STEP_NUMBER = 85, STEP_IMPLICIT = 86, STEP_DOT = 87, STEP_BARE = 88, STEP_UNNUMBERED = 89, PREFIX_OP = 90, BOX_OP = 91, DIAMOND_OP = 92, NEG_DOT_OP = 93, POSTFIX_OP = 94, INFIX_OP = 95, AND_OP = 96, OR_OP = 97, IN_OP = 98, EQ_OP = 99, MINUS_OP = 100, EOF = 101, SOURCE_FILE = 102, MODULE = 103, MODULE_HEADER = 104, EXTENDS = 105, PRAGMA = 106, VARIABLE_DECL = 107, CONSTANT_DECL = 108, RECURSIVE_DECL = 109, IDENT_DECL = 110, PREFIX_DECL = 111, INFIX_DECL = 112, POSTFIX_DECL = 113, OPERATOR_DEF = 114, FUNCTION_DEF = 115, MODULE_DEF = 116, IDENT_LHS = 117, PREFIX_LHS = 118, INFIX_LHS = 119, POSTFIX_LHS = 120, INSTANCE = 121, INSTANTIATION = 122, SUBSTITUTION = 123, ASSUMPTION = 124, THEOREM = 125, USE_OR_HIDE = 126, MODULE_REF = 127, PROOF = 128, TERMINAL_PROOF = 129, PROOF_STEP = 130, QED_STEP = 131, DEF_STEP = 132, HAVE_STEP = 133, TAKE_STEP = 134, WITNESS_STEP = 135, PICK_STEP = 136, CASE_STEP = 137, ASSERT_STEP = 138, ASSUME_PROVE = 139, NEW_DECL = 140, GENERAL_ID = 141, ID_PREFIX = 142, ID_PREFIX_ELEMENT = 143, STRUCT_OP = 144, OP_APPLICATION = 145, OP_ARGS = 146, OP_REF = 147, NUMBER_LIT = 148, DECIMAL_LIT = 149, STRING_LIT = 150, PREFIX_EXPR = 151, INFIX_EXPR = 152, POSTFIX_EXPR = 153, CARTESIAN_PRODUCT = 154, PAREN_EXPR = 155, RECORD_FIELD = 156, FCN_APPL = 157, TUPLE = 158, SET_ENUM = 159, SET_FILTER = 160, SET_MAP = 161, FCN_CONSTRUCTOR = 162, SET_OF_FCNS = 163, RECORD = 164, FIELD_VAL = 165, SET_OF_RECORDS = 166, FIELD_SET = 167, EXCEPT = 168, EXCEPT_SPEC = 169, EXCEPT_COMPONENT = 170, ACTION_EXPR = 171, FAIRNESS_EXPR = 172, IF_EXPR = 173, CASE_EXPR = 174, CASE_ARM = 175, OTHER_ARM = 176, LET_EXPR = 177, LET_DEFS = 178, CONJ_LIST = 179, CONJ_ITEM = 180, DISJ_LIST = 181, DISJ_ITEM = 182, BOUNDED_QUANT = 183, UNBOUNDED_QUANT = 184, TEMPORAL_QUANT = 185, QUANT_BOUND = 186, IDENT_TUPLE = 187, CHOOSE = 188, LAMBDA = 189, LABEL = 190, ERROR = 191,
}
Expand description

The kind of a token or node in the concrete syntax tree.

Token kinds come first, then node kinds. The numeric values are an implementation detail and are not stable across versions.

Variants§

§

WHITESPACE = 0

Spaces, tabs, carriage returns and line feeds.

§

LINE_COMMENT = 1

A \* comment, up to but excluding the line terminator.

§

BLOCK_COMMENT = 2

A (* ... *) comment; these nest. PlusCal algorithms live here.

§

PRELUDE = 3

Text before the first module header, which SANY ignores.

§

TRAILER = 4

Text after the end of the top-level module, which SANY ignores.

§

BEGIN_MODULE = 5

---- MODULE, the start of a module (dashes, spaces and the keyword).

§

SEPARATOR = 6

A line of four or more dashes.

§

END_MODULE = 7

A line of four or more equals signs, ending a module.

§

PRAGMA_START = 8

--->, the start of a SANY pragma before the module.

§

ACTION_KW = 9

ACTION or ACTIONS.

§

ASSUME_KW = 10

ASSUME.

§

BOX_ASSUME_KW = 11

[]ASSUME.

§

ASSUMPTION_KW = 12

ASSUMPTION or AXIOM.

§

CASE_KW = 13

CASE.

§

CHOOSE_KW = 14

CHOOSE.

§

CONSTANT_KW = 15

CONSTANT or CONSTANTS.

§

ELSE_KW = 16

ELSE.

§

EXCEPT_KW = 17

EXCEPT.

§

EXISTS_KW = 18

\E, \exists or ∃.

§

EXTENDS_KW = 19

EXTENDS.

§

FORALL_KW = 20

\A, \forall or ∀.

§

IF_KW = 21

IF.

§

INSTANCE_KW = 22

INSTANCE.

§

LET_KW = 23

LET.

§

IN_KW = 24

IN (of LET ... IN).

§

LOCAL_KW = 25

LOCAL.

§

MODULE_KW = 26

MODULE (in USE MODULE M and similar).

§

NEW_KW = 27

NEW.

§

OTHER_KW = 28

OTHER.

§

PROPOSITION_KW = 29

PROPOSITION, LEMMA or COROLLARY.

§

SF_KW = 30

SF_.

§

TEMPORAL_EXISTS_KW = 31

\EE.

§

TEMPORAL_FORALL_KW = 32

\AA.

§

THEN_KW = 33

THEN.

§

BY_KW = 34

BY.

§

ONLY_KW = 35

ONLY.

§

DEFINE_KW = 36

DEFINE.

§

DEF_KW = 37

DEF or DEFS.

§

THEOREM_KW = 38

THEOREM.

§

USE_KW = 39

USE.

§

HIDE_KW = 40

HIDE.

§

HAVE_KW = 41

HAVE.

§

OBVIOUS_KW = 42

OBVIOUS.

§

OMITTED_KW = 43

OMITTED.

§

LAMBDA_KW = 44

LAMBDA.

§

TAKE_KW = 45

TAKE.

§

PROOF_KW = 46

PROOF.

§

PROVE_KW = 47

PROVE.

§

BOX_PROVE_KW = 48

[]PROVE.

§

QED_KW = 49

QED.

§

RECURSIVE_KW = 50

RECURSIVE.

§

STATE_KW = 51

STATE.

§

TEMPORAL_KW = 52

TEMPORAL or TEMPORALS.

§

PICK_KW = 53

PICK.

§

WITNESS_KW = 54

WITNESS.

§

SUFFICES_KW = 55

SUFFICES.

§

VARIABLE_KW = 56

VARIABLE or VARIABLES.

§

WF_KW = 57

WF_.

§

WITH_KW = 58

WITH.

§

COMMA = 59

,.

§

COLON = 60

:.

§

COLON_COLON = 61

:: or ∷.

§

DOT = 62

..

§

UNDERSCORE = 63

_.

§

DEF_EQ = 64

== or ≜.

§

L_PAREN = 65

(.

§

R_PAREN = 66

).

§

DEFBREAK_LIT = 67

The literal -|-, which SANY lexes as its internal definition marker.

§

L_BRACK = 68

[.

§

R_BRACK_UNDERSCORE = 69

]_.

§

R_BRACK = 70

].

§

L_BRACE = 71

{.

§

R_BRACE = 72

}.

§

L_ANGLE = 73

<< or ⟨.

§

R_ANGLE_UNDERSCORE = 74

>>_ or ⟩_.

§

R_ANGLE = 75

>> or ⟩.

§

BANG = 76

!.

§

ARROW = 77

-> or →.

§

LEFT_ARROW = 78

<- or ←.

§

MAPS_TO = 79

|-> or ↦.

§

NUMBER = 80

A natural number: decimal digits, or \b, \o, \h forms.

§

STRING = 81

A string literal with its quotes.

§

IDENT = 82

An identifier, @, or one of ℕ ℤ ℝ.

§

BAD_JUNCTION = 83

SANY’s x./\ and x.\/ lexemes, which no production accepts.

§

LEX_ERROR = 84

A lexical error: a character or string no token matches.

§

STEP_NUMBER = 85

<1>2: a numbered step name.

§

STEP_IMPLICIT = 86

<*>a or <+>a: a step name with an implicit level.

§

STEP_DOT = 87

<1>2.: a step start followed by dots.

§

STEP_BARE = 88

<1>, <*> or <+>: a bare level.

§

STEP_UNNUMBERED = 89

<1>., <1>* or <1>-: an unnumbered step start.

§

PREFIX_OP = 90

A prefix operator: ~ \lnot \neg ¬ ENABLED UNCHANGED SUBSET UNION DOMAIN.

§

BOX_OP = 91

[] or □: the always operator and the CASE separator.

§

DIAMOND_OP = 92

<> or ◇.

§

NEG_DOT_OP = 93

-., the name of prefix minus.

§

POSTFIX_OP = 94

A postfix operator: ' ^+ ⁺ ^* ^#.

§

INFIX_OP = 95

An infix operator other than the specially handled ones below.

§

AND_OP = 96

/\ or ∧ (also a conjunction-list bullet).

§

OR_OP = 97

\/ or ∨ (also a disjunction-list bullet).

§

IN_OP = 98

\in or ∈.

§

EQ_OP = 99

=.

§

MINUS_OP = 100

- (infix minus, and prefix minus in expressions).

§

EOF = 101

End of input (never appears in the tree).

§

SOURCE_FILE = 102

The root: prelude, top-level module and trailer.

§

MODULE = 103

A module, top-level or nested.

§

MODULE_HEADER = 104

---- MODULE Name ----.

§

EXTENDS = 105

The EXTENDS clause.

§

PRAGMA = 106

SANY’s pragma before a module.

§

VARIABLE_DECL = 107

VARIABLE(S) x, y.

§

CONSTANT_DECL = 108

CONSTANT(S) ....

§

RECURSIVE_DECL = 109

RECURSIVE ....

§

IDENT_DECL = 110

Id or Id(_, _) in a declaration.

§

PREFIX_DECL = 111

-. _ or ~ _ in a declaration.

§

INFIX_DECL = 112

_ + _ in a declaration.

§

POSTFIX_DECL = 113

_ ^+ in a declaration.

§

OPERATOR_DEF = 114

Op(params) == expr and the other operator definition forms.

§

FUNCTION_DEF = 115

f[x \in S] == expr.

§

MODULE_DEF = 116

I == INSTANCE M WITH ....

§

IDENT_LHS = 117

The left-hand side Id or Id(params).

§

PREFIX_LHS = 118

The left-hand side op x of a prefix operator definition.

§

INFIX_LHS = 119

The left-hand side x op y of an infix operator definition.

§

POSTFIX_LHS = 120

The left-hand side x op of a postfix operator definition.

§

INSTANCE = 121

[LOCAL] INSTANCE M WITH ... as a module unit.

§

INSTANTIATION = 122

INSTANCE M WITH ....

§

SUBSTITUTION = 123

x <- expr in an INSTANCE ... WITH.

§

ASSUMPTION = 124

ASSUME / ASSUMPTION / AXIOM unit.

§

THEOREM = 125

THEOREM / LEMMA / PROPOSITION / COROLLARY unit, with its proof.

§

USE_OR_HIDE = 126

USE or HIDE (also a proof step body).

§

MODULE_REF = 127

MODULE M inside USE, HIDE, BY or DEF lists.

§

PROOF = 128

A non-terminal proof: optional PROOF then steps ending in QED.

§

TERMINAL_PROOF = 129

BY ..., OBVIOUS or OMITTED, optionally after PROOF.

§

PROOF_STEP = 130

A proof step: step start token, body, optional proof.

§

QED_STEP = 131

QED.

§

DEF_STEP = 132

DEFINE and/or definitions as a step.

§

HAVE_STEP = 133

HAVE expr.

§

TAKE_STEP = 134

TAKE ....

§

WITNESS_STEP = 135

WITNESS ....

§

PICK_STEP = 136

PICK ... : expr.

§

CASE_STEP = 137

CASE expr as a step.

§

ASSERT_STEP = 138

An assertion step: optional SUFFICES, then an expression or ASSUME/PROVE.

§

ASSUME_PROVE = 139

ASSUME ... PROVE ....

§

NEW_DECL = 140

NEW x \in S, CONSTANT c, VARIABLE v, STATE f and similar.

§

GENERAL_ID = 141

A possibly qualified name such as x, M!Op or Op!1!<<.

§

ID_PREFIX = 142

The M!N! qualification of a SyntaxKind::GENERAL_ID.

§

ID_PREFIX_ELEMENT = 143

One name[(args)]! element of an SyntaxKind::ID_PREFIX.

§

STRUCT_OP = 144

A structural subexpression selector <<, >>, :, @ or a number.

§

OP_APPLICATION = 145

Op(args).

§

OP_ARGS = 146

(arg, ...).

§

OP_REF = 147

A bare operator symbol passed as an argument or substituted: F(+).

§

NUMBER_LIT = 148

A natural number literal.

§

DECIMAL_LIT = 149

A decimal literal 1.5.

§

STRING_LIT = 150

A string literal.

§

PREFIX_EXPR = 151

op e for a prefix operator.

§

INFIX_EXPR = 152

a op b.

§

POSTFIX_EXPR = 153

e op for a postfix operator.

§

CARTESIAN_PRODUCT = 154

A \X B \X C (n-ary Cartesian product).

§

PAREN_EXPR = 155

(e).

§

RECORD_FIELD = 156

r.field.

§

FCN_APPL = 157

f[a, b].

§

TUPLE = 158

<<a, b>>.

§

SET_ENUM = 159

{a, b}.

§

SET_FILTER = 160

{x \in S : P}.

§

SET_MAP = 161

{e : x \in S}.

§

FCN_CONSTRUCTOR = 162

[x \in S |-> e].

§

SET_OF_FCNS = 163

[S -> T].

§

RECORD = 164

[a |-> 1, b |-> 2].

§

FIELD_VAL = 165

a |-> 1 inside a record.

§

SET_OF_RECORDS = 166

[a : S, b : T].

§

FIELD_SET = 167

a : S inside a set of records.

§

EXCEPT = 168

[f EXCEPT ![x] = y].

§

EXCEPT_SPEC = 169

![x].y = e inside EXCEPT.

§

EXCEPT_COMPONENT = 170

[x] or .y inside an SyntaxKind::EXCEPT_SPEC.

§

ACTION_EXPR = 171

[A]_v or <<A>>_v.

§

FAIRNESS_EXPR = 172

WF_v(A) or SF_v(A).

§

IF_EXPR = 173

IF c THEN a ELSE b.

§

CASE_EXPR = 174

CASE ....

§

CASE_ARM = 175

p -> e inside CASE.

§

OTHER_ARM = 176

OTHER -> e inside CASE.

§

LET_EXPR = 177

LET ... IN e.

§

LET_DEFS = 178

The definitions of a LET.

§

CONJ_LIST = 179

A bulleted /\ list.

§

CONJ_ITEM = 180

One /\ e item.

§

DISJ_LIST = 181

A bulleted \/ list.

§

DISJ_ITEM = 182

One \/ e item.

§

BOUNDED_QUANT = 183

\A x \in S : P and \E x \in S : P.

§

UNBOUNDED_QUANT = 184

\A x : P and \E x : P.

§

TEMPORAL_QUANT = 185

\AA x : P and \EE x : P.

§

QUANT_BOUND = 186

x, y \in S or <<x, y>> \in S.

§

IDENT_TUPLE = 187

<<x, y>> as a bound variable tuple.

§

CHOOSE = 188

CHOOSE x \in S : P.

§

LAMBDA = 189

LAMBDA x, y : e.

§

LABEL = 190

lab :: e (also labels on ASSUME/PROVE).

§

ERROR = 191

Tokens skipped while recovering from a syntax error.

Implementations§

Source§

impl SyntaxKind

Source

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

The kind’s name, for tree dumps and JSON output.

Source§

impl SyntaxKind

Source

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

Converts a raw value produced by SyntaxKind::to_raw back to a kind.

Source

pub fn to_raw(self) -> u16

The raw value of this kind.

Source

pub fn is_trivia(self) -> bool

Whether the kind is trivia (whitespace, comments, ignored text).

Source

pub fn is_keyword(self) -> bool

Whether the kind is a keyword token.

Source

pub fn is_operator(self) -> bool

Whether the kind is an operator token.

Source

pub fn is_node(self) -> bool

Whether the kind is a node kind (as opposed to a token kind).

Trait Implementations§

Source§

impl Clone for SyntaxKind

Source§

fn clone(&self) -> Self

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

Source§

fn from(kind: SyntaxKind) -> Self

Converts to this type from the input type.
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: &Self) -> 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§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for SyntaxKind

Source§

fn eq(&self, other: &Self) -> 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: &Self) -> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.