Skip to main content

parse_module

Function parse_module 

Source
pub fn parse_module(source: &str) -> Parse
Expand description

Parses a TLA+ source file containing one top-level module.

Text before the first ---- MODULE line and after the module’s closing ==== is kept in the tree as PRELUDE and TRAILER trivia, as SANY ignores it.

§Example

let p = dive_syntax::parse_module("---- MODULE M ----\nx == 1 * -2\n====");
assert!(!p.is_ok());
assert_eq!(p.diagnostics()[0].code.as_str(), "DIVE-S0012"); // precedence conflict