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