Expand description
Typed, read-only wrappers over the CST.
Accessors are positional and do not assign meaning or arity to commands.
Free functions provide the same operations for untyped SyntaxNode callers.
Re-exports§
pub use nodes::Begin;pub use nodes::Command;pub use nodes::Conditional;pub use nodes::ConditionalBranch;pub use nodes::End;pub use nodes::Environment;pub use nodes::Group;pub use nodes::NameGroup;pub use nodes::Optional;pub use tokens::ControlWord;
Modules§
- nodes
- Typed
AstNodewrappers over the generic CST. - tokens
- Typed
AstTokenwrappers over CST tokens. OnlyControlWordexists today — the rest of the lexer’s tokens (L_BRACE,WORD, trivia, …) are matched raw by the formatter’s token loops, which is idiomatic and should stay that way. Add a wrapper here only when a token grows a named accessor consumer.
Traits§
- AstNode
- A typed wrapper over CST nodes of a particular
SyntaxKind. - AstToken
- A typed wrapper over CST tokens of a particular
SyntaxKind.
Functions§
- child
- Returns the first child node castable to
N. - child_
token - The first child token castable to
T. - children
- All child nodes castable to
N, in source order. - command_
name - The control-word name of a
COMMANDnode (the leading\stripped), orNonefor a control symbol. - control_
word_ range - The range of a
COMMANDnode’s leadingCONTROL_WORDtoken, orNonefor a control symbol. - environment_
name - The environment name of a
BEGINorENDnode — the text of itsNAME_GROUPchild, braces dropped. - environment_
name_ range - The byte range of the environment name inside a
BEGINorENDnode’sNAME_GROUP. - first_
group_ range - The byte range of
commandspanning its control word through the end of its first{…}group; the full command range when the first group is absent. - group_
command_ name - The control-word name of a single
COMMANDwrapped ingroup. A braced l3docv-type name argument (\begin{macro}{\foo}) captures its content as one opaqueVERBtoken instead of aCOMMAND(issue #60); a control-word- shapedVERB(\+ letters, nothing else) reads as the same name. - group_
inner_ source - The raw inner source of
groupwith its outer braces dropped, nested braces kept. - nth_
group - The
n-thGROUPargument node ofcommand, if present. - nth_
group_ inner - The byte range of the content inside the
n-thGROUPargument together with that inner text. - nth_
group_ text - The literal text inside the
n-thGROUPargument ofcommand, braces dropped.