Crate rustc_parse
source ·Expand description
The main parser interface.
Modules
Macros
If the next tokens are ill-formed
$ty::
recover them as <$ty>::
.Like
maybe_whole_expr
, but for things other than expressions.A variant of ‘panictry!’ that works on a
Vec<Diagnostic>
instead of a single
DiagnosticBuilder
.Constants
Functions
Given a session and a path and an optional span (for error reporting),
adds the path to the session’s
source_map
and returns the new source_file
.Given a source file, produces a sequence of token trees. Returns any buffered errors from
parsing the token stream.
Creates a new parser from a source string. Returns any buffered errors from lexing the initial
token stream.
Given a session and a
source_file
, return a parser. Returns any buffered errors from lexing the
initial token stream.Creates a new parser, handling errors as appropriate if the file doesn’t exist.
If a span is given, that is used on an error as the source of the problem.
Creates a new parser from a source string.
Runs the given subparser
f
on the tokens of the given attr
’s item.Given a session and a
source_file
, returns a parser.Given a
source_file
, produces a sequence of token trees.Given a stream and the
ParseSess
, produces a parser.Given a session and a path and an optional span (for error reporting),
add the path to the session’s source_map and return the new source_file or
error when a file can’t be read.