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
- A macro to get the type of a punctuation token.
- Generate types for keywords.
- Generate types for keywords, with the type names prefixed with
keyword_
. - Returns true if
ParseBuffer::peek2
would return true for any types passed. - Returns true if
ParseBuffer::peek
would return true for any types passed.
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, usingT
’s default parsing implementation, and continuing untilinput
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
. - pretty_unwrap
ariadne
Gets theOk
value, panicking with a formatted error message if the value isErr
.
Type Aliases
- The input type for all parsing functions. This is a stable alias for
ParseBuffer
. - The return type of a parsing function.