pub fn parse_file(file_id: SourceFileId, src: &str) -> (Module, Vec<Diagnostic>)
Expand description
Parse a Module
from the file content string.
Returns a Module
(which may be incomplete), and a vec of Diagnostic
s
(which may be empty) to display to the user. If any of the returned
diagnostics are errors, the compilation of this file should ultimately fail.
If a fatal parse error occurred, the last element of the Module::body
will
be a ModuleStmt::ParseError
. The parser currently has very limited ability
to recover from syntax errors; this is just a first meager attempt at returning a
useful AST when there are syntax errors.
A SourceFileId
is required to associate any diagnostics with the
underlying file.