Skip to main content

SyntaxKind

Enum SyntaxKind 

Source
#[repr(u16)]
pub enum SyntaxKind {
Show 107 variants ROOT = 0, BINARY_EXPR = 1, ASSIGNMENT_EXPR = 2, PAREN_EXPR = 3, IF_EXPR = 4, FOR_EXPR = 5, WHILE_EXPR = 6, REPEAT_EXPR = 7, FUNCTION_EXPR = 8, BLOCK_EXPR = 9, UNARY_EXPR = 10, IDENT = 11, INT = 12, FLOAT = 13, STRING = 14, COMMENT = 15, TILDE = 16, USER_OP = 17, LBRACK = 18, RBRACK = 19, LBRACK2 = 20, RBRACK2 = 21, PLUS = 22, MINUS = 23, STAR = 24, SLASH = 25, CARET = 26, PIPE = 27, COLON = 28, COLON2 = 29, COLON3 = 30, DOLLAR = 31, AT = 32, SEMICOLON = 33, COMMA = 34, OR = 35, OR2 = 36, AND = 37, AND2 = 38, EQUAL2 = 39, NOT_EQUAL = 40, BANG = 41, LESS_THAN = 42, LESS_THAN_OR_EQUAL = 43, GREATER_THAN = 44, GREATER_THAN_OR_EQUAL = 45, LPAREN = 46, RPAREN = 47, IF_KW = 48, ELSE_KW = 49, FOR_KW = 50, WHILE_KW = 51, REPEAT_KW = 52, FUNCTION_KW = 53, IN_KW = 54, LBRACE = 55, RBRACE = 56, WHITESPACE = 57, NEWLINE = 58, ASSIGN_LEFT = 59, SUPER_ASSIGN = 60, ASSIGN_RIGHT = 61, SUPER_ASSIGN_RIGHT = 62, ASSIGN_EQ = 63, CALL_EXPR = 64, SUBSET_EXPR = 65, SUBSET2_EXPR = 66, ARG_LIST = 67, ARG = 68, ERROR = 69, COMPLEX = 70, QUESTION = 71, WALRUS = 72, ROXYGEN_MARKER = 73, ROXYGEN_AT = 74, ROXYGEN_TAG_NAME = 75, ROXYGEN_TAG_ARG = 76, ROXYGEN_TEXT = 77, ROXYGEN_CODE = 78, ROXYGEN_RD_MACRO = 79, ROXYGEN_MD_LINK = 80, ROXYGEN_BLOCK = 81, ROXYGEN_LINE = 82, ROXYGEN_TAG = 83, ROXYGEN_RD_MACRO_NAME = 84, ROXYGEN_RD_MACRO_OPT = 85, ROXYGEN_RD_MACRO_DELIM = 86, ROXYGEN_RD_MACRO_VERB = 87, ROXYGEN_SECTION = 88, ROXYGEN_PARAGRAPH = 89, ROXYGEN_MD_EMPH = 90, ROXYGEN_MD_STRONG = 91, ROXYGEN_MD_CODE = 92, ROXYGEN_MD_LIST_MARKER = 93, ROXYGEN_MD_LIST = 94, ROXYGEN_MD_LIST_ITEM = 95, ROXYGEN_MD_IMAGE = 96, ROXYGEN_MD_CODE_BLOCK = 97, ROXYGEN_MD_FENCE = 98, ROXYGEN_MD_HTML = 99, ROXYGEN_MD_HTML_BLOCK = 100, ROXYGEN_MD_DELIM = 101, ROXYGEN_MD_TABLE = 102, ROXYGEN_MD_HEADING = 103, ROXYGEN_MD_BLOCK_QUOTE = 104, ROXYGEN_MD_THEMATIC_BREAK = 105, ROXYGEN_MD_INDENTED_CODE = 106,
}

Variants§

§

ROOT = 0

§

BINARY_EXPR = 1

§

ASSIGNMENT_EXPR = 2

§

PAREN_EXPR = 3

§

IF_EXPR = 4

§

FOR_EXPR = 5

§

WHILE_EXPR = 6

§

REPEAT_EXPR = 7

§

FUNCTION_EXPR = 8

§

BLOCK_EXPR = 9

§

UNARY_EXPR = 10

§

IDENT = 11

§

INT = 12

§

FLOAT = 13

§

STRING = 14

§

COMMENT = 15

§

TILDE = 16

§

USER_OP = 17

§

LBRACK = 18

§

RBRACK = 19

§

LBRACK2 = 20

§

RBRACK2 = 21

§

PLUS = 22

§

MINUS = 23

§

STAR = 24

§

SLASH = 25

§

CARET = 26

§

PIPE = 27

§

COLON = 28

§

COLON2 = 29

§

COLON3 = 30

§

DOLLAR = 31

§

AT = 32

§

SEMICOLON = 33

§

COMMA = 34

§

OR = 35

§

OR2 = 36

§

AND = 37

§

AND2 = 38

§

EQUAL2 = 39

§

NOT_EQUAL = 40

§

BANG = 41

§

LESS_THAN = 42

§

LESS_THAN_OR_EQUAL = 43

§

GREATER_THAN = 44

§

GREATER_THAN_OR_EQUAL = 45

§

LPAREN = 46

§

RPAREN = 47

§

IF_KW = 48

§

ELSE_KW = 49

§

FOR_KW = 50

§

WHILE_KW = 51

§

REPEAT_KW = 52

§

FUNCTION_KW = 53

§

IN_KW = 54

§

LBRACE = 55

§

RBRACE = 56

§

WHITESPACE = 57

§

NEWLINE = 58

§

ASSIGN_LEFT = 59

§

SUPER_ASSIGN = 60

§

ASSIGN_RIGHT = 61

§

SUPER_ASSIGN_RIGHT = 62

§

ASSIGN_EQ = 63

§

CALL_EXPR = 64

§

SUBSET_EXPR = 65

§

SUBSET2_EXPR = 66

§

ARG_LIST = 67

§

ARG = 68

§

ERROR = 69

§

COMPLEX = 70

§

QUESTION = 71

§

WALRUS = 72

§

ROXYGEN_MARKER = 73

§

ROXYGEN_AT = 74

§

ROXYGEN_TAG_NAME = 75

§

ROXYGEN_TAG_ARG = 76

§

ROXYGEN_TEXT = 77

§

ROXYGEN_CODE = 78

§

ROXYGEN_RD_MACRO = 79

§

ROXYGEN_BLOCK = 81

§

ROXYGEN_LINE = 82

Reserved: the legacy physical-line node. No longer emitted since the CST re-model (a roxygen block now owns logical content — sections and paragraphs — with #' markers and newlines threaded in as trivia, the way rowan/rust-analyzer trees attach whitespace). Kept in the enum so the as u16 discriminants of the later variants stay stable.

§

ROXYGEN_TAG = 83

§

ROXYGEN_RD_MACRO_NAME = 84

§

ROXYGEN_RD_MACRO_OPT = 85

§

ROXYGEN_RD_MACRO_DELIM = 86

§

ROXYGEN_RD_MACRO_VERB = 87

§

ROXYGEN_SECTION = 88

§

ROXYGEN_PARAGRAPH = 89

§

ROXYGEN_MD_EMPH = 90

§

ROXYGEN_MD_STRONG = 91

§

ROXYGEN_MD_CODE = 92

§

ROXYGEN_MD_LIST_MARKER = 93

A markdown list item’s leading marker (-/*/+ or 1./1)), emitted only under a resolved @md block mode and only at a line’s content start. Like the other markdown leaves it holds its literal source (the bullet/number punctuation, without the trailing space, so a marker that does not form a list — see the CommonMark interrupt rule — chunks for reflow exactly as the plain text it stands in for). The projector maps the enclosing ROXYGEN_MD_LIST to \itemize/\enumerate and each item to a name-only \item.

§

ROXYGEN_MD_LIST = 94

§

ROXYGEN_MD_LIST_ITEM = 95

§

ROXYGEN_MD_IMAGE = 96

A markdown image ![alt](url "title"), emitted only under a resolved @md block mode. Like the other markdown leaves it holds its whole span (delimiters included) so the run tiles exactly. The projector maps it to \figure{url}{title}, wrapping the figure in \if{html}{…}/\if{pdf}{…} per roxygen2’s extension-keyed get_image_format rule. Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_CODE_BLOCK = 97

A markdown fenced code block (resolved @md mode only): a ROXYGEN_MD_FENCE opener leaf, the verbatim code lines, and a ROXYGEN_MD_FENCE closer leaf, with the #' markers, marker→content whitespace, and inter-line newlines threaded in as trivia (losslessness), the way the block Rd macros and markdown lists thread them. The projector maps it to roxygen2’s \if{html}{\out{<div…>}} \preformatted{…} \if{html}{\out{</div>}} triple. Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_FENCE = 98

A fenced-code-block delimiter line (3+ backticks plus an optional info string), a leaf inside a ROXYGEN_MD_CODE_BLOCK.

§

ROXYGEN_MD_HTML = 99

A raw inline-HTML tag (<img …>, </span>), emitted only under a resolved @md block mode. Like the other markdown leaves it holds its whole span so the run tiles exactly. The projector maps it to roxygen2’s \if{html}{\out{<tag>}} (mdxml_html_inline). Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_HTML_BLOCK = 100

A markdown HTML block (resolved @md mode only): a run of #' lines opened by a CommonMark HTML-block start (condition 6 — a block-level tag at line start) and continuing to the next blank line, with the #' markers, marker→content whitespace, and inter-line newlines threaded in as trivia (losslessness), the way the fenced code block threads them. Its line content is verbatim ROXYGEN_TEXT; the projector reconstructs the block text and maps it to roxygen2’s \if{html}{\out{…}} (mdxml_html_block). Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_DELIM = 101

A raw markdown emphasis-delimiter run leaf (*, **, _, …), emitted only under a resolved @md block mode. The lexer carves the maximal same- char run neutrally; the inline pass (parser::roxygen::inline) resolves matched runs into ROXYGEN_MD_EMPH/ROXYGEN_MD_STRONG nodes (now node kinds, not leaves), whose opener/closer delimiters are themselves ROXYGEN_MD_DELIM leaves, and leaves an unmatched run as a literal ROXYGEN_MD_DELIM leaf (projected as plain text). Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_TABLE = 102

A GFM table (resolved @md mode only): a header row, a delimiter row (|---|:--:|) whose cell count matches the header, and zero or more body rows, with the #' markers, marker→content whitespace, and inter-line newlines threaded in as trivia (losslessness), the way the fenced code block and HTML block thread them. Its line content is verbatim ROXYGEN_TEXT (and, for the delimiter row, whatever inline leaves the lexer carved); the projector reconstructs the rows and cells from the node text and maps them to roxygen2’s \tabular{<align>}{… \tab … \cr}. Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_HEADING = 103

A markdown ATX heading line (resolved @md mode only): a single line whose content is #{1,6} followed by a space/tab or the line end, holding the #' marker (trivia) and the verbatim ROXYGEN_TEXT heading leaf. The projector reads the level and title from the node text and hoists it into an Rd \section (level 1) / \subsection (level >= 2) out of the enclosing @description/@details. Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_BLOCK_QUOTE = 104

A markdown block quote (resolved @md mode only): a run of consecutive #' lines each opening with > (after up to three spaces), with the #' markers, marker→content whitespace, and inter-line newlines threaded in as trivia (losslessness), the way the HTML block threads them. Its line content is verbatim ROXYGEN_TEXT. roxygen2 does not support block quotes: it warns and renders the node’s flattened plain text (escape_comment(xml_text)), which the projector reproduces (strip each > marker, flatten the inner markdown, concatenate with no separator). Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_THEMATIC_BREAK = 105

A markdown thematic break (resolved @md mode only): a single line whose whole content is a CommonMark thematic break (***/---/___, three or more of one character with optional spaces between, up to three leading spaces), holding the #' marker (trivia) and the verbatim break leaf. roxygen2 has no thematic-break support: it warns and renders the empty escape_comment(xml_text) (a thematic break has no text), so the break contributes nothing and the surrounding paragraphs coalesce. The projector drops it in section_body_parts. Appended last to keep the earlier variants’ as u16 discriminants stable.

§

ROXYGEN_MD_INDENTED_CODE = 106

A markdown indented code block resolved under @md mode: a run of prose lines each indented four or more columns past roxygen2’s stripped #' prefix (a CommonMark indented code block), with interior blank lines, holding the #' markers (trivia) and the verbatim code leaves. roxygen2 renders it exactly like a fenced code block — the three-atom \if{html}{\out{<div…>}} / \preformatted{…} / \if{html}{\out{</div>}} sequence — but with a bare sourceCode class and each line’s indentation stripped (see serialize_md_indented_code). Appended last to keep the earlier variants’ as u16 discriminants stable.

Implementations§

Source§

impl SyntaxKind

Source

pub const COUNT: usize

Number of distinct kinds, sized to the last variant. Used to allocate dispatch tables indexed by kind as usize (see the linter’s single-walk rule dispatch). Stays correct as long as ROXYGEN_MD_INDENTED_CODE remains the last variant.

Source

pub fn is_roxygen_token(self) -> bool

A roxygen line’s bytes are carried by these leaf tokens, which stand in for the single COMMENT token a non-roxygen comment line uses.

Source

pub fn is_roxygen_prose_content(self) -> bool

The prose / inline-markup roxygen content elements: plain text plus the protected spans (inline code, Rd macro, markdown link/code/list-marker/…) and the resolved emphasis/strong nodes. The SyntaxKind-side counterpart of [crate::parser::lexer::RoxygenRole::Content]; the single list the formatter derives “is this a prose element” from. Includes the ROXYGEN_MD_EMPH/ROXYGEN_MD_STRONG nodes (the inline pass’s output) so the formatter treats a resolved span as one atomic prose chunk.

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<'de> Deserialize<'de> for SyntaxKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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: &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§

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: &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 Serialize for SyntaxKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.