paralegal_flow::ann

Module parse

Source
Expand description

nom-based parser-combinators for parsing the token stream in Rust Attributes.

Usually used in a closure handed to MetaItemMatch::match_extract.

The benefit of using a combinator library such as nom is not just that it gives us boundaries for parsers that lets us (re)combine them, but also that we get features that are annoying to implement (such as backtracking) for free.

Re-exportsยง

  • pub extern crate nom;

Structsยง

Functionsยง

  • ann_match_fn ๐Ÿ”’
    Parser for a [LabelAnnotation]
  • Expect the next token to be an identifier with the value s
  • Expect the next token to have the token kind k.
  • Parse a TokenTree::Delimited with the delimiter character delim, applying the subparser p to the tokens in between the delimiters and return the result of the subparser.
  • Parse something dictionnary-like.
  • Parse an identifier. Identifiers in annotations are similar to identifiers in rust in general, e.g. strings or word character, numbers and underscores.
  • Parse an integer literal and return the integer.
  • Parse bracket-delimited, comma-separated integers, e.g. [1,2,3].
  • Parse a TokenKind::Literal if it has a specific LitKind and return the payload of the literal.
  • match_exception ๐Ÿ”’
    Parser for an ExceptionAnnotation
  • one ๐Ÿ”’
    Parse any one token, returning the token.
  • Parse a single token that is not a subtree and return the token.
  • otype_ann_match ๐Ÿ”’
    Parser for the payload of the #[paralegal_flow::output_type(...)] annotation.
  • refinements_parser ๐Ÿ”’
    A parser for annotation refinements.

Type Aliasesยง