pub fn parse_module(source: &str) -> ParseModuleResultExpand description
Parse Daml source into a Module plus any ParseDiagnostics, in
source order.
This is the crate’s entry point. It never panics and never aborts the
file: recovery is per-declaration, so an unparseable declaration becomes a
Decl::Unknown (with a diagnostic) and parsing continues at the next
declaration. A Module is therefore always returned, even for badly broken
input — a non-empty diagnostics list signals problems, not a missing tree.
let result = daml_parser::parse::parse_module("module M where\n");
assert_eq!(result.module.name, "M");
assert!(result.diagnostics.is_empty());