Skip to main content

parse_file

Function parse_file 

Source
pub fn parse_file(path: &Path) -> Result<IndexMap<String, Element>, MpsError>
Expand description

Parses a .mps file into a flat ordered map keyed by dotted ref-path (e.g. “1746000000.1.2”).

Algorithm mirrors Ruby’s Engines::Parser.parse_mps_file_to_elements_hash exactly:

  1. Wrap file content in a synthetic @mps[]{\n…\n} root.
  2. Single-pass: at each pos, find the nearest @element[args]{ open and } close.
  3. Whichever starts earlier wins.
  4. Open → push stack frame; Close → pop, emit element keyed by dotted ref path.