pub enum SyntaxKind {
Show 68 variants
ParenOpen = 0,
ParenClose,
BracketOpen,
BracketClose,
BraceOpen,
BraceClose,
DoubleColon,
Colon,
Equals,
Negation,
Minus,
Tilde,
Underscore,
Star,
Plus,
Question,
StarQuestion,
PlusQuestion,
QuestionQuestion,
Slash,
Comma,
Pipe,
DoubleQuote,
SingleQuote,
StrVal,
KwError,
KwMissing,
Id,
Dot,
CaptureToken,
SuppressiveCapture,
At,
Whitespace,
Newline,
LineComment,
BlockComment,
OpEq,
OpNe,
OpStartsWith,
OpEndsWith,
OpContains,
OpRegexMatch,
OpRegexNoMatch,
RegexPredicateMatch,
RegexPredicateNoMatch,
RegexLiteral,
RegexContent,
XMLGarbage,
TsPredicate,
Garbage,
Error,
Root,
Tree,
Ref,
Str,
Field,
Capture,
Type,
Quantifier,
Seq,
Alt,
Branch,
Wildcard,
Anchor,
NegatedField,
Def,
NodePredicate,
Regex,
// some variants omitted
}Expand description
All token and node kinds. Tokens first, then nodes, then __LAST sentinel.
#[repr(u16)] enables safe transmute in kind_from_raw.
Variants§
ParenOpen = 0
ParenClose
BracketOpen
BracketClose
BraceOpen
BraceClose
DoubleColon
:: for type annotations. Defined before Colon for correct precedence.
Colon
Equals
Negation
Minus
Tilde
Underscore
Star
Plus
Question
StarQuestion
Non-greedy *? quantifier
PlusQuestion
Non-greedy +? quantifier
QuestionQuestion
Non-greedy ?? quantifier
Slash
Slash for supertype paths: (expression/binary_expression)
Comma
Comma (invalid separator, for error recovery)
Pipe
Pipe (invalid separator, for error recovery)
DoubleQuote
SingleQuote
StrVal
String content between quotes
KwError
KwMissing
Id
Identifier. Accepts dots/hyphens for tree-sitter compat; parser validates per context. Defined after keywords so they take precedence.
Dot
CaptureToken
Regular capture: @name (matches before At)
SuppressiveCapture
Suppressive capture: @_ or @_name (matches before At)
At
Bare @ (for error recovery: “capture without target”)
Whitespace
Newline
LineComment
BlockComment
OpEq
== for predicate equals
OpNe
!= for predicate not equals
OpStartsWith
^= for predicate starts-with
OpEndsWith
$= for predicate ends-with
OpContains
*= for predicate contains (defined after Star for correct precedence)
OpRegexMatch
=~ for predicate regex match (when followed by string or error)
OpRegexNoMatch
!~ for predicate regex no-match (when followed by string or error)
RegexPredicateMatch
=~ followed by regex literal: =~ /pattern/
Compound token to avoid // being lexed as line comment.
RegexPredicateNoMatch
!~ followed by regex literal: !~ /pattern/
RegexLiteral
Regex literal token (after splitting compound predicate)
RegexContent
Regex pattern content (between slashes, set by parser)
XMLGarbage
XML-like tags matched as errors (common LLM output)
TsPredicate
Tree-sitter predicates (unsupported)
Garbage
Coalesced unrecognized characters
Error
Root
Tree
Ref
Str
Field
Capture
Type
Quantifier
Seq
Alt
Branch
Wildcard
Anchor
NegatedField
Def
NodePredicate
Predicate on a node: (identifier == "foo")
Regex
Regex literal: /pattern/
Implementations§
Trait Implementations§
Source§impl Clone for SyntaxKind
impl Clone for SyntaxKind
Source§fn clone(&self) -> SyntaxKind
fn clone(&self) -> SyntaxKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntaxKind
impl Debug 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<'s> Logos<'s> for SyntaxKind
impl<'s> Logos<'s> for SyntaxKind
Source§type Error = ()
type Error = ()
#[logos(error = MyError)]. Defaults to () if not set.Source§type Extras = ()
type Extras = ()
Extras for the particular lexer. This can be set using
#[logos(extras = MyExtras)] and accessed inside callbacks.Source§type Source = str
type Source = str
str,
unless one of the defined patterns explicitly uses non-unicode byte values
or byte slices, in which case that implementation will use [u8].Source§fn lex(
lex: &mut Lexer<'s, Self>,
) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
fn lex( lex: &mut Lexer<'s, Self>, ) -> Option<Result<Self, <Self as Logos<'s>>::Error>>
Lexer. The implementation for this function
is generated by the logos-derive crate.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 · 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§impl PartialOrd for SyntaxKind
impl PartialOrd for SyntaxKind
impl Copy for SyntaxKind
impl Eq for SyntaxKind
impl StructuralPartialEq for SyntaxKind
Auto Trait Implementations§
impl Freeze for SyntaxKind
impl RefUnwindSafe for SyntaxKind
impl Send for SyntaxKind
impl Sync for SyntaxKind
impl Unpin for SyntaxKind
impl UnwindSafe for SyntaxKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.