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§

error
Types for error reporting.
group
Streams of tokens delimited by punctuation.
punctuated
Utilities for parsing types separated by punctuation.
to_tokens
A trait for converting types composed of tokens into a TokenStream.
token
Tokens representing punctuation, identifiers, keywords, and whitespace.

Macros§

Punct
A macro to get the type of a punctuation token.
group
A macro to easily parse a delimited group.
keywords
Generate types for keywords.
peek2_any
Returns true if ParseBuffer::peek2 would return true for any types passed.
peek_any
Returns true if ParseBuffer::peek would return true for any types passed.

Structs§

Lookahead
A type for peeking at the next token, and generating a helpful error if it isn’t an expected type.
ParseBuffer
A cursor position within a token stream.
SourceFile
A struct representing a file of source code.
Span
A region of source code.
ToTokensWrapperproc-macro2
A wrapper for types that implement crate::to_tokens::ToTokens which implements quote::ToTokens.
TokenStream
A sequence of tokens.

Traits§

Parse
Parsing interface for types with a default parsing method.
Parser
A parser that can parse a stream of tokens into a syntax tree node.
Peek
Types that can be parsed by looking at a single token.

Functions§

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

Type Aliases§

ParseStream
The input type for all parsing functions.
Result
The return type of a parsing function.