Crate flexi_parse

source ·
Expand description

flexi-parse is a crate for parsing arbitrary syntax into a syntax tree. It is intended to be more flexible than a parser generator or parser combinator, while still being simple to use.

Modules

  • Types for error reporting.
  • Streams of tokens delimited by punctuation.
  • Utilities for parsing types separated by punctuation.
  • Tokens representing punctuation, identifiers, keywords, and whitespace.

Macros

Structs

  • A type for peeking at the next token, and generating a helpful error if it isn’t an expected type.
  • A cursor position within a token stream.
  • A struct representing a file of source code.
  • A region of source code.
  • A sequence of tokens.

Traits

  • Parsing interface for types with a default parsing method.
  • A parser that can parse a stream of tokens into a syntax tree node.
  • Types that can be parsed by looking at a single token.
  • A trait for types that represent one of a few possible tokens.

Functions

  • Creates a new error in the given source file, at the given location, and with the given message and code.
  • Parses the given tokens into the syntax tree node T.
  • Attempts to repeatedly parse input into the given syntax tree node, using T’s default parsing implementation, and continuing until input is exhausted.
  • Scans and parses the given source file into the syntax tree node T.
  • Scans and parses the given string into the syntax tree node T.
  • Gets the Ok value, panicking with a formatted error message if the value is Err.

Type Aliases