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