Crate mitex_parser

Source
Expand description

Given source strings, MiTeX Parser provides an AST (abstract syntax tree).

§Option: Command Specification

The parser retrieves a command specification which defines shape of commands. With the specification, the parser can parse commands correctly. Otherwise, all commands are parsed as barely names without arguments.

§Produce: AST

It returns an untyped syntax node representing the AST defined by rowan. You can access the AST conveniently with interfaces provided by rowan::SyntaxNode.

The untyped syntax node can convert to typed ones defined in crate::syntax.

The untyped syntax node can also convert to rowan::cursor::SyntaxNode to modify the AST syntactically.

Re-exports§

pub use mitex_spec as spec;

Modules§

argument_kind
The character encoding used for argument matching
command_preludes
preludes
query
The query module contains the data structures that are used by typst query <mitex-packages>
syntax
Syntax kinds and typed syntax nodes

Structs§

ArchivedCmdShape
An archived CmdShape
ArchivedCommandSpec
An archived CommandSpec
ArchivedCommandSpecRepr
An archived CommandSpecRepr
ArchivedEnvShape
An archived EnvShape
ArchivedGlobStr
An archived GlobStr
CmdShape
Shape of a TeX command.
CmdShapeResolver
The resolver for an archived CmdShape
CommandSpec
Command specification that is cheap to clone
CommandSpecRepr
Command specification that contains a set of commands and environments.
CommandSpecReprResolver
The resolver for an archived CommandSpecRepr
CommandSpecResolver
The resolver for an archived CommandSpec
EnvShape
Shape of a TeX envionment.
EnvShapeResolver
The resolver for an archived EnvShape
GlobStr
A shared string that represents a glob pattern.
GlobStrResolver
The resolver for an archived GlobStr
JsonCommandSpec
Command specification that contains a set of commands and environments. It is used for us to define the meta data of LaTeX packages in typst code and query by typst query then. See Spec for an example.

Enums§

ArchivedArgPattern
An archived ArgPattern
ArchivedArgShape
An archived ArgShape
ArchivedCommandSpecItem
An archived CommandSpecItem
ArchivedContextFeature
An archived ContextFeature
ArgPattern
An efficient pattern used for argument matching.
ArgPatternResolver
The resolver for an archived ArgPattern
ArgShape
Shape of arguments with direction to match since.
ArgShapeResolver
The resolver for an archived ArgShape
CommandSpecItem
An item of command specification. It is either a normal command or an environment. See Command Syntax for concept of command. See Environment Syntax for concept of environment.
CommandSpecItemResolver
The resolver for an archived CommandSpecItem
ContextFeature
A feature that specifies how to process the content of an environment.
ContextFeatureResolver
The resolver for an archived ContextFeature

Functions§

parse
Parse the input text with the given command specification and return the untyped syntax tree
parse_without_macro
It is only for internal testing