#[repr(u8)]pub enum SyntaxKind {
Show 132 variants
End = 0,
Error = 1,
LineComment = 2,
BlockComment = 3,
Markup = 4,
Text = 5,
Space = 6,
Linebreak = 7,
Parbreak = 8,
Escape = 9,
Shorthand = 10,
SmartQuote = 11,
Strong = 12,
Emph = 13,
Raw = 14,
RawLang = 15,
RawDelim = 16,
RawTrimmed = 17,
Link = 18,
Label = 19,
Ref = 20,
RefMarker = 21,
Heading = 22,
HeadingMarker = 23,
ListItem = 24,
ListMarker = 25,
EnumItem = 26,
EnumMarker = 27,
TermItem = 28,
TermMarker = 29,
Equation = 30,
Math = 31,
MathIdent = 32,
MathShorthand = 33,
MathAlignPoint = 34,
MathDelimited = 35,
MathAttach = 36,
MathPrimes = 37,
MathFrac = 38,
MathRoot = 39,
Hash = 40,
LeftBrace = 41,
RightBrace = 42,
LeftBracket = 43,
RightBracket = 44,
LeftParen = 45,
RightParen = 46,
Comma = 47,
Semicolon = 48,
Colon = 49,
Star = 50,
Underscore = 51,
Dollar = 52,
Plus = 53,
Minus = 54,
Slash = 55,
Hat = 56,
Prime = 57,
Dot = 58,
Eq = 59,
EqEq = 60,
ExclEq = 61,
Lt = 62,
LtEq = 63,
Gt = 64,
GtEq = 65,
PlusEq = 66,
HyphEq = 67,
StarEq = 68,
SlashEq = 69,
Dots = 70,
Arrow = 71,
Root = 72,
Not = 73,
And = 74,
Or = 75,
None = 76,
Auto = 77,
Let = 78,
Set = 79,
Show = 80,
Context = 81,
If = 82,
Else = 83,
For = 84,
In = 85,
While = 86,
Break = 87,
Continue = 88,
Return = 89,
Import = 90,
Include = 91,
As = 92,
Code = 93,
Ident = 94,
Bool = 95,
Int = 96,
Float = 97,
Numeric = 98,
Str = 99,
CodeBlock = 100,
ContentBlock = 101,
Parenthesized = 102,
Array = 103,
Dict = 104,
Named = 105,
Keyed = 106,
Unary = 107,
Binary = 108,
FieldAccess = 109,
FuncCall = 110,
Args = 111,
Spread = 112,
Closure = 113,
Params = 114,
LetBinding = 115,
SetRule = 116,
ShowRule = 117,
Contextual = 118,
Conditional = 119,
WhileLoop = 120,
ForLoop = 121,
ModuleImport = 122,
ImportItems = 123,
ImportItemPath = 124,
RenamedImportItem = 125,
ModuleInclude = 126,
LoopBreak = 127,
LoopContinue = 128,
FuncReturn = 129,
Destructuring = 130,
DestructAssignment = 131,
}
Expand description
A syntactical building block of a Typst file.
Can be created by the lexer or by the parser.
Variants§
End = 0
The end of token stream.
Error = 1
An invalid sequence of characters.
LineComment = 2
A line comment: // ...
.
BlockComment = 3
A block comment: /* ... */
.
Markup = 4
The contents of a file or content block.
Text = 5
Plain text without markup.
Space = 6
Whitespace. Contains at most one newline in markup, as more indicate a paragraph break.
Linebreak = 7
A forced line break: \
.
Parbreak = 8
A paragraph break, indicated by one or multiple blank lines.
Escape = 9
An escape sequence: \#
, \u{1F5FA}
.
Shorthand = 10
A shorthand for a unicode codepoint. For example, ~
for non-breaking
space or -?
for a soft hyphen.
SmartQuote = 11
A smart quote: '
or "
.
Strong = 12
Strong content: *Strong*
.
Emph = 13
Emphasized content: _Emphasized_
.
Raw = 14
Raw text with optional syntax highlighting: `...`
.
RawLang = 15
A language tag at the start of raw text: typ
.
RawDelim = 16
A raw delimiter consisting of 1 or 3+ backticks: `
.
RawTrimmed = 17
A sequence of whitespace to ignore in a raw text:
.
Link = 18
A hyperlink: https://typst.org
.
Label = 19
A label: <intro>
.
Ref = 20
A reference: @target
, @target[..]
.
RefMarker = 21
Introduces a reference: @target
.
Heading = 22
A section heading: = Introduction
.
HeadingMarker = 23
Introduces a section heading: =
, ==
, …
ListItem = 24
An item in a bullet list: - ...
.
ListMarker = 25
Introduces a list item: -
.
EnumItem = 26
An item in an enumeration (numbered list): + ...
or 1. ...
.
EnumMarker = 27
Introduces an enumeration item: +
, 1.
.
TermItem = 28
An item in a term list: / Term: Details
.
TermMarker = 29
Introduces a term item: /
.
Equation = 30
A mathematical equation: $x$
, $ x^2 $
.
Math = 31
The contents of a mathematical equation: x^2 + 1
.
MathIdent = 32
An identifier in math: pi
.
MathShorthand = 33
A shorthand for a unicode codepoint in math: a <= b
.
MathAlignPoint = 34
An alignment point in math: &
.
MathDelimited = 35
Matched delimiters in math: [x + y]
.
MathAttach = 36
A base with optional attachments in math: a_1^2
.
MathPrimes = 37
Grouped primes in math: a'''
.
MathFrac = 38
A fraction in math: x/2
.
MathRoot = 39
A root in math: √x
, ∛x
or ∜x
.
Hash = 40
A hash that switches into code mode: #
.
LeftBrace = 41
A left curly brace, starting a code block: {
.
RightBrace = 42
A right curly brace, terminating a code block: }
.
LeftBracket = 43
A left square bracket, starting a content block: [
.
RightBracket = 44
A right square bracket, terminating a content block: ]
.
LeftParen = 45
A left round parenthesis, starting a grouped expression, collection,
argument or parameter list: (
.
RightParen = 46
A right round parenthesis, terminating a grouped expression, collection,
argument or parameter list: )
.
Comma = 47
A comma separator in a sequence: ,
.
Semicolon = 48
A semicolon terminating an expression: ;
.
Colon = 49
A colon between name/key and value in a dictionary, argument or
parameter list, or between the term and body of a term list term: :
.
Star = 50
The strong text toggle, multiplication operator, and wildcard import
symbol: *
.
Underscore = 51
Toggles emphasized text and indicates a subscript in math: _
.
Dollar = 52
Starts and ends a mathematical equation: $
.
Plus = 53
The unary plus and binary addition operator: +
.
Minus = 54
The unary negation and binary subtraction operator: -
.
Slash = 55
The division operator and fraction operator in math: /
.
Hat = 56
The superscript operator in math: ^
.
Prime = 57
The prime in math: '
.
Dot = 58
The field access and method call operator: .
.
Eq = 59
The assignment operator: =
.
EqEq = 60
The equality operator: ==
.
ExclEq = 61
The inequality operator: !=
.
Lt = 62
The less-than operator: <
.
LtEq = 63
The less-than or equal operator: <=
.
Gt = 64
The greater-than operator: >
.
GtEq = 65
The greater-than or equal operator: >=
.
PlusEq = 66
The add-assign operator: +=
.
HyphEq = 67
The subtract-assign operator: -=
.
StarEq = 68
The multiply-assign operator: *=
.
SlashEq = 69
The divide-assign operator: /=
.
Dots = 70
Indicates a spread or sink: ..
.
Arrow = 71
An arrow between a closure’s parameters and body: =>
.
Root = 72
A root: √
, ∛
or ∜
.
Not = 73
The not
operator.
And = 74
The and
operator.
Or = 75
The or
operator.
None = 76
The none
literal.
Auto = 77
The auto
literal.
Let = 78
The let
keyword.
Set = 79
The set
keyword.
Show = 80
The show
keyword.
Context = 81
The context
keyword.
If = 82
The if
keyword.
Else = 83
The else
keyword.
For = 84
The for
keyword.
In = 85
The in
keyword.
While = 86
The while
keyword.
Break = 87
The break
keyword.
Continue = 88
The continue
keyword.
Return = 89
The return
keyword.
Import = 90
The import
keyword.
Include = 91
The include
keyword.
As = 92
The as
keyword.
Code = 93
The contents of a code block.
Ident = 94
An identifier: it
.
Bool = 95
A boolean: true
, false
.
Int = 96
An integer: 120
.
Float = 97
A floating-point number: 1.2
, 10e-4
.
Numeric = 98
A numeric value with a unit: 12pt
, 3cm
, 2em
, 90deg
, 50%
.
Str = 99
A quoted string: "..."
.
CodeBlock = 100
A code block: { let x = 1; x + 2 }
.
ContentBlock = 101
A content block: [*Hi* there!]
.
Parenthesized = 102
A grouped expression: (1 + 2)
.
Array = 103
An array: (1, "hi", 12cm)
.
Dict = 104
A dictionary: (thickness: 3pt, pattern: dashed)
.
Named = 105
A named pair: thickness: 3pt
.
Keyed = 106
A keyed pair: "spacy key": true
.
Unary = 107
A unary operation: -x
.
Binary = 108
A binary operation: a + b
.
FieldAccess = 109
A field access: properties.age
.
FuncCall = 110
An invocation of a function or method: f(x, y)
.
Args = 111
A function call’s argument list: (12pt, y)
.
Spread = 112
Spread arguments or an argument sink: ..x
.
Closure = 113
A closure: (x, y) => z
.
Params = 114
A closure’s parameters: (x, y)
.
LetBinding = 115
A let binding: let x = 1
.
SetRule = 116
A set rule: set text(...)
.
ShowRule = 117
A show rule: show heading: it => emph(it.body)
.
Contextual = 118
A contextual expression: context text.lang
.
Conditional = 119
An if-else conditional: if x { y } else { z }
.
WhileLoop = 120
A while loop: while x { y }
.
ForLoop = 121
A for loop: for x in y { z }
.
ModuleImport = 122
A module import: import "utils.typ": a, b, c
.
ImportItems = 123
Items to import from a module: a, b, c
.
ImportItemPath = 124
A path to an imported name from a submodule: a.b.c
.
RenamedImportItem = 125
A renamed import item: a as d
.
ModuleInclude = 126
A module include: include "chapter1.typ"
.
LoopBreak = 127
A break from a loop: break
.
LoopContinue = 128
A continue in a loop: continue
.
FuncReturn = 129
A return from a function: return
, return x + 1
.
Destructuring = 130
A destructuring pattern: (x, _, ..y)
.
DestructAssignment = 131
A destructuring assignment expression: (x, y) = (1, 2)
.
Implementations§
source§impl SyntaxKind
impl SyntaxKind
sourcepub fn is_grouping(self) -> bool
pub fn is_grouping(self) -> bool
Is this a bracket, brace, or parenthesis?
sourcepub fn is_terminator(self) -> bool
pub fn is_terminator(self) -> bool
Does this node terminate a preceding expression?
sourcepub fn is_keyword(self) -> bool
pub fn is_keyword(self) -> bool
Is this node is a keyword.
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 Hash for SyntaxKind
impl Hash for SyntaxKind
source§impl PartialEq for SyntaxKind
impl PartialEq 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more