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.
- Parse
Buffer - A cursor position within a token stream.
- Source
File - A struct representing a file of source code.
- Span
- A region of source code.
- ToTokens
Wrapper proc-macro2
- A wrapper for types that implement
crate::to_tokens::ToTokens
which implementsquote::ToTokens
. - Token
Stream - 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, usingT
’s default parsing implementation, and continuing untilinput
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_
unwrap ariadne
- Gets the
Ok
value, panicking with a formatted error message if the value isErr
.
Type Aliases§
- Parse
Stream - The input type for all parsing functions.
- Result
- The return type of a parsing function.