Crate vermouth

Source
Expand description

Fortification against sin. A new kind of parser for procedural macros.

Opposing syn, this crate is designed around the philosophy that malformed input should be handled gracefully by procedural macros.

See the methods on the Parser type for structural documentation.

§Stable Features

  • attributes (enabled by default) — Provides support and utilities for parsing and handling Rust attributes.

  • warnings — Enables emitting diagnostic warnings through the vermouth::Diagnostic API.

  • complete — Enables the complete suite of parsing utilities. This implies every other stable feature except proc-macro2.

  • proc-macro2 — Rewires this crate to build on top of the proc-macro2 crate, instead of the default, officially supported proc_macro crate. This feature should be enabled with caution, and it is considered a major breaking change to do so. Due to the risks of compounding additive features across dependencies, it can be problematic to enable this feature in a library, since it may break other dependencies of this crate.

§Unstable Features (nightly)

Modules§

attributesattributes
Provides utilities for parsing attributes.
path
punctuated

Macros§

for_all_punct_seqs
Expands a macro with every distinct (supported) sequence of punctuation.
punct_decompose
Decomposes a larger token into a sequence of chars.
punct_pat
Transforms a sequence of punctuation (like && or ..=) into a PunctPat.

Structs§

Checkpoint
A location in the stream of a Parser.
Diagnostic
The universal type used for parsing diagnostics.
Expected
Builds an diagnostic which represents some syntax which was expected.
Parser
A simple parser for Rust source which traverses TokenTrees.
ParserPos
A reference to a position within the internal stream of a Parser.
PunctPat
A pattern representing a sequence of Puncts.
Spanned
A simple wrapper which provides span information for any value.

Enums§

DiagnosticLevel
The severity level of a custom Diagnostic.
Finish
Describes the termination behaviour of Parser::collect_until.

Traits§

Parse
A common interface for parsing values from a Parser.
Pattern
Performs simple pattern-matched parsing through a Parser object.
ToSpan
Enables conversion between different span formats.
ToTokens
Methods for converting values into TokenStreams.
TokenTreeExt
A trait extending the behaviour of TokenTrees.
TokensExtend
An extension trait for manually building TokenStreams more ergonomically.

Type Aliases§

Result
An alias for the standard library Result.