Enum SyntaxKind

Source
#[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: .

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

Source

pub fn is_grouping(self) -> bool

Is this a bracket, brace, or parenthesis?

Source

pub fn is_terminator(self) -> bool

Does this node terminate a preceding expression?

Source

pub fn is_block(self) -> bool

Is this a code or content block.

Source

pub fn is_stmt(self) -> bool

Does this node need termination through a semicolon or linebreak?

Source

pub fn is_keyword(self) -> bool

Is this node is a keyword.

Source

pub fn is_trivia(self) -> bool

Whether this kind of node is automatically skipped by the parser in code and math mode.

Source

pub fn is_error(self) -> bool

Whether this is an error.

Source

pub fn name(self) -> &'static str

A human-readable name for the kind.

Trait Implementations§

Source§

impl Clone for SyntaxKind

Source§

fn clone(&self) -> SyntaxKind

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SyntaxKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Hash for SyntaxKind

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

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 PartialEq for SyntaxKind

Source§

fn eq(&self, other: &SyntaxKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for SyntaxKind

Source§

impl Eq for SyntaxKind

Source§

impl StructuralPartialEq for SyntaxKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: Real + Zero + Arithmetics + Clone, Swp: WhitePoint<T>, Dwp: WhitePoint<T>, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<T>,

Convert the source color to the destination color using the specified method.
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default.
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, C> ArraysFrom<C> for T
where C: IntoArrays<T>,

Source§

fn arrays_from(colors: C) -> T

Cast a collection of colors into a collection of arrays.
Source§

impl<T, C> ArraysInto<C> for T
where C: FromArrays<T>,

Source§

fn arrays_into(self) -> C

Cast this collection of arrays into a collection of colors.
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for U
where T: FromCam16Unclamped<WpParam, U>,

Source§

type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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, C> ComponentsFrom<C> for T
where C: IntoComponents<T>,

Source§

fn components_from(colors: C) -> T

Cast a collection of colors into a collection of color components.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> Filterable for T

Source§

fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>

Creates a filterable data provider with the given name for debugging. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromAngle<T> for T

Source§

fn from_angle(angle: T) -> T

Performs a conversion from angle.
Source§

impl<T, U> FromStimulus<U> for T
where U: IntoStimulus<T>,

Source§

fn from_stimulus(other: U) -> T

Converts other into Self, while performing the appropriate scaling, rounding and clamping.
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, U> IntoAngle<U> for T
where U: FromAngle<T>,

Source§

fn into_angle(self) -> U

Performs a conversion into T.
Source§

impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for U
where T: Cam16FromUnclamped<WpParam, U>,

Source§

type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar

The number type that’s used in parameters when converting.
Source§

fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T

Converts self into C, using the provided parameters.
Source§

impl<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space Read more
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> IntoStimulus<T> for T

Source§

fn into_stimulus(self) -> T

Converts self into T, while performing the appropriate scaling, rounding and clamping.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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, C> TryComponentsInto<C> for T
where C: TryFromComponents<T>,

Source§

type Error = <C as TryFromComponents<T>>::Error

The error for when try_into_colors fails to cast.
Source§

fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>

Try to cast this collection of color components into a collection of colors. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more
Source§

impl<C, U> UintsFrom<C> for U
where C: IntoUints<U>,

Source§

fn uints_from(colors: C) -> U

Cast a collection of colors into a collection of unsigned integers.
Source§

impl<C, U> UintsInto<C> for U
where C: FromUints<U>,

Source§

fn uints_into(self) -> C

Cast this collection of unsigned integers into a collection of colors.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T
where T: Send + Sync,